X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/257a7038788d7ce6183c946cf37ab2d27d114100..refs/pull/4815/head:/resources/js/markdown/codemirror.js diff --git a/resources/js/markdown/codemirror.js b/resources/js/markdown/codemirror.js index 55ea485e3..9d54c19d7 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 {provideKeyBindings} from './shortcuts'; +import {debounce} from '../services/util'; +import {Clipboard} from '../services/clipboard'; /** * Initiate the codemirror instance for the markdown editor. @@ -21,13 +21,15 @@ 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 - scroll: (event) => syncActive && onScrollDebounced(event), + scroll: event => syncActive && onScrollDebounced(event), // Handle image & content drag n drop - drop: (event) => { + drop: event => { const templateId = event.dataTransfer.getData('bookstack/template'); if (templateId) { event.preventDefault(); @@ -43,7 +45,7 @@ export async function init(editor) { } }, // Handle image paste - paste: (event) => { + paste: event => { const clipboard = new Clipboard(event.clipboardData || event.dataTransfer); // Don't handle the event ourselves if no items exist of contains table-looking data @@ -55,8 +57,8 @@ export async function init(editor) { for (const image of images) { editor.actions.uploadImage(image); } - } - } + }, + }; const cm = Code.markdownEditor( editor.config.inputEl, @@ -70,4 +72,4 @@ export async function init(editor) { window.mdEditorView = cm; return cm; -} \ No newline at end of file +}