From 6733f2edca7bcc98e853b05055edb5ea7acb7b5e Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Mon, 25 Jul 2022 18:04:00 +0300 Subject: [PATCH] Freeze note schema version to 8 We can do it because it was only used to create a note from annotations. No need to update schema version in Zotero client, unless using new features when creating a note from annotations. --- chrome/content/zotero/xpcom/editorInstance.js | 8 +++----- note-editor | 2 +- test/tests/itemPaneTest.js | 6 +++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/xpcom/editorInstance.js b/chrome/content/zotero/xpcom/editorInstance.js index c8795262ee..3dbd4b5dea 100644 --- a/chrome/content/zotero/xpcom/editorInstance.js +++ b/chrome/content/zotero/xpcom/editorInstance.js @@ -43,9 +43,6 @@ const DOWNLOADED_IMAGE_TYPE = [ 'image/png' ]; -// Schema version here has to be the same as in note-editor! -const SCHEMA_VERSION = 8; - class EditorInstance { constructor() { this.instanceID = Zotero.Utilities.randomString(); @@ -1261,7 +1258,9 @@ class EditorInstance { let { html: serializedHTML, citationItems } = Zotero.EditorInstanceUtilities.serializeAnnotations(jsonAnnotations, true); html += serializedHTML; citationItems = encodeURIComponent(JSON.stringify(citationItems)); - html = `
${html}
`; + // Note: Update schema version only if using new features + let schemaVersion = 8; + html = `
${html}
`; note.setNote(html); await note.saveTx(); return note; @@ -1556,5 +1555,4 @@ class EditorInstanceUtilities { } Zotero.EditorInstance = EditorInstance; -Zotero.EditorInstance.SCHEMA_VERSION = SCHEMA_VERSION; Zotero.EditorInstanceUtilities = new EditorInstanceUtilities(); diff --git a/note-editor b/note-editor index cf3afa60d8..5920f9674e 160000 --- a/note-editor +++ b/note-editor @@ -1 +1 @@ -Subproject commit cf3afa60d846a23f29b7a8c48d99917e4f37cc33 +Subproject commit 5920f9674eeef6da5b43128248b82033cbd0c471 diff --git a/test/tests/itemPaneTest.js b/test/tests/itemPaneTest.js index 78cf8df97e..4aa3f7ed03 100644 --- a/test/tests/itemPaneTest.js +++ b/test/tests/itemPaneTest.js @@ -304,7 +304,11 @@ describe("Item pane", function () { // Wait for asynchronous editor update do { yield Zotero.Promise.delay(10); - } while(noteEditor._editorInstance._iframeWindow.wrappedJSObject.getDataSync().html.replace(/\n/g,'') != `

Test

`); + } while ( + !/

Test<\/p><\/div>/.test( + noteEditor._editorInstance._iframeWindow.wrappedJSObject.getDataSync().html.replace(/\n/g, '') + ) + ); }); });