From 17c6e768fcf100cc344519ed3fa8f3434e5097a1 Mon Sep 17 00:00:00 2001 From: Ella Date: Sat, 13 Apr 2024 21:01:55 +0300 Subject: [PATCH] Block bindings: allow editing post meta (new API) --- packages/editor/src/bindings/post-meta.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/editor/src/bindings/post-meta.js b/packages/editor/src/bindings/post-meta.js index f5b3b526dbfd4a..287e9aeb09d718 100644 --- a/packages/editor/src/bindings/post-meta.js +++ b/packages/editor/src/bindings/post-meta.js @@ -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, };