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

Add indented list support #1658

Merged
merged 1 commit into from
Apr 13, 2022
Merged

Add indented list support #1658

merged 1 commit into from
Apr 13, 2022

Conversation

fantactuka
Copy link
Contributor

  • Indented lists
  • Merge lists
  • Inline code

@fantactuka fantactuka requested a review from kraisler April 12, 2022 14:20
@vercel
Copy link

vercel bot commented Apr 12, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

lexical – ./packages/lexical-website

🔍 Inspect: https://vercel.com/fbopensource/lexical/GsBeCtq2J8ewda8hAx6o1hk1HjSo
✅ Preview: https://lexical-git-markdown-indented-list-fbopensource.vercel.app

lexical-playground – ./packages/lexical-playground

🔍 Inspect: https://vercel.com/fbopensource/lexical-playground/5rPnsjLjAoQfxbTDXahxXCnKkbCk
✅ Preview: https://lexical-playground-git-markdown-indented-list-fbopensource.vercel.app

lexical-website-new – ./packages/lexical-website-new

🔍 Inspect: https://vercel.com/fbopensource/lexical-website-new/FigBgiGaLbSoiddEcEaV6j73K9Ky
✅ Preview: https://lexical-website-new-git-markdown-indented-list-fbopensource.vercel.app

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 12, 2022
Copy link
Contributor

@acywatson acywatson left a 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?

@@ -212,15 +214,15 @@ const markdownBlockQuote: MarkdownCriteria = {
const markdownUnorderedListDash: MarkdownCriteria = {
...paragraphStartBase,
markdownFormatKind: 'paragraphUnorderedList',
regEx: /^(?:- )/,
regExForAutoFormatting: /^(?:- )/,
regEx: /^(\s{0,10})(?:- )/,
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor

@kraisler kraisler left a 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;
Copy link
Contributor

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.

Copy link
Contributor

@kraisler kraisler left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants