Updated cm6 theme handling to allow extension via API

Uses our custom event system, uses methods that take callables so that
internal dependancies can be passed.
This commit is contained in:
Dan Brown
2023-04-15 15:35:41 +01:00
parent 9874a53206
commit 74b76ecdb9
4 changed files with 25 additions and 15 deletions

View File

@ -1,5 +1,5 @@
import {EditorView, keymap, highlightSpecialChars, drawSelection, highlightActiveLine, dropCursor,
import {EditorView, keymap, drawSelection, highlightActiveLine, dropCursor,
rectangularSelection, lineNumbers, highlightActiveLineGutter} from "@codemirror/view"
import {syntaxHighlighting, bracketMatching} from "@codemirror/language"
import {defaultKeymap, history, historyKeymap} from "@codemirror/commands"
@ -11,17 +11,14 @@ export function viewer() {
return [
lineNumbers(),
highlightActiveLineGutter(),
highlightSpecialChars(),
history(),
drawSelection(),
dropCursor(),
syntaxHighlighting(defaultLight, {fallback: true}),
// syntaxHighlighting(defaultLight, {fallback: false}),
bracketMatching(),
rectangularSelection(),
highlightActiveLine(),
keymap.of([
...defaultKeymap,
...historyKeymap,
]),
EditorState.readOnly.of(true),
];
@ -31,7 +28,6 @@ export function editor(language) {
return [
lineNumbers(),
highlightActiveLineGutter(),
highlightSpecialChars(),
history(),
drawSelection(),
dropCursor(),