@tiptap/vue-2 3.29.2 → 3.30.0

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.
@@ -221,6 +221,7 @@ interface FloatingMenuInterface extends Vue {
221
221
  appendTo: FloatingMenuPluginProps['appendTo'];
222
222
  shouldShow: FloatingMenuPluginProps['shouldShow'];
223
223
  getPluginKey: () => FloatingMenuPluginProps['pluginKey'];
224
+ isDestroyed: boolean;
224
225
  }
225
226
  declare const FloatingMenu: Component;
226
227
 
@@ -221,6 +221,7 @@ interface FloatingMenuInterface extends Vue {
221
221
  appendTo: FloatingMenuPluginProps['appendTo'];
222
222
  shouldShow: FloatingMenuPluginProps['shouldShow'];
223
223
  getPluginKey: () => FloatingMenuPluginProps['pluginKey'];
224
+ isDestroyed: boolean;
224
225
  }
225
226
  declare const FloatingMenu: Component;
226
227
 
@@ -2445,36 +2445,32 @@ var FloatingMenu = {
2445
2445
  default: null
2446
2446
  }
2447
2447
  },
2448
- watch: {
2449
- editor: {
2450
- immediate: true,
2451
- handler(editor) {
2452
- if (!editor) {
2453
- return;
2454
- }
2455
- if (!this.$el) {
2456
- return;
2457
- }
2458
- ;
2459
- this.$el.style.visibility = "hidden";
2460
- this.$el.style.position = "absolute";
2461
- this.$el.remove();
2462
- this.$nextTick(() => {
2463
- editor.registerPlugin(
2464
- FloatingMenuPlugin({
2465
- pluginKey: this.getPluginKey(),
2466
- editor,
2467
- element: this.$el,
2468
- updateDelay: this.updateDelay,
2469
- resizeDelay: this.resizeDelay,
2470
- options: this.options,
2471
- appendTo: this.appendTo,
2472
- shouldShow: this.shouldShow
2473
- })
2474
- );
2475
- });
2476
- }
2448
+ mounted() {
2449
+ const editor = this.editor;
2450
+ const el = this.$el;
2451
+ if (!editor || !el) {
2452
+ return;
2477
2453
  }
2454
+ el.style.visibility = "hidden";
2455
+ el.style.position = "absolute";
2456
+ el.remove();
2457
+ this.$nextTick(() => {
2458
+ if (this.isDestroyed) {
2459
+ return;
2460
+ }
2461
+ editor.registerPlugin(
2462
+ FloatingMenuPlugin({
2463
+ pluginKey: this.getPluginKey(),
2464
+ editor,
2465
+ element: el,
2466
+ updateDelay: this.updateDelay,
2467
+ resizeDelay: this.resizeDelay,
2468
+ options: this.options,
2469
+ appendTo: this.appendTo,
2470
+ shouldShow: this.shouldShow
2471
+ })
2472
+ );
2473
+ });
2478
2474
  },
2479
2475
  render(createElement) {
2480
2476
  var _a, _b;
@@ -2491,7 +2487,12 @@ var FloatingMenu = {
2491
2487
  );
2492
2488
  },
2493
2489
  beforeDestroy() {
2494
- this.editor.unregisterPlugin(this.getPluginKey());
2490
+ this.isDestroyed = true;
2491
+ const editor = this.editor;
2492
+ if (!editor) {
2493
+ return;
2494
+ }
2495
+ editor.unregisterPlugin(this.getPluginKey());
2495
2496
  },
2496
2497
  methods: {
2497
2498
  getPluginKey() {