diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index 86e1f6c702..fdec1317bf 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -313,7 +313,6 @@ this.itemTypeMenu.parentNode.hidden = true; } - // // Clear and rebuild metadata fields // @@ -602,10 +601,11 @@ } // Move to next or previous field if (shift-)tab was pressed - if (this._lastTabIndex && this._tabDirection) - { - this._focusNextField(this._dynamicFields, this._lastTabIndex, this._tabDirection == -1); + if (this._lastTabIndex && this._lastTabIndex != -1) { + this._focusNextField(this._lastTabIndex); } + + this._refreshed = true; ]]> @@ -1046,6 +1046,10 @@ var fields = this.getCreatorFields(row); fields.fieldMode = fieldMode; this.modifyCreator(index, fields); + if (this.saveOnEdit) { + // See note in transformText() + this.blurOpenField().then(() => this.item.saveTx()); + } } ]]> @@ -1144,7 +1148,8 @@ this.item.setType(itemTypeID); if (this.saveOnEdit) { - this.item.saveTx(); + // See note in transformText() + this.blurOpenField().then(() => this.item.saveTx()); } else { this.refresh(); @@ -1412,11 +1417,25 @@ - - - + }.bind(this))(); + ]]> @@ -1634,11 +1648,13 @@ fields[creatorField] = creator[creatorField]; fields[otherField] = creator[otherField]; - this.ignoreBlur = true; - this.modifyCreator(creatorIndex, fields) - .then(function () { - this.ignoreBlur = false; - }.bind(this)); + this.modifyCreator(creatorIndex, fields); + if (this.saveOnEdit) { + this.ignoreBlur = true; + this.item.saveTx().then(() => { + this.ignoreBlur = false; + }); + } } // Otherwise let the autocomplete popup handle matters @@ -1662,7 +1678,6 @@ break; } - // Prevent blur on containing textbox // DEBUG: what happens if this isn't present? event.preventDefault(); @@ -1674,7 +1689,7 @@ Zotero.debug("Value hasn't changed"); // If + button is disabled, just focus next creator row if (Zotero.getAncestorByTagName(target, 'row').lastChild.lastChild.disabled) { - this._focusNextField(this._dynamicFields, this._lastTabIndex, false); + this._focusNextField(this._lastTabIndex); } else { var creatorFields = this.getCreatorFields(Zotero.getAncestorByTagName(target, 'row')); @@ -1714,10 +1729,12 @@ return false; case event.DOM_VK_TAB: - this._tabDirection = event.shiftKey ? -1 : 1; - // Blur the old manually -- not sure why this is necessary, - // but it prevents an immediate blur() on the next tag - focused.blur(); + if (event.shiftKey) { + this._focusNextField(this._lastTabIndex, true); + } + else { + this._focusNextField(++this._lastTabIndex); + } return false; } @@ -1747,8 +1764,10 @@ 0) { //Add extra creators for (var i=0;i @@ -1978,14 +1987,8 @@ - @@ -2022,7 +2025,7 @@ @@ -2085,9 +2090,7 @@ - @@ -2131,7 +2118,7 @@ @@ -2168,9 +2160,8 @@ this.item.setCreator(newIndex, a); this.item.setCreator(index, b); if (this.saveOnEdit) { - // See note in modifyCreator() + // See note in transformText() yield this.blurOpenField(); - return this.item.saveTx(); } }, this); @@ -2200,7 +2191,7 @@ @@ -2215,11 +2206,11 @@ completes, so it doesn't know where it's supposed to go next.) --> - tabindex) { + if (parseInt(tabbableFields[pos].getAttribute('ztabindex')) >= tabindex) { next = tabbableFields[pos]; break; } @@ -2278,12 +2269,13 @@ @@ -2385,7 +2377,11 @@ }; itemBox._updateAutoCompleteParams(row, changedParams); - itemBox.modifyCreator(index, fields);"/> + itemBox.modifyCreator(index, fields); + if (itemBox.saveOnEdit) { + itemBox.item.saveTx(); + } + "/>