-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Editable: Adding a prop to opt-for formatting controls #618
Conversation
cdb9fc6
to
e61871c
Compare
blocks/components/editable/index.js
Outdated
@@ -366,7 +366,7 @@ export default class Editable extends wp.element.Component { | |||
} | |||
|
|||
render() { | |||
const { tagName: Tag = 'div', style, focus, className, showAlignments = false } = this.props; | |||
const { tagName: Tag = 'div', style, focus, className, showAlignments = false, formatttingControls } = this.props; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
triple t
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙃
e61871c
to
b3dab99
Compare
isActive: !! formats[ control.format ] | ||
} ) ); | ||
|
||
if ( enabledControls.indexOf( 'link' ) !== -1 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is only link being singled out here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it has a different behaviour (different onClick
and isActive
props)
Thanks! Looks good to me, though some comments in the code would be good to have. |
b3dab99
to
e8cac35
Compare
This PR adds a
formatttingControls
prop to theEditable
component to choose which formatting controls to show.Usage:
formattingControls={ [ 'bold', 'italic' ] }