Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List view: show context menu for content-only blocks in posts #62354

Merged
merged 6 commits into from
Jun 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check for content blocks
  • Loading branch information
ramonjd committed Jun 11, 2024
commit e17d37defad081a572b518b55fac3c3c85a9367b
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ 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(
@@ -26,6 +27,7 @@ function ContentOnlySettingsMenuItems( { clientId, onClose } ) {
getBlockParentsByBlockName,
getSettings,
getBlockAttributes,
getBlockName,
} = select( blockEditorStore );
const contentOnly =
getBlockEditingMode( clientId ) === 'contentOnly';
@@ -48,7 +50,10 @@ function ContentOnlySettingsMenuItems( { clientId, onClose } ) {
} else {
const { getCurrentTemplateId } = select( editorStore );
const templateId = getCurrentTemplateId();
if ( templateId ) {
if (
CONTENT_ONLY_BLOCKS.includes( getBlockName( clientId ) ) &&
templateId
) {
record = select( coreStore ).getEntityRecord(
'postType',
'wp_template',
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
import { useEffect } from '@wordpress/element';
import { applyFilters } from '@wordpress/hooks';

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