mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 17:38:10 +00:00
ensure no keyboard events leak through to the canvas
This commit is contained in:
1 parent
b046f6ff2a
commit
9aee7c898f
1 file changed
+5
-1
@@ -235,11 +235,13 @@ export const PromptBox2D = ({
|
||||
|
||||
const handlePaste = (e: React.ClipboardEvent<HTMLTextAreaElement>) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const pastedText = e.clipboardData.getData("text").trim();
|
||||
setPrompt(pastedText);
|
||||
};
|
||||
|
||||
const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
||||
e.stopPropagation();
|
||||
setPrompt(e.target.value);
|
||||
};
|
||||
|
||||
@@ -444,9 +446,11 @@ export const PromptBox2D = ({
|
||||
};
|
||||
|
||||
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
// Stop propagation of keyboard events to prevent them from reaching the canvas
|
||||
e.stopPropagation();
|
||||
|
||||
if (e.key === "Enter" && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
|
||||
handleEnqueue();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user