Skip to content

Build your personal knowledge base with Trilium Notes

chore(code): reintroduce history (undo-redo)

Elian Dorana4054dfa4295
diff --git a/packages/codemirror/src/index.ts b/packages/codemirror/src/index.ts
index 787c4a40ef..98548bab2b 100644
--- a/packages/codemirror/src/index.ts
+++ b/packages/codemirror/src/index.ts
@@ -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 { defaultHighlightStyle, StreamLanguage, syntaxHighlighting, indentUnit, bracketMatching } from "@codemirror/language";
import { Compartment } from "@codemirror/state";
@@ -21,17 +21,19 @@ export default class CodeMirror extends EditorView {
constructor(config: EditorConfig) {
const languageCompartment = new Compartment();
let extensions = [
- keymap.of([
- ...defaultKeymap,
- indentWithTab
- ]),
languageCompartment.of([]),
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
highlightActiveLine(),
highlightSelectionMatches(),
bracketMatching(),
lineNumbers(),
- indentUnit.of(" ".repeat(4))
+ indentUnit.of(" ".repeat(4)),
+ history(),
+ keymap.of([
+ ...defaultKeymap,
+ ...historyKeymap,
+ indentWithTab
+ ]),
];
if (Array.isArray(config.extensions)) {