Skip to content

Commit ae517d9

Browse files
committed
Fix paste in code editor also pasting in cell
1 parent 517910b commit ae517d9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/App.svelte

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,17 @@
272272
{/snippet}
273273
274274
<svelte:window
275-
onpaste={(e) => actions.Paste(e, globals)}
275+
onpaste={(e) => {
276+
// Don't handle keypresses from within text or other editable inputs
277+
if (
278+
globals.mode == "insert" ||
279+
["input", "textarea"].includes(e.target?.tagName.toLocaleLowerCase()) ||
280+
e.target.isContentEditable
281+
) {
282+
return;
283+
}
284+
actions.Paste(e, globals);
285+
}}
276286
ondragover={(e) => e.preventDefault(/* Necessary for drop handler to work */)}
277287
ondrop={(e) => actions.Paste(e, globals)}
278288
onkeydown={(e) => keyboardHandler(e, globals)}

0 commit comments

Comments
 (0)