The Block API of Gutenberg supports post meta as source.
To render UI we extend Component and implement the method.
For this example I used PanelColor component which allows user to select color.
updateMeta } } > < PluginSidebar> < Fragment> ) } }...
Now we need component which is used to fetch the data, in this case our post meta..
Fetch the post meta const applyWithSelect = withSelect => { const { getEditedPostAttribute } = select return { meta getEditedPostAttribute, } } )..
Provide method to update post meta const applyWithDispatch = withDispatch => { const { editPost } = dispatch return { updateMeta { editPost Important Old and new meta need to be merged in non-mutating way }, } } )..
Combine the higher-order components const render = compose ..
registerPlugin ..
July 2018 Categories Development Tags gutenberg Leave comment on How to edit post meta outside of Gutenberg Block...
Read more