Skip to content

Commit

Permalink
Editor: Pass meta updates from block as patch
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Nov 8, 2018
1 parent d76a250 commit 7b6bccd
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
@@ -164,21 +164,14 @@ export class BlockListBlock extends Component {

const metaAttributes = reduce( attributes, ( result, value, key ) => {
if ( get( type, [ 'attributes', key, 'source' ] ) === 'meta' ) {
const metaKey = type.attributes[ key ].meta;
result = {
previous: { [ metaKey ]: this.props.meta[ metaKey ] },
edits: { [ metaKey ]: value },
};
result[ type.attributes[ key ].meta ] = value;
}

return result;
}, {} );

if ( size( metaAttributes ) ) {
this.props.onMetaChange( {
...metaAttributes.previous,
...metaAttributes.edits,
} );
this.props.onMetaChange( metaAttributes );
}
}

@@ -597,7 +590,6 @@ const applyWithSelect = withSelect( ( select, { clientId, rootClientId, isLargeV
isTyping,
isCaretWithinFormattedText,
getBlockIndex,
getEditedPostAttribute,
getBlockMode,
isSelectionEnabled,
getSelectedBlocksInitialCaretPosition,
@@ -623,7 +615,6 @@ const applyWithSelect = withSelect( ( select, { clientId, rootClientId, isLargeV
isTypingWithinBlock: ( isSelected || isParentOfSelectedBlock ) && isTyping(),
isCaretWithinFormattedText: isCaretWithinFormattedText(),
order: getBlockIndex( clientId, rootClientId ),
meta: getEditedPostAttribute( 'meta' ),
mode: getBlockMode( clientId ),
isSelectionEnabled: isSelectionEnabled(),
initialPosition: getSelectedBlocksInitialCaretPosition(),

0 comments on commit 7b6bccd

Please sign in to comment.