fix: scope shortcuts to textarea

This commit is contained in:
Xyphyn committed 2023-08-09 11:15:51 -07:00
1 parent 6c4b44357c
commit ffbb37e0df
2 files changed
+11 -13

No files matched your search

+1
View File
@@ -30,6 +30,7 @@
bind:value bind:value
bind:this={item} bind:this={item}
on:input={(e) => dispatcher('input', e)} on:input={(e) => dispatcher('input', e)}
on:keydown
{placeholder} {placeholder}
{maxlength} {maxlength}
{rows} {rows}
@@ -104,19 +104,6 @@
</Modal> </Modal>
{/if} {/if}
<svelte:body
on:keydown={(e) => {
if (e.ctrlKey) {
// @ts-ignore
let shortcut = shortcuts[e.code]
if (shortcut) {
e.preventDefault()
shortcut?.()
}
}
}}
/>
<div> <div>
{#if label} {#if label}
<div class="block my-1 font-bold text-sm">{label}</div> <div class="block my-1 font-bold text-sm">{label}</div>
@@ -235,6 +222,16 @@ overflow-hidden focus-within:border-black focus-within:dark:border-white transit
class="bg-inherit border-0 rounded-none" class="bg-inherit border-0 rounded-none"
bind:value bind:value
bind:item={textArea} bind:item={textArea}
on:keydown={(e) => {
if (e.ctrlKey) {
// @ts-ignore
let shortcut = shortcuts[e.code]
if (shortcut) {
e.preventDefault()
shortcut?.()
}
}
}}
{...$$restProps} {...$$restProps}
/> />
{/if} {/if}