Skip to content

Commit 7b6dd6d

Browse files
committed
Fixed Vue AnnotationContainer component where mixBlendMode style was incorrectly applied to the selection menu.
1 parent bf4b07e commit 7b6dd6d

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@embedpdf/plugin-annotation': patch
3+
---
4+
5+
Fixed Vue `AnnotationContainer` component where `mixBlendMode` style was incorrectly applied to the selection menu. The style now only applies to the annotation content div, matching the behavior of React and Svelte implementations. This was caused by Vue's attribute inheritance passing the style to the root element which wrapped both the annotation and the selection menu.

packages/plugin-annotation/src/vue/components/annotation-container.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div data-no-interaction>
3-
<div v-bind="{ ...dragProps, ...doubleProps }" :style="containerStyle">
2+
<div data-no-interaction :style="{ display: 'contents' }">
3+
<div v-bind="{ ...dragProps, ...doubleProps }" :style="mergedContainerStyle">
44
<slot :annotation="currentObject"></slot>
55

66
<template v-if="isSelected && isResizable">
@@ -53,6 +53,13 @@
5353
</div>
5454
</template>
5555

56+
<script lang="ts">
57+
// Disable attribute inheritance so style doesn't fall through to root element
58+
export default {
59+
inheritAttrs: false,
60+
};
61+
</script>
62+
5663
<script setup lang="ts" generic="T extends PdfAnnotationObject">
5764
import { ref, computed, watch, useSlots, toRaw, shallowRef, VNode } from 'vue';
5865
import { PdfAnnotationObject, Rect } from '@embedpdf/models';
@@ -88,6 +95,7 @@ const props = withDefaults(
8895
onSelect: (event: TouchEvent | MouseEvent) => void;
8996
zIndex?: number;
9097
selectionOutlineColor?: string;
98+
style?: Record<string, string | number>;
9199
}>(),
92100
{
93101
lockAspectRatio: false,
@@ -260,6 +268,12 @@ const containerStyle = computed(() => ({
260268
zIndex: props.zIndex,
261269
}));
262270
271+
// Merge container style with passed style prop (for mixBlendMode, etc.)
272+
const mergedContainerStyle = computed(() => ({
273+
...containerStyle.value,
274+
...(props.style ?? {}),
275+
}));
276+
263277
// Add useSlots to access slot information
264278
const slots = useSlots();
265279
</script>

0 commit comments

Comments
 (0)