BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

Adding onBlur breaks SideMenu customization

Open khash opened this issue 1 year ago • 1 comments

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

  • Node version: 20.10
  • Package manager: npm
  • Browser: Chrome
  • [ ] I'm a sponsor and would appreciate if you could look into this sooner than later 💖

khash avatar Feb 14 '24 11:02 khash

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.

matthewlipski avatar Jun 11 '24 11:06 matthewlipski