Skip to content

Commit 5b4c7ef

Browse files
authored
Merge pull request #1651 from hackmdio/bugfix/fix-pdf-embed-freeze-on-safari-big-sur
fix: avoid insert embed tag on the main thread which cause Safari on Big Sur freezing
2 parents 14e93fd + 250dba3 commit 5b4c7ef

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
"nyc": "~14.0.0",
174174
"optimize-css-assets-webpack-plugin": "~5.0.0",
175175
"papaparse": "^5.2.0",
176-
"pdfobject": "~2.1.1",
176+
"pdfobject": "~2.2.4",
177177
"plantuml-encoder": "^1.2.5",
178178
"power-assert": "~1.6.1",
179179
"prismjs": "^1.17.1",

public/js/extra.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,11 @@ export function finishView (view) {
608608
const url = $(value).attr('data-pdfurl')
609609
const inner = $('<div></div>')
610610
$(this).append(inner)
611-
PDFObject.embed(url, inner, {
612-
height: '400px'
613-
})
611+
setTimeout(() => {
612+
PDFObject.embed(url, inner, {
613+
height: '400px'
614+
})
615+
}, 1)
614616
})
615617
// syntax highlighting
616618
view.find('code.raw').removeClass('raw')

0 commit comments

Comments
 (0)