-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Upgrade React & React-DOM & React-Router + adding DevTools #2990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a6a522b
Update dependencies & change to React-router v5
AWolf81 0fc4549
add React & Redux devtools
AWolf81 496dd1b
fix auto-scroll
AWolf81 546f2eb
address review comments - add production/dev main.html & remove comments
AWolf81 5b22e0f
remove commented imports
AWolf81 3e8bb6a
change redirecting to connected-react-router
AWolf81 e49f6fb
fix local link detection by creating a link tag to parse the input st…
AWolf81 4c9efbe
Merge branch 'master' into upgrade-react
AWolf81 ad7a5ff
Merge branch 'master' into upgrade-react
AWolf81 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1015,15 +1015,19 @@ export default class MarkdownPreview extends React.Component { | |
| e.preventDefault() | ||
| e.stopPropagation() | ||
|
|
||
| const href = e.target.getAttribute('href') | ||
| const linkHash = href.split('/').pop() | ||
| const rawHref = e.target.getAttribute('href') | ||
| const parser = document.createElement('a') | ||
| parser.href = e.target.getAttribute('href') | ||
| const { href, hash } = parser | ||
| const linkHash = hash === '' ? rawHref : hash // needed because we're having special link formats that are removed by parser e.g. :line:10 | ||
|
|
||
| if (!href) return | ||
| if (!rawHref) return // not checked href because parser will create file://... string for [empty link]() | ||
|
|
||
| const regexNoteInternalLink = /main.html#(.+)/ | ||
| if (regexNoteInternalLink.test(linkHash)) { | ||
| const targetId = mdurl.encode(linkHash.match(regexNoteInternalLink)[1]) | ||
| const targetElement = this.refs.root.contentWindow.document.getElementById( | ||
| const regexNoteInternalLink = /.*[main.\w]*.html#/ | ||
|
|
||
| if (regexNoteInternalLink.test(href)) { | ||
| const targetId = mdurl.encode(linkHash) | ||
| const targetElement = this.refs.root.contentWindow.document.querySelector( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed to querySelector because |
||
| targetId | ||
| ) | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import CSSModules from 'react-css-modules' | ||
|
|
||
| export default function (component, styles) { | ||
| return CSSModules(component, styles, {errorWhenNotFound: false}) | ||
| return CSSModules(component, styles, {handleNotFoundStyleName: 'log'}) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import React from 'react' | ||
| import { createDevTools } from 'redux-devtools' | ||
| import LogMonitor from 'redux-devtools-log-monitor' | ||
| import DockMonitor from 'redux-devtools-dock-monitor' | ||
|
|
||
| const DevTools = createDevTools( | ||
| <DockMonitor | ||
| toggleVisibilityKey='ctrl-h' | ||
| changePositionKey='ctrl-q' | ||
| defaultIsVisible={false} | ||
| > | ||
| <LogMonitor theme='tomorrow' /> | ||
| </DockMonitor> | ||
| ) | ||
|
|
||
| export default DevTools |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /* eslint-disable no-undef */ | ||
| if (process.env.NODE_ENV === 'production') { | ||
| // eslint-disable-next-line global-require | ||
| module.exports = require('./index.prod').default | ||
| } else { | ||
| // eslint-disable-next-line global-require | ||
| module.exports = require('./index.dev').default | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import React from 'react' | ||
|
|
||
| const DevTools = () => <div /> | ||
| DevTools.instrument = () => {} | ||
|
|
||
| export default DevTools |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note
Added
.*to the regex in front of[main.\w]to match everything beforemain.development.html. The string to test contains file protocol + path e.g.file:///c:/path/to/project/main.development.htmlhttps://regex101.com/r/zRLTIR/4