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

Block Editor: Correctly mark Block Comment SlotFills private #67271

Merged
merged 3 commits into from
Nov 26, 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
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { pipe, useCopyToClipboard } from '@wordpress/compose';
* Internal dependencies
*/
import BlockActions from '../block-actions';
import __unstableCommentIconFill from '../../components/collab/block-comment-icon-slot';
import CommentIconSlotFill from '../../components/collab/block-comment-icon-slot';
import BlockHTMLConvertButton from './block-html-convert-button';
import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
import BlockSettingsMenuControls from '../block-settings-menu-controls';
Expand Down Expand Up @@ -295,7 +295,7 @@ export function BlockSettingsDropdown( {
</MenuItem>
</>
) }
<__unstableCommentIconFill.Slot
<CommentIconSlotFill.Slot
fillProps={ { onClose } }
/>
</MenuGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { ToolbarGroup, ToolbarItem } from '@wordpress/components';
* Internal dependencies
*/
import BlockSettingsDropdown from './block-settings-dropdown';
import __unstableCommentIconToolbarFill from '../../components/collab/block-comment-icon-toolbar-slot';
import CommentIconToolbarSlotFill from '../../components/collab/block-comment-icon-toolbar-slot';

export function BlockSettingsMenu( { clientIds, ...props } ) {
return (
<ToolbarGroup>
<__unstableCommentIconToolbarFill.Slot />
<CommentIconToolbarSlotFill.Slot />

<ToolbarItem>
{ ( toggleProps ) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
*/
import { createSlotFill } from '@wordpress/components';

const { Fill: __unstableCommentIconFill, Slot } = createSlotFill(
'__unstableCommentIconFill'
);
const CommentIconSlotFill = createSlotFill( Symbol( 'CommentIconSlotFill' ) );

__unstableCommentIconFill.Slot = Slot;

export default __unstableCommentIconFill;
export default CommentIconSlotFill;
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
*/
import { createSlotFill } from '@wordpress/components';

const { Fill: __unstableCommentIconToolbarFill, Slot } = createSlotFill(
'__unstableCommentIconToolbarFill'
const CommentIconToolbarSlotFill = createSlotFill(
Symbol( 'CommentIconToolbarSlotFill' )
);

__unstableCommentIconToolbarFill.Slot = Slot;

export default __unstableCommentIconToolbarFill;
export default CommentIconToolbarSlotFill;
8 changes: 4 additions & 4 deletions packages/block-editor/src/private-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ import { PrivatePublishDateTimePicker } from './components/publish-date-time-pic
import useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';
import useBlockDisplayTitle from './components/block-title/use-block-display-title';
import TabbedSidebar from './components/tabbed-sidebar';
import __unstableCommentIconFill from './components/collab/block-comment-icon-slot';
import __unstableCommentIconToolbarFill from './components/collab/block-comment-icon-toolbar-slot';
import CommentIconSlotFill from './components/collab/block-comment-icon-slot';
import CommentIconToolbarSlotFill from './components/collab/block-comment-icon-toolbar-slot';
/**
* Private @wordpress/block-editor APIs.
*/
Expand Down Expand Up @@ -95,6 +95,6 @@ lock( privateApis, {
__unstableBlockStyleVariationOverridesWithConfig,
setBackgroundStyleDefaults,
sectionRootClientIdKey,
__unstableCommentIconFill,
__unstableCommentIconToolbarFill,
CommentIconSlotFill,
CommentIconToolbarSlotFill,
} );
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
*/
import { unlock } from '../../lock-unlock';

const { __unstableCommentIconToolbarFill } = unlock( blockEditorPrivateApis );
const { CommentIconToolbarSlotFill } = unlock( blockEditorPrivateApis );

const AddCommentToolbarButton = ( { onClick } ) => {
return (
<__unstableCommentIconToolbarFill>
<CommentIconToolbarSlotFill.Fill>
<ToolbarButton
accessibleWhenDisabled
icon={ commentIcon }
label={ _x( 'Comment', 'View comment' ) }
onClick={ onClick }
/>
</__unstableCommentIconToolbarFill>
</CommentIconToolbarSlotFill.Fill>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
*/
import { unlock } from '../../lock-unlock';

const { __unstableCommentIconFill } = unlock( blockEditorPrivateApis );
const { CommentIconSlotFill } = unlock( blockEditorPrivateApis );

const AddCommentButton = ( { onClick } ) => {
return (
<__unstableCommentIconFill>
<CommentIconSlotFill.Fill>
<MenuItem
icon={ commentIcon }
onClick={ onClick }
aria-haspopup="dialog"
>
{ _x( 'Comment', 'Add comment button' ) }
</MenuItem>
</__unstableCommentIconFill>
</CommentIconSlotFill.Fill>
);
};

Expand Down
Loading