Add collectionID option to EditorInstance.createNoteFromAnnotations()

For adding a standalone note to the current collection
This commit is contained in:
Dan Stillman 2022-09-02 01:43:44 +02:00
parent 39e45221b1
commit e81b43be98
5 changed files with 28 additions and 11 deletions

View file

@ -413,7 +413,7 @@ describe("Create a note from annotations from multiple items and attachments", f
annotations.push(annotation1);
let annotation2 = await createAnnotation('highlight', attachment);
annotations.push(annotation2);
let note = await Zotero.EditorInstance.createNoteFromAnnotations(annotations, null);
let note = await Zotero.EditorInstance.createNoteFromAnnotations(annotations);
assert.equal(note.note.split('test.pdf').length - 1, 1);
assert.equal(note.note.split(annotation1.annotationText).length - 1, 1);
assert.equal(note.note.split(annotation2.annotationText).length - 1, 1);
@ -428,7 +428,7 @@ describe("Create a note from annotations from multiple items and attachments", f
annotations.push(annotation1);
let annotation2 = await createAnnotation('highlight', attachment2);
annotations.push(annotation2);
let note = await Zotero.EditorInstance.createNoteFromAnnotations(annotations, null);
let note = await Zotero.EditorInstance.createNoteFromAnnotations(annotations);
assert.equal(note.note.split('test.pdf').length - 1, 2);
assert.equal(note.note.split('>' + item.getField('title') + '<').length - 1, 0);
assert.equal(note.note.split(annotation1.annotationText).length - 1, 1);
@ -445,7 +445,7 @@ describe("Create a note from annotations from multiple items and attachments", f
annotations.push(annotation1);
let annotation2 = await createAnnotation('highlight', attachment2);
annotations.push(annotation2);
let note = await Zotero.EditorInstance.createNoteFromAnnotations(annotations, null);
let note = await Zotero.EditorInstance.createNoteFromAnnotations(annotations);
assert.equal(note.note.split('test.pdf').length - 1, 0);
assert.equal(note.note.split('>' + item1.getField('title') + '<').length - 1, 1);
assert.equal(note.note.split('>' + item2.getField('title') + '<').length - 1, 1);
@ -468,7 +468,7 @@ describe("Create a note from annotations from multiple items and attachments", f
annotations.push(annotation3);
let annotation4 = await createAnnotation('highlight', attachment3);
annotations.push(annotation4);
let note = await Zotero.EditorInstance.createNoteFromAnnotations(annotations, null);
let note = await Zotero.EditorInstance.createNoteFromAnnotations(annotations);
Zotero.debug(note.note);
assert.equal(note.note.split('test.pdf').length - 1, 2);
assert.equal(note.note.split('>' + item1.getField('title') + '<').length - 1, 1);