Merge pull request #5467 from mokazemi/fix/panel-pin-icon

keep the "pinned" attribute of the side web panel and the button in sync
This commit is contained in:
mr. m
2025-03-02 15:07:42 +01:00
committed by GitHub
2 changed files with 13 additions and 1 deletions

View File

@@ -10,7 +10,7 @@
</hbox>
<hbox>
<toolbarbutton id="zen-sidebar-web-panel-home" class="toolbarbutton-1 chromeclass-toolbar-additional" oncommand="gZenBrowserManagerSidebar.home();"/>
<toolbarbutton id="zen-sidebar-web-panel-pinned" class="toolbarbutton-1 chromeclass-toolbar-additional" oncommand="gZenBrowserManagerSidebar.togglePinned(this);"/>
<toolbarbutton id="zen-sidebar-web-panel-pinned" class="toolbarbutton-1 chromeclass-toolbar-additional" pinned="true" oncommand="gZenBrowserManagerSidebar.togglePinned(this);"/>
<toolbarbutton id="zen-sidebar-web-panel-close" class="toolbarbutton-1 chromeclass-toolbar-additional" oncommand="gZenBrowserManagerSidebar.close();"/>
</hbox>
</toolbar>

View File

@@ -33,6 +33,7 @@ class ZenBrowserManagerSidebar extends ZenDOMOperatedFeature {
this.listenForPrefChanges();
this.insertIntoContextMenu();
this.addPositioningListeners();
this.syncPinnedState();
}
onlySafeWidthAndHeight() {
@@ -98,6 +99,17 @@ class ZenBrowserManagerSidebar extends ZenDOMOperatedFeature {
window.addEventListener('resize', this.onWindowResize.bind(this));
}
syncPinnedState() {
const sidebar = document.getElementById('zen-sidebar-web-panel');
const pinButton = document.getElementById('zen-sidebar-web-panel-pinned');
if (sidebar.hasAttribute('pinned')) {
pinButton.setAttribute('pinned', 'true');
} else {
pinButton.removeAttribute('pinned');
}
}
handleSplitterMouseDown(mouseDownEvent) {
if (this._isDragging) return;
this._isDragging = true;