From ee2602c93291306f2878dc43df26a130d771d39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Thu, 9 Dec 2021 12:18:41 +0100 Subject: [PATCH] Keep indentation when pasting code into the editor (#779) --- assets/js/cell/live_editor.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/assets/js/cell/live_editor.js b/assets/js/cell/live_editor.js index ba13f0051..be27353d6 100644 --- a/assets/js/cell/live_editor.js +++ b/assets/js/cell/live_editor.js @@ -164,6 +164,10 @@ class LiveEditor { fontFamily: "JetBrains Mono, Droid Sans Mono, monospace", fontSize: 14, tabIndex: -1, + tabSize: 2, + autoIndent: true, + formatOnType: true, + formatOnPaste: true, quickSuggestions: this.type === "elixir" && settings.editor_auto_completion, tabCompletion: "on", @@ -176,16 +180,6 @@ class LiveEditor { parameterHints: this.type === "elixir" && settings.editor_auto_signature, }); - this.editor.getModel().updateOptions({ - tabSize: 2, - }); - - this.editor.updateOptions({ - autoIndent: true, - tabSize: 2, - formatOnType: true, - }); - // Automatically adjust the editor size to fit the container. const resizeObserver = new ResizeObserver((entries) => { entries.forEach((entry) => {