mirror of
				https://github.com/zen-browser/desktop.git
				synced 2025-11-04 01:34:35 +00:00 
			
		
		
		
	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:
		@@ -10,7 +10,7 @@
 | 
				
			|||||||
      </hbox>
 | 
					      </hbox>
 | 
				
			||||||
      <hbox>
 | 
					      <hbox>
 | 
				
			||||||
        <toolbarbutton id="zen-sidebar-web-panel-home" class="toolbarbutton-1 chromeclass-toolbar-additional" oncommand="gZenBrowserManagerSidebar.home();"/>
 | 
					        <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();"/>
 | 
					        <toolbarbutton id="zen-sidebar-web-panel-close" class="toolbarbutton-1 chromeclass-toolbar-additional" oncommand="gZenBrowserManagerSidebar.close();"/>
 | 
				
			||||||
      </hbox>
 | 
					      </hbox>
 | 
				
			||||||
    </toolbar>
 | 
					    </toolbar>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,6 +33,7 @@ class ZenBrowserManagerSidebar extends ZenDOMOperatedFeature {
 | 
				
			|||||||
    this.listenForPrefChanges();
 | 
					    this.listenForPrefChanges();
 | 
				
			||||||
    this.insertIntoContextMenu();
 | 
					    this.insertIntoContextMenu();
 | 
				
			||||||
    this.addPositioningListeners();
 | 
					    this.addPositioningListeners();
 | 
				
			||||||
 | 
					    this.syncPinnedState();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onlySafeWidthAndHeight() {
 | 
					  onlySafeWidthAndHeight() {
 | 
				
			||||||
@@ -98,6 +99,17 @@ class ZenBrowserManagerSidebar extends ZenDOMOperatedFeature {
 | 
				
			|||||||
    window.addEventListener('resize', this.onWindowResize.bind(this));
 | 
					    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) {
 | 
					  handleSplitterMouseDown(mouseDownEvent) {
 | 
				
			||||||
    if (this._isDragging) return;
 | 
					    if (this._isDragging) return;
 | 
				
			||||||
    this._isDragging = true;
 | 
					    this._isDragging = true;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user