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

Editor: Remove the 'content-only' check from 'TemplatePartConverterMenuItem' #67961

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Changes from all commits
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
13 changes: 2 additions & 11 deletions packages/editor/src/components/template-part-menu-items/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,16 @@ export default function TemplatePartMenuItems() {
}

function TemplatePartConverterMenuItem( { clientIds, onClose } ) {
const { isContentOnly, blocks } = useSelect(
const { blocks } = useSelect(
( select ) => {
const { getBlocksByClientId, getBlockEditingMode } =
select( blockEditorStore );
const { getBlocksByClientId } = select( blockEditorStore );
return {
blocks: getBlocksByClientId( clientIds ),
isContentOnly:
clientIds.length === 1 &&
getBlockEditingMode( clientIds[ 0 ] ) === 'contentOnly',
};
},
[ clientIds ]
);

// Do not show the convert button if the block is in content-only mode.
if ( isContentOnly ) {
return null;
}

// Allow converting a single template part to standard blocks.
if ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {
return (
Expand Down
Loading