commit 94c44454759e3c047a53ca1ca077b2021865a9f9
parent 000e7f9744b1ce67984167cd33c7a7c048760df5
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 30 Aug 2017 17:22:47 -0400
Fix restart error moving away from note that hadn't finished loading
Diffstat:
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/bindings/noteeditor.xml b/chrome/content/zotero/bindings/noteeditor.xml
@@ -251,8 +251,14 @@
return;
}
- // Update note
var noteField = this._id('noteField');
+ var value = noteField.value;
+ if (value === null) {
+ Zotero.debug("Note value not available -- not saving", 2);
+ return;
+ }
+
+ // Update note
if (this.item) {
// If note field doesn't match item, abort save and run error handler
if (noteField.getAttribute('itemID') != this.item.id) {
@@ -263,7 +269,7 @@
throw new Error("Note field doesn't match current item");
}
- let changed = this.item.setNote(noteField.value);
+ let changed = this.item.setNote(value);
if (changed && this.saveOnEdit) {
this.noteField.changed = false;
yield this.item.saveTx({
@@ -280,7 +286,7 @@
if (this.parentItem) {
item.libraryID = this.parentItem.libraryID;
}
- item.setNote(noteField.value);
+ item.setNote(value);
if (this.parentItem) {
item.parentKey = this.parentItem.key;
}
diff --git a/chrome/content/zotero/bindings/styled-textbox.xml b/chrome/content/zotero/bindings/styled-textbox.xml
@@ -500,6 +500,10 @@
<!-- Sets or returns contents of rich text box -->
<property name="value">
<getter><![CDATA[
+ if (!this._editor) {
+ return null;
+ }
+
var output = this._editor.getContent().trim();
if(this._format == "RTF") {