-
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.
Merge pull request #11 from shimotmk/update_format
update format
- Loading branch information
Showing
16 changed files
with
99 additions
and
153 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
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,70 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import clsx from 'clsx'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { BlockFormatControls } from '@wordpress/block-editor'; | ||
import { registerFormatType } from '@wordpress/rich-text'; | ||
import { ToolbarItem, Slot, DropdownMenu } from '@wordpress/components'; | ||
import { Icon } from '@wordpress/icons'; | ||
|
||
import { blockCategoryIcon } from '../../icons'; | ||
|
||
const POPOVER_PROPS = { | ||
placement: 'bottom-start', | ||
}; | ||
|
||
const BlockToolbar = () => { | ||
return ( | ||
<BlockFormatControls> | ||
<Slot name={ `RichText.ToolbarControls.moneMenu` }> | ||
{ ( fills ) => { | ||
if ( ! fills.length ) { | ||
return null; | ||
} | ||
|
||
const allProps = fills.map( ( [ { props } ] ) => props ); | ||
const hasActive = allProps.some( | ||
( { isActive } ) => isActive | ||
); | ||
|
||
return ( | ||
<ToolbarItem> | ||
{ ( toggleProps ) => ( | ||
<DropdownMenu | ||
icon={ <Icon icon={ blockCategoryIcon } /> } | ||
label={ __( 'Mone Menu', 'mone' ) } | ||
toggleProps={ { | ||
...toggleProps, | ||
className: clsx( | ||
toggleProps.className, | ||
{ 'is-pressed': hasActive } | ||
), | ||
description: __( | ||
'Displays more mone tools' | ||
), | ||
} } | ||
controls={ fills.map( | ||
( [ { props } ] ) => props | ||
) } | ||
popoverProps={ POPOVER_PROPS } | ||
/> | ||
) } | ||
</ToolbarItem> | ||
); | ||
} } | ||
</Slot> | ||
</BlockFormatControls> | ||
); | ||
}; | ||
|
||
registerFormatType( 'mone/block-toolbar', { | ||
title: __( 'Block Toolbar', 'mone' ), | ||
tagName: 'block-toolbar', | ||
className: null, | ||
edit: BlockToolbar, | ||
} ); |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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
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,7 @@ | ||
import './block-toolbar'; | ||
import './bold'; | ||
import './code'; | ||
import './font-size'; | ||
import './icon'; | ||
|
||
import './style.scss'; |
45 changes: 12 additions & 33 deletions
45
src/format-library/icon/index.php → src/format-library/index.php
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@import './code/style.scss'; | ||
@import './icon/style.scss'; |