mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-01 06:59:52 +00:00

Uses our custom event system, uses methods that take callables so that internal dependancies can be passed.
44 lines
No EOL
1.2 KiB
JavaScript
44 lines
No EOL
1.2 KiB
JavaScript
|
|
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"
|
|
import {EditorState} from "@codemirror/state"
|
|
|
|
import {defaultLight} from "./themes";
|
|
|
|
export function viewer() {
|
|
return [
|
|
lineNumbers(),
|
|
highlightActiveLineGutter(),
|
|
drawSelection(),
|
|
dropCursor(),
|
|
// syntaxHighlighting(defaultLight, {fallback: false}),
|
|
bracketMatching(),
|
|
rectangularSelection(),
|
|
highlightActiveLine(),
|
|
keymap.of([
|
|
...defaultKeymap,
|
|
]),
|
|
EditorState.readOnly.of(true),
|
|
];
|
|
}
|
|
|
|
export function editor(language) {
|
|
return [
|
|
lineNumbers(),
|
|
highlightActiveLineGutter(),
|
|
history(),
|
|
drawSelection(),
|
|
dropCursor(),
|
|
syntaxHighlighting(defaultLight, {fallback: true}),
|
|
bracketMatching(),
|
|
rectangularSelection(),
|
|
highlightActiveLine(),
|
|
keymap.of([
|
|
...defaultKeymap,
|
|
...historyKeymap,
|
|
]),
|
|
EditorView.lineWrapping,
|
|
];
|
|
} |