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

Quality: Remove "reusable block name hint" code #63514

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 0 additions & 4 deletions packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,6 @@ _Returns_

- `JSX.Element`: A React element.

### ReusableBlocksRenameHint

Undocumented declaration.

Comment on lines -733 to -736
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this a public component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I just realized that this component is both private and public at the same time 😅

According to WPdirectory's results, there are two plugins other than the Gutenberg plugin that use this component.

Should we keep this component?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if those two plugins are bundling the block-editor package. I can't find the ReusableBlocksRenameHint instance in their codebase.

The same is probably true for the "Kubio AI Page Builder" plugin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I downloaded the two plugins. Neither plugin has pre-build code, but looking at the build files, it doesn't look like they use this component.

Therefore, I think it's safe to delete it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it should be okay. Let's wait until tomorrow if others have different opinions regarding the public component.

### RichText

_Related_
Expand Down
5 changes: 0 additions & 5 deletions packages/block-editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,3 @@ export { useBlockEditingMode } from './block-editing-mode';
export { default as BlockEditorProvider } from './provider';
export { useSettings, useSetting } from './use-settings';
export { useBlockCommands } from './use-block-commands';

/*
* The following rename hint component can be removed in 6.4.
*/
export { default as ReusableBlocksRenameHint } from './inserter/reusable-block-rename-hint';

This file was deleted.

24 changes: 0 additions & 24 deletions packages/block-editor/src/components/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -655,30 +655,6 @@ $block-inserter-tabs-height: 44px;
margin: $grid-unit-20 $grid-unit-20 0;
}

.reusable-blocks-menu-items__rename-hint {
align-items: top;
background: $gray-100;
border-radius: $radius-block-ui;
color: $gray-900;
display: flex;
flex-direction: row;
max-width: 380px;
}

.reusable-blocks-menu-items__rename-hint-content {
margin: $grid-unit-15 0 $grid-unit-15 $grid-unit-15;
}

.reusable-blocks-menu-items__rename-hint-dismiss {
// The dismiss button has a lot of empty space through its padding.
// Apply margin to visually align the icon with the top of the text to its left.
margin: $grid-unit-05 $grid-unit-05 $grid-unit-05 0;
}

.components-menu-group .reusable-blocks-menu-items__rename-hint {
margin: 0;
}

.block-editor-patterns__sync-status-filter {
.components-input-control__container {
select.components-select-control__input {
Expand Down
6 changes: 0 additions & 6 deletions packages/block-editor/src/private-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ import {
import DimensionsTool from './components/dimensions-tool';
import ResolutionTool from './components/resolution-tool';
import TextAlignmentControl from './components/text-alignment-control';
import {
default as ReusableBlocksRenameHint,
useReusableBlocksRenameHint,
} from './components/inserter/reusable-block-rename-hint';
import { usesContextKey } from './components/rich-text/format-edit';
import { ExperimentalBlockCanvas } from './components/block-canvas';
import { getDuotoneFilter } from './components/duotone/utils';
Expand Down Expand Up @@ -82,8 +78,6 @@ lock( privateApis, {
ResolutionTool,
TabbedSidebar,
TextAlignmentControl,
ReusableBlocksRenameHint,
useReusableBlocksRenameHint,
usesContextKey,
useFlashEditableBlocks,
globalStylesDataKey,
Expand Down
10 changes: 0 additions & 10 deletions packages/edit-post/src/components/init-pattern-modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ import {
} from '@wordpress/components';
import { useEffect, useState } from '@wordpress/element';
import { store as editorStore } from '@wordpress/editor';
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';

/**
* Internal dependencies
*/

import { unlock } from '../../lock-unlock';

const { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );

export default function InitPatternModal() {
const { editPost } = useDispatch( editorStore );
Expand Down Expand Up @@ -82,7 +73,6 @@ export default function InitPatternModal() {
__nextHasNoMarginBottom
__next40pxDefaultSize
/>
<ReusableBlocksRenameHint />
<ToggleControl
label={ _x( 'Synced', 'pattern (singular)' ) }
help={ __(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
* WordPress dependencies
*/
import { hasBlockSupport, isReusableBlock } from '@wordpress/blocks';
import {
store as blockEditorStore,
privateApis as blockEditorPrivateApis,
} from '@wordpress/block-editor';
import { store as blockEditorStore } from '@wordpress/block-editor';
import { useCallback, useState } from '@wordpress/element';
import {
MenuItem,
Expand All @@ -26,11 +23,6 @@ import { store as coreStore } from '@wordpress/core-data';
* Internal dependencies
*/
import { store } from '../../store';
import { unlock } from '../../lock-unlock';

const { useReusableBlocksRenameHint, ReusableBlocksRenameHint } = unlock(
blockEditorPrivateApis
);

/**
* Menu control to convert block(s) to reusable block.
Expand All @@ -46,7 +38,6 @@ export default function ReusableBlockConvertButton( {
rootClientId,
onClose,
} ) {
const showRenameHint = useReusableBlocksRenameHint();
const [ syncType, setSyncType ] = useState( undefined );
const [ isModalOpen, setIsModalOpen ] = useState( false );
const [ title, setTitle ] = useState( '' );
Expand Down Expand Up @@ -156,9 +147,7 @@ export default function ReusableBlockConvertButton( {
return (
<>
<MenuItem icon={ symbol } onClick={ () => setIsModalOpen( true ) }>
{ showRenameHint
? __( 'Create pattern/reusable block' )
: __( 'Create pattern' ) }
{ __( 'Create pattern' ) }
</MenuItem>
{ isModalOpen && (
<Modal
Expand All @@ -179,7 +168,6 @@ export default function ReusableBlockConvertButton( {
} }
>
<VStack spacing="5">
<ReusableBlocksRenameHint />
<TextControl
__nextHasNoMarginBottom
label={ __( 'Name' ) }
Expand Down
Loading