Skip to content

Commit

Permalink
Merge pull request #79 from TaTo30/feature/intent-prop
Browse files Browse the repository at this point in the history
added 'intent' prop with 'display' as default value
  • Loading branch information
TaTo30 authored Jan 3, 2024
2 parents a1199a2 + 4961b09 commit b41f82b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions src/components/VuePDF.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const props = withDefaults(defineProps<{
textLayer?: boolean
imageResourcesPath?: string
hideForms?: boolean
intent?: string
annotationLayer?: boolean
annotationsFilter?: string[]
annotationsMap?: object
Expand All @@ -40,6 +41,7 @@ const props = withDefaults(defineProps<{
}>(), {
page: 1,
scale: 1,
intent: 'display',
})

const emit = defineEmits<{
Expand Down Expand Up @@ -67,6 +69,7 @@ const alayerProps = computed(() => {
annotationsFilter: props.annotationsFilter,
imageResourcesPath: props.imageResourcesPath,
hideForms: props.hideForms,
intent: props.intent,
}
})
const tlayerProps = computed(() => {
Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -261,6 +265,7 @@ watch(() => [
props.rotation,
props.page,
props.hideForms,
props.intent,
], () => {
// Props that should dispatch an render task
renderPage(props.page)
Expand Down
3 changes: 2 additions & 1 deletion src/components/layers/AnnotationLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const props = defineProps<{
imageResourcesPath?: string
hideForms?: boolean
enableScripting?: boolean
intent: string
}>()
const emit = defineEmits<{
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit b41f82b

Please sign in to comment.