Skip to content

Commit

Permalink
Merge pull request #37 from wordpress-mobile/feature/new-more-block
Browse files Browse the repository at this point in the history
Support for the more block
  • Loading branch information
hypest authored Apr 18, 2018
2 parents bdd4f60 + 359eae6 commit 8c8deee
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions block-management/block-holder.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default class BlockHolder extends React.Component<PropsType, StateType> {
attributes={ { ...this.props.attributes } }
// pass a curried version of onChanged with just one argument
setAttributes={ attrs => this.props.onChange( this.props.uid, attrs ) }
isSelected={ this.props.focused }
style={ style }
/>
);
Expand Down
7 changes: 6 additions & 1 deletion store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type BlockType = {
uid: string,
name: string,
isValid: boolean,
attributes: { content: string },
attributes: Object,
innerBlocks: Array<BlockType>,
focused: boolean,
};
Expand All @@ -30,6 +30,10 @@ const codeBlockInstance = createBlock( 'core/code', {
content: 'if name == "World":\n return "Hello World"\nelse:\n return "Hello Pony"',
} );

const moreBlockInstance = createBlock( 'core/more', {
customText: undefined,
} );

const initialState: StateType = {
// TODO: get blocks list block state should be externalized (shared with Gutenberg at some point?).
// If not it should be created from a string parsing (commented HTML to json).
Expand Down Expand Up @@ -67,6 +71,7 @@ const initialState: StateType = {
focused: false,
},
{ ...codeBlockInstance, focused: false },
{ ...moreBlockInstance, focused: false },
{
uid: '4',
name: 'paragraph',
Expand Down
1 change: 1 addition & 0 deletions store/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const reducer = (
...block,
attributes: nextAttributes,
};

return { blocks: blocks, refresh: ! state.refresh };
}
case ActionTypes.BLOCK.FOCUS: {
Expand Down

0 comments on commit 8c8deee

Please sign in to comment.