X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/e711290d8b1ce06b38e0560248806e8de2077870..refs/pull/4815/head:/resources/js/markdown/shortcuts.js diff --git a/resources/js/markdown/shortcuts.js b/resources/js/markdown/shortcuts.js index fcb66a12d..543e6dcdd 100644 --- a/resources/js/markdown/shortcuts.js +++ b/resources/js/markdown/shortcuts.js @@ -7,35 +7,35 @@ function provide(editor) { const shortcuts = {}; // Insert Image shortcut - shortcuts['Shift-Mod-i'] = cm => editor.actions.insertImage(); + shortcuts['Shift-Mod-i'] = () => editor.actions.insertImage(); // Save draft - shortcuts['Mod-s'] = cm => window.$events.emit('editor-save-draft'); + shortcuts['Mod-s'] = () => window.$events.emit('editor-save-draft'); // Save page - shortcuts['Mod-Enter'] = cm => window.$events.emit('editor-save-page'); + shortcuts['Mod-Enter'] = () => window.$events.emit('editor-save-page'); // Show link selector - shortcuts['Shift-Mod-k'] = cm => editor.actions.showLinkSelector(); + shortcuts['Shift-Mod-k'] = () => editor.actions.showLinkSelector(); // Insert Link - shortcuts['Mod-k'] = cm => editor.actions.insertLink(); + shortcuts['Mod-k'] = () => editor.actions.insertLink(); // FormatShortcuts - shortcuts['Mod-1'] = cm => editor.actions.replaceLineStart('##'); - shortcuts['Mod-2'] = cm => editor.actions.replaceLineStart('###'); - shortcuts['Mod-3'] = cm => editor.actions.replaceLineStart('####'); - shortcuts['Mod-4'] = cm => editor.actions.replaceLineStart('#####'); - shortcuts['Mod-5'] = cm => editor.actions.replaceLineStart(''); - shortcuts['Mod-d'] = cm => editor.actions.replaceLineStart(''); - shortcuts['Mod-6'] = cm => editor.actions.replaceLineStart('>'); - shortcuts['Mod-q'] = cm => editor.actions.replaceLineStart('>'); - shortcuts['Mod-7'] = cm => editor.actions.wrapSelection('\n```\n', '\n```'); - shortcuts['Mod-8'] = cm => editor.actions.wrapSelection('`', '`'); - shortcuts['Shift-Mod-e'] = cm => editor.actions.wrapSelection('`', '`'); - shortcuts['Mod-9'] = cm => editor.actions.cycleCalloutTypeAtSelection(); - shortcuts['Mod-p'] = cm => editor.actions.replaceLineStart('-'); - shortcuts['Mod-o'] = cm => editor.actions.replaceLineStartForOrderedList(); + shortcuts['Mod-1'] = () => editor.actions.replaceLineStart('##'); + shortcuts['Mod-2'] = () => editor.actions.replaceLineStart('###'); + shortcuts['Mod-3'] = () => editor.actions.replaceLineStart('####'); + shortcuts['Mod-4'] = () => editor.actions.replaceLineStart('#####'); + shortcuts['Mod-5'] = () => editor.actions.replaceLineStart(''); + shortcuts['Mod-d'] = () => editor.actions.replaceLineStart(''); + shortcuts['Mod-6'] = () => editor.actions.replaceLineStart('>'); + shortcuts['Mod-q'] = () => editor.actions.replaceLineStart('>'); + shortcuts['Mod-7'] = () => editor.actions.wrapSelection('\n```\n', '\n```'); + shortcuts['Mod-8'] = () => editor.actions.wrapSelection('`', '`'); + shortcuts['Shift-Mod-e'] = () => editor.actions.wrapSelection('`', '`'); + shortcuts['Mod-9'] = () => editor.actions.cycleCalloutTypeAtSelection(); + shortcuts['Mod-p'] = () => editor.actions.replaceLineStart('-'); + shortcuts['Mod-o'] = () => editor.actions.replaceLineStartForOrderedList(); return shortcuts; }