fix wrong suggestions for creators

Fix to a glitch where after switching creator field mode, the
autocomplete suggestions for creators would still be for the old mode.
This only happened if the field mode was changed on an empty, unsaved
creator row.
This commit is contained in:
Bogdan Abaev 2024-05-20 17:50:30 -04:00 committed by Dan Stillman
parent c6799bc3c2
commit fe01113935

View file

@ -1255,21 +1255,16 @@
firstName.sizeToContent(); firstName.sizeToContent();
lastName.sizeToContent(); lastName.sizeToContent();
this.modifyCreator(rowIndex, fields); this.modifyCreator(rowIndex, fields);
if (this.saveOnEdit) { // For empty unsaved creator rows, update their autocomplete setting so that
let activeField = this.getFocusedTextArea(); // e.g fullnames are not suggested after switch to first-last name mode.
if (activeField !== null && activeField !== firstName && activeField !== lastName) { // Otherwise, just save the item and appropriate autocomplete modes will be set in render()
this.blurOpenField(); if (row.querySelector("[unsaved=true]")) {
}
else {
this.item.saveTx();
}
}
else {
// If the creator is saved, autocomplete will be set in refresh()
// Otherwise, we'll reset it here.
this.addAutocompleteToElement(firstName); this.addAutocompleteToElement(firstName);
this.addAutocompleteToElement(lastName); this.addAutocompleteToElement(lastName);
} }
else {
this.item.saveTx();
}
} }
} }