When dropping combo buttons into panel, add two separate buttons instead

And move combo button to customization palette
This commit is contained in:
Dan Stillman 2015-02-27 17:41:36 -05:00
parent 6b8cc59bea
commit 806259d187

View file

@ -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) {