From 64723210007fb575e582614c181ea90af6d89e28 Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Fri, 6 Aug 2021 10:53:28 +0300 Subject: [PATCH] Upgrade note-editor schema to v4: - Set `annotation.attachmentURI` instead of `annotation.uri` when inserting annotations - Migrate `annotation.uri` to `annotation.attachmentURI` - Add `annotation.annotationKey` that references to the original annotation --- chrome/content/zotero/xpcom/editorInstance.js | 11 ++++++----- note-editor | 2 +- pdf-reader | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/xpcom/editorInstance.js b/chrome/content/zotero/xpcom/editorInstance.js index 5faae4da56..d5198c4032 100644 --- a/chrome/content/zotero/xpcom/editorInstance.js +++ b/chrome/content/zotero/xpcom/editorInstance.js @@ -44,7 +44,7 @@ const DOWNLOADED_IMAGE_TYPE = [ ]; // Schema version here has to be the same as in note-editor! -const SCHEMA_VERSION = 3; +const SCHEMA_VERSION = 4; class EditorInstance { constructor() { @@ -335,7 +335,8 @@ class EditorInstance { let commentHTML = ''; let storedAnnotation = { - uri: Zotero.URI.getItemURI(attachmentItem), + attachmentURI: Zotero.URI.getItemURI(attachmentItem), + annotationKey: annotation.id, color: annotation.color, pageLabel: annotation.pageLabel, position: annotation.position @@ -571,14 +572,14 @@ class EditorInstance { return; } case 'openAnnotation': { - let { uri, position } = message; + let { attachmentURI, position } = message; if (this.onNavigate) { - this.onNavigate(uri, { position }); + this.onNavigate(attachmentURI, { position }); } else { let zp = Zotero.getActiveZoteroPane(); if (zp) { - let item = await Zotero.URI.getURIItem(uri); + let item = await Zotero.URI.getURIItem(attachmentURI); if (item) { zp.viewPDF(item.id, { position }); } diff --git a/note-editor b/note-editor index f2caf42275..a644874dce 160000 --- a/note-editor +++ b/note-editor @@ -1 +1 @@ -Subproject commit f2caf422755f256af82cab5eba534bb0fd1f65a4 +Subproject commit a644874dcef4fea355a6310a95413a74db935141 diff --git a/pdf-reader b/pdf-reader index 06cef9ac89..05da34b95a 160000 --- a/pdf-reader +++ b/pdf-reader @@ -1 +1 @@ -Subproject commit 06cef9ac89dbd51ecaed311dcc06f74f5e3d82d0 +Subproject commit 05da34b95a12c6aad2fe28699e3e41a65a6825d4