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,18 +438,29 @@
// 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 if (newTagIndex<origTagIndex) {
if (this._tabDirection == -1) {
this._lastTabIndex++;
}
}
}
else if (value != Zotero.Tags.getName(id)) {
if (this._tabDirection == 1) {
this._lastTabIndex -= 1;
}
} }
} }
else {
tagsbox.remove(id);
return;
}
}
// New tag // New tag
else { else {
//Check for newlines or carriage returns used as delimiters //Check for newlines or carriage returns used as delimiters