From 42144e19cc321a873f8bfc556bfe1ae7033d1508 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Mon, 28 Oct 2024 20:17:13 -0300 Subject: [PATCH] chore: change setup of workerSrc Signed-off-by: Vitor Mattos --- README.md | 1 - package.json | 2 +- src/VuePdfEditor.vue | 9 +-------- src/utils/asyncReader.js | 4 ++-- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index c9634b2..ccd2278 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,6 @@ https://www.npmjs.com/package/@libresign/vue-pdf-editor :init-image-scale = "0.2" :seal-image-show="true" :seal-image-hidden-on-save="true" - :worker-src=null @onSave2Upload="【save callback】" /> ``` diff --git a/package.json b/package.json index 5c3c973..214dbba 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@libresign/vue-pdf-editor", "description": "vue2 pdf editor component", - "version": "1.3.5", + "version": "1.3.6", "author": "LibreCode", "private": false, "main": "dist/vue-pdf-editor.umd.js", diff --git a/src/VuePdfEditor.vue b/src/VuePdfEditor.vue index b415cc3..68d1f09 100644 --- a/src/VuePdfEditor.vue +++ b/src/VuePdfEditor.vue @@ -197,7 +197,7 @@ import ImageItem from './Components/Image.vue' import TextItem from './Components/TextItem.vue' import Drawing from './Components/Drawing.vue' import DrawingCanvas from './Components/DrawingCanvas.vue' -import { configurePDFWorkerSrc, readAsImage, readAsPDF, readAsDataURL } from './utils/asyncReader.js' +import { readAsImage, readAsPDF, readAsDataURL } from './utils/asyncReader.js' import { save } from './utils/PDF.js' import ImageIcon from 'vue-material-design-icons/Image.vue' import TextIcon from 'vue-material-design-icons/Text.vue' @@ -311,10 +311,6 @@ export default { type: Boolean, default: false, }, - workerSrc: { - type: String, - default: null - }, }, data() { return { @@ -497,9 +493,6 @@ export default { file = await blob.arrayBuffer(); } - if (this.workerSrc) { - configurePDFWorkerSrc(this.workerSrc) - } this.pdfDocument = await readAsPDF(file) if (this.pdfDocument) { this.numPages = this.pdfDocument.numPages diff --git a/src/utils/asyncReader.js b/src/utils/asyncReader.js index 9405bde..a60cd19 100644 --- a/src/utils/asyncReader.js +++ b/src/utils/asyncReader.js @@ -1,8 +1,8 @@ import { getDocument, GlobalWorkerOptions } from 'pdfjs-dist' import pdfWorkerCode from 'pdfjs-dist/legacy/build/pdf.worker.min.mjs' -export function configurePDFWorkerSrc(customWorkerSrc) { - GlobalWorkerOptions.workerSrc = customWorkerSrc || pdfWorkerCode +if (!GlobalWorkerOptions.workerSrc) { + GlobalWorkerOptions.workerSrc = pdfWorkerCode } /**