Select appropriate tag when moving from changed tag using enter or tab (not for mouse click)

This commit is contained in:
Will S 2011-12-27 09:06:50 -05:00
parent 87c47c0615
commit 520a2b061c

View file

@ -438,16 +438,27 @@
// when the notifier kicks in // when the notifier kicks in
var existing = Zotero.Tags.getID(value, 0); var existing = Zotero.Tags.getID(value, 0);
if (existing && id != existing) { if (existing && id != existing) {
this._tabDirection = false; // this._tabDirection = false;
} }
var origTagIndex = this.item.getTagIndex(id);
var changed = tagsbox.replace(id, value); var changed = tagsbox.replace(id, value);
if (changed) { if (changed) {
return; var newTagIndex = this.item.getTagIndex(changed);
if (newTagIndex>origTagIndex) {
if (this._tabDirection == 1) {
this._lastTabIndex--;
} }
} }
else { else if (newTagIndex<origTagIndex) {
tagsbox.remove(id); if (this._tabDirection == -1) {
return; this._lastTabIndex++;
}
}
}
else if (value != Zotero.Tags.getName(id)) {
if (this._tabDirection == 1) {
this._lastTabIndex -= 1;
}
} }
} }
// New tag // New tag