From 79ad356d90b10047a422c52fb11ccb665fdad804 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 5 Apr 2022 23:10:51 +0200 Subject: [PATCH] web/elements: insert spaces instead of tabs in codemirror Signed-off-by: Jens Langhammer --- web/src/elements/CodeMirror.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/src/elements/CodeMirror.ts b/web/src/elements/CodeMirror.ts index 633b2e8aa..321f93e73 100644 --- a/web/src/elements/CodeMirror.ts +++ b/web/src/elements/CodeMirror.ts @@ -112,6 +112,12 @@ export class CodeMirrorTextarea extends LitElement { autoRefresh: true, lineWrapping: true, value: this._value, + extraKeys: { + Tab: (cm) => { + cm.execCommand("insertSoftTab"); + }, + }, + indentUnit: 4, }); this.editor.on("blur", () => { this.editor?.save();