-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
base: main
Are you sure you want to change the base?
[lexical-playground] Fix: ListMaxIndentLevelPlugin
allows indent beyond maxDepth on paste
#6718
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
size-limit report 📦
|
packages/lexical-playground/src/plugins/ListMaxIndentLevelPlugin/index.ts
Outdated
Show resolved
Hide resolved
@mdmuhtasimfuadfahim don't forget to do the CLA as well. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Hi @ivailop7. Facebook CLA Check is done now. Please check the code. |
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.
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. |
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. |
Description
The
ListMaxIndentLevelPlugin
restricts the maximum indent level for list items based on the definedmaxDepth
. 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 setmaxDepth
.Added logic to restrict paste behaviour for lists in
ListMaxIndentLevelPlugin
, ensuring that pasted content respects the definedmaxDepth
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.