BiblioNexus-Foundation / scripture-editors

Monorepo for various Scripture editors
MIT License
1 stars 1 forks source link

Error causes input to stop working after putting cursor before chapter number #133

Closed tjcouch-sil closed 4 weeks ago

tjcouch-sil commented 1 month ago

Describe the bug When putting the cursor before the chapter number, an error occurs, then editing no longer functions properly.

To Reproduce Steps to reproduce the behavior:

  1. Left click right after a chapter number
  2. Press left arrow until you get to before the chapter number
  3. See weird error about E.getMarker is not a function (in P.B) or "Children of root nodes must be elements" (online editor)
  4. Left click some other text
  5. Hit backspace, and it just selects a character every time you hit backspace. Typing sometimes doesn't work.

image

image

Tested in the online platform editor preview in CodeSandbox.

irahopkinson commented 1 month ago

Hmm... an ImmutableChapterNode is a decorator node. In previous versions of Lexical, root nodes could have element nodes or decorator nodes as children. I can no longer find that statement in the documentation and the code seems to clearly state it only allows element nodes now. This will take a bit of refactoring to fix. I'm surprised Lexical doesn't complain sooner (like when we initially load the nodes).

irahopkinson commented 1 month ago

Posted this question in the Lexical Discord https://discord.com/channels/953974421008293909/1265086313871314944

irahopkinson commented 1 month ago

Created this issue in the Lexical repo https://github.com/facebook/lexical/issues/6451