Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Focus: rename updateFocus to setFocus and default value in state
  • Loading branch information
youknowriad committed Apr 20, 2017
commit c990b516fdadf5f348149600140464edbb32b71b
2 changes: 1 addition & 1 deletion blocks/components/editable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class Editable extends wp.element.Component {
this.editor = editor;
editor.on( 'init', this.onInit );
editor.on( 'focusout', this.onChange );
editor.on( 'NewBlock', this.onNewBlock )
editor.on( 'NewBlock', this.onNewBlock );
editor.on( 'focusin', this.onFocus );
}

Expand Down
4 changes: 2 additions & 2 deletions blocks/library/heading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ registerBlock( 'core/heading', {
} ) )
],

edit( { attributes, setAttributes, focus, updateFocus } ) {
edit( { attributes, setAttributes, focus, setFocus } ) {
const { content, tag, align } = attributes;

return (
<Editable
tagName={ tag }
value={ content }
focus={ focus }
onFocus={ updateFocus }
onFocus={ setFocus }
onChange={ ( value ) => setAttributes( { content: value } ) }
style={ align ? { textAlign: align } : null }
/>
Expand Down
4 changes: 2 additions & 2 deletions blocks/library/image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ registerBlock( 'core/image', {
caption: html( 'figcaption' )
},

edit( { attributes, setAttributes, focus, updateFocus } ) {
edit( { attributes, setAttributes, focus, setFocus } ) {
const { url, alt, caption } = attributes;

return (
Expand All @@ -31,7 +31,7 @@ registerBlock( 'core/image', {
placeholder={ wp.i18n.__( 'Write caption…' ) }
value={ caption }
focus={ focus }
onFocus={ updateFocus }
onFocus={ setFocus }
onChange={ ( value ) => setAttributes( { caption: value } ) } />
) : null }
</figure>
Expand Down
4 changes: 2 additions & 2 deletions blocks/library/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ registerBlock( 'core/list', {
}
],

edit( { attributes, focus, updateFocus } ) {
edit( { attributes, focus, setFocus } ) {
const { listType = 'ol', items = [], align } = attributes;
const content = items.map( item => {
return `<li>${ item.value }</li>`;
Expand All @@ -66,7 +66,7 @@ registerBlock( 'core/list', {
style={ align ? { textAlign: align } : null }
value={ content }
focus={ focus }
onFocus={ updateFocus }
onFocus={ setFocus }
className="blocks-list" />
);
},
Expand Down
6 changes: 3 additions & 3 deletions blocks/library/quote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ registerBlock( 'core/quote', {
citation: html( 'footer' )
},

edit( { attributes, setAttributes, focus, updateFocus } ) {
edit( { attributes, setAttributes, focus, setFocus } ) {
const { value, citation } = attributes;

return (
Expand All @@ -33,7 +33,7 @@ registerBlock( 'core/quote', {
} )
}
focus={ focus && focus.editable === 'value' ? focus : null }
onFocus={ () => updateFocus( { editable: 'value' } ) }
onFocus={ () => setFocus( { editable: 'value' } ) }
/>
{ ( citation || !! focus ) &&
<footer>
Expand All @@ -45,7 +45,7 @@ registerBlock( 'core/quote', {
} )
}
focus={ focus && focus.editable === 'citation' ? focus : null }
onFocus={ () => updateFocus( { editable: 'citation' } ) }
onFocus={ () => setFocus( { editable: 'citation' } ) }
/>
</footer>
}
Expand Down
4 changes: 2 additions & 2 deletions blocks/library/text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ registerBlock( 'core/text', {
}
],

edit( { attributes, setAttributes, insertBlockAfter, focus, updateFocus } ) {
edit( { attributes, setAttributes, insertBlockAfter, focus, setFocus } ) {
const { content, align } = attributes;

return (
Expand All @@ -57,7 +57,7 @@ registerBlock( 'core/text', {
content: fromParagraphsToValue( paragraphs )
} ) }
focus={ focus }
onFocus={ updateFocus }
onFocus={ setFocus }
style={ align ? { textAlign: align } : null }
onSplit={ ( before, after ) => {
setAttributes( { content: fromParagraphsToValue( before ) } );
Expand Down
2 changes: 1 addition & 1 deletion editor/modes/visual-editor/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default connect(
} );
},

onFocus( config = {} ) {
onFocus( config ) {
dispatch( {
type: 'UPDATE_FOCUS',
uid: ownProps.uid,
Expand Down
2 changes: 1 addition & 1 deletion editor/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export function selectedBlock( state = {}, action ) {
return {
uid: action.uid,
typing: state.uid === action.uid ? state.typing : false,
focus: action.config
focus: action.config || {}
};

case 'START_TYPING':
Expand Down