Item box: Wrap all fields (#4802)

This commit is contained in:
Abe Jellinek 2024-11-06 08:37:38 -05:00 • committed by GitHub
parent 51f2c76d82
commit 17f003df0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 22 deletions

View file

@ -660,11 +660,6 @@
|| Zotero.ItemFields.isFieldOfBase(fieldID, 'publicationTitle'))) {
let optionsButton = document.createXULElement("toolbarbutton");
optionsButton.className = "zotero-clicky zotero-clicky-options show-on-hover";
// Options button after single-line fields will not occupy space unless hovered.
// This does not apply to multiline fields because it would move textarea on hover.
if (!(Zotero.ItemFields.isLong(fieldName) || Zotero.ItemFields.isMultiline(fieldName))) {
optionsButton.classList.add("no-display");
}
optionsButton.setAttribute('data-l10n-id', "itembox-button-options");
optionsButton.id = `itembox-field-${fieldName}-options`;
// eslint-disable-next-line no-loop-func
@ -1457,7 +1452,7 @@
}
let openLink = document.createXULElement("toolbarbutton");
openLink.id = `itembox-field-${fieldName}-link`;
openLink.className = "zotero-clicky zotero-clicky-open-link show-on-hover no-display";
openLink.className = "zotero-clicky zotero-clicky-open-link show-on-hover";
openLink.addEventListener("click", event => ZoteroPane.loadURI(value, event));
openLink.setAttribute('data-l10n-id', "item-button-view-online");
if (!value) openLink.hidden = true;
@ -1472,15 +1467,14 @@
}
let isMultiline = Zotero.ItemFields.isMultiline(fieldName);
let isLong = Zotero.ItemFields.isLong(fieldName);
let isNoWrap = fieldName.startsWith('creator-');
var valueElement = document.createXULElement("editable-text");
valueElement.className = 'value';
if (isMultiline) {
valueElement.setAttribute('multiline', true);
}
else if (!isLong) {
// Usual fields occupy all available space and keep info on one line
else if (isNoWrap) {
valueElement.setAttribute("nowrap", true);
}

View file

@ -384,19 +384,10 @@ Zotero.ItemFields = new function() {
}
/**
* A long field expands into a multiline textbox while editing; newlines are not allowed
*/
this.isLong = function (field) {
field = this.getName(field);
var fields = [
'title',
...this.getTypeFieldsFromBase('title', true),
'publicationTitle',
...this.getTypeFieldsFromBase('publicationTitle', true),
];
return fields.indexOf(field) != -1;
}
this.isLong = function () {
Zotero.warn('Zotero.ItemFields.isLong() is deprecated -- update your code');
return true;
};
/**