diff --git a/CHANGELOG.md b/CHANGELOG.md index a6c4365..b030ff8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 0.32.1 + +- Fix an issue with enrichHTML if it is called without a second argument (the optional `options`) + ## 0.32.0 - Add a simple CSS file that ensures that PDF pages are shown full length within the window. diff --git a/scripts/pdf-linker.mjs b/scripts/pdf-linker.mjs index 3516493..a98a99e 100644 --- a/scripts/pdf-linker.mjs +++ b/scripts/pdf-linker.mjs @@ -87,10 +87,10 @@ function getAnchor(match) { * @param {*} options * @returns */ -function TextEditor_enrichHTML(wrapped, content, options) { +function TextEditor_enrichHTML(wrapped, content, options={}) { let text = content; if (!options.async && text?.length && text.includes('@PDF[')) { - text = text.replaceAll(pattern, (match, p1, p2, /*p3*/pagenum, /*p4*/label, options, groups) => { + text = text.replaceAll(pattern, (match, p1, p2, /*p3*/pagenum, /*p4*/label, moptions, mgroups) => { const anchor = getAnchor([match, p1, p2, pagenum, label]); return anchor ? anchor.outerHTML : label; });