mdx-editor / editor

A rich text editor React component for markdown
https://mdxeditor.dev
MIT License
1.91k stars 145 forks source link

[BUG] Typing email address with three domain segments, auto-link leaves editor in broken state #542

Closed mrcrowl closed 2 months ago

mrcrowl commented 2 months ago

If you want to ask for support or request features, sponsor the project and contact me over email.

Describe the bug Typing an email address with more than two domain levels leaves the editor in a broken state (e.g. test@telstra.com.au) due to auto-link plugin.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://mdxeditor.dev/editor/demo
  2. Insert a cursor on a new line.
  3. Start typing an email address with more than three domain segments (e.g. test@telstra.com.au)
  4. When the .com part is typed the email is "auto-linked".
  5. After continuing to type .au the backspace key no longer works (it selects the text instead of removing).
  6. Console shows errors (on a local build, the errors are similar to this):
    Error: Expected node 13 to have a parent.
    at _TextNode.getParentOrThrow (Lexical.dev.mjs:3460:15)
    at $shouldInsertTextAfterOrBeforeTextNode (Lexical.dev.mjs:1032:23)
    at $shouldPreventDefaultAndInsertText (Lexical.dev.mjs:2398:3)
    at Lexical.dev.mjs:2689:34
    at $beginUpdate (Lexical.dev.mjs:8093:5)
    at updateEditor (Lexical.dev.mjs:8169:5)
    at onBeforeInput (Lexical.dev.mjs:2607:3)
    at Lexical.dev.mjs:2344:61
    at HTMLDivElement.<anonymous> (Lexical.dev.mjs:3163:9)

Expected behavior After typing .au the full email address should have been converted into a link, and the editor state should remain editable.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

petyosi commented 2 months ago

This is entirely a Lexical behavior, have you searched for a similar problem on their side?

mrcrowl commented 2 months ago

The same test works correctly on the lexical playground site: https://playground.lexical.dev/

petyosi commented 2 months ago

Searching for issues in their repo found this - https://github.com/facebook/lexical/issues/6430.

Since this will be fixed once Lexical releases a new version, I will close this issue.

mrcrowl commented 2 months ago

facebook/lexical has now released v0.17.0. Is there a rough timeframe for when this update will be included in mdx-editor?

github-actions[bot] commented 2 months ago

:tada: This issue has been resolved in version 3.11.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: