diff --git a/chrome/content/zotero/xpcom/report.js b/chrome/content/zotero/xpcom/report.js
index 525cb5abc8..e5ee06157a 100644
--- a/chrome/content/zotero/xpcom/report.js
+++ b/chrome/content/zotero/xpcom/report.js
@@ -30,7 +30,7 @@ Zotero.Report.HTML = new function () {
let domParser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
.createInstance(Components.interfaces.nsIDOMParser);
- this.listGenerator = function* (items, combineChildItems) {
+ this.listGenerator = function* (items, combineChildItems, libraryID) {
yield '\n'
+ '\n'
+ '
\n'
@@ -69,7 +69,7 @@ Zotero.Report.HTML = new function () {
// Independent note
if (obj['note']) {
content += '\n\t\t\t';
- content += getNoteHTML(obj.note);
+ content += yield getNoteHTML(libraryID, obj);
}
}
@@ -85,7 +85,7 @@ Zotero.Report.HTML = new function () {
for (let note of obj.reportChildren.notes) {
content += '\t\t\t\t\t\n';
- content += getNoteHTML(note.note);
+ content += yield getNoteHTML(libraryID, note);
// Child note tags
content += _generateTagsList(note);
@@ -95,8 +95,8 @@ Zotero.Report.HTML = new function () {
content += '\t\t\t\t\n';
}
- // Chid attachments
- content += _generateAttachmentsList(obj.reportChildren);
+ // Child attachments
+ content += yield _generateAttachmentsList(libraryID, obj.reportChildren);
}
// Related items
@@ -273,7 +273,7 @@ Zotero.Report.HTML = new function () {
}
- function _generateAttachmentsList(obj) {
+ async function _generateAttachmentsList(libraryID, obj) {
var content = '';
if (obj.attachments && obj.attachments.length) {
content += '\t\t\t\t' + escapeXML(Zotero.getString('itemFields.attachments')) + '
\n';
@@ -292,7 +292,7 @@ Zotero.Report.HTML = new function () {
// Attachment note
if (attachment.note) {
content += '\t\t\t\t\t\t';
- content += getNoteHTML(attachment.note);
+ content += await getNoteHTML(libraryID, attachment);
content += '\t\t\t\t\t
';
}
@@ -304,7 +304,14 @@ Zotero.Report.HTML = new function () {
}
- function getNoteHTML(note) {
+ async function getNoteHTML(libraryID, jsonItem) {
+ var note = jsonItem.note;
+ if (libraryID) {
+ var item = Zotero.Items.getByLibraryAndKey(libraryID, jsonItem.key);
+ if (item.isNote()) {
+ note = await Zotero.Notes.getExportableNote(item);
+ }
+ }
// If HTML tag or entity, parse as HTML
if (note.match(/(<(p|ul|ol|div|a|br|b|i|u|strong|em( >))|&[a-z]+;|[0-9]+;)/)) {
let doc = domParser.parseFromString(''
diff --git a/components/zotero-protocol-handler.js b/components/zotero-protocol-handler.js
index 3e23c22200..7315aea4c8 100644
--- a/components/zotero-protocol-handler.js
+++ b/components/zotero-protocol-handler.js
@@ -510,7 +510,7 @@ function ZoteroProtocolHandler() {
default:
this.contentType = 'text/html';
return Zotero.Utilities.Internal.getAsyncInputStream(
- Zotero.Report.HTML.listGenerator(items, combineChildItems),
+ Zotero.Report.HTML.listGenerator(items, combineChildItems, params.libraryID),
function () {
Zotero.logError(e);
return 'Error generating report';