Skip to content

Commit

Permalink
Use getContentLockingParent
Browse files Browse the repository at this point in the history
Whoops, too many exclamation marks :)
  • Loading branch information
ramonjd committed Jun 11, 2024
1 parent e17d37d commit 77a02a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { __ } from '@wordpress/i18n';
*/
import { store as editorStore } from '../../store';
import { unlock } from '../../lock-unlock';
import { CONTENT_ONLY_BLOCKS } from '../provider/disable-non-page-content-blocks';

function ContentOnlySettingsMenuItems( { clientId, onClose } ) {
const { entity, onNavigateToEntityRecord, canEditTemplates } = useSelect(
Expand All @@ -27,7 +26,6 @@ function ContentOnlySettingsMenuItems( { clientId, onClose } ) {
getBlockParentsByBlockName,
getSettings,
getBlockAttributes,
getBlockName,
} = select( blockEditorStore );
const contentOnly =
getBlockEditingMode( clientId ) === 'contentOnly';
Expand All @@ -50,10 +48,10 @@ function ContentOnlySettingsMenuItems( { clientId, onClose } ) {
} else {
const { getCurrentTemplateId } = select( editorStore );
const templateId = getCurrentTemplateId();
if (
CONTENT_ONLY_BLOCKS.includes( getBlockName( clientId ) ) &&
templateId
) {
const { getContentLockingParent } = unlock(
select( blockEditorStore )
);
if ( ! getContentLockingParent( clientId ) && templateId ) {
record = select( coreStore ).getEntityRecord(
'postType',
'wp_template',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
import { useEffect } from '@wordpress/element';
import { applyFilters } from '@wordpress/hooks';

export const DEFAULT_CONTENT_ONLY_BLOCKS = [
const DEFAULT_CONTENT_ONLY_BLOCKS = [
'core/post-title',
'core/post-featured-image',
'core/post-content',
Expand Down

0 comments on commit 77a02a4

Please sign in to comment.