@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.
@@ -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'];
@@ -1977,37 +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
- if (!this.$el) {
1988
- return;
1989
- }
1990
- ;
1991
- this.$el.style.visibility = "hidden";
1992
- this.$el.style.position = "absolute";
1993
- this.$el.remove();
1994
- this.$nextTick(() => {
1995
- editor.registerPlugin(
1996
- BubbleMenuPlugin({
1997
- updateDelay: this.updateDelay,
1998
- resizeDelay: this.resizeDelay,
1999
- options: this.options,
2000
- editor,
2001
- element: this.$el,
2002
- pluginKey: this.pluginKey,
2003
- appendTo: this.appendTo,
2004
- shouldShow: this.shouldShow,
2005
- getReferencedVirtualElement: this.getReferencedVirtualElement
2006
- })
2007
- );
2008
- });
2009
- }
1980
+ mounted() {
1981
+ const editor = this.editor;
1982
+ const el = this.$el;
1983
+ if (!editor || !el) {
1984
+ return;
2010
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
+ });
2011
2004
  },
2012
2005
  render(createElement) {
2013
2006
  return createElement("div", {}, this.$slots.default);