forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Edit post: Convert tools more menu group into internal plugin (WordPr…
…ess#10194) * Edit post: Convert tools more menu group into internal plugin * Refactor check for children count in MenuGroup * Update failing snapshot test
- Loading branch information
Showing
15 changed files
with
82 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
edit-post/components/header/tools-more-menu-group/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { isEmpty } from 'lodash'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createSlotFill, MenuGroup } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
const { Fill: ToolsMoreMenuGroup, Slot } = createSlotFill( 'ToolsMoreMenuGroup' ); | ||
|
||
ToolsMoreMenuGroup.Slot = ( { fillProps } ) => ( | ||
<Slot fillProps={ fillProps }> | ||
{ ( fills ) => ! isEmpty( fills ) && ( | ||
<MenuGroup label={ __( 'Tools' ) }> | ||
{ fills } | ||
</MenuGroup> | ||
) } | ||
</Slot> | ||
); | ||
|
||
export default ToolsMoreMenuGroup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ | |
* Internal dependencies | ||
*/ | ||
import './components'; | ||
import './more-menu'; | ||
import './validate-multiple-use'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { MenuItem } from '@wordpress/components'; | ||
import { Fragment } from '@wordpress/element'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { registerPlugin } from '@wordpress/plugins'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import CopyContentMenuItem from './copy-content-menu-item'; | ||
import KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item'; | ||
import PublishSidebarToggleMenuItem from './publish-sidebar-toggle-menu-item'; | ||
import TipsToggleMenuItem from './tips-toggle-menu-item'; | ||
import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group'; | ||
|
||
registerPlugin( 'edit-post', { | ||
render() { | ||
return ( | ||
<Fragment> | ||
<ToolsMoreMenuGroup> | ||
{ ( { onClose } ) => ( | ||
<Fragment> | ||
<MenuItem | ||
role="menuitem" | ||
href="edit.php?post_type=wp_block" | ||
> | ||
{ __( 'Manage All Reusable Blocks' ) } | ||
</MenuItem> | ||
<TipsToggleMenuItem onToggle={ onClose } /> | ||
<PublishSidebarToggleMenuItem onToggle={ onClose } /> | ||
<KeyboardShortcutsHelpMenuItem onSelect={ onClose } /> | ||
<CopyContentMenuItem /> | ||
</Fragment> | ||
) } | ||
</ToolsMoreMenuGroup> | ||
</Fragment> | ||
); | ||
}, | ||
} ); |
8 changes: 2 additions & 6 deletions
8
...eyboard-shortcuts-help-menu-item/index.js → ...eyboard-shortcuts-help-menu-item/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters