diff --git a/package-lock.json b/package-lock.json index b36ad318..40624611 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "BSD-3-Clause", "dependencies": { "@codemirror/lang-javascript": "^6.2.2", + "@codemirror/search": "^6.5.6", "@codemirror/view": "^6.28.1", "@uiw/codemirror-theme-github": "^4.22.2", "@uiw/codemirror-theme-monokai": "^4.22.2", diff --git a/package.json b/package.json index 8c95f6b4..1571d516 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ }, "dependencies": { "@codemirror/lang-javascript": "^6.2.2", + "@codemirror/search": "^6.5.6", "@codemirror/view": "^6.28.1", "@uiw/codemirror-theme-github": "^4.22.2", "@uiw/codemirror-theme-monokai": "^4.22.2", diff --git a/public/css/styles.css b/public/css/styles.css index 21c54675..69e82e79 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -45,4 +45,8 @@ main { .CodeMirror-scroll { height: auto !important; overflow: visible !important; +} + +.cm-editor { + max-height: 100vh; } \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 2885c652..fe8deea1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,7 @@ import { monokai } from '@uiw/codemirror-theme-monokai'; import { githubLight } from '@uiw/codemirror-theme-github'; import { EditorView } from '@codemirror/view'; import { EditorState, Compartment } from '@codemirror/state'; +import { search } from '@codemirror/search'; import { javascript } from '@codemirror/lang-javascript'; import { basicSetup } from 'codemirror'; import { Converter } from 'showdown'; @@ -64,6 +65,7 @@ async function makeCodeMirrorEditor(parent: HTMLElement, filename: string) { themeConfig.of([getCodeMirrorTheme()]), EditorView.lineWrapping, javascript(), + search({ top: true }), readOnly, ], parent,