]> BookStack Code Mirror - bookstack/blobdiff - resources/js/markdown/codemirror.js
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / resources / js / markdown / codemirror.js
index 67b7c68ec869d19d1cddfdf705244fba7bdd8454..664767605b8a91b33125512efc96476068da4c32 100644 (file)
@@ -1,6 +1,6 @@
 import {provideKeyBindings} from './shortcuts';
-import {debounce} from '../services/util';
-import Clipboard from '../services/clipboard';
+import {debounce} from '../services/util.ts';
+import {Clipboard} from '../services/clipboard.ts';
 
 /**
  * Initiate the codemirror instance for the markdown editor.
@@ -21,7 +21,9 @@ export async function init(editor) {
 
     const onScrollDebounced = debounce(editor.actions.syncDisplayPosition.bind(editor.actions), 100, false);
     let syncActive = editor.settings.get('scrollSync');
-    editor.settings.onChange('scrollSync', val => syncActive = val);
+    editor.settings.onChange('scrollSync', val => {
+        syncActive = val;
+    });
 
     const domEventHandlers = {
         // Handle scroll to sync display view
@@ -42,6 +44,10 @@ export async function init(editor) {
                 editor.actions.insertClipboardImages(clipboardImages, event.pageX, event.pageY);
             }
         },
+        // Handle dragover event to allow as drop-target in chrome
+        dragover: event => {
+            event.preventDefault();
+        },
         // Handle image paste
         paste: event => {
             const clipboard = new Clipboard(event.clipboardData || event.dataTransfer);