From 87455d28c3c5d81f7ab5ea6bf8035be33b54a1a0 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Fri, 5 Aug 2022 17:06:04 -0400 Subject: [PATCH] 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. --- chrome/content/zotero/bindings/itembox.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index 3054e3219c..f7117cc52d 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -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(); }