Fix editor key events bubbling up

This commit is contained in:
Joscha 2025-02-07 22:16:06 +01:00
parent 6c1ee3a3fc
commit 9ce2169931

View file

@ -29,15 +29,12 @@ function onInput() {
function onKeyPress(ev: KeyboardEvent) { function onKeyPress(ev: KeyboardEvent) {
if (ev.key === "Escape") { if (ev.key === "Escape") {
emit("close"); emit("close");
ev.preventDefault(); } else if (ev.key === "Enter" && !ev.shiftKey) {
return;
}
if (ev.key === "Enter" && !ev.shiftKey) {
emit("finish", text.value); emit("finish", text.value);
} else return;
ev.preventDefault(); ev.preventDefault();
return; ev.stopPropagation();
}
} }
</script> </script>