tiptap: [Bug]: Bubble Menu Not Working with Collaboration Extension

Affected Packages

Bubble menu

Version(s)

2.4.0

Bug Description

We encountered an issue where the Bubble Menu extension, which previously worked fine alongside the Collaboration extension, is no longer functioning after updating all dependencies. The Bubble Menu works correctly when the Collaboration extension is not included, but fails to work when Collaboration is enabled. No errors are indicated.

We discovered that the Bubble Menu plugin gets removed during the execution of the updatePluginViews function in prosemirror-view/dist/index.js. Specifically, in the y-prosemirror/src/plugins/sync phase, the length of this.state.plugins decreases from 76 (including Bubble Menu) to 75, effectively removing the Bubble Menu plugin.

Below is the basic code from the Tiptap example, which replicates the issue:

<template>
  <div class="container">
    <div class="control-group">
      <label>
        <input type="checkbox" :checked="isEditable" @change="() => (isEditable = !isEditable)" />
        Editable
      </label>
    </div>
    <bubble-menu :editor="editor" :tippy-options="{ duration: 100 }" v-if="editor">
      <div class="bubble-menu">
        <button @click="editor.chain().focus().toggleBold().run()" :class="{ 'is-active': editor.isActive('bold') }">
          Bold
        </button>
        <button
          @click="editor.chain().focus().toggleItalic().run()"
          :class="{ 'is-active': editor.isActive('italic') }"
        >
          Italic
        </button>
        <button
          @click="editor.chain().focus().toggleStrike().run()"
          :class="{ 'is-active': editor.isActive('strike') }"
        >
          Strike
        </button>
      </div>
    </bubble-menu>
    <editor-content :editor="editor" />
  </div>
</template>
<script>
import StarterKit from '@tiptap/starter-kit';
import { BubbleMenu, Editor, EditorContent } from '@tiptap/vue-3';
import Collaboration from '@tiptap/extension-collaboration';
import * as Y from 'yjs';
export default {
  components: {
    EditorContent,
    BubbleMenu
  },
  data() {
    return {
      editor: null,
      isEditable: true
    };
  },
  watch: {
    isEditable(value) {
      this.editor.setEditable(value);
    }
  },
  mounted() {
    this.editor = new Editor({
      extensions: [
        StarterKit,
        Collaboration.configure({
          document: new Y.Doc()
        })
      ],
      content: `
        <p>
          Hey, try to select some text here. There will popup a menu for selecting some inline styles. Remember: you have full control about content and styling of this menu.
        </p>
      `
    });
  },
  beforeUnmount() {
    this.editor.destroy();
  }
};
</script>

image

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

Bubble menu working with collaboration extension

Additional Context (Optional)

No response

Dependency Updates

  • Yes, I’ve updated all my dependencies.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 15
  • Comments: 28 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Sorry for the silence. We are checking, but it might take some time. It seems that the issue occurs due to changes made in y-prosemirror versions 1.2.4 and 1.2.5. I can confirm that the issue is present in Vue (only).

@nperez0111, it doesn’t seem to be related to any recent changes in Vue on our side. I tried with Tiptap 2.0.0, and the same issue occurs.

editor.registerPlugin doesn’t trigger the plugin view update

I can confirm what @alexigasse wrote; it concerns plugins registered late via registerPlugin. The same issue is happening with the FloatingMenu.

move the <EditorContent/> after all <BubbleMenu/> components

I’ve done this but it still doesn’t work.

2.7.2 resolves this issue

I temporarily solved this problem by setting "y-prosemirror": "1.2.3"

same here 😟

As a tiptap-pro user this issue is preventing us to go to production.

I created a sandbox: https://codesandbox.io/p/sandbox/tiptap-issue-template-forked-rm83nw?file=%2Fsrc%2Fmain.js%3A4%2C15

Refresh the preview.

When collaboration extention is not provided the menu is shown correctly: image When the collaboration is used, the menu is always displayed above the editor: image

I’m also encountering a related issue where bubble menus aren’t working properly with the Collaboration extension. The bubble menus are always visible regardless of the condition I set in the shouldShow prop. Also, they are displayed above the editor instead of following the cursor.

As soon as I remove the Collaboration extension, the bubble menus work as expected.

I’m struggling with the same issue.