-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[lexical-markdown][lexical-playground] Bug Fix: Keep indent when switching with markdown #7845
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
base: main
Are you sure you want to change the base?
[lexical-markdown][lexical-playground] Bug Fix: Keep indent when switching with markdown #7845
Conversation
This transformer allows to keep indentation when switching with markdown
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Failing lint https://github.com/facebook/lexical/actions/runs/17919434734/job/50950181819?pr=7845 |
|
Now the prettier check is failing https://github.com/facebook/lexical/actions/runs/17919849090/job/50951631139 You can run the integrity checks locally with |
# Conflicts: # packages/lexical-markdown/src/MarkdownTransformers.ts
|
Given it's not a standard spec transformation, it might be better to keep it as a separate exported transformer instead of including it into default transformers set. And then add it explicitly into playground's transformers list |
- Remove INDENT from TEXT_MATCH_TRANSFORMERS - Export INDENT and use it in playground Signed-off-by: Simon Bauchet <[email protected]>
# Conflicts: # packages/lexical-markdown/src/MarkdownTransformers.ts # packages/lexical-markdown/src/__tests__/unit/LexicalMarkdown.test.ts
|
Is there some way to run tests in a linux environment or should I test it in a vm ? |
| return; | ||
| } | ||
| parentNode.setIndent(indents.length); | ||
| textNode.setTextContent(textNode.getTextContent().replace(/^\t+/, '')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like maybe there's a bug elsewhere because tabs are usually supposed to use TabNode
Co-authored-by: Bob Ippolito <[email protected]>
Description
Reported issue: #7820
To summarize, if you use indent button and then switch to markdown, indent will be lost.
I decided to fix this issue by adding a transformer by I think it could also be fixed by handling it directly in
createMarkdownExportandcreateMarkdownImportThis transformer simply add '\t' when exporting to markdown and remove those '\t' and set indent when importing from markdown. This only happen if '\t' is found at the beginning of the string and if the parent is a paragraph to avoid applying it to lists.
Closes #7820