From 34c0c7ddabb792c9a890fc2362e9c2a9ffcf95d5 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 19 Dec 2024 17:18:29 -0800 Subject: [PATCH] use dedicated container div for tippy.js --- gui/src/components/mainInput/MentionList.tsx | 6 +-- gui/src/components/mainInput/TipTapEditor.tsx | 38 +++++++++++-------- gui/src/components/mainInput/getSuggestion.ts | 8 +++- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index 02cf4d8aa..f0f328a8d 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -38,10 +38,10 @@ import { } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; -import HeaderButtonWithToolTip from "../gui/HeaderButtonWithToolTip"; import FileIcon from "../FileIcon"; import SafeImg from "../SafeImg"; import AddDocsDialog from "../dialogs/AddDocsDialog"; +import HeaderButtonWithToolTip from "../gui/HeaderButtonWithToolTip"; import { ComboBoxItem, ComboBoxItemType } from "./types"; const ICONS_FOR_DROPDOWN: { [key: string]: any } = { @@ -120,7 +120,7 @@ const ItemsDiv = styled.div` overflow-y: auto; max-height: 330px; padding: 0.2rem; - position: relative; + position: relative; // absolute to test tippy.js bug background-color: ${vscQuickInputBackground}; /* backdrop-filter: blur(12px); */ @@ -352,7 +352,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { }, [allItems]); return ( - + {querySubmenuItem ? ( ` resize: none; @@ -986,6 +986,12 @@ function TipTapEditor(props: TipTapEditorProps) { Hold ⇧ to drop image )} +
); } diff --git a/gui/src/components/mainInput/getSuggestion.ts b/gui/src/components/mainInput/getSuggestion.ts index b52328148..41e6338c1 100644 --- a/gui/src/components/mainInput/getSuggestion.ts +++ b/gui/src/components/mainInput/getSuggestion.ts @@ -37,9 +37,15 @@ function getSuggestion( return; } + const container = document.getElementById("tippy-js-div"); + if (!container) { + console.log("no container"); + return; + } + popup = tippy("body", { getReferenceClientRect: props.clientRect, - appendTo: () => document.body, + appendTo: () => container, content: component.element, showOnCreate: true, interactive: true,