BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

Bug: Cannot add space at the end of a custom block's content

Open Mirrorlance opened this issue 1 year ago • 3 comments

Describe the bug I have implemented several custom blocks by following the documentation. In Firefox, when typing content in any custom block there is no way to leave a space. The precise behavior is this:

  • When writing at the very end of the block you can only input one space.
  • Anything you type after that final space simply replaces that space. This includes pressing space again.
  • The end result is that all your text is strung together in a single string with no spaces.
  • This can be circumvented by placing the cursor in any other position except the very end of the block. Then you can input spaces correctly and type normally.
  • This behavior can be reproduced on the docs at https://www.blocknotejs.org/docs/custom-schemas/custom-blocks.
  • This seems to affect only Firefox. Chrome and Edge work normally.

To Reproduce

  • Go to https://www.blocknotejs.org/docs/custom-schemas/custom-blocks in Firefox.
  • In the editor create a new alert block or click on the existing one. If you go for the existing one, make sure the cursor is at the very end.
  • Type away.

Misc

  • Node version: 20.11.1
  • Package manager: npm
  • Browser: Firefox
  • [x] I work for a sponsor and would appreciate if you could look into this sooner than later 💖

Mirrorlance avatar Mar 22 '24 21:03 Mirrorlance

Thanks @Mirrorlance , we'll look into this!

YousefED avatar Mar 27 '24 09:03 YousefED

@Mirrorlance this is probably fixed by adding white-space: pre-wrap to the contentRef element. We'll look into a library-level fix, but this might already be helpful info for you to implement a workaround :)

YousefED avatar Apr 02 '24 16:04 YousefED

@YousefED this seems to work! Thanks for the prompt resolution

Mirrorlance avatar Apr 10 '24 10:04 Mirrorlance