From 5ecbf13348d383e71fcb3809f5c01ceb8d72a5a9 Mon Sep 17 00:00:00 2001 From: Hyko Date: Sun, 26 Apr 2026 16:03:28 -0400 Subject: [PATCH] fix(ui): replace form submit with explicit key and click handlers in image block - remove form element and onSubmit in favor of a plain div - add handleKeyDown to trigger submit on Enter key press - attach onClick handler directly to the insert button with type="button" --- .../BlockEditor/blockTypes/Image.client.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/shared/components/BlockEditor/blockTypes/Image.client.js b/src/shared/components/BlockEditor/blockTypes/Image.client.js index db43624..0227446 100644 --- a/src/shared/components/BlockEditor/blockTypes/Image.client.js +++ b/src/shared/components/BlockEditor/blockTypes/Image.client.js @@ -18,12 +18,18 @@ function ImageBlock({ block, onChange, disabled }) { } }, [block.src, disabled]); - function submit(e) { - e.preventDefault(); + function submit() { if (!url.trim()) return; onChange?.({ src: url.trim() }); } + function handleKeyDown(e) { + if (e.key === 'Enter') { + e.preventDefault(); + submit(); + } + } + function handleAltChange(e) { onChange?.({ alt: e.target.value }); } @@ -39,10 +45,7 @@ function ImageBlock({ block, onChange, disabled }) { if (!block.src) { return ( -
+
setUrl(e.target.value)} + onKeyDown={handleKeyDown} disabled={disabled} className="flex-1 px-2 py-1 text-sm rounded border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 text-neutral-900 dark:text-white outline-none focus:border-blue-500" /> - +
); }