Skip to content

Commit a7213b5

Browse files
committed
fix: resolve BubbleMenu Vue 2 runtime errors with prop defaults (#7215)
* fix: resolve BubbleMenu Vue 2 runtime errors with prop defaults and $el timing Fixed two critical errors in BubbleMenu component for Vue 2: - Changed options prop default from object literal to factory function to comply with Vue 2 validation requirements - Added guard clause to prevent accessing $el before component mount when immediate watcher runs Closes #6696 * add vue 2 runtime fixes for floating menu fix
1 parent a365c61 commit a7213b5

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@tiptap/vue-2": patch
3+
---
4+
5+
Fix BubbleMenu and FloatingMenu component runtime errors in Vue 2.

packages/vue-2/src/menus/BubbleMenu.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const BubbleMenu: Component = {
3434

3535
options: {
3636
type: Object as PropType<BubbleMenuPluginProps['options']>,
37-
default: {},
37+
default: () => ({}),
3838
},
3939

4040
resizeDelay: {
@@ -60,6 +60,10 @@ export const BubbleMenu: Component = {
6060
return
6161
}
6262

63+
if (!this.$el) {
64+
return
65+
}
66+
6367
;(this.$el as HTMLElement).style.visibility = 'hidden'
6468
;(this.$el as HTMLElement).style.position = 'absolute'
6569

packages/vue-2/src/menus/FloatingMenu.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ export const FloatingMenu: Component = {
4949
return
5050
}
5151

52+
if (!this.$el) {
53+
return
54+
}
55+
5256
;(this.$el as HTMLElement).style.visibility = 'hidden'
5357
;(this.$el as HTMLElement).style.position = 'absolute'
5458

0 commit comments

Comments
 (0)