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

Editable: Adding a prop to opt-for formatting controls #618

Merged
merged 1 commit into from
May 3, 2017

Conversation

youknowriad
Copy link
Contributor

This PR adds a formatttingControls prop to the Editable component to choose which formatting controls to show.

Usage: formattingControls={ [ 'bold', 'italic' ] }

@youknowriad youknowriad self-assigned this May 3, 2017
@youknowriad youknowriad requested a review from mtias May 3, 2017 12:48
@youknowriad youknowriad force-pushed the add/opt-in-format-controls branch from cdb9fc6 to e61871c Compare May 3, 2017 12:50
@@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

triple t :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙃

@youknowriad youknowriad force-pushed the add/opt-in-format-controls branch from e61871c to b3dab99 Compare May 3, 2017 13:19
isActive: !! formats[ control.format ]
} ) );

if ( enabledControls.indexOf( 'link' ) !== -1 ) {
Copy link
Member

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?

Copy link
Contributor Author

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)

@mtias
Copy link
Member

mtias commented May 3, 2017

Thanks! Looks good to me, though some comments in the code would be good to have.

@youknowriad youknowriad force-pushed the add/opt-in-format-controls branch from b3dab99 to e8cac35 Compare May 3, 2017 13:27
@youknowriad youknowriad merged commit 142a20b into master May 3, 2017
@youknowriad youknowriad deleted the add/opt-in-format-controls branch May 3, 2017 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants