Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Redo doesn't work with BubbleMenu and Collaboration enabled #5729

Open
1 task done
tuanalumi opened this issue Oct 15, 2024 · 1 comment
Open
1 task done
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@tuanalumi
Copy link

tuanalumi commented Oct 15, 2024

Affected Packages

BubbleMenu, Collaboration

Version(s)

2.8.0

Bug Description

When you have both BubbleMenu and Collaboration extensions enabled, Redo doesn't work anymore. Undo still works though.

If you disable BubbleMenu, Redo works again.
If you disable Collaboration (and enable History), Redo works again.

Browser Used

Chrome

Code Example URL

https://codesandbox.io/p/devbox/elastic-mcnulty-r756rh

Expected Behavior

Redo should work with BubbleMenu and Collaboration.

Additional Context (Optional)

The same issue happens in this example: https://github.com/ueberdosis/tiptap/blob/v2.8.0/demos/src/Extensions/CollaborationWithMenus/Vue/index.vue

Dependency Updates

  • Yes, I've updated all my dependencies.
@tuanalumi tuanalumi added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Oct 15, 2024
@Cirr0e
Copy link

Cirr0e commented Nov 25, 2024

Hi there! I understand you're experiencing an issue where Redo doesn't work when both BubbleMenu and Collaboration extensions are enabled. Let me help you resolve this.

The root cause of this issue appears to be a conflict between the history handling mechanisms of the Collaboration extension and the BubbleMenu's interaction with the editor state. This is a known issue that has been documented in similar cases.

Here's how to resolve this:

  1. First, let's understand why this happens: The Collaboration extension uses its own history implementation (based on Y.js) which can conflict with the standard history management when other extensions like BubbleMenu are involved.

  2. The recommended solution is to update your configuration to properly handle the history:

import { Editor } from '@tiptap/core'
import { Collaboration } from '@tiptap/extension-collaboration'
import { BubbleMenu } from '@tiptap/extension-bubble-menu'

new Editor({
  extensions: [
    BubbleMenu.configure({
      // Add a unique plugin key to avoid conflicts
      pluginKey: 'uniqueBubbleMenu',
      // Add updateDelay to minimize interference with history
      updateDelay: 0,
    }),
    Collaboration.configure({
      // Your collaboration config
      document: yourYDoc,
      // Make sure fragment is properly configured
      field: 'default'
    }),
    // Make sure you're NOT including the default History extension
    // if you're using Collaboration
  ],
})

Key points to note:

  1. The Collaboration extension comes with its own history extension, so make sure you're not including the default History extension (especially if using StarterKit)
  2. Set a unique pluginKey for your BubbleMenu to avoid any potential conflicts
  3. Consider setting updateDelay: 0 on the BubbleMenu if you're still experiencing issues

Please be aware of the following:

  • If you're using the StarterKit, you'll need to disable its default History extension:
import { StarterKit } from '@tiptap/starter-kit'

StarterKit.configure({
  history: false // Disable default history
})

Let me know if you need any clarification or if you run into any issues while implementing this solution. I'm here to help!

Important Context: This solution is based on similar reported issues (#3953 and #4265) where users experienced conflicts between BubbleMenu and collaboration features. The fix has been confirmed to work in those cases, and the approach aligns with Tiptap's official documentation regarding collaboration setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

2 participants