diff --git a/lib/note-content-editor.tsx b/lib/note-content-editor.tsx index 7f3b320ad..7ef3dd341 100644 --- a/lib/note-content-editor.tsx +++ b/lib/note-content-editor.tsx @@ -186,23 +186,6 @@ class NoteContentEditor extends Component { componentDidMount() { const { noteId } = this.props; - this.bootTimer = setTimeout(() => { - if (noteId === this.props.noteId) { - this.setState({ - editor: 'full', - content: withCheckboxCharacters(this.props.note.content), - }); - const position = getNotePosition(noteId); - if (position) { - this.editor?.setScrollPosition({ - scrollTop: position, - }); - } - } - }, SPEED_DELAY); - this.focusEditor(); - this.props.storeFocusEditor(this.focusEditor); - this.props.storeHasFocus(this.hasFocus); window.addEventListener('resize', clearNotePositions); window.addEventListener('toggleChecklist', this.handleChecklist, true); this.toggleShortcuts(true); @@ -613,6 +596,19 @@ class NoteContentEditor extends Component { editorReady: EditorDidMount = (editor, monaco) => { this.editor = editor; + this.focusEditor(); + this.props.storeFocusEditor(this.focusEditor); + this.props.storeHasFocus(this.hasFocus); + + this.bootTimer = setTimeout(() => { + const position = getNotePosition(this.props.noteId); + if (position) { + this.editor?.setScrollPosition({ + scrollTop: position, + }); + } + }, SPEED_DELAY); + monaco.languages.registerLinkProvider('plaintext', { provideLinks: (model) => { const matches = model.findMatches( diff --git a/package-lock.json b/package-lock.json index f7242d4c6..810286e0e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "react-dom": "17.0.2", "react-dropzone": "11.7.1", "react-modal": "3.16.1", - "react-monaco-editor": "0.50.1", + "react-monaco-editor": "0.55.0", "react-overlays": "5.2.1", "react-redux": "8.1.3", "react-sortable-hoc": "2.0.0", @@ -16872,16 +16872,16 @@ } }, "node_modules/react-monaco-editor": { - "version": "0.50.1", - "resolved": "https://registry.npmjs.org/react-monaco-editor/-/react-monaco-editor-0.50.1.tgz", - "integrity": "sha512-qvYdJhQdkPIrPDMxCrEl0T2x9TfBB+aUbrpFv69FwoTybeyfAjxgJ219MYSsgn3c/g06BgyLX4ENrXM4niZ9ag==", + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/react-monaco-editor/-/react-monaco-editor-0.55.0.tgz", + "integrity": "sha512-GdEP0Q3Rn1dczfKEEyY08Nes5plWwIYU4sWRBQO0+jsQWQsKMHKCC6+hPRwR7G/4aA3V/iU9jSmWPzVJYMVFSQ==", "dependencies": { "prop-types": "^15.8.1" }, "peerDependencies": { - "@types/react": ">=17 <= 18", - "monaco-editor": "^0.34.0", - "react": ">=17 <= 18" + "@types/react": ">=16 <= 18", + "monaco-editor": "^0.44.0", + "react": ">=16 <= 18" } }, "node_modules/react-onclickoutside": { diff --git a/package.json b/package.json index 0e046f2cf..616345cb6 100644 --- a/package.json +++ b/package.json @@ -147,7 +147,7 @@ "react-dom": "17.0.2", "react-dropzone": "11.7.1", "react-modal": "3.16.1", - "react-monaco-editor": "0.50.1", + "react-monaco-editor": "0.55.0", "react-overlays": "5.2.1", "react-redux": "8.1.3", "react-sortable-hoc": "2.0.0",