Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Quote in Quote breaking in Source mode #622

Open
2 tasks done
tsuzumiC opened this issue Oct 31, 2024 · 0 comments
Open
2 tasks done

[BUG] Quote in Quote breaking in Source mode #622

tsuzumiC opened this issue Oct 31, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@tsuzumiC
Copy link

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • I have read the documentation and cannot find an answer.

Describe the bug
You can't stack block quotes in RichText mode. It is possible for it to present them if you make them in Source mode first however so I am guessing it is the reading and conversion of the input in RichText mode that prevents it. Like If you use MarkdownShortcuts and adds a ">" at the start of a line followed by a space it starts a Block Quote but if you add it anywhere else it gets escaped.

Also, Source mode scrambles the input of ">" if you try to stack quotes. If you add this:

> This is a quote
>> A second quote

and changes to RichText it will show up correctly and if you save content externally with the onChange it will be correct, like this: > This is a quote\n>> A second quote. But if you go back to Source mode it will have converted it to > This is a quote> A second quote which, if applied by editing or saving, etc, will break it in RichText mode since it doesn't seems to know how to handle that.

I have seen other Markdown situations where > This is a quote> A second quote is valid but the RichText does not. Maybe something to do with Lexical, but I don't know.

Reproduction
Start from https://codesandbox.io/p/sandbox/mdx-editor-base-q8s7zr?file=/src/App.tsx to reproduce the problem so that I can observe the issue on my side and make sure that the fix reliably addresses it.

https://codesandbox.io/p/sandbox/mdx-editor-base-forked-cgdwkp

To Reproduce
Steps to reproduce the behavior:

  1. In Preview, go to Source mode and add
> This is a quote
>> A second quote
  1. Go to RichText mode and it should have a Quote in Quote.
  2. Go back to Source mode and it should have converted to > This is a quote> A second quote.
  3. If you edit anything in Source mode and goes back to RichText it should now show up like this

This is a quote> A second quote

Expected behavior
That either RichText mode can handle > This is a quote> A second quote, or that Source mode does not convert

> This is a quote
>> A second quote

into > This is a quote> A second quote

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Brave, Edge, Chrome
@tsuzumiC tsuzumiC added the bug Something isn't working label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant