From a21d4faba7e4ee180e9bdf1cd9a3fd429a283671 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 24 Nov 2024 00:33:05 +0100 Subject: [PATCH] Mark the current successor tab with [data-successor] attribute --- src/services/tabs.fg.actions.ts | 11 +++++++++++ src/services/tabs.fg.ts | 1 + src/sidebar/components/tab.vue | 1 + src/types/tabs.ts | 1 + 4 files changed, 14 insertions(+) diff --git a/src/services/tabs.fg.actions.ts b/src/services/tabs.fg.actions.ts index 2b6e5722..70651672 100644 --- a/src/services/tabs.fg.actions.ts +++ b/src/services/tabs.fg.actions.ts @@ -82,6 +82,7 @@ export function mutateNativeTabToSideberyTab(nativeTab: NativeTab): Tab { color: null, isGroup: tab.isGroup, preview: false, + isSuccessor: false } } @@ -123,6 +124,7 @@ export function createReactiveProps(tab: Tab): ReactiveTabProps { color: null, isGroup: tab.isGroup, preview: false, + isSuccessor: false } if (reactFn) return reactFn(rProps) @@ -2704,6 +2706,15 @@ function updateSuccession(exclude?: ID[]) { Logs.err('Tabs.updateSuccession: Cannot update succession:', err) }) activeTab.successorTabId = target.id + + // Mark the current successor tab + target.reactive.isSuccessor = true + const prevPrevActive = Tabs.byId[Tabs.successorId] + if (prevPrevActive) { + prevPrevActive.reactive.isSuccessor = false + } + Tabs.successorId = target.id + return target } } diff --git a/src/services/tabs.fg.ts b/src/services/tabs.fg.ts index d0042845..f84a70ec 100644 --- a/src/services/tabs.fg.ts +++ b/src/services/tabs.fg.ts @@ -55,6 +55,7 @@ export const Tabs = { removingTabs: [] as ID[], ignoreTabsEvents: false, activeId: NOID, + successorId: NOID, blockedScrollPosition: false, activateSelectedOnMouseLeave: false, sorting: false, diff --git a/src/sidebar/components/tab.vue b/src/sidebar/components/tab.vue index 7f7055eb..a9b958ef 100644 --- a/src/sidebar/components/tab.vue +++ b/src/sidebar/components/tab.vue @@ -20,6 +20,7 @@ :data-unread="tab.reactive.unread" :data-edit="tab.reactive.customTitleEdit" :data-preview="tab.reactive.preview" + :data-successor="tab.reactive.isSuccessor" :title="tab.reactive.tooltip" :draggable="!tab.reactive.customTitleEdit" @dragstart="onDragStart" diff --git a/src/types/tabs.ts b/src/types/tabs.ts index 7a1538e7..606ace51 100644 --- a/src/types/tabs.ts +++ b/src/types/tabs.ts @@ -75,6 +75,7 @@ export interface ReactiveTabProps { customColor: string | null isGroup: boolean preview: boolean + isSuccessor: boolean } export interface InlineTabData {