diff --git a/package.json b/package.json index 97bf21e..d809610 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ ], "scripts": { "dev": "vite --force --config vite.playground.ts", - "build": "npm run build:lib && npm run build:dts", + "build": "npm run tests && npm run build:lib && npm run build:dts", "build:lib": "vite build", "build:dts": "vue-tsc --declaration --emitDeclarationOnly -p tsconfig.build.json", "publish": "npm publish --access public", diff --git a/src/components/VuePDF.vue b/src/components/VuePDF.vue index d69d992..43a97c9 100644 --- a/src/components/VuePDF.vue +++ b/src/components/VuePDF.vue @@ -30,6 +30,7 @@ const props = withDefaults(defineProps<{ textLayer?: boolean imageResourcesPath?: string hideForms?: boolean + intent?: string annotationLayer?: boolean annotationsFilter?: string[] annotationsMap?: object @@ -40,6 +41,7 @@ const props = withDefaults(defineProps<{ }>(), { page: 1, scale: 1, + intent: 'display', }) const emit = defineEmits<{ @@ -67,6 +69,7 @@ const alayerProps = computed(() => { annotationsFilter: props.annotationsFilter, imageResourcesPath: props.imageResourcesPath, hideForms: props.hideForms, + intent: props.intent, } }) const tlayerProps = computed(() => { @@ -218,6 +221,7 @@ function renderPage(pageNum: number) { viewport, annotationMode: props.hideForms ? PDFJS.AnnotationMode.ENABLE : PDFJS.AnnotationMode.ENABLE_FORMS, transform, + intent: props.intent, } if (canvas?.getAttribute('role') !== 'main') { @@ -261,6 +265,7 @@ watch(() => [ props.rotation, props.page, props.hideForms, + props.intent, ], () => { // Props that should dispatch an render task renderPage(props.page) diff --git a/src/components/layers/AnnotationLayer.vue b/src/components/layers/AnnotationLayer.vue index 429fd53..25146bc 100644 --- a/src/components/layers/AnnotationLayer.vue +++ b/src/components/layers/AnnotationLayer.vue @@ -19,6 +19,7 @@ const props = defineProps<{ imageResourcesPath?: string hideForms?: boolean enableScripting?: boolean + intent: string }>() const emit = defineEmits<{ @@ -49,7 +50,7 @@ async function getHasJSActions() { async function getAnnotations() { const page = props.page - let annotations = await page?.getAnnotations() + let annotations = await page?.getAnnotations({ intent: props.intent }) if (props.annotationsFilter) { const filters = props.annotationsFilter annotations = annotations!.filter((value) => {