Skip to content

Commit 62f3f7f

Browse files
committed
fix blur
1 parent 5402453 commit 62f3f7f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

gui/src/components/mainInput/tiptap/TipTapEditor.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,24 @@ function TipTapEditor(props: TipTapEditorProps) {
153153
setActiveKey,
154154
});
155155

156+
const handleBlur = (e: React.FocusEvent) => {
157+
// Check if the new focus target is within our InputBoxDiv
158+
const currentTarget = e.currentTarget;
159+
const relatedTarget = e.relatedTarget as Node | null;
160+
161+
if (relatedTarget && currentTarget.contains(relatedTarget)) {
162+
return;
163+
}
164+
165+
setShouldHideToolbar(true);
166+
};
167+
156168
return (
157169
<InputBoxDiv
158170
onFocus={() => {
159171
setShouldHideToolbar(false);
160172
}}
161-
onBlur={() => {
162-
setShouldHideToolbar(true);
163-
}}
173+
onBlur={handleBlur}
164174
onKeyDown={handleKeyDown}
165175
onKeyUp={handleKeyUp}
166176
className={shouldHideToolbar ? "cursor-default" : "cursor-text"}

0 commit comments

Comments
 (0)