diff --git a/src/lib/components/markdown/MarkdownEditor.svelte b/src/lib/components/markdown/MarkdownEditor.svelte index e8deae3c..3b091d9c 100644 --- a/src/lib/components/markdown/MarkdownEditor.svelte +++ b/src/lib/components/markdown/MarkdownEditor.svelte @@ -82,6 +82,13 @@ } let previewing = false + + const shortcuts = { + KeyB: () => wrapSelection('**', '**'), + KeyI: () => wrapSelection('*', '*'), + KeyS: () => wrapSelection('~~', '~~'), + KeyH: () => wrapSelection('\n# ', ''), + } {#if uploadingImage && images} @@ -96,6 +103,19 @@ {/if} + { + if (e.ctrlKey) { + // @ts-ignore + let shortcut = shortcuts[e.code] + if (shortcut) { + e.preventDefault() + shortcut?.() + } + } + }} +/> +
{#if label}
{label}