Skip to content

Commit

Permalink
Block bindings: allow editing post meta (new API)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Apr 17, 2024
1 parent 06d7e49 commit 9645c67
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/editor/src/bindings/post-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,17 @@ export default {
.getEditedEntityRecord( 'postType', postType, context.postId )
.meta?.[ args.key ];
},
setValue( { registry, context, args, value } ) {
const postType = context.postType
? context.postType
: registry.select( editorStore ).getCurrentPostType();
registry
.dispatch( coreDataStore )
.editEntityRecord( 'postType', postType, context.postId, {
meta: {
[ args.key ]: value,
},
} );
},
lockAttributesEditing: false,
};

0 comments on commit 9645c67

Please sign in to comment.