-
Notifications
You must be signed in to change notification settings - Fork 11
Conversation
src/gutenberg-packages/frontend.js
Outdated
) | ||
|
||
for ( const attr in sourcedAttributes ) { | ||
attributes[ attr ] = matcherFromSource( sourcedAttributes[ attr ] )( this ); |
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.
matcherFromSource
is a wrapper around hpq
's parsing functions (e.g. text
or html
) , which expects a DOM element tree. Good thing that this
is one! 😄
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 great 🙂
I was originally planning to add support for more attribute sources here ( So maybe this is ready for review/merging? |
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.
Sure, approved so you can merge as you please 🙂
However, would you mind adding a non-sourced attribute before you do so? Just a simple one can do. If not, the demo won't ship any non-sourced attribute anymore.
Thanks, good point! I made the counter value an attribute (i.e. it's now possible to set the initial counter value from the editor). (Changing it on the frontend won't persist it, though.) |
Okay, Imma go ahead and merge this 🙂 |
Awesome. Thank you, Bernie 🙂 |
Here's a very bare-bones, WIP, implementation of attribute sourcing.
For more background, refer to @luisherranz' great video in #27.
Feel free to pick it up and play with it; otherwise, I'll continue working on it on Friday 🙂