From 37cc48a8c417fe6fb9752673c7faa5eb52c1b1f6 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 19 Feb 2025 17:08:12 -0800 Subject: [PATCH 1/4] show toolbar immediately upon clicking --- gui/src/components/mainInput/InputToolbar.tsx | 1 - .../components/mainInput/InputToolbar/ToggleToolsButton.tsx | 6 +++--- gui/src/components/mainInput/TipTapEditor.tsx | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index a6b92ab90..2ffd52a48 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -110,7 +110,6 @@ function InputToolbar(props: InputToolbarProps) {
diff --git a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx index 3265b2778..119639045 100644 --- a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx +++ b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx @@ -82,8 +82,8 @@ export default function ToolDropdown(props: ToolDropdownProps) { {}} - as="div" - onClick={(e) => e.stopPropagation()} + // as="div" + // onClick={(e) => e.stopPropagation()} disabled={props.disabled} > {({ open }) => ( @@ -101,7 +101,7 @@ export default function ToolDropdown(props: ToolDropdownProps) { setDropdownOpen(false)} + // afterLeave={() => setDropdownOpen(false)} > { setShouldHideToolbar(value); - }, 200); + }, 1000); function getPlaceholderText( placeholder: TipTapEditorProps["placeholder"], @@ -591,7 +591,7 @@ function TipTapEditor(props: TipTapEditorProps) { useEffect(() => { if (editor) { const handleFocus = () => { - debouncedShouldHideToolbar(false); + setShouldHideToolbar(false); }; const handleBlur = () => { From 661b07a9faa51818709af295ba835023bcccd049 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 19 Feb 2025 17:21:29 -0800 Subject: [PATCH 2/4] tweaks --- .../components/mainInput/InputToolbar/ToggleToolsButton.tsx | 6 +++--- gui/src/components/mainInput/TipTapEditor.tsx | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx index 119639045..3fa0d4447 100644 --- a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx +++ b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx @@ -82,8 +82,8 @@ export default function ToolDropdown(props: ToolDropdownProps) { {}} - // as="div" - // onClick={(e) => e.stopPropagation()} + as="div" + onClick={(e) => e.stopPropagation()} disabled={props.disabled} > {({ open }) => ( @@ -147,7 +147,7 @@ export default function ToolDropdown(props: ToolDropdownProps) { />
-
+
{availableTools.map((tool: any) => ( { - debouncedShouldHideToolbar(true); + // TODO - make toolbar auto-hiding work without breaking tool dropdown focus + // debouncedShouldHideToolbar(true); }; editor.on("focus", handleFocus); From c10e54da870094d648003442aa3ddc5bc5df53fa Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 19 Feb 2025 17:23:28 -0800 Subject: [PATCH 3/4] cleanup --- gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx | 2 +- gui/src/components/mainInput/TipTapEditor.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx index 3fa0d4447..c20d1810f 100644 --- a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx +++ b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx @@ -101,7 +101,7 @@ export default function ToolDropdown(props: ToolDropdownProps) { setDropdownOpen(false)} + afterLeave={() => setDropdownOpen(false)} > { setShouldHideToolbar(value); - }, 1000); + }, 200); function getPlaceholderText( placeholder: TipTapEditorProps["placeholder"], From b60b671a54a8e5bbdf25d458a2268a36759e4965 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 19 Feb 2025 17:38:33 -0800 Subject: [PATCH 4/4] query context provider focus issue fixes --- gui/src/components/mainInput/MentionList.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index 323b586d0..94324b75e 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -257,7 +257,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { if (queryInputRef.current) { queryInputRef.current.focus(); } - }, [querySubmenuItem]); + }, [querySubmenuItem, queryInputRef]); const selectItem = (index: number) => { const item = allItems[index]; @@ -378,6 +378,9 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { {querySubmenuItem ? ( { + e.stopPropagation(); + }} rows={1} ref={queryInputRef} placeholder={querySubmenuItem.description} @@ -436,7 +439,10 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { ref={(el) => (itemRefs.current[index] = el)} className={`item cursor-pointer ${isSelected ? "is-selected" : ""}`} key={index} - onClick={() => selectItem(index)} + onClick={(e) => { + e.stopPropagation(); + selectItem(index); + }} onMouseEnter={() => setSelectedIndex(index)} data-testid="context-provider-dropdown-item" >