Skip to content

Commit

Permalink
Mobile,Desktop: Upgrade CodeMirror packages
Browse files Browse the repository at this point in the history
This commit upgrades most `@codemirror/` packages, like
#11034, but disables the
EditContext API (see #11170).
  • Loading branch information
personalizedrefrigerator committed Oct 16, 2024
1 parent 6afa2d1 commit b1c1a77
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 105 deletions.
10 changes: 10 additions & 0 deletions packages/editor/CodeMirror/createEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ import biDirectionalTextExtension from './utils/biDirectionalTextExtension';
import searchExtension from './utils/searchExtension';
import isCursorAtBeginning from './utils/isCursorAtBeginning';

// Newer versions of CodeMirror by default use Chrome's EditContext API.
// While this might be stable enough for desktop use, it causes significant
// problems on Android:
// - https://github.com/codemirror/dev/issues/1450
// - https://github.com/codemirror/dev/issues/1451
// For now, CodeMirror allows disabling EditContext to work around these issues:
// https://discuss.codemirror.net/t/experimental-support-for-editcontext/8144/3
type ExtendedEditorView = typeof EditorView & { EDIT_CONTEXT: boolean };
(EditorView as ExtendedEditorView).EDIT_CONTEXT = false;

const createEditor = (
parentElement: HTMLElement, props: EditorProps,
): CodeMirrorControl => {
Expand Down
22 changes: 11 additions & 11 deletions packages/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@
"typescript": "5.4.5"
},
"dependencies": {
"@codemirror/autocomplete": "6.13.0",
"@codemirror/commands": "6.3.3",
"@codemirror/lang-html": "6.4.8",
"@codemirror/lang-markdown": "6.2.4",
"@codemirror/language": "6.10.1",
"@codemirror/autocomplete": "6.18.1",
"@codemirror/commands": "6.7.0",
"@codemirror/lang-html": "6.4.9",
"@codemirror/lang-markdown": "6.3.0",
"@codemirror/language": "6.10.3",
"@codemirror/language-data": "6.3.1",
"@codemirror/legacy-modes": "6.3.3",
"@codemirror/lint": "6.5.0",
"@codemirror/legacy-modes": "6.4.1",
"@codemirror/lint": "6.8.2",
"@codemirror/search": "6.5.6",
"@codemirror/state": "6.4.1",
"@codemirror/view": "6.26.3",
"@lezer/common": "1.2.1",
"@lezer/highlight": "1.2.0",
"@lezer/markdown": "1.2.0",
"@codemirror/view": "6.34.1",
"@lezer/common": "1.2.3",
"@lezer/highlight": "1.2.1",
"@lezer/markdown": "1.3.1",
"@replit/codemirror-vim": "6.2.0"
}
}
Loading

0 comments on commit b1c1a77

Please sign in to comment.