Conversation
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @khristiansnyder, @ccwalburn. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| } | ||
| } | ||
| }, | ||
| "editorStyle": "wp-block-todo-editor" |
There was a problem hiding this comment.
Do you also need a style key here?
What?
This PR adds a new core/todo block, allowing editors to embed a to-do list in posts or pages. The block supports:
Closes #15005
Why?
Editors often need lightweight checklists—whether for content preparation, collaboration tracking, or simple task lists. The core/todo block provides this functionality natively in Gutenberg, avoiding the need for custom plugins or external solutions. It supports both site-wide and local to-do use cases for logged-in users.
How?
The block uses block attributes and post meta to manage task data and sync checkbox states. It uses useEntityProp for global persistence and localStorage for per-user local mode. Role-based access is handled by checking the current user's capabilities against the allowed roles set in the block. Server-side rendering ensures frontend behavior matches the editor view, with checkbox styling and behavior controlled by inspector settings. Tasks can be added, reordered, and edited directly in the editor.
Testing Instructions
Add the Todo block to a page or post.
In the block inspector, configure:
Add several to-do items.
Toggle checkboxes as permitted:
Switch roles or log in as a different user to verify role-based toggling.
Reload the page and confirm checkbox states persist appropriately.
Screenshots or screencast