mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-29 20:23:52 +08:00
30 lines
968 B
JavaScript
30 lines
968 B
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 {defaultLight} from "./themes";
|
|
|
|
export function viewer() {
|
|
return [
|
|
lineNumbers(),
|
|
highlightActiveLineGutter(),
|
|
highlightSpecialChars(),
|
|
history(),
|
|
drawSelection(),
|
|
dropCursor(),
|
|
syntaxHighlighting(defaultLight, {fallback: true}),
|
|
bracketMatching(),
|
|
rectangularSelection(),
|
|
highlightActiveLine(),
|
|
keymap.of([
|
|
...defaultKeymap,
|
|
...historyKeymap,
|
|
...foldKeymap,
|
|
]),
|
|
EditorState.readOnly.of(true),
|
|
];
|
|
} |