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

[lexical-playground] Fix: ListMaxIndentLevelPlugin allows indent beyond maxDepth on paste #6718

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mdmuhtasimfuadfahim
Copy link

@mdmuhtasimfuadfahim mdmuhtasimfuadfahim commented Oct 9, 2024

Description

The ListMaxIndentLevelPlugin restricts the maximum indent level for list items based on the defined maxDepth. However, when pasting content with a deeper indent, the plugin doesn't automatically enforce this restriction. This allows the pasted content to exceed the allowed indent level, resulting in a higher indent depth than the set maxDepth.

Added logic to restrict paste behaviour for lists in ListMaxIndentLevelPlugin, ensuring that pasted content respects the defined maxDepth and prevents exceeding the allowed indent level.

Closes #5170

Test plan

Before

max-depth-issue.mp4

URL: https://d.pr/v/IRF0rH

After

mex-depth-solved.mp4

URL: https://d.pr/v/zw3uMQ

Note: The solution restricts pasting beyond indent level 7, ensuring the list structure stays within the defined limit.

Copy link

vercel bot commented Oct 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 13, 2024 4:22am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 13, 2024 4:22am

@facebook-github-bot
Copy link
Contributor

Hi @mdmuhtasimfuadfahim!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

Copy link

github-actions bot commented Oct 9, 2024

size-limit report 📦

Path Size
lexical - cjs 29.94 KB (0%)
lexical - esm 29.81 KB (0%)
@lexical/rich-text - cjs 38.54 KB (0%)
@lexical/rich-text - esm 31.61 KB (0%)
@lexical/plain-text - cjs 37.15 KB (0%)
@lexical/plain-text - esm 28.99 KB (0%)
@lexical/react - cjs 40.34 KB (0%)
@lexical/react - esm 33.08 KB (0%)

@ivailop7
Copy link
Collaborator

ivailop7 commented Oct 12, 2024

@mdmuhtasimfuadfahim don't forget to do the CLA as well. Thanks!

@mdmuhtasimfuadfahim
Copy link
Author

mdmuhtasimfuadfahim commented Oct 13, 2024

**ivailop7 ** c

Hi @ivailop7. I have updated the code. Please check and signed here https://code.facebook.com/cla with the same email I did the commits. I guess it will take 1 hour.

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 Oct 13, 2024
@mdmuhtasimfuadfahim
Copy link
Author

Hi @ivailop7. Facebook CLA Check is done now. Please check the code.

@ivailop7 ivailop7 added the extended-tests Run extended e2e tests on a PR label Oct 13, 2024
Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what this does is prevent pasting at all when the indent is at the limit (even if the paste is just plain text), it doesn't prevent the problem from happening if the pasted content contains multiple levels of indent

@mdmuhtasimfuadfahim
Copy link
Author

mdmuhtasimfuadfahim commented Oct 15, 2024

I think what this does is prevent pasting at all when the indent is at the limit (even if the paste is just plain text), it doesn't prevent the problem from happening if the pasted content contains multiple levels of indent

Hi @etrepum. If I don't prevent the pasting when the limit hits it generates the issue #5170. Well let me check if I can allow the pasting for text but not to increase the indent level.

@etrepum
Copy link
Collaborator

etrepum commented Oct 15, 2024

Yes, I understand that this prevents one situation where this issue happens, but I don't think it's a complete fix because pasted content can have embedded indentation. I also think it also prevents certain pastes that are expected to work. Possibly the only way to make this solution complete without unintended consequences would be through node transforms and not just commands.

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. extended-tests Run extended e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: ListMaxIndentLevelPlugin allows indent beyond maxDepth on paste
5 participants