-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add indented list support #1658
Conversation
fantactuka
commented
Apr 12, 2022
- Indented lists
- Merge lists
- Inline code
This pull request is being automatically deployed with Vercel (learn more). lexical – ./packages/lexical-website🔍 Inspect: https://vercel.com/fbopensource/lexical/GsBeCtq2J8ewda8hAx6o1hk1HjSo lexical-playground – ./packages/lexical-playground🔍 Inspect: https://vercel.com/fbopensource/lexical-playground/5rPnsjLjAoQfxbTDXahxXCnKkbCk lexical-website-new – ./packages/lexical-website-new🔍 Inspect: https://vercel.com/fbopensource/lexical-website-new/FigBgiGaLbSoiddEcEaV6j73K9Ky |
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.
Seems fine, but should we add a test or two?
d044313
to
47365fd
Compare
47365fd
to
699cca5
Compare
699cca5
to
04739a2
Compare
@@ -212,15 +214,15 @@ const markdownBlockQuote: MarkdownCriteria = { | |||
const markdownUnorderedListDash: MarkdownCriteria = { | |||
...paragraphStartBase, | |||
markdownFormatKind: 'paragraphUnorderedList', | |||
regEx: /^(?:- )/, | |||
regExForAutoFormatting: /^(?:- )/, | |||
regEx: /^(\s{0,10})(?:- )/, |
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.
nit: should this 10 be a configurable constant? This is max indent level, right?
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.
There's actually no hard requirement to have limit here at all, IIRC we have 10 as max indention level anyways so even if user puts 30 spaces it still 10 nested lists max. WDYT?
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.
Yea it makes sense...someone made a MaxIndentLevel plugin though, I think, so I wonder how this interacts with that if you set the limit to like 5 in the plugin props.
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.
Great PR. I'll wait until you address Acy's feedback before approving.
const listItem = $createListItemNode(); | ||
const indentMatch = | ||
patternMatchResults.regExCaptureGroups[0].text.match(/^\s*/); | ||
const indent = indentMatch ? Math.floor(indentMatch[0].length / 2) : 0; |
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.
We need to use 4 vs 2 to match existing PC behavior.
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.
Looks like Acy's comments were not blockers.
04739a2
to
08a6e4f
Compare
08a6e4f
to
bc6e080
Compare