TypeCellOS / BlockNote

A React Rich Text Editor that's block-based (Notion style) and extensible. Built on top of Prosemirror and Tiptap.
https://www.blocknotejs.org/
Mozilla Public License 2.0
6.26k stars 427 forks source link

Adding onBlur breaks SideMenu customization #577

Closed khash closed 1 week ago

khash commented 6 months ago

Describe the bug If you implement this example in the docs (https://www.blocknotejs.org/docs/side-menu#custom-side-menu) to customize the side menu it works, until you add an onBlur event to the editor:

To Reproduce Just implement the above example, add and remove the onBlur event handler.

Misc

matthewlipski commented 2 months ago

Hi I'm not running into any issues with this on 0.14.0, but you can try using this to add a blur listener to the editor instead:

useEffect(() => {
  const cb = () => {
    console.log('blur');
  };

  editor._tiptapEditor.on('blur', cb);

  return () => {
    editor._tiptapEditor.off('blur', cb);
  };
}, []);

I would suggest updating to 0.14.0 though if you haven't already, as it seems to be fixed.