From 806259d18777444ded91ba12c9225eefca89557d Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 27 Feb 2015 17:41:36 -0500 Subject: [PATCH] When dropping combo buttons into panel, add two separate buttons instead And move combo button to customization palette --- chrome/content/zotero/icon.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/chrome/content/zotero/icon.js b/chrome/content/zotero/icon.js index 1d8ee090a4..de8708297f 100644 --- a/chrome/content/zotero/icon.js +++ b/chrome/content/zotero/icon.js @@ -32,6 +32,21 @@ var comboButtonsID = 'zotero-toolbar-buttons'; CustomizableUI.addListener({ onWidgetAdded: function (id, area, position) { if (id == comboButtonsID) { + // When dropping combo button into panel, add two independent buttons instead + if (area == CustomizableUI.AREA_PANEL) { + let mainID = getSingleID('main'); + let saveID = getSingleID('save'); + CustomizableUI.removeWidgetFromArea(id); + // Remove independent main and save buttons first if they're already in panel + CustomizableUI.removeWidgetFromArea(mainID); + CustomizableUI.removeWidgetFromArea(saveID); + CustomizableUI.addWidgetToArea(mainID, area, position); + let placement = CustomizableUI.getPlacementOfWidget(mainID) + let mainPos = placement.position; + CustomizableUI.addWidgetToArea(saveID, area, mainPos + 1); + return; + } + var item = document.getElementById(id); // Element may not exist yet if it was added to the panel if (item) {