Improve merge pane (#4200)

resolve: #4142
This commit is contained in:
windingwind 2024-06-07 12:37:54 +08:00 committed by GitHub
parent c826805bca
commit 5cc6631fd3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 13 deletions

View file

@ -37,12 +37,13 @@
</hbox>
</groupbox>
<groupbox flex="1">
<description id="zotero-duplicates-merge-field-select">&zotero.duplicatesMerge.fieldSelect;</description>
<vbox id="zotero-duplicates-merge-item-box-container" flex="1">
<item-box id="zotero-duplicates-merge-item-box" flex="1"/>
</vbox>
<groupbox id="zotero-duplicates-merge-field-select">
<description>&zotero.duplicatesMerge.fieldSelect;</description>
</groupbox>
<vbox id="zotero-duplicates-merge-item-box-container">
<item-box id="zotero-duplicates-merge-item-box"/>
</vbox>
`, ['chrome://zotero/locale/zotero.dtd']);
init() {

View file

@ -669,15 +669,15 @@
this.addDynamicRow(rowLabel, rowData);
let button, popup;
// In field merge mode, add a button to switch field versions
if (this.mode == 'fieldmerge' && typeof this._fieldAlternatives[fieldName] != 'undefined') {
var button = document.createXULElement("toolbarbutton");
button = document.createXULElement("toolbarbutton");
button.className = 'zotero-field-version-button zotero-clicky-merge';
button.setAttribute('type', 'menu');
let fieldLocalName = rowLabel.querySelector("label")?.textContent;
document.l10n.setAttributes(button, 'itembox-button-merge', { field: fieldLocalName || "" });
var popup = button.appendChild(document.createXULElement("menupopup"));
popup = button.appendChild(document.createXULElement("menupopup"));
for (let v of this._fieldAlternatives[fieldName]) {
let menuitem = document.createXULElement("menuitem");
@ -698,6 +698,10 @@
popup.appendChild(menuitem);
}
button.addEventListener("click", (e) => {
this.handlePopupOpening(e, popup);
});
rowData.appendChild(button);
}
}

View file

@ -552,6 +552,7 @@
}
case "duplicates": {
this._deck.selectedIndex = 3;
this.removeAttribute("collapsed");
break;
}
}

View file

@ -3,6 +3,7 @@ duplicates-merge-pane {
display: flex;
flex-direction: column;
gap: 8px;
scrollbar-color: var(--color-scrollbar) var(--color-scrollbar-background);
}
padding-top: 9px;
@ -19,15 +20,14 @@ duplicates-merge-pane {
}
}
#zotero-duplicates-merge-field-select {
margin-bottom: 9px;
}
#zotero-duplicates-merge-item-box-container {
flex: 1;
padding-inline: 8px;
overflow-y: scroll;
#zotero-duplicates-merge-item-box {
border-top: var(--material-border-quinary);
}
collapsible-section > .head {
display: none;