Skip to content

Commit cf63e10

Browse files
committed
Blocks: Addressed feedback related to BlockEditContext changes
1 parent fbb66c8 commit cf63e10

File tree

3 files changed

+59
-56
lines changed

3 files changed

+59
-56
lines changed

blocks/library/paragraph/index.js

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -226,40 +226,42 @@ class ParagraphBlock extends Component {
226226
/>
227227
</PanelBody>
228228
</InspectorControls>
229-
<RichText
230-
tagName="p"
231-
className={ classnames( 'wp-block-paragraph', className, {
232-
'has-background': backgroundColor,
233-
'has-drop-cap': dropCap,
234-
} ) }
235-
style={ {
236-
backgroundColor: backgroundColor,
237-
color: textColor,
238-
fontSize: fontSize ? fontSize + 'px' : undefined,
239-
textAlign: align,
240-
} }
241-
value={ content }
242-
onChange={ ( nextContent ) => {
243-
setAttributes( {
244-
content: nextContent,
245-
} );
246-
} }
247-
onSplit={ insertBlocksAfter ?
248-
( before, after, ...blocks ) => {
249-
setAttributes( { content: before } );
250-
insertBlocksAfter( [
251-
...blocks,
252-
createBlock( 'core/paragraph', { content: after } ),
253-
] );
254-
} :
255-
undefined
256-
}
257-
onMerge={ mergeBlocks }
258-
onReplace={ this.onReplace }
259-
onRemove={ () => onReplace( [] ) }
260-
placeholder={ placeholder || __( 'Add text or type / to add content' ) }
261-
autocompleters={ autocompleters }
262-
/>
229+
<div>
230+
<RichText
231+
tagName="p"
232+
className={ classnames( 'wp-block-paragraph', className, {
233+
'has-background': backgroundColor,
234+
'has-drop-cap': dropCap,
235+
} ) }
236+
style={ {
237+
backgroundColor: backgroundColor,
238+
color: textColor,
239+
fontSize: fontSize ? fontSize + 'px' : undefined,
240+
textAlign: align,
241+
} }
242+
value={ content }
243+
onChange={ ( nextContent ) => {
244+
setAttributes( {
245+
content: nextContent,
246+
} );
247+
} }
248+
onSplit={ insertBlocksAfter ?
249+
( before, after, ...blocks ) => {
250+
setAttributes( { content: before } );
251+
insertBlocksAfter( [
252+
...blocks,
253+
createBlock( 'core/paragraph', { content: after } ),
254+
] );
255+
} :
256+
undefined
257+
}
258+
onMerge={ mergeBlocks }
259+
onReplace={ this.onReplace }
260+
onRemove={ () => onReplace( [] ) }
261+
placeholder={ placeholder || __( 'Add text or type / to add content' ) }
262+
autocompleters={ autocompleters }
263+
/>
264+
</div>
263265
</Fragment>
264266
);
265267
}

blocks/library/paragraph/test/__snapshots__/index.js.snap

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,31 @@
33
exports[`core/paragraph block edit matches snapshot 1`] = `
44
<div>
55
6-
<div
7-
class="blocks-rich-text"
8-
>
9-
<div>
6+
<div>
7+
<div
8+
class="blocks-rich-text"
9+
>
1010
<div>
11-
<div
12-
class="components-autocomplete"
13-
>
14-
<p
15-
aria-autocomplete="list"
16-
aria-expanded="false"
17-
aria-label="Add text or type / to add content"
18-
aria-multiline="false"
19-
class="wp-block-paragraph blocks-rich-text__tinymce"
20-
contenteditable="true"
21-
data-is-placeholder-visible="true"
22-
role="textbox"
23-
/>
24-
<p
25-
class="blocks-rich-text__tinymce wp-block-paragraph"
11+
<div>
12+
<div
13+
class="components-autocomplete"
2614
>
27-
Add text or type / to add content
28-
</p>
15+
<p
16+
aria-autocomplete="list"
17+
aria-expanded="false"
18+
aria-label="Add text or type / to add content"
19+
aria-multiline="false"
20+
class="wp-block-paragraph blocks-rich-text__tinymce"
21+
contenteditable="true"
22+
data-is-placeholder-visible="true"
23+
role="textbox"
24+
/>
25+
<p
26+
class="blocks-rich-text__tinymce wp-block-paragraph"
27+
>
28+
Add text or type / to add content
29+
</p>
30+
</div>
2931
</div>
3032
</div>
3133
</div>

docs/deprecated.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo
99
## 2.7.0
1010

1111
- `wp.element.getWrapperDisplayName` function removed. Please use `wp.element.createHigherOrderComponent` instead.
12-
- `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.
1312

1413
## 2.6.0
1514

0 commit comments

Comments
 (0)