Item box: Fix Short Title rendering as multiline
Also, rerender editable-text when noWrap changes.
This commit is contained in:
parent
1cc5c1ce2e
commit
00ca99ae86
2 changed files with 8 additions and 4 deletions
|
@ -169,7 +169,9 @@
|
|||
render() {
|
||||
let autocompleteParams = this.autocomplete;
|
||||
let autocompleteEnabled = !this.multiline && !!autocompleteParams;
|
||||
if (!this._input || autocompleteEnabled !== (this._input.constructor.name === 'AutocompleteInput')) {
|
||||
if (!this._input
|
||||
|| (this._input.constructor.name === 'AutocompleteInput') !== autocompleteEnabled
|
||||
|| this._input.tagName !== (this.noWrap ? 'input' : 'textarea')) {
|
||||
let input;
|
||||
if (autocompleteEnabled) {
|
||||
input = document.createElement('input', { is: 'autocomplete-input' });
|
||||
|
|
|
@ -1467,13 +1467,15 @@
|
|||
var fieldID = Zotero.ItemFields.getID(fieldName);
|
||||
}
|
||||
|
||||
var isMultiline = Zotero.ItemFields.isMultiline(fieldName) || Zotero.ItemFields.isLong(fieldName);
|
||||
let isMultiline = Zotero.ItemFields.isMultiline(fieldName);
|
||||
let isLong = Zotero.ItemFields.isLong(fieldName);
|
||||
|
||||
var valueElement = document.createXULElement("editable-text");
|
||||
valueElement.className = 'value';
|
||||
if (isMultiline) {
|
||||
valueElement.setAttribute('multiline', true);
|
||||
}
|
||||
else {
|
||||
else if (!isLong) {
|
||||
// Usual fields occupy all available space and keep info on one line
|
||||
valueElement.setAttribute("nowrap", true);
|
||||
}
|
||||
|
@ -1548,7 +1550,7 @@
|
|||
else {
|
||||
valueElement.style.textAlign = 'left';
|
||||
}
|
||||
if (!fieldName.includes("creator")) {
|
||||
if (!isLong && !fieldName.includes("creator")) {
|
||||
// autocomplete for creator names is added in addCreatorRow
|
||||
this.addAutocompleteToElement(valueElement);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue