X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/e711290d8b1ce06b38e0560248806e8de2077870..refs/heads/development:/resources/js/markdown/codemirror.js diff --git a/resources/js/markdown/codemirror.js b/resources/js/markdown/codemirror.js index 67b7c68ec..664767605 100644 --- a/resources/js/markdown/codemirror.js +++ b/resources/js/markdown/codemirror.js @@ -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);