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
|
@ -160,12 +160,21 @@
|
||||||
<parameter name="event"/>
|
<parameter name="event"/>
|
||||||
<parameter name="type"/>
|
<parameter name="type"/>
|
||||||
<parameter name="ids"/>
|
<parameter name="ids"/>
|
||||||
|
<parameter name="extraData"/>
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
if (event != 'modify' || !this.item || !this.item.id) return;
|
if (event != 'modify' || !this.item || !this.item.id) return;
|
||||||
for (let i = 0; i < ids.length; i++) {
|
for (let id of ids) {
|
||||||
if (ids[i] != this.item.id) {
|
if (id != this.item.id) {
|
||||||
continue;
|
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();
|
this.refresh();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
|
|
||||||
<constructor>
|
<constructor>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
this._instanceID = Zotero.Utilities.randomString();
|
this.instanceID = Zotero.Utilities.randomString();
|
||||||
this._notifierID = Zotero.Notifier.registerObserver(this, ['item'], 'noteeditor');
|
this._notifierID = Zotero.Notifier.registerObserver(this, ['item'], 'noteeditor');
|
||||||
]]>
|
]]>
|
||||||
</constructor>
|
</constructor>
|
||||||
|
@ -172,7 +172,7 @@
|
||||||
if (id != this.item.id) {
|
if (id != this.item.id) {
|
||||||
continue;
|
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");
|
//Zotero.debug("Skipping notification from current note field");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@
|
||||||
this.noteField.changed = false;
|
this.noteField.changed = false;
|
||||||
yield this.item.saveTx({
|
yield this.item.saveTx({
|
||||||
notifierData: {
|
notifierData: {
|
||||||
noteEditorID: this._instanceID
|
noteEditorID: this.instanceID
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user