commit 05eb3a340c23a37f5f35b2dbb5bcb1db7e5465e0
parent 8f5903f5eb95985dbda18ba2edd5d99ccd9b0da6
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 12 Dec 2017 03:31:10 -0500
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
Diffstat:
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/bindings/attachmentbox.xml b/chrome/content/zotero/bindings/attachmentbox.xml
@@ -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;
}
diff --git a/chrome/content/zotero/bindings/noteeditor.xml b/chrome/content/zotero/bindings/noteeditor.xml
@@ -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
}
});
}