fix: avoid insert embed tag on the main thread which cause Safari on Big Sur freezing

upgrade pdfobject to version 2.2.4

Signed-off-by: Max Wu <jackymaxj@gmail.com>
This commit is contained in:
Max Wu 2021-01-21 14:14:32 +08:00
parent dd16949222
commit a1e3768f98
3 changed files with 9 additions and 7 deletions

6
package-lock.json generated
View File

@ -12440,9 +12440,9 @@
}
},
"pdfobject": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/pdfobject/-/pdfobject-2.1.1.tgz",
"integrity": "sha512-QFktTHyjs4q/WhGFfV2RdAbscPdNkyQb/JfFz18cwILvs9ocDiYVFAEh/jgkKGv6my+r4nlbLjwj7BHFKAupHQ==",
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/pdfobject/-/pdfobject-2.2.4.tgz",
"integrity": "sha512-r6Rw9CQWsrY6uqmKvlgFNoupmuRbSt9EsG0sZhSAy3cIk4WgOXyAVmebFSlLhqj6gA5NIEXL3lSEbwOOYfdUvw==",
"dev": true
},
"pend": {

View File

@ -173,7 +173,7 @@
"nyc": "~14.0.0",
"optimize-css-assets-webpack-plugin": "~5.0.0",
"papaparse": "^5.2.0",
"pdfobject": "~2.1.1",
"pdfobject": "2.2.4",
"plantuml-encoder": "^1.2.5",
"power-assert": "~1.6.1",
"prismjs": "^1.17.1",

View File

@ -597,9 +597,11 @@ export function finishView (view) {
const url = $(value).attr('data-pdfurl')
const inner = $('<div></div>')
$(this).append(inner)
PDFObject.embed(url, inner, {
height: '400px'
})
setTimeout(() => {
PDFObject.embed(url, inner, {
height: '400px'
})
}, 1)
})
// syntax highlighting
view.find('code.raw').removeClass('raw')