]> BookStack Code Mirror - bookstack/blobdiff - resources/js/markdown/codemirror.js
Adjusted/improved some color setting wording
[bookstack] / resources / js / markdown / codemirror.js
index 06860b929cddb3c5a73bb888af4dc2e91689aed7..8724a23c89e33a04b8e0b700dd6395eeb9beaad0 100644 (file)
@@ -24,7 +24,13 @@ export async function init(editor) {
 
     // Handle scroll to sync display view
     const onScrollDebounced = debounce(editor.actions.syncDisplayPosition.bind(editor.actions), 100, false);
-    cm.on('scroll', instance => onScrollDebounced(instance));
+    let syncActive = editor.settings.get('scrollSync');
+    editor.settings.onChange('scrollSync', val => syncActive = val);
+    cm.on('scroll', instance => {
+        if (syncActive) {
+            onScrollDebounced(instance);
+        }
+    });
 
     // Handle image paste
     cm.on('paste', (cm, event) => {