Rename itemBox > infoBox

Following the discussion in #4114
This commit is contained in:
windingwind 2024-06-08 22:58:05 +08:00 committed by Dan Stillman
parent 28e3c7b47f
commit 347caaff4c
16 changed files with 34 additions and 41 deletions

View file

@ -17,14 +17,6 @@ tree {
padding-left: 0.05em;
}
.zotero-editpane-item-box > scrollbox, .zotero-view-item > tabpanel > vbox,
#zotero-editpane-tags > scrollbox, .zotero-editpane-related {
padding-top: 5px;
}
#zotero-editpane-tags > scrollbox {
padding-left: 5px;
}
/*
Default scrollbar displays up/down arrows even

View file

@ -40,7 +40,8 @@ Services.scriptloader.loadSubScript('chrome://zotero/content/elements/itemTreeMe
['context-pane', 'chrome://zotero/content/elements/contextPane.js'],
['duplicates-merge-pane', 'chrome://zotero/content/elements/duplicatesMergePane.js'],
['guidance-panel', 'chrome://zotero/content/elements/guidancePanel.js'],
['item-box', 'chrome://zotero/content/elements/itemBox.js'],
// TODO: rename itemBox.js to infoBox.js later to avoid conflict
['info-box', 'chrome://zotero/content/elements/itemBox.js'],
['item-details', 'chrome://zotero/content/elements/itemDetails.js'],
['item-pane', 'chrome://zotero/content/elements/itemPane.js'],
['item-message-pane', 'chrome://zotero/content/elements/itemMessagePane.js'],

View file

@ -41,8 +41,8 @@
<description>&zotero.duplicatesMerge.fieldSelect;</description>
</groupbox>
<vbox id="zotero-duplicates-merge-item-box-container">
<item-box id="zotero-duplicates-merge-item-box"/>
<vbox id="zotero-duplicates-merge-info-box-container">
<info-box id="zotero-duplicates-merge-info-box"/>
</vbox>
`, ['chrome://zotero/locale/zotero.dtd']);
@ -110,7 +110,7 @@
let button = document.getElementById('zotero-duplicates-merge-button');
let versionSelect = document.getElementById('zotero-duplicates-merge-version-select');
let itembox = document.getElementById('zotero-duplicates-merge-item-box');
let itembox = document.getElementById('zotero-duplicates-merge-info-box');
let fieldSelect = document.getElementById('zotero-duplicates-merge-field-select');
let alternatives = oldestItem.multiDiff(otherItems, this._ignoreFields);
@ -148,7 +148,7 @@
}
setMaster(pos) {
let itembox = document.getElementById('zotero-duplicates-merge-item-box');
let itembox = document.getElementById('zotero-duplicates-merge-info-box');
itembox.mode = 'fieldmerge';
this._otherItems = this._items.concat();
@ -173,7 +173,7 @@
}
async merge() {
let itembox = document.getElementById('zotero-duplicates-merge-item-box');
let itembox = document.getElementById('zotero-duplicates-merge-info-box');
Zotero.CollectionTreeCache.clear();
// Update master item with any field alternatives from the item box
let json = this._masterItem.toJSON();

View file

@ -36,7 +36,7 @@
false
);
class ItemBox extends ItemPaneSectionElementBase {
class InfoBox extends ItemPaneSectionElementBase {
constructor() {
super();
@ -69,7 +69,7 @@
return MozXULElement.parseXULToFragment(`
<collapsible-section data-l10n-id="section-info" data-pane="info" style="width:100%">
<html:div class="body">
<div id="item-box" xmlns="http://www.w3.org/1999/xhtml">
<div id="info-box" xmlns="http://www.w3.org/1999/xhtml">
<popupset xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<menupopup id="creator-type-menu" position="after_start"/>
<menupopup id="zotero-creator-transform-menu">
@ -1650,7 +1650,7 @@
addAutocompleteToElement(elem) {
var fieldName = elem.getAttribute('fieldname');
var [field, creatorIndex, creatorField] = fieldName.split('-');
var [field, _creatorIndex, _creatorField] = fieldName.split('-');
if (elem.getAttribute("readonly") || !(field == 'creator' || Zotero.ItemFields.isAutocompleteField(fieldName))) {
return;
}
@ -2525,5 +2525,5 @@
return this.querySelector(`#${id}`);
}
}
customElements.define("item-box", ItemBox);
customElements.define("info-box", InfoBox);
}

View file

@ -50,7 +50,7 @@
<item-pane-header id="zotero-item-pane-header" />
<html:div id="zotero-view-item" class="zotero-view-item" tabindex="0">
<item-box id="zotero-editpane-item-box" data-pane="info"/>
<info-box id="zotero-editpane-info-box" data-pane="info"/>
<abstract-box id="zotero-editpane-abstract" class="zotero-editpane-abstract" data-pane="abstract"/>

View file

@ -370,7 +370,7 @@ import ReactDOM from "react-dom";
var elementName;
switch (this.type) {
case 'item':
elementName = 'item-box';
elementName = 'info-box';
break;
case 'attachment':

View file

@ -852,7 +852,7 @@ Zotero.Schema = new function(){
var enumerator = Services.wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
let win = enumerator.getNext();
//win.document.getElementById('zotero-editpane-item-box').buildItemTypeMenu();
//win.document.getElementById('zotero-editpane-info-box').buildItemTypeMenu();
}
});
}

View file

@ -1326,7 +1326,7 @@ var ZoteroPane = new function()
var mru = Zotero.Prefs.get('newItemTypeMRU');
var type = mru ? mru.split(',')[0] : 'book';
await ZoteroPane.newItem(Zotero.ItemTypes.getID(type));
let itemBox = document.getElementById('zotero-editpane-item-box');
let itemBox = document.getElementById('zotero-editpane-info-box');
// Ensure itemBox is opened
itemBox.open = true;
var menu = itemBox.itemTypeMenu;
@ -1468,7 +1468,7 @@ var ZoteroPane = new function()
if (manual) {
// Update most-recently-used list for New Item menu
this.addItemTypeToNewItemTypeMRU(Zotero.ItemTypes.getName(typeID));
let itemBox = ZoteroPane.itemPane.querySelector("item-box");
let itemBox = ZoteroPane.itemPane.querySelector("info-box");
// Make sure the item box is opened
itemBox.open = true;
// Focus the title field
@ -2159,7 +2159,7 @@ var ZoteroPane = new function()
await original.saveTx({ skipDateModifiedUpdate: true });
await duplicate.saveTx();
ZoteroPane.itemPane.querySelector("item-box").getTitleField().focus();
ZoteroPane.itemPane.querySelector("info-box").getTitleField().focus();
return duplicate;
};

View file

@ -75,7 +75,7 @@
@import "elements/attachmentPreviewBox";
@import "elements/colorPicker";
@import "elements/guidancePanel";
@import "elements/itemBox";
@import "elements/infoBox";
@import "elements/noteEditor";
@import "elements/notesBox";
@import "elements/publicationsLicenseInfo";

View file

@ -1,5 +1,5 @@
duplicates-merge-pane {
&, #zotero-duplicates-merge-version-select, #zotero-duplicates-merge-item-box-container {
&, #zotero-duplicates-merge-version-select, #zotero-duplicates-merge-info-box-container {
display: flex;
flex-direction: column;
gap: 8px;
@ -20,12 +20,12 @@ duplicates-merge-pane {
}
}
#zotero-duplicates-merge-item-box-container {
#zotero-duplicates-merge-info-box-container {
flex: 1;
padding-inline: 8px;
overflow-y: scroll;
#zotero-duplicates-merge-item-box {
#zotero-duplicates-merge-info-box {
border-top: var(--material-border-quinary);
}

View file

@ -1,4 +1,4 @@
item-box {
info-box {
display: flex;
min-width: 0;
@ -8,7 +8,7 @@ item-box {
display: none;
}
#item-box {
#info-box {
width: 100%;
}

View file

@ -1,4 +1,4 @@
item-box {
info-box {
#item-type-menu {
padding: 1px;

View file

@ -1,4 +1,4 @@
item-box {
info-box {
@media (-moz-platform: windows-win10) {
.meta-data > input, .meta-data > textarea, .creator-name-box > input {

View file

@ -14,4 +14,4 @@
// Elements
@import "linux/elements/itemBox";
@import "linux/elements/infoBox";

View file

@ -12,7 +12,7 @@
// Elements
@import "win/elements/itemBox";
@import "win/elements/infoBox";
// Components

View file

@ -236,7 +236,7 @@ describe("Item pane", function () {
var item = new Zotero.Item('book');
var id = yield item.saveTx();
var itemBox = doc.getElementById('zotero-editpane-item-box');
var itemBox = doc.getElementById('zotero-editpane-info-box');
var label = itemBox.querySelectorAll('[fieldname="series"]')[1];
assert.equal(label.value, '');
@ -261,7 +261,7 @@ describe("Item pane", function () {
]);
await item.saveTx();
var itemBox = doc.getElementById('zotero-editpane-item-box');
var itemBox = doc.getElementById('zotero-editpane-info-box');
var lastName = itemBox.querySelector('#itembox-field-value-creator-0-lastName');
var parent = lastName.closest(".creator-type-value");
assert.property(parent, 'oncontextmenu');
@ -293,7 +293,7 @@ describe("Item pane", function () {
]);
await item.saveTx();
var itemBox = doc.getElementById('zotero-editpane-item-box');
var itemBox = doc.getElementById('zotero-editpane-info-box');
var label = itemBox.querySelector('#itembox-field-value-creator-0-lastName');
var firstlast = label.closest('.creator-type-value');
firstlast.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, button: 2 }));
@ -320,7 +320,7 @@ describe("Item pane", function () {
]);
await item.saveTx();
var itemBox = doc.getElementById('zotero-editpane-item-box');
var itemBox = doc.getElementById('zotero-editpane-info-box');
// Move One to the last spot
itemBox.moveCreator(0, null, 3);
await waitForItemEvent('modify');
@ -364,7 +364,7 @@ describe("Item pane", function () {
]);
var id = yield item.saveTx();
var itemBox = doc.getElementById('zotero-editpane-item-box');
var itemBox = doc.getElementById('zotero-editpane-info-box');
var label = itemBox.querySelector('[fieldname="place"]');
label.click();
var textbox = itemBox.querySelector('[fieldname="place"]');
@ -387,7 +387,7 @@ describe("Item pane", function () {
it("should accept 'now' for Accessed", async function () {
var item = await createDataObject('item');
var itemBox = doc.getElementById('zotero-editpane-item-box');
var itemBox = doc.getElementById('zotero-editpane-info-box');
var textbox = itemBox.querySelector('[fieldname="accessDate"]');
textbox.value = 'now';
// Blur events don't necessarily trigger if window doesn't have focus
@ -413,7 +413,7 @@ describe("Item pane", function () {
]);
await item.saveTx();
let itemBox = doc.getElementById('zotero-editpane-item-box');
let itemBox = doc.getElementById('zotero-editpane-info-box');
itemBox.querySelector('[fieldname="creator-0-lastName"]').click();
itemBox.hideEditor(itemBox.querySelector('input[fieldname="creator-0-lastName"]'));