commit c95e42240f8266df95a75c59ef8c0d0e72522af3
parent e0d92ecd94e929f66800aa4fdfb4ed5ef612a010
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 19 Jan 2017 11:58:43 -0500
Fix #1157, Note content lost when typing during sync
Someday, I will say this is fixed and it actually will be fixed.
Diffstat:
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/chrome/content/zotero/bindings/noteeditor.xml b/chrome/content/zotero/bindings/noteeditor.xml
@@ -171,6 +171,10 @@
//Zotero.debug("Skipping notification from current note field");
continue;
}
+ if (this.noteField.changed) {
+ //Zotero.debug("Note has changed since last save -- skipping refresh");
+ return;
+ }
this.refresh();
break;
}
@@ -181,7 +185,7 @@
<body><![CDATA[
Zotero.debug('Refreshing note editor');
- var textbox = this._id('noteField');
+ var textbox = this.noteField;
var textboxReadOnly = this._id('noteFieldReadOnly');
var button = this._id('goButton');
@@ -249,6 +253,7 @@
if (this.item) {
let changed = this.item.setNote(noteField.value);
if (changed && this.saveOnEdit) {
+ this.noteField.changed = false;
yield this.item.saveTx({
notifierData: {
noteEditorID: this._instanceID
diff --git a/chrome/content/zotero/bindings/styled-textbox.xml b/chrome/content/zotero/bindings/styled-textbox.xml
@@ -429,6 +429,7 @@
//Zotero.debug("Not a char");
return;
}
+ this._changed = true;
commandEvent = true;
break;
@@ -436,6 +437,7 @@
case 'change':
case 'undo':
case 'redo':
+ this._changed = true;
commandEvent = true;
break;
@@ -524,6 +526,7 @@
if (this.value == val) {
Zotero.debug("Textbox value hasn't changed");
+ this._changed = false;
return;
}
@@ -570,7 +573,7 @@
onset="this.setAttribute('timeout', val); return val;"
onget="return parseInt(this.getAttribute('timeout')) || 0;"/>
- <property name="changed" onget="return this._changed;"/>
+ <property name="changed" onget="return this._changed;" onset="this._changed = !!val;"/>
<method name="focus">
<body>