diff --git a/src/modules/template/editorWindow.ts b/src/modules/template/editorWindow.ts index 42abb7a..282fa03 100644 --- a/src/modules/template/editorWindow.ts +++ b/src/modules/template/editorWindow.ts @@ -184,10 +184,14 @@ async function updatePreview() { const win = addon.data.templateEditor.window; const container = win?.document.getElementById("preview-container"); if (container) { - container.innerHTML = ""; - container.appendChild( - ztoolkit.getDOMParser().parseFromString(html, "text/html").body - ); + if (ztoolkit.isZotero7()) { + container.innerHTML = html; + } else { + container.innerHTML = ""; + container.appendChild( + ztoolkit.getDOMParser().parseFromString(html, "text/html").body + ); + } } } diff --git a/src/modules/template/preview.ts b/src/modules/template/preview.ts index 4046d9e..b3c688e 100644 --- a/src/modules/template/preview.ts +++ b/src/modules/template/preview.ts @@ -8,7 +8,7 @@ async function renderTemplatePreview( inputItems?: Zotero.Item[] ): Promise { let html: string = "

Preview rendering failed

"; - if (inputItems) { + if (!inputItems) { inputItems = ZoteroPane.getSelectedItems(); } if (templateName.startsWith("[Text]")) {