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