- fix highlights
- improve error handling in annotations
This commit is contained in:
parent
9c436a331f
commit
289abf6133
|
@ -335,8 +335,13 @@ var Zotero_Browser = new function() {
|
|||
Zotero.Annotate.setAnnotated(tab.annotateID, true);
|
||||
browser.contentWindow.addEventListener('beforeunload', function() {
|
||||
// save annotations
|
||||
tab.page.annotations.save();
|
||||
Zotero.Annotate.setAnnotated(tab.page.annotations.itemID, false);
|
||||
try {
|
||||
tab.page.annotations.save();
|
||||
} catch(e) {
|
||||
throw(e);
|
||||
} finally {
|
||||
Zotero.Annotate.setAnnotated(tab.page.annotations.itemID, false);
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -501,6 +501,7 @@ Zotero.Annotations.prototype.save = function() {
|
|||
}
|
||||
Zotero.DB.commitTransaction();
|
||||
} catch(e) {
|
||||
throw(e);
|
||||
Zotero.DB.rollbackTransaction();
|
||||
}
|
||||
}
|
||||
|
@ -1021,7 +1022,7 @@ Zotero.Highlight.prototype.save = function(index) {
|
|||
var start = Zotero.Annotate.getPathForPoint(this.range.startContainer, this.range.startOffset);
|
||||
var end = Zotero.Annotate.getPathForPoint(this.range.endContainer, this.range.endOffset);
|
||||
|
||||
var query = "INSERT INTO highlights VALUES (NULL, ?, ?, ?, ?, ?, ?, ?)";
|
||||
var query = "INSERT INTO highlights VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, DATETIME('now'))";
|
||||
var parameters = [
|
||||
this.annotationsObj.itemID, // itemID
|
||||
start.parent, // startParent
|
||||
|
|
Loading…
Reference in New Issue
Block a user