@tiptap/vue-2 3.10.6 → 3.10.7

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-2",
3
3
  "description": "Vue components for tiptap",
4
- "version": "3.10.6",
4
+ "version": "3.10.7",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -43,17 +43,17 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "vue": "^2.7.16",
46
- "@tiptap/core": "^3.10.6",
47
- "@tiptap/pm": "^3.10.6"
46
+ "@tiptap/core": "^3.10.7",
47
+ "@tiptap/pm": "^3.10.7"
48
48
  },
49
49
  "optionalDependencies": {
50
- "@tiptap/extension-bubble-menu": "^3.10.6",
51
- "@tiptap/extension-floating-menu": "^3.10.6"
50
+ "@tiptap/extension-bubble-menu": "^3.10.7",
51
+ "@tiptap/extension-floating-menu": "^3.10.7"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "vue": "^2.6.0",
55
- "@tiptap/core": "^3.10.6",
56
- "@tiptap/pm": "^3.10.6"
55
+ "@tiptap/core": "^3.10.7",
56
+ "@tiptap/pm": "^3.10.7"
57
57
  },
58
58
  "repository": {
59
59
  "type": "git",
@@ -1,9 +1,11 @@
1
1
  import type { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'
2
2
  import { BubbleMenuPlugin } from '@tiptap/extension-bubble-menu'
3
- import type { Component, CreateElement, PropType } from 'vue'
4
- import type Vue from 'vue'
3
+ import type { Component, CreateElement, PropType, VNode } from 'vue'
5
4
 
6
- export interface BubbleMenuInterface extends Vue {
5
+ export interface BubbleMenuInterface {
6
+ $el: HTMLElement
7
+ $nextTick: (callback: () => void) => void
8
+ $slots: { default?: VNode[] }
7
9
  pluginKey: BubbleMenuPluginProps['pluginKey']
8
10
  editor: BubbleMenuPluginProps['editor']
9
11
  updateDelay: BubbleMenuPluginProps['updateDelay']
@@ -52,40 +54,35 @@ export const BubbleMenu: Component = {
52
54
  },
53
55
  },
54
56
 
55
- watch: {
56
- editor: {
57
- immediate: true,
58
- handler(this: BubbleMenuInterface, editor: BubbleMenuPluginProps['editor']) {
59
- if (!editor) {
60
- return
61
- }
62
-
63
- if (!this.$el) {
64
- return
65
- }
66
-
67
- ;(this.$el as HTMLElement).style.visibility = 'hidden'
68
- ;(this.$el as HTMLElement).style.position = 'absolute'
69
-
70
- this.$el.remove()
71
-
72
- this.$nextTick(() => {
73
- editor.registerPlugin(
74
- BubbleMenuPlugin({
75
- updateDelay: this.updateDelay,
76
- resizeDelay: this.resizeDelay,
77
- options: this.options,
78
- editor,
79
- element: this.$el as HTMLElement,
80
- pluginKey: this.pluginKey,
81
- appendTo: this.appendTo,
82
- shouldShow: this.shouldShow,
83
- getReferencedVirtualElement: this.getReferencedVirtualElement,
84
- }),
85
- )
86
- })
87
- },
88
- },
57
+ mounted(this: BubbleMenuInterface) {
58
+ const editor = this.editor
59
+ const el = this.$el as HTMLElement
60
+
61
+ if (!editor || !el) {
62
+ return
63
+ }
64
+
65
+ el.style.visibility = 'hidden'
66
+ el.style.position = 'absolute'
67
+
68
+ // Remove element from DOM; plugin will re-parent it when shown
69
+ el.remove()
70
+
71
+ this.$nextTick(() => {
72
+ editor.registerPlugin(
73
+ BubbleMenuPlugin({
74
+ updateDelay: this.updateDelay,
75
+ resizeDelay: this.resizeDelay,
76
+ options: this.options,
77
+ editor,
78
+ element: el,
79
+ pluginKey: this.pluginKey,
80
+ appendTo: this.appendTo,
81
+ shouldShow: this.shouldShow,
82
+ getReferencedVirtualElement: this.getReferencedVirtualElement,
83
+ }),
84
+ )
85
+ })
89
86
  },
90
87
 
91
88
  render(this: BubbleMenuInterface, createElement: CreateElement) {