mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-10 21:53:34 +08:00
Got markdown editor barely functional
Updated content sync and preview scoll sync to work. Many features commented out until they can be updated.
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
|
||||
import {keymap, highlightSpecialChars, drawSelection, highlightActiveLine, dropCursor,
|
||||
import {EditorView, keymap, highlightSpecialChars, drawSelection, highlightActiveLine, dropCursor,
|
||||
rectangularSelection, lineNumbers, highlightActiveLineGutter} from "@codemirror/view"
|
||||
import {defaultHighlightStyle, syntaxHighlighting, bracketMatching,
|
||||
foldKeymap} from "@codemirror/language"
|
||||
import {syntaxHighlighting, bracketMatching} from "@codemirror/language"
|
||||
import {defaultKeymap, history, historyKeymap} from "@codemirror/commands"
|
||||
import {EditorState} from "@codemirror/state"
|
||||
|
||||
import {defaultLight} from "./themes";
|
||||
import {getLanguageExtension} from "./languages";
|
||||
|
||||
export function viewer() {
|
||||
return [
|
||||
@ -23,8 +23,27 @@ export function viewer() {
|
||||
keymap.of([
|
||||
...defaultKeymap,
|
||||
...historyKeymap,
|
||||
...foldKeymap,
|
||||
]),
|
||||
EditorState.readOnly.of(true),
|
||||
];
|
||||
}
|
||||
|
||||
export function editor(language) {
|
||||
return [
|
||||
lineNumbers(),
|
||||
highlightActiveLineGutter(),
|
||||
highlightSpecialChars(),
|
||||
history(),
|
||||
drawSelection(),
|
||||
dropCursor(),
|
||||
syntaxHighlighting(defaultLight, {fallback: true}),
|
||||
bracketMatching(),
|
||||
rectangularSelection(),
|
||||
highlightActiveLine(),
|
||||
keymap.of([
|
||||
...defaultKeymap,
|
||||
...historyKeymap,
|
||||
]),
|
||||
getLanguageExtension(language, ''),
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user