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.
This commit is contained in:
parent
44ef4cd35a
commit
d595b3f195
2 changed files with 8 additions and 6 deletions
|
@ -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();
|
||||
|
@ -1258,7 +1255,9 @@ class EditorInstance {
|
|||
let { html: serializedHTML, citationItems } = Zotero.EditorInstanceUtilities.serializeAnnotations(jsonAnnotations, true);
|
||||
html += serializedHTML;
|
||||
citationItems = encodeURIComponent(JSON.stringify(citationItems));
|
||||
html = `<div data-citation-items="${citationItems}" data-schema-version="${SCHEMA_VERSION}">${html}</div>`;
|
||||
// Note: Update schema version only if using new features
|
||||
let schemaVersion = 8;
|
||||
html = `<div data-citation-items="${citationItems}" data-schema-version="${schemaVersion}">${html}</div>`;
|
||||
note.setNote(html);
|
||||
await note.saveTx();
|
||||
return note;
|
||||
|
@ -1552,5 +1551,4 @@ class EditorInstanceUtilities {
|
|||
}
|
||||
|
||||
Zotero.EditorInstance = EditorInstance;
|
||||
Zotero.EditorInstance.SCHEMA_VERSION = SCHEMA_VERSION;
|
||||
Zotero.EditorInstanceUtilities = new EditorInstanceUtilities();
|
||||
|
|
|
@ -307,7 +307,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,'') != `<div data-schema-version="${Zotero.EditorInstance.SCHEMA_VERSION}"><p>Test</p></div>`);
|
||||
} while (
|
||||
!/<div data-schema-version=".*"><p>Test<\/p><\/div>/.test(
|
||||
noteEditor._editorInstance._iframeWindow.wrappedJSObject.getDataSync().html.replace(/\n/g, '')
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue