X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/5ffec2c52d6b6c1cf61e53813fe4bfbece3da1aa..6b4b500a3313f30c92a8a6ffa1d8427fdf4d2aaa:/resources/js/markdown/shortcuts.ts diff --git a/resources/js/markdown/shortcuts.ts b/resources/js/markdown/shortcuts.ts index c746b52e7..734160f29 100644 --- a/resources/js/markdown/shortcuts.ts +++ b/resources/js/markdown/shortcuts.ts @@ -1,11 +1,13 @@ import {MarkdownEditor} from "./index.mjs"; import {KeyBinding} from "@codemirror/view"; +export type MarkdownEditorShortcutMap = Record void>; + /** * Provide shortcuts for the editor instance. */ -function provide(editor: MarkdownEditor): Record void> { - const shortcuts: Record void> = {}; +export function provideShortcutMap(editor: MarkdownEditor): MarkdownEditorShortcutMap { + const shortcuts: MarkdownEditorShortcutMap = {}; // Insert Image shortcut shortcuts['Shift-Mod-i'] = () => editor.actions.insertImage(); @@ -45,7 +47,7 @@ function provide(editor: MarkdownEditor): Record void> { * Get the editor shortcuts in CodeMirror keybinding format. */ export function provideKeyBindings(editor: MarkdownEditor): KeyBinding[] { - const shortcuts = provide(editor); + const shortcuts = provideShortcutMap(editor); const keyBindings = []; const wrapAction = (action: ()=>void) => () => {