From 7b6bccd33efb458dd848dff2287150a4fac0b0ac Mon Sep 17 00:00:00 2001 From: Andrew Duthie <andrew@andrewduthie.com> Date: Tue, 23 Oct 2018 13:09:05 -0400 Subject: [PATCH] Editor: Pass meta updates from block as patch --- packages/editor/src/components/block-list/block.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/packages/editor/src/components/block-list/block.js b/packages/editor/src/components/block-list/block.js index eb60ca820648bd..c3ae05d4b1c56d 100644 --- a/packages/editor/src/components/block-list/block.js +++ b/packages/editor/src/components/block-list/block.js @@ -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(),