From feb918444da417fbb46d390b9e81b7e7b61c9cbe Mon Sep 17 00:00:00 2001 From: sdasda7777 <17746796+sdasda7777@users.noreply.github.com> Date: Sat, 10 Feb 2024 12:19:12 +0100 Subject: [PATCH] Fixed scroll retention, removed right click close --- src/PageTabs.tsx | 7 ++++--- src/utils.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/PageTabs.tsx b/src/PageTabs.tsx index 5062707..852d871 100644 --- a/src/PageTabs.tsx +++ b/src/PageTabs.tsx @@ -148,10 +148,11 @@ const Tabs = React.forwardRef( return (
onClickTab(tab, e.shiftKey)} - onAuxClick={onClose} onDoubleClick={() => onPinTab(tab)} onContextMenu={(e) => { e.preventDefault(); + console.log(e); + // onAuxClick={/*onClose*/} // TODO: show the same context menu like right-clicking the title? console.log("Not implemented yet"); }} @@ -426,7 +427,7 @@ export function useActiveTab(tabs: ITabInfo[]) { tab = { ...tab, ...p }; if (tab.scrollTop) { - mainContainerScroll({ top: tab.scrollTop }); + setTimeout(() => { mainContainerScroll({ top: tab.scrollTop }); }, 250); } pageRef.current = tab; setPage(tab); @@ -654,7 +655,7 @@ export function PageTabs(): JSX.Element { // remember current page's scroll position if (idx !== -1) { const scrollTop = - top?.document.querySelector("#main-container")?.scrollTop; + top?.document.querySelector("#main-content-container")?.scrollTop; setTabs( produce(tabs, (draft) => { diff --git a/src/utils.ts b/src/utils.ts index e4f0c88..1641c84 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -341,7 +341,7 @@ export const useScrollWidth = ( }; export const mainContainerScroll = (scrollOptions: ScrollToOptions) => { - top?.document.querySelector("#main-container")?.scrollTo(scrollOptions); + top?.document.querySelector("#main-content-container")?.scrollTo(scrollOptions); }; export const isBlock = (t: ITabInfo) => {