Item box: Fix fieldMode resetting after editor hidden twice
hideEditor() called switchCreatorMode() too early, setting the fieldMode attribute on the soon-to-be-discarded textbox instead of the label replacing it. Then, showing the editor a second time would carry over an empty fieldMode attribute from the label to the new textbox. Hiding that editor would update the creator in the item to fieldMode = 0 and trigger a save. Moving the switchCreatorMode() call does the trick, and the flex settings changes still work fine when made there.
This commit is contained in:
parent
2048319541
commit
87455d28c3
1 changed files with 5 additions and 2 deletions
|
@ -1932,8 +1932,6 @@
|
|||
|
||||
newVal = val;
|
||||
|
||||
// Reset creator mode settings here so that flex attribute gets reset
|
||||
this.switchCreatorMode(row, (otherFields.fieldMode ? 1 : 0), true);
|
||||
if (Zotero.ItemTypes.getName(this.item.itemTypeID) === "bookSection") {
|
||||
var creatorTypeLabels = document.getAnonymousNodes(this)[0].getElementsByClassName("creator-type-label");
|
||||
Zotero.debug(creatorTypeLabels[creatorTypeLabels.length-1] + "");
|
||||
|
@ -2018,6 +2016,11 @@
|
|||
// Disassociate textbox from label
|
||||
label.setAttribute('control', elem.getAttribute('id'));
|
||||
|
||||
if (field == 'creator') {
|
||||
// Set correct flex settings and fieldMode attribute
|
||||
this.switchCreatorMode(row, (otherFields.fieldMode ? 1 : 0), true);
|
||||
}
|
||||
|
||||
if (this.saveOnEdit) {
|
||||
await this.item.saveTx();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue