When dropping combo buttons into panel, add two separate buttons instead
And move combo button to customization palette
This commit is contained in:
parent
6b8cc59bea
commit
806259d187
1 changed files with 15 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue