-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Editable: Adding an inline link control to the format toolbar #524
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
Changes from 1 commit
28b7e06
d6a006c
609f2a5
328b212
31a5778
910d2dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| * External dependencies | ||
| */ | ||
| import classnames from 'classnames'; | ||
| import { last, isEqual, capitalize, omitBy } from 'lodash'; | ||
| import { last, isEqual, capitalize, omitBy, forEach } from 'lodash'; | ||
| import { nodeListToReact } from 'dom-react'; | ||
| import { Fill } from 'react-slot-fill'; | ||
| import 'element-closest'; | ||
|
|
@@ -319,8 +319,7 @@ export default class Editable extends wp.element.Component { | |
| changeFormats( formats ) { | ||
| this.editor.focus(); | ||
|
|
||
| Object.keys( formats ).forEach( format => { | ||
| const formatValue = formats[ format ]; | ||
| forEach( formats, ( formatValue, format ) => { | ||
| if ( format === 'link' ) { | ||
| if ( formatValue !== undefined ) { | ||
|
||
| this.editor.execCommand( 'mceInsertLink', true, formatValue ); | ||
|
|
||
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.
Based on the distinctly unique treatment between links and other formatting, I'm wondering if they ought to be handled separately. Maybe not; I do like the single
onChangeprop applied to the toolbar component.