Browse Source

Merge pull request #10353 from jasongrout/editorsettings

Fix codemirror options updating
Jeremy Tuloup 3 years ago
parent
commit
5fb1efc7bc
1 changed files with 18 additions and 10 deletions
  1. 18 10
      packages/codemirror-extension/src/index.ts

+ 18 - 10
packages/codemirror-extension/src/index.ts

@@ -234,20 +234,19 @@ function activateEditorCommands(
       (settings.get('lineWiseCopyCut').composite as boolean) ?? lineWiseCopyCut;
   }
 
-  const editorOptions: any = {
-    keyMap,
-    theme,
-    scrollPastEnd,
-    styleActiveLine,
-    styleSelectedText,
-    selectionPointer,
-    lineWiseCopyCut
-  };
-
   /**
    * Update the settings of the current tracker instances.
    */
   function updateTracker(): void {
+    const editorOptions: any = {
+      keyMap,
+      theme,
+      scrollPastEnd,
+      styleActiveLine,
+      styleSelectedText,
+      selectionPointer,
+      lineWiseCopyCut
+    };
     tracker.forEach(widget => {
       if (widget.content.editor instanceof CodeMirrorEditor) {
         widget.content.editor.setOptions(editorOptions);
@@ -274,6 +273,15 @@ function activateEditorCommands(
    * Handle the settings of new widgets.
    */
   tracker.widgetAdded.connect((sender, widget) => {
+    const editorOptions: any = {
+      keyMap,
+      theme,
+      scrollPastEnd,
+      styleActiveLine,
+      styleSelectedText,
+      selectionPointer,
+      lineWiseCopyCut
+    };
     if (widget.content.editor instanceof CodeMirrorEditor) {
       widget.content.editor.setOptions(editorOptions);
     }