Skip to content

When creating a new check list, set the checked value of the list item to false instead of undefined - #5978

Merged
etrepum merged 5 commits into
meta:mainfrom
standardnotes:default-checked-value
Aug 4, 2024
Merged

etrepum merged 5 commits into
meta:mainfrom
standardnotes:default-checked-value

Conversation

@amanharwara

@amanharwara amanharwara commented Apr 27, 2024 •

Copy link
Copy Markdown
Contributor

At the moment, when creating a new checklist, the newly created list item doesn't have the checked set until the user manually toggles it. This PR makes sure that the checked value is set to false and not undefined.
This also makes the behavior in line with the behavior when creating a check list using the markdown transformer.

lexical-checklist.mp4

@vercel

vercel Bot commented Apr 27, 2024 •

Copy link
Copy Markdown

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 Jun 5, 2024 8:54am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 5, 2024 8:54am

@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 27, 2024

@potatowagon potatowagon left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do u mind updating the description with recordings/screenshots to show no regressions to checklist behavior please?

Comment thread packages/lexical-list/src/formatList.ts Outdated
const listItem = $createListItemNode();
const listItem = $createListItemNode(
listType === 'check' ? false : undefined,
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wondering if its more appropriate to make the handling of this behaviour clearer inside packages/lexical-list/src/LexicalListItemNode.ts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

how about now? i've refactored LexicalListItemNode.getChecked() to always return a boolean if the parent list type is "check" and undefined otherwise.

@potatowagon

Copy link
Copy Markdown
Contributor

packages/lexical-playground/tests/e2e/List.spec.mjs:1170:3 › Nested List › Can create check list, toggle it to bullet-list and back

is breaking

@github-actions

github-actions Bot commented Jun 5, 2024 •

Copy link
Copy Markdown

size-limit report 📦

Path Size
lexical - cjs 28.33 KB (0%)
lexical - esm 28.14 KB (0%)
@lexical/rich-text - cjs 36.77 KB (0%)
@lexical/rich-text - esm 28.1 KB (0%)
@lexical/plain-text - cjs 35.35 KB (0%)
@lexical/plain-text - esm 25.33 KB (0%)
@lexical/react - cjs 38.51 KB (0%)
@lexical/react - esm 29.12 KB (0%)

@amanharwara

Copy link
Copy Markdown
Contributor Author

Sorry for the long delay. Should be fixed now.

@etrepum etrepum left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, seems reasonable to enforce this and the node transform should keep it consistent

@etrepum
etrepum added this pull request to the merge queue Aug 4, 2024
Merged via the queue into meta:main with commit f834a04 Aug 4, 2024
@amanharwara
amanharwara deleted the default-checked-value branch August 4, 2024 10:27
jkjk822 pushed a commit to jkjk822/lexical that referenced this pull request Aug 26, 2024

This branch was successfully deployed

2 active deployments
Preview – lexical-playground — 8e9a9665 Deployed Jun 5, 2024 by vercel[bot]
Preview – lexical — 8e9a9665 Deployed Jun 5, 2024 by vercel[bot]
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