updates to the latest version of react-codemirror2. The new version provides the component UnControlled rather than Codemirror. This component keeps track of its own code state, so we shouldn't update the text manually. Updating the code text with the onChange callback was causing each change to trigger a second onChange with the entire code text appearing as a change, and the cursor position being lost.
Adds an explicit check for window.navigator before requiring codemirror. The use of navigator in codemirror is causing build errors
WebpackError: navigator is not defined
- codemirror.js:18
~/codemirror/lib/codemirror.js:18:1
...
…nges
This PR:
react-codemirror2
. The new version provides the componentUnControlled
rather thanCodemirror
. This component keeps track of its own code state, so we shouldn't update the text manually. Updating the code text with theonChange
callback was causing each change to trigger a secondonChange
with the entire code text appearing as a change, and the cursor position being lost.window.navigator
before requiringcodemirror
. The use ofnavigator
incodemirror
is causing build errors