mdx-editor / editor

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

[BUG] Cursor bug after deleting a paragraph before/after a table. #420

Closed ajboni closed 3 months ago

ajboni commented 3 months ago

Hi, this is a bit hard to explain, if you open the demo at https://mdxeditor.dev/editor/demo and replace the content with this table:

| 1 | 2 | 3 |
| - | - | - |
| a | b | c |
| e | e | f |

then go back to editing mode and delete the empty paragraph after the table. The user is unable to enter text either before or after the table. in this particular example, they cannot edit the document any more.

image

Workarounds

Inerting an image or a link

petyosi commented 3 months ago

@ajboni that's a fair point, but I have no definitive idea on how to address this in an elegant way. One approach would be to always keep a paragraph at the bottom, if the last node is a decorator (table, code block, etc). This should be doable with Lexical. I will think about this.

github-actions[bot] commented 3 months ago

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

The release is available on:

Your semantic-release bot :package::rocket:

petyosi commented 3 months ago

I have done something here, for the "after" part. The before part is not so trivial, I'm afraid. Google docs seems to always keep a paragraph above the table, for example.

ajboni commented 3 months ago

Works great! I think the "after" part is the most common case, thank you!