From 798a0bfc28cd38968e8a1553c4eb14e5ad31ae3c Mon Sep 17 00:00:00 2001 From: Patrick MARIE Date: Sun, 13 Oct 2024 23:45:50 +0200 Subject: [PATCH] Allow adding multiple empty lines in editor. (#345) --- public/editor.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/editor.ts b/public/editor.ts index 2916ee7..f682418 100644 --- a/public/editor.ts +++ b/public/editor.ts @@ -1,6 +1,6 @@ import {EditorView, gutter, keymap, lineNumbers} from "@codemirror/view"; import {Compartment, EditorState, Facet, Line, SelectionRange} from "@codemirror/state"; -import {indentLess} from "@codemirror/commands"; +import {defaultKeymap, indentLess} from "@codemirror/commands"; document.addEventListener("DOMContentLoaded", () => { EditorView.theme({}, {dark: true}); @@ -27,7 +27,10 @@ document.addEventListener("DOMContentLoaded", () => { extensions: [ lineNumbers(), gutter({class: "cm-mygutter"}), - keymap.of([{key: "Tab", run: customIndentMore, shift: indentLess}]), + keymap.of([ + {key: "Tab", run: customIndentMore, shift: indentLess}, + ...defaultKeymap, + ]), indentSize.of(EditorState.tabSize.of(2)), wrapMode.of([]), indentType.of(txtFacet.of("space")),