@tiptap/vue-2 3.10.5 → 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.
@@ -2,7 +2,7 @@ import { Editor } from '@tiptap/core';
2
2
  import { VirtualElement, offset, flip, shift, arrow, size, autoPlacement, hide, inline } from '@floating-ui/dom';
3
3
  import { PluginKey, EditorState } from '@tiptap/pm/state';
4
4
  import { EditorView } from '@tiptap/pm/view';
5
- import Vue, { Component } from 'vue';
5
+ import Vue, { VNode, Component } from 'vue';
6
6
 
7
7
  interface BubbleMenuPluginProps {
8
8
  /**
@@ -94,7 +94,12 @@ interface BubbleMenuPluginProps {
94
94
  };
95
95
  }
96
96
 
97
- interface BubbleMenuInterface extends Vue {
97
+ interface BubbleMenuInterface {
98
+ $el: HTMLElement;
99
+ $nextTick: (callback: () => void) => void;
100
+ $slots: {
101
+ default?: VNode[];
102
+ };
98
103
  pluginKey: BubbleMenuPluginProps['pluginKey'];
99
104
  editor: BubbleMenuPluginProps['editor'];
100
105
  updateDelay: BubbleMenuPluginProps['updateDelay'];
@@ -2,7 +2,7 @@ import { Editor } from '@tiptap/core';
2
2
  import { VirtualElement, offset, flip, shift, arrow, size, autoPlacement, hide, inline } from '@floating-ui/dom';
3
3
  import { PluginKey, EditorState } from '@tiptap/pm/state';
4
4
  import { EditorView } from '@tiptap/pm/view';
5
- import Vue, { Component } from 'vue';
5
+ import Vue, { VNode, Component } from 'vue';
6
6
 
7
7
  interface BubbleMenuPluginProps {
8
8
  /**
@@ -94,7 +94,12 @@ interface BubbleMenuPluginProps {
94
94
  };
95
95
  }
96
96
 
97
- interface BubbleMenuInterface extends Vue {
97
+ interface BubbleMenuInterface {
98
+ $el: HTMLElement;
99
+ $nextTick: (callback: () => void) => void;
100
+ $slots: {
101
+ default?: VNode[];
102
+ };
98
103
  pluginKey: BubbleMenuPluginProps['pluginKey'];
99
104
  editor: BubbleMenuPluginProps['editor'];
100
105
  updateDelay: BubbleMenuPluginProps['updateDelay'];
@@ -1963,7 +1963,7 @@ var BubbleMenu2 = {
1963
1963
  },
1964
1964
  options: {
1965
1965
  type: Object,
1966
- default: {}
1966
+ default: () => ({})
1967
1967
  },
1968
1968
  resizeDelay: {
1969
1969
  type: Number
@@ -1977,34 +1977,30 @@ var BubbleMenu2 = {
1977
1977
  default: null
1978
1978
  }
1979
1979
  },
1980
- watch: {
1981
- editor: {
1982
- immediate: true,
1983
- handler(editor) {
1984
- if (!editor) {
1985
- return;
1986
- }
1987
- ;
1988
- this.$el.style.visibility = "hidden";
1989
- this.$el.style.position = "absolute";
1990
- this.$el.remove();
1991
- this.$nextTick(() => {
1992
- editor.registerPlugin(
1993
- BubbleMenuPlugin({
1994
- updateDelay: this.updateDelay,
1995
- resizeDelay: this.resizeDelay,
1996
- options: this.options,
1997
- editor,
1998
- element: this.$el,
1999
- pluginKey: this.pluginKey,
2000
- appendTo: this.appendTo,
2001
- shouldShow: this.shouldShow,
2002
- getReferencedVirtualElement: this.getReferencedVirtualElement
2003
- })
2004
- );
2005
- });
2006
- }
1980
+ mounted() {
1981
+ const editor = this.editor;
1982
+ const el = this.$el;
1983
+ if (!editor || !el) {
1984
+ return;
2007
1985
  }
1986
+ el.style.visibility = "hidden";
1987
+ el.style.position = "absolute";
1988
+ el.remove();
1989
+ this.$nextTick(() => {
1990
+ editor.registerPlugin(
1991
+ BubbleMenuPlugin({
1992
+ updateDelay: this.updateDelay,
1993
+ resizeDelay: this.resizeDelay,
1994
+ options: this.options,
1995
+ editor,
1996
+ element: el,
1997
+ pluginKey: this.pluginKey,
1998
+ appendTo: this.appendTo,
1999
+ shouldShow: this.shouldShow,
2000
+ getReferencedVirtualElement: this.getReferencedVirtualElement
2001
+ })
2002
+ );
2003
+ });
2008
2004
  },
2009
2005
  render(createElement) {
2010
2006
  return createElement("div", {}, this.$slots.default);
@@ -2285,6 +2281,9 @@ var FloatingMenu2 = {
2285
2281
  if (!editor) {
2286
2282
  return;
2287
2283
  }
2284
+ if (!this.$el) {
2285
+ return;
2286
+ }
2288
2287
  ;
2289
2288
  this.$el.style.visibility = "hidden";
2290
2289
  this.$el.style.position = "absolute";