Mobile: Ctrl+F search support in beta editor (#6587)

pull/6616/head
Henry Heino 2022-06-24 02:56:59 -07:00 committed by GitHub
parent 20a7cd2323
commit aaa610d5f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View File

@ -11,6 +11,7 @@
import { EditorState, Extension } from '@codemirror/state';
import { markdown } from '@codemirror/lang-markdown';
import { highlightSelectionMatches, search } from '@codemirror/search';
import { defaultHighlightStyle, syntaxHighlighting, HighlightStyle } from '@codemirror/language';
import { tags } from '@lezer/highlight';
import { EditorView, drawSelection, highlightSpecialChars, ViewUpdate } from '@codemirror/view';
@ -18,6 +19,7 @@ import { undo, redo, history, undoDepth, redoDepth } from '@codemirror/commands'
import { keymap } from '@codemirror/view';
import { indentOnInput } from '@codemirror/language';
import { searchKeymap } from '@codemirror/search';
import { historyKeymap, defaultKeymap } from '@codemirror/commands';
interface CodeMirrorResult {
@ -183,8 +185,10 @@ export function initCodeMirror(parentElement: any, initialText: string, theme: a
markdown(),
...createTheme(theme),
history(),
search(),
drawSelection(),
highlightSpecialChars(),
highlightSelectionMatches(),
indentOnInput(),
EditorView.lineWrapping,
@ -203,7 +207,7 @@ export function initCodeMirror(parentElement: any, initialText: string, theme: a
}
}),
keymap.of([
...defaultKeymap, ...historyKeymap,
...defaultKeymap, ...historyKeymap, ...searchKeymap,
]),
],
doc: initialText,

View File

@ -73,6 +73,7 @@
"@codemirror/commands": "^6.0.0",
"@codemirror/lang-markdown": "^6.0.0",
"@codemirror/language": "^6.0.0",
"@codemirror/search": "^6.0.0",
"@codemirror/state": "^6.0.0",
"@codemirror/view": "^6.0.0",
"@joplin/tools": "~2.8",

View File

@ -2189,6 +2189,17 @@ __metadata:
languageName: node
linkType: hard
"@codemirror/search@npm:^6.0.0":
version: 6.0.0
resolution: "@codemirror/search@npm:6.0.0"
dependencies:
"@codemirror/state": ^6.0.0
"@codemirror/view": ^6.0.0
crelt: ^1.0.5
checksum: e40b55f1ff1287a8b5b321f633bff638c9d4a411ada524b36b275344a13f9f4a66b7c5176d8a142a6a7761d1591d18dc535c88897f30b9885508a2890162fc72
languageName: node
linkType: hard
"@codemirror/state@npm:^6.0.0":
version: 6.0.0
resolution: "@codemirror/state@npm:6.0.0"
@ -3261,6 +3272,7 @@ __metadata:
"@codemirror/commands": ^6.0.0
"@codemirror/lang-markdown": ^6.0.0
"@codemirror/language": ^6.0.0
"@codemirror/search": ^6.0.0
"@codemirror/state": ^6.0.0
"@codemirror/view": ^6.0.0
"@joplin/lib": ~2.8