- fix highlights

- improve error handling in annotations
This commit is contained in:
Simon Kornblith 2007-08-14 21:45:34 +00:00
parent 9c436a331f
commit 289abf6133
2 changed files with 9 additions and 3 deletions

View File

@ -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);
}
}

View File

@ -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