mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-05 07:08:14 +08:00
chore(code): reintroduce history (undo-redo)
This commit is contained in:
parent
67d1868078
commit
a4054dfa42
@ -1,4 +1,4 @@
|
|||||||
import { defaultKeymap, indentWithTab } from "@codemirror/commands";
|
import { defaultKeymap, history, historyKeymap, indentWithTab } from "@codemirror/commands";
|
||||||
import { EditorView, highlightActiveLine, keymap, lineNumbers, placeholder, ViewUpdate, type EditorViewConfig } from "@codemirror/view";
|
import { EditorView, highlightActiveLine, keymap, lineNumbers, placeholder, ViewUpdate, type EditorViewConfig } from "@codemirror/view";
|
||||||
import { defaultHighlightStyle, StreamLanguage, syntaxHighlighting, indentUnit, bracketMatching } from "@codemirror/language";
|
import { defaultHighlightStyle, StreamLanguage, syntaxHighlighting, indentUnit, bracketMatching } from "@codemirror/language";
|
||||||
import { Compartment } from "@codemirror/state";
|
import { Compartment } from "@codemirror/state";
|
||||||
@ -21,17 +21,19 @@ export default class CodeMirror extends EditorView {
|
|||||||
constructor(config: EditorConfig) {
|
constructor(config: EditorConfig) {
|
||||||
const languageCompartment = new Compartment();
|
const languageCompartment = new Compartment();
|
||||||
let extensions = [
|
let extensions = [
|
||||||
keymap.of([
|
|
||||||
...defaultKeymap,
|
|
||||||
indentWithTab
|
|
||||||
]),
|
|
||||||
languageCompartment.of([]),
|
languageCompartment.of([]),
|
||||||
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
|
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
|
||||||
highlightActiveLine(),
|
highlightActiveLine(),
|
||||||
highlightSelectionMatches(),
|
highlightSelectionMatches(),
|
||||||
bracketMatching(),
|
bracketMatching(),
|
||||||
lineNumbers(),
|
lineNumbers(),
|
||||||
indentUnit.of(" ".repeat(4))
|
indentUnit.of(" ".repeat(4)),
|
||||||
|
history(),
|
||||||
|
keymap.of([
|
||||||
|
...defaultKeymap,
|
||||||
|
...historyKeymap,
|
||||||
|
indentWithTab
|
||||||
|
]),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (Array.isArray(config.extensions)) {
|
if (Array.isArray(config.extensions)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user