-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Block API: stabilize light block hook #25642
Conversation
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 agree it's stable enough but the other question is whether we'd also rename the "lightBlockWrapper": true
as apiVersion: 2
top-level on the settings in order to be able to do similar changes on the future?
I like versioning it |
85fd04c
to
d2d432d
Compare
Size Change: -41 B (0%) Total Size: 1.18 MB
ℹ️ View Unchanged
|
The only thing needed before stabilisation is #25644. |
I like the idea of an |
b3d24ff
to
28c1c86
Compare
5b4697a
to
1375643
Compare
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.
This is looking good for me.
I think we'd need some good documentation about this for the release and in the handbook.
packages/block-editor/src/components/block-list/block-wrapper.js
Outdated
Show resolved
Hide resolved
packages/block-editor/src/components/block-list/block-wrapper.js
Outdated
Show resolved
Hide resolved
8dd382f
to
7b23e31
Compare
7b23e31
to
8db8143
Compare
@@ -558,6 +558,26 @@ _Related_ | |||
|
|||
Undocumented declaration. | |||
|
|||
<a name="useBlockProps" href="#useBlockProps">#</a> **useBlockProps** |
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.
Noting that useBlockProps.save
isn't documented. I guess it's too late to expose it under its own name.
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.
We discussed this and we preferred to use that notation because we'll have the same thing for innerblocks, richtext, and each one of this have a version for edit and for save.
And we plan to document this properly see the PR description here #26100
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.
Cool, makes sense to follow the same pattern, although it isn't ideal moving forward :)
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.
What's not ideal moving forward?
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.
The dot notation that takes advantage of the fact that a function is also an object in JS.
Description
Blocked by #25644.
This is solid and ready to be used by plugins.
Remaining questions:
Rename toYesuseBlockProps
? Inner blocks: try hook approach #25633 (comment)Keep theVersionlightBlockWrapper
supports key or introduce versioning?After this we should update documentation with the new recommended API, e.g. https://developer.wordpress.org/block-editor/developers/block-api/block-edit-save/.
How has this been tested?
Screenshots
Types of changes
Checklist: