tiptap: registerPlugin() will break UndoManger in Collaboration Extension

What’s the bug you are facing?

Collaboration Extension cannot not work well with BubbleMenu, which is registered by using registerPlugin() after editori s initialized.

Specifically, once you call registerPlugin() after editor is initialized, UndoManger does not work.


import { Editor, EditorContent } from '@tiptap/vue-3';
import Collaboration from '@tiptap/extension-collaboration';
import StarterKit from '@tiptap/starter-kit';
import CollaborationCursor from '@tiptap/extension-collaboration-cursor';
import * as Y from 'yjs';
import { WebrtcProvider } from 'y-webrtc';
import Placeholder from '@tiptap/extension-placeholder';
import { Plugin } from 'prosemirror-state';

const editor = shallowRef<Editor>();

const ydoc = new Y.Doc();

const provider = new WebrtcProvider(
  'tiptap-collaboration-cursor-extension',
  ydoc,
);

editor.value = new Editor({
  extensions: [
    StarterKit.configure({
      // The Collaboration extension comes with its own history handling
      history: false,
    }),
    Collaboration.configure({
      document: ydoc
    }),
    CollaborationCursor.configure({
      provider: provider,
      user: {
        name: 'Cyndi Lauper',
        color: '#f783ac',
      },
    }),
    Placeholder.configure({
      placeholder:
        'Write something … It’ll be shared with everyone else looking at this example.',
    }),
  ],
});
// comment this line to make undoManager work
editor.value.registerPlugin(new Plugin({}));
</script>

If you comment last line, UndoManger is back to work.

Can you provide a CodeSandbox?

Reproduction Link

Did you update your dependencies?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 17 (9 by maintainers)

Most upvoted comments

Why is this closed? The problem persists, and only a poor workaround of copying the original extension currently exists.

We released the fix in 2.0.0.

I maintain all extensions of my own to gain more flexibility for my project, after all, the code for these extensions is very simple and easy to modify.