@tiptap/vue-2 3.10.6 → 3.10.8

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.8",
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.8",
47
+ "@tiptap/pm": "^3.10.8"
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.8",
51
+ "@tiptap/extension-floating-menu": "^3.10.8"
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.8",
56
+ "@tiptap/pm": "^3.10.8"
57
57
  },
58
58
  "repository": {
59
59
  "type": "git",
package/src/Vue.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type { VueConstructor } from 'vue'
2
+ import VueDefault from 'vue'
3
+
4
+ // With nodenext module resolution, TypeScript treats the default import as the module type.
5
+ // We need to explicitly type it as VueConstructor to access static methods like extend and observable.
6
+ // This is necessary because Vue 2's type definitions export Vue as VueConstructor, but nodenext
7
+ // doesn't correctly infer the default export type.
8
+ export const Vue: VueConstructor = VueDefault as unknown as VueConstructor
@@ -2,11 +2,11 @@ import type { DecorationWithType, NodeViewProps, NodeViewRenderer, NodeViewRende
2
2
  import { NodeView } from '@tiptap/core'
3
3
  import type { Node as ProseMirrorNode } from '@tiptap/pm/model'
4
4
  import type { Decoration, DecorationSource, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'
5
- import Vue from 'vue'
6
- import type { VueConstructor } from 'vue/types/umd'
5
+ import type { VueConstructor } from 'vue'
7
6
  import { booleanProp, functionProp, objectProp } from 'vue-ts-types'
8
7
 
9
8
  import type { Editor } from './Editor.js'
9
+ import { Vue } from './Vue.js'
10
10
  import { VueRenderer } from './VueRenderer.js'
11
11
 
12
12
  export const nodeViewProps = {
@@ -1,5 +1,6 @@
1
- import Vue from 'vue'
2
- import type { VueConstructor } from 'vue/types/umd'
1
+ import type { VueConstructor } from 'vue'
2
+
3
+ import { Vue } from './Vue.js'
3
4
 
4
5
  /**
5
6
  * The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.
@@ -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) {