Skip to content

Commit

Permalink
Simplify lockAttributesEditing fallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed May 21, 2024
1 parent b3f4488 commit f66fb79
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/editor/src/bindings/post-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ export default {
},
setValue( { registry, context, args, value } ) {
const postId =
context.postId || registry.select( editorStore ).getCurrentPostId();
context?.postId ||
registry.select( editorStore ).getCurrentPostId();
const postType =
context.postType ||
context?.postType ||
registry.select( editorStore ).getCurrentPostType();
registry
.dispatch( coreDataStore )
Expand All @@ -42,13 +43,11 @@ export default {
},
} );
},
lockAttributesEditing( { select, context = {}, args } ) {
const postId = context.postId
? context.postId
: select( editorStore ).getCurrentPostId();
const postType = context.postType
? context.postType
: select( editorStore ).getCurrentPostType();
lockAttributesEditing( { select, context, args } ) {
const postId =
context?.postId || select( editorStore ).getCurrentPostId();
const postType =
context?.postType || select( editorStore ).getCurrentPostType();

// Check that editing is happening in the post editor and not a template.
if ( postType === 'wp_template' ) {
Expand Down

0 comments on commit f66fb79

Please sign in to comment.