ianstormtaylor / slate

A completely customizable framework for building rich text editors. (Currently in beta.)
http://slatejs.org
MIT License
29.87k stars 3.25k forks source link

Error thrown with Katex library: Cannot resolve a DOM point #4851

Open antondc opened 2 years ago

antondc commented 2 years ago

Description When using Slate and Slate-react along with Katex library —to render math within blocks—, the whole editor breaks when cursor reachs the rendered formula, throwing an error and breaking the whole editor: Cannot resolve a DOM point from Slate point: {"path":[0,1],"offset":1}

Recording https://user-images.githubusercontent.com/55709791/155305908-16de0603-3f56-43b6-a9ca-9985e4e447b6.mov

Sandbox https://codesandbox.io/s/slate-reproductions-forked-xg95mz

Steps To reproduce the behavior:

  1. Place cursor on the start of the text
  2. Move cursor to the right until you reach the formula
  3. See how editor breaks when cursor reachs formula
  4. Repeat backwards, starting from end of text to start

Expectation Editor should not fail, or when failing log an error without throwing and crashing whole editor

Environment

HugoDerigny commented 1 year ago

Any news on this ?