-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Open
Labels
[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Feature] ExtensibilityThe ability to extend blocks or the editing experienceThe ability to extend blocks or the editing experience[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Milestone
Description
Describe the bug
When an attribute isn't changed, the value will not be written into the serialized html comment, which in fact, makes it unaccessible for PHPs render_callback
-function.
To Reproduce
Steps to reproduce the behavior:
- Make a custom block
- Add a sourceless attribute with default value
attributes: {
myNumber: {
type: "number",
default: 1, // this number won't appear in the html comments
}
}
- Do not alter the attribute
- Save the content
var_dump()
the$attribues
in'render_callback
5b. or look into database, the html comment doesn't contain 'number'- Be sad 'number' isn't there :'(
Expected behavior
To avoid syncing the defaults in both php and js, I expect gutenberg to save defaults into the html comment aswell.
Desktop (please complete the following information):
- OS: MacOS High Sierra
- Browser Doesn't matter
- Version Doesn't matter
Additional context
- Gutenberg Version 3.0.1
skorasaurus, gsarig, kantbtrue, zahardev, lflorent and 6 more
Metadata
Metadata
Assignees
Labels
[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Feature] ExtensibilityThe ability to extend blocks or the editing experienceThe ability to extend blocks or the editing experience[Type] EnhancementA suggestion for improvement.A suggestion for improvement.