Fix cursor reset while typing in attachment notes
If you started typing just as auto-save was kicking in (i.e., 1 second after stopping typing), any additional characters could be removed and the cursor could jump back to the beginning of the note. Fixes #1336, probably
This commit is contained in:
parent
8f5903f5eb
commit
05eb3a340c
2 changed files with 14 additions and 5 deletions
|
@ -160,12 +160,21 @@
|
|||
<parameter name="event"/>
|
||||
<parameter name="type"/>
|
||||
<parameter name="ids"/>
|
||||
<parameter name="extraData"/>
|
||||
<body><![CDATA[
|
||||
if (event != 'modify' || !this.item || !this.item.id) return;
|
||||
for (let i = 0; i < ids.length; i++) {
|
||||
if (ids[i] != this.item.id) {
|
||||
for (let id of ids) {
|
||||
if (id != this.item.id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var noteEditor = this._id('attachment-note-editor')
|
||||
if (extraData && extraData[id]
|
||||
&& extraData[id].noteEditorID == noteEditor.instanceID) {
|
||||
//Zotero.debug("Skipping notification from current attachment note field");
|
||||
continue;
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this._instanceID = Zotero.Utilities.randomString();
|
||||
this.instanceID = Zotero.Utilities.randomString();
|
||||
this._notifierID = Zotero.Notifier.registerObserver(this, ['item'], 'noteeditor');
|
||||
]]>
|
||||
</constructor>
|
||||
|
@ -172,7 +172,7 @@
|
|||
if (id != this.item.id) {
|
||||
continue;
|
||||
}
|
||||
if (extraData && extraData[id] && extraData[id].noteEditorID == this._instanceID) {
|
||||
if (extraData && extraData[id] && extraData[id].noteEditorID == this.instanceID) {
|
||||
//Zotero.debug("Skipping notification from current note field");
|
||||
continue;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@
|
|||
this.noteField.changed = false;
|
||||
yield this.item.saveTx({
|
||||
notifierData: {
|
||||
noteEditorID: this._instanceID
|
||||
noteEditorID: this.instanceID
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue