Skip to content

Commit

Permalink
Put search UI at top of editor
Browse files Browse the repository at this point in the history
Also, make max editor size to be 100vh

Hopefully that provides a better UX as it
keeps the search area on the screen.
  • Loading branch information
greggman committed Jun 18, 2024
1 parent 25448fc commit 9b9c989
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions public/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ main {
.CodeMirror-scroll {
height: auto !important;
overflow: visible !important;
}

.cm-editor {
max-height: 100vh;
}
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -64,6 +65,7 @@ async function makeCodeMirrorEditor(parent: HTMLElement, filename: string) {
themeConfig.of([getCodeMirrorTheme()]),
EditorView.lineWrapping,
javascript(),
search({ top: true }),
readOnly,
],
parent,
Expand Down

0 comments on commit 9b9c989

Please sign in to comment.