@tiptap/vue-3 3.20.2 → 3.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/vue-3",
3
3
  "description": "Vue components for tiptap",
4
- "version": "3.20.2",
4
+ "version": "3.20.3",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -40,18 +40,18 @@
40
40
  ],
41
41
  "devDependencies": {
42
42
  "vue": "^3.5.13",
43
- "@tiptap/core": "^3.20.2",
44
- "@tiptap/pm": "^3.20.2"
43
+ "@tiptap/pm": "^3.20.3",
44
+ "@tiptap/core": "^3.20.3"
45
45
  },
46
46
  "optionalDependencies": {
47
- "@tiptap/extension-bubble-menu": "^3.20.2",
48
- "@tiptap/extension-floating-menu": "^3.20.2"
47
+ "@tiptap/extension-floating-menu": "^3.20.3",
48
+ "@tiptap/extension-bubble-menu": "^3.20.3"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "vue": "^3.0.0",
52
52
  "@floating-ui/dom": "^1.0.0",
53
- "@tiptap/core": "^3.20.2",
54
- "@tiptap/pm": "^3.20.2"
53
+ "@tiptap/core": "^3.20.3",
54
+ "@tiptap/pm": "^3.20.3"
55
55
  },
56
56
  "repository": {
57
57
  "type": "git",
@@ -1,5 +1,6 @@
1
1
  import type { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'
2
2
  import { BubbleMenuPlugin } from '@tiptap/extension-bubble-menu'
3
+ import { PluginKey } from '@tiptap/pm/state'
3
4
  import type { PropType } from 'vue'
4
5
  import { defineComponent, h, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
5
6
 
@@ -11,7 +12,7 @@ export const BubbleMenu = defineComponent({
11
12
  props: {
12
13
  pluginKey: {
13
14
  type: [String, Object] as PropType<BubbleMenuPluginProps['pluginKey']>,
14
- default: 'bubbleMenu',
15
+ default: undefined,
15
16
  },
16
17
 
17
18
  editor: {
@@ -52,18 +53,10 @@ export const BubbleMenu = defineComponent({
52
53
 
53
54
  setup(props, { slots, attrs }) {
54
55
  const root = ref<HTMLElement | null>(null)
56
+ const resolvedPluginKey = props.pluginKey ?? new PluginKey('bubbleMenu')
55
57
 
56
58
  onMounted(() => {
57
- const {
58
- editor,
59
- options,
60
- pluginKey,
61
- resizeDelay,
62
- appendTo,
63
- shouldShow,
64
- getReferencedVirtualElement,
65
- updateDelay,
66
- } = props
59
+ const { editor, options, resizeDelay, appendTo, shouldShow, getReferencedVirtualElement, updateDelay } = props
67
60
 
68
61
  const el = root.value
69
62
 
@@ -83,7 +76,7 @@ export const BubbleMenu = defineComponent({
83
76
  editor,
84
77
  element: el,
85
78
  options,
86
- pluginKey,
79
+ pluginKey: resolvedPluginKey,
87
80
  resizeDelay,
88
81
  appendTo,
89
82
  shouldShow,
@@ -95,9 +88,9 @@ export const BubbleMenu = defineComponent({
95
88
  })
96
89
 
97
90
  onBeforeUnmount(() => {
98
- const { pluginKey, editor } = props
91
+ const { editor } = props
99
92
 
100
- editor.unregisterPlugin(pluginKey)
93
+ editor.unregisterPlugin(resolvedPluginKey)
101
94
  })
102
95
 
103
96
  // Vue owns this element; attrs are applied reactively by Vue
@@ -1,5 +1,6 @@
1
1
  import type { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'
2
2
  import { FloatingMenuPlugin } from '@tiptap/extension-floating-menu'
3
+ import { PluginKey } from '@tiptap/pm/state'
3
4
  import type { PropType } from 'vue'
4
5
  import { defineComponent, h, onBeforeUnmount, onMounted, ref } from 'vue'
5
6
 
@@ -13,7 +14,7 @@ export const FloatingMenu = defineComponent({
13
14
  // TODO: TypeScript breaks :(
14
15
  // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],
15
16
  type: null,
16
- default: 'floatingMenu',
17
+ default: undefined,
17
18
  },
18
19
 
19
20
  editor: {
@@ -49,9 +50,10 @@ export const FloatingMenu = defineComponent({
49
50
 
50
51
  setup(props, { slots, attrs }) {
51
52
  const root = ref<HTMLElement | null>(null)
53
+ const resolvedPluginKey = props.pluginKey ?? new PluginKey('floatingMenu')
52
54
 
53
55
  onMounted(() => {
54
- const { pluginKey, editor, updateDelay, resizeDelay, options, appendTo, shouldShow } = props
56
+ const { editor, updateDelay, resizeDelay, options, appendTo, shouldShow } = props
55
57
 
56
58
  const el = root.value
57
59
 
@@ -67,7 +69,7 @@ export const FloatingMenu = defineComponent({
67
69
 
68
70
  editor.registerPlugin(
69
71
  FloatingMenuPlugin({
70
- pluginKey,
72
+ pluginKey: resolvedPluginKey,
71
73
  editor,
72
74
  element: el,
73
75
  updateDelay,
@@ -80,9 +82,9 @@ export const FloatingMenu = defineComponent({
80
82
  })
81
83
 
82
84
  onBeforeUnmount(() => {
83
- const { pluginKey, editor } = props
85
+ const { editor } = props
84
86
 
85
- editor.unregisterPlugin(pluginKey)
87
+ editor.unregisterPlugin(resolvedPluginKey)
86
88
  })
87
89
 
88
90
  // Vue owns this element; attrs are applied reactively by Vue