File tree Expand file tree Collapse file tree
block-library/src/paragraph Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -244,8 +244,8 @@ class ParagraphBlock extends Component {
244244 } }
245245 unstableOnSplit = { this . splitBlock }
246246 onMerge = { mergeBlocks }
247- onReplace = { this . onReplace }
248- onRemove = { ( ) => onReplace ( [ ] ) }
247+ onReplace = { this . props . onReplace && this . onReplace }
248+ onRemove = { onReplace && ( ( ) => onReplace ( [ ] ) ) }
249249 aria-label = { content ? __ ( 'Paragraph block' ) : __ ( 'Empty block; start writing or type forward slash to choose a block' ) }
250250 placeholder = { placeholder || __ ( 'Start writing or type / to choose a block' ) }
251251 />
Original file line number Diff line number Diff line change 11// Jest Snapshot v1, https://goo.gl/fbAQLP
22
3+ exports [` cpt locking template_lock all should not error when deleting the cotents of a paragraph 1` ] = `
4+ "<!-- wp:image -->
5+ <figure class =\\"wp-block-image\\"><img alt =\\"\\"/></figure>
6+ <!-- /wp:image -->
7+
8+ <!-- wp:paragraph { \\" placeholder\\ " :\\" Add a description\\ " } -->
9+ <p></p>
10+ <!-- /wp:paragraph -->
11+
12+ <!-- wp:quote -->
13+ <blockquote class =\\"wp-block-quote\\"><p></p></blockquote>
14+ <!-- /wp:quote -->"
15+ `;
16+
317exports[`cpt locking template_lock false should allow blocks to be inserted 1`] = `
418" <!-- wp:image -->
519<figure class=\\" wp-block-image\\"><img alt =\\"\\"/></figure>
Original file line number Diff line number Diff line change 88 deactivatePlugin ,
99 getEditedPostContent ,
1010 insertBlock ,
11+ pressKeyTimes ,
1112} from '@wordpress/e2e-test-utils' ;
1213
1314describe ( 'cpt locking' , ( ) => {
@@ -58,6 +59,14 @@ describe( 'cpt locking', () => {
5859 await page . $ ( 'button[aria-label="Move up"]' )
5960 ) . toBeNull ( ) ;
6061 } ) ;
62+
63+ it ( 'should not error when deleting the cotents of a paragraph' , async ( ) => {
64+ await page . click ( '.block-editor-block-list__block[data-type="core/paragraph"] p' ) ;
65+ const textToType = 'Paragraph' ;
66+ await page . keyboard . type ( 'Paragraph' ) ;
67+ await pressKeyTimes ( 'Backspace' , textToType . length + 1 ) ;
68+ expect ( await getEditedPostContent ( ) ) . toMatchSnapshot ( ) ;
69+ } ) ;
6170 } ) ;
6271
6372 describe ( 'template_lock insert' , ( ) => {
You can’t perform that action at this time.
0 commit comments