From cf63e10ec54eacb1322e32a3377d85b0fc8de3d4 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Mon, 16 Apr 2018 08:37:06 +0200 Subject: [PATCH] Blocks: Addressed feedback related to BlockEditContext changes --- blocks/library/paragraph/index.js | 70 ++++++++++--------- .../test/__snapshots__/index.js.snap | 44 ++++++------ docs/deprecated.md | 1 - 3 files changed, 59 insertions(+), 56 deletions(-) diff --git a/blocks/library/paragraph/index.js b/blocks/library/paragraph/index.js index 55b9822f2e85c5..f776299fda0bde 100644 --- a/blocks/library/paragraph/index.js +++ b/blocks/library/paragraph/index.js @@ -226,40 +226,42 @@ class ParagraphBlock extends Component { /> - { - setAttributes( { - content: nextContent, - } ); - } } - onSplit={ insertBlocksAfter ? - ( before, after, ...blocks ) => { - setAttributes( { content: before } ); - insertBlocksAfter( [ - ...blocks, - createBlock( 'core/paragraph', { content: after } ), - ] ); - } : - undefined - } - onMerge={ mergeBlocks } - onReplace={ this.onReplace } - onRemove={ () => onReplace( [] ) } - placeholder={ placeholder || __( 'Add text or type / to add content' ) } - autocompleters={ autocompleters } - /> +
+ { + setAttributes( { + content: nextContent, + } ); + } } + onSplit={ insertBlocksAfter ? + ( before, after, ...blocks ) => { + setAttributes( { content: before } ); + insertBlocksAfter( [ + ...blocks, + createBlock( 'core/paragraph', { content: after } ), + ] ); + } : + undefined + } + onMerge={ mergeBlocks } + onReplace={ this.onReplace } + onRemove={ () => onReplace( [] ) } + placeholder={ placeholder || __( 'Add text or type / to add content' ) } + autocompleters={ autocompleters } + /> +
); } diff --git a/blocks/library/paragraph/test/__snapshots__/index.js.snap b/blocks/library/paragraph/test/__snapshots__/index.js.snap index 4350e0121dc5bc..0369b0add114df 100644 --- a/blocks/library/paragraph/test/__snapshots__/index.js.snap +++ b/blocks/library/paragraph/test/__snapshots__/index.js.snap @@ -3,29 +3,31 @@ exports[`core/paragraph block edit matches snapshot 1`] = `
-
-
+
+
-
-

+

- Add text or type / to add content -

+

+ Add text or type / to add content +

+
diff --git a/docs/deprecated.md b/docs/deprecated.md index 6f905f7f38c717..97b9d25eff1475 100644 --- a/docs/deprecated.md +++ b/docs/deprecated.md @@ -9,7 +9,6 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo ## 2.7.0 - `wp.element.getWrapperDisplayName` function removed. Please use `wp.element.createHigherOrderComponent` instead. -- `isSelected` usage is no longer mandatory with `BlockControls`, `InspectorControls` and `RichText`. It is now handled by the editor internally to ensure that controls are visible only when block is selected. See updated docs: https://github.com/WordPress/gutenberg/blob/master/blocks/README.md#components. ## 2.6.0