mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 23:19:58 +02:00
Fix: Update pinned tab context menu visibility logic
This commit fixes an issue where weird stuff would happen if pinned tab didn't have a base url to reset to. If there is no base url, reset tab functionality won't work and it won't be visible in context menu until you click replace pinned url with current or unpin and repin the tab.
This commit is contained in:
parent
d2296c0523
commit
7f430568a8
1 changed files with 5 additions and 13 deletions
|
@ -108,17 +108,9 @@
|
|||
}
|
||||
|
||||
updatePinnedTabForSessionRestore(tabData, tab) {
|
||||
if (tabData.zenPinnedUrl) {
|
||||
tab.setAttribute("zen-pinned-url", tabData.zenPinnedUrl);
|
||||
}
|
||||
|
||||
if (tabData.zenPinnedTitle) {
|
||||
tab.setAttribute("zen-pinned-title", tabData.zenPinnedTitle);
|
||||
}
|
||||
|
||||
if(tabData.zenPinnedIcon) {
|
||||
tab.setAttribute("zen-pinned-icon", tabData.zenPinnedIcon);
|
||||
}
|
||||
!!tabData.zenPinnedUrl ? tab.setAttribute("zen-pinned-url", tabData.zenPinnedUrl) : tab.removeAttribute("zen-pinned-url");
|
||||
!!tabData.zenPinnedTitle ? tab.setAttribute("zen-pinned-title", tabData.zenPinnedTitle) : tab.removeAttribute("zen-pinned-title");
|
||||
!!tabData.zenPinnedIcon ? tab.setAttribute("zen-pinned-icon", tabData.zenPinnedIcon) : tab.removeAttribute("zen-pinned-icon");
|
||||
}
|
||||
|
||||
_onCloseTabShortcut(event) {
|
||||
|
@ -215,8 +207,8 @@
|
|||
}
|
||||
|
||||
updatePinnedTabContextMenu(contextTab) {
|
||||
const isVisible = contextTab.pinned && contextTab.getAttribute("zen-pinned-url") && !contextTab.multiselected;
|
||||
document.getElementById("context_zen-reset-pinned-tab").hidden = !isVisible;
|
||||
const isVisible = contextTab.pinned && !contextTab.multiselected;
|
||||
document.getElementById("context_zen-reset-pinned-tab").hidden = !isVisible || !contextTab.getAttribute("zen-pinned-url");
|
||||
document.getElementById("context_zen-replace-pinned-url-with-current").hidden = !isVisible;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue