-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Formatting API * Fix image test * WIP: create format lib * Adjust internal value to use format attributes and name instead of element properties * Add activeAttributes prop * Add FillToolbarSlot and Shortcut * Editor: Add keyboard shortcuts support for formatters * Fix rebase error * Fix shortcuts * Remove registerCoreFormats * Address feedback * Simplify filling slots * Fix typos * Fix inserter, move url function * Fix rebase error * Enqueue format library styles * Fix formatting on collapsed selection * Remove Token API * Remove obsolete RichText.Siblings slot * Remove all style imports * Fix after rebase * Fix dependency issue * Use stable key for list of blocks in the inserter * Fix Eslint issue for unsuded lodash method * Move Inline Elements to its own component * Import rich-text store only in the entry point (follow other modules) * Rich Text: Expose unregister format type method * Don't use index for React element keys
- Loading branch information
Showing
81 changed files
with
1,672 additions
and
1,058 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
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
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,50 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import classnames from 'classnames'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import IconButton from '../icon-button'; | ||
import ToolbarButtonContainer from './toolbar-button-container'; | ||
|
||
function ToolbarButton( { | ||
containerClassName, | ||
icon, | ||
title, | ||
shortcut, | ||
subscript, | ||
onClick, | ||
className, | ||
isActive, | ||
isDisabled, | ||
extraProps, | ||
children, | ||
} ) { | ||
return ( | ||
<ToolbarButtonContainer className={ containerClassName }> | ||
<IconButton | ||
icon={ icon } | ||
label={ title } | ||
shortcut={ shortcut } | ||
data-subscript={ subscript } | ||
onClick={ ( event ) => { | ||
event.stopPropagation(); | ||
onClick(); | ||
} } | ||
className={ classnames( | ||
'components-toolbar__control', | ||
className, | ||
{ 'is-active': isActive } | ||
) } | ||
aria-pressed={ isActive } | ||
disabled={ isDisabled } | ||
{ ...extraProps } | ||
/> | ||
{ children } | ||
</ToolbarButtonContainer> | ||
); | ||
} | ||
|
||
export default ToolbarButton; |
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,77 @@ | ||
.components-toolbar__control.components-button { | ||
display: inline-flex; | ||
align-items: flex-end; | ||
margin: 0; | ||
padding: 3px; | ||
outline: none; | ||
cursor: pointer; | ||
position: relative; | ||
width: $icon-button-size; | ||
height: $icon-button-size; | ||
|
||
// Unset icon button styles | ||
&:active, | ||
&:not([aria-disabled="true"]):hover, | ||
&:not([aria-disabled="true"]):focus { | ||
outline: none; | ||
box-shadow: none; | ||
background: none; | ||
border: none; | ||
} | ||
|
||
// Disabled | ||
&:disabled { | ||
cursor: default; | ||
} | ||
|
||
& > svg { | ||
padding: 5px; | ||
border-radius: $radius-round-rectangle; | ||
height: 30px; | ||
width: 30px; | ||
} | ||
|
||
// Subscript for numbered icon buttons, like headings | ||
&[data-subscript] svg { | ||
padding: 5px 10px 5px 0; | ||
} | ||
|
||
&[data-subscript]::after { | ||
content: attr(data-subscript); | ||
font-family: $default-font; | ||
font-size: $default-font-size; | ||
font-weight: 600; | ||
line-height: 12px; | ||
position: absolute; | ||
right: 8px; | ||
bottom: 10px; | ||
} | ||
|
||
// Assign hover style to child element, not the button itself | ||
&:not(:disabled):not([aria-disabled="true"]):hover { | ||
box-shadow: none; | ||
} | ||
|
||
&:not(:disabled).is-active > svg, | ||
&:not(:disabled):hover > svg { | ||
@include formatting-button-style__hover; | ||
} | ||
|
||
// Active & toggled style | ||
&:not(:disabled).is-active > svg { | ||
@include formatting-button-style__active; | ||
} | ||
|
||
&:not(:disabled).is-active[data-subscript]::after { | ||
color: $white; | ||
} | ||
|
||
// Focus style | ||
&:not(:disabled):focus > svg { | ||
@include formatting-button-style__focus; | ||
} | ||
} | ||
|
||
.components-toolbar__control .dashicon { | ||
display: block; | ||
} |
File renamed without changes.
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 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
Oops, something went wrong.