mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-29 13:42:38 +00:00
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
![]() |
|
||
|
import {keymap, highlightSpecialChars, drawSelection, highlightActiveLine, dropCursor,
|
||
|
rectangularSelection, lineNumbers, highlightActiveLineGutter} from "@codemirror/view"
|
||
|
import {defaultHighlightStyle, syntaxHighlighting, bracketMatching,
|
||
|
foldKeymap} from "@codemirror/language"
|
||
|
import {defaultKeymap, history, historyKeymap} from "@codemirror/commands"
|
||
|
import {EditorState} from "@codemirror/state"
|
||
|
|
||
|
import {modesAsStreamLanguages} from "./modes";
|
||
|
|
||
|
|
||
|
export function viewer() {
|
||
|
return [
|
||
|
lineNumbers(),
|
||
|
highlightActiveLineGutter(),
|
||
|
highlightSpecialChars(),
|
||
|
history(),
|
||
|
drawSelection(),
|
||
|
dropCursor(),
|
||
|
syntaxHighlighting(defaultHighlightStyle, {fallback: true}),
|
||
|
bracketMatching(),
|
||
|
rectangularSelection(),
|
||
|
highlightActiveLine(),
|
||
|
keymap.of([
|
||
|
...defaultKeymap,
|
||
|
...historyKeymap,
|
||
|
...foldKeymap,
|
||
|
]),
|
||
|
EditorState.readOnly.of(true),
|
||
|
...modesAsStreamLanguages(),
|
||
|
];
|
||
|
}
|