Skip to content

Commit

Permalink
Fix enrichHTML when called with only one parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
farling42 committed Nov 7, 2022
1 parent 8b635d0 commit f2560e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions 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.
Expand Down
4 changes: 2 additions & 2 deletions scripts/pdf-linker.mjs
Expand Up @@ -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;
});
Expand Down

0 comments on commit f2560e3

Please sign in to comment.