add pinned="true" attribute to web panel pin icon, also keep the pinned state of the panel and the button in sync

This commit is contained in:
Mohammad Kazemi
2025-02-17 15:58:54 +03:30
parent 06a03cd4ca
commit 19bb1a1ce1
2 changed files with 13 additions and 1 deletions

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;