andi23rosca / tiptap-solid

MIT License
45 stars 1 forks source link

`BubbleMenu` and collaboration features don't play nice together #5

Open odnamrataizem opened 1 month ago

odnamrataizem commented 1 month ago

I reckon I'm still a young padawan at solid-js (slightly better at prosemirror and tiptap), but the editor's performance is massively reduced when configuring it as such:

import Collaboration from '@tiptap/extension-collaboration';
import StarterKit from '@tiptap/starter-kit';
import { Show } from 'solid-js';
import { BubbleMenu, createEditor, EditorContent } from 'tiptap-solid';
import * as Y from 'yjs';

const document = new Y.Doc();

export function Editor() {
  const editor = createEditor({
    extensions: [
      StarterKit.configure({ history: false }),
      Collaboration.configure({ document }),
    ],
  });

  return (
    <Show when={editor()}>
      <BubbleMenu editor={editor()} />
      <EditorContent editor={editor()} />
    </Show>
  );
}

Removing either @tiptap/extension-collaboration or BubbleMenu makes it happy again.

I'm using @solidjs/start v1.0.5 if it helps, but I didn't test this issue outside it.

andi23rosca commented 1 month ago

Seems like I made some mistakes with the initial implementation of the BubbleMenu The effect listener that was registering/unregistering the plugin would do that every single time the editor state changes, which is a lot

Just released v1.0.4 that should fix this hopefully, let me know

odnamrataizem commented 1 month ago

Hmm, I ended up forgetting to mention that FloatingMenu has this problem as well...

That said, BubbleMenu is indeed fixed. Thanks!

andi23rosca commented 1 month ago

Yeah floating menu has exactly the same issue, thanks, will also fix that one soon