diff --git a/chrome/content/zotero/xpcom/editorInstance.js b/chrome/content/zotero/xpcom/editorInstance.js index 155507fb4f..d253388ad1 100644 --- a/chrome/content/zotero/xpcom/editorInstance.js +++ b/chrome/content/zotero/xpcom/editorInstance.js @@ -1359,6 +1359,14 @@ class EditorInstanceUtilities { template = '

{{image}}
{{citation}} {{comment}}

'; } + Zotero.debug('Using note template:'); + Zotero.debug(template); + + template = template.replace( + /(
[^<>]*?)({{highlight}})([\s\S]*?<\/blockquote>)/g, + (match, p1, p2, p3) => p1 + "{{highlight quotes='false'}}" + p3 + ); + let vars = { color: annotation.color || '', // Include quotation marks by default, but allow to disable with `quotes='false'` @@ -1368,8 +1376,7 @@ class EditorInstanceUtilities { image: imageHTML, tags: (attrs) => (annotation.tags && annotation.tags.map(tag => tag.name) || []).join(attrs.join || ' ') }; - Zotero.debug('Using note template:'); - Zotero.debug(template); + let templateHTML = Zotero.Utilities.Internal.generateHTMLFromTemplate(template, vars); // Remove some spaces at the end of paragraph templateHTML = templateHTML.replace(/([\s]*)(<\/p)/g, '$2');