Skip to content

Commit

Permalink
Revert "Cherry-pick changes react-monaco-editor from #3201"
Browse files Browse the repository at this point in the history
This reverts commit 40b4250.
  • Loading branch information
mokagio committed May 31, 2024
1 parent 83c8756 commit 5078f0d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
30 changes: 17 additions & 13 deletions lib/note-content-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,23 @@ class NoteContentEditor extends Component<Props> {

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);
Expand Down Expand Up @@ -596,19 +613,6 @@ class NoteContentEditor extends Component<Props> {
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(
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
"react-dom": "17.0.2",
"react-dropzone": "11.7.1",
"react-modal": "3.16.1",
"react-monaco-editor": "0.55.0",
"react-monaco-editor": "0.50.1",
"react-overlays": "5.2.1",
"react-redux": "8.1.3",
"react-sortable-hoc": "2.0.0",
Expand Down

0 comments on commit 5078f0d

Please sign in to comment.