File tree 2 files changed +14
-0
lines changed
block-editor/src/components/rich-text
components/src/primitives/block-quotation
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,12 @@ export class RichText extends Component {
299
299
result = this . removeRootTag ( element , result ) ;
300
300
} ) ;
301
301
}
302
+
303
+ if ( this . props . tagsToEliminate ) {
304
+ this . props . tagsToEliminate . forEach ( ( element ) => {
305
+ result = this . removeTag ( element , result ) ;
306
+ } ) ;
307
+ }
302
308
return result ;
303
309
}
304
310
@@ -307,6 +313,11 @@ export class RichText extends Component {
307
313
const closingTagRegexp = RegExp ( '</' + tag + '>$' , 'gim' ) ;
308
314
return html . replace ( openingTagRegexp , '' ) . replace ( closingTagRegexp , '' ) ;
309
315
}
316
+ removeTag ( tag , html ) {
317
+ const openingTagRegexp = RegExp ( '<' + tag + '>' , 'gim' ) ;
318
+ const closingTagRegexp = RegExp ( '</' + tag + '>' , 'gim' ) ;
319
+ return html . replace ( openingTagRegexp , '' ) . replace ( closingTagRegexp , '' ) ;
320
+ }
310
321
311
322
/*
312
323
* Handles any case where the content of the AztecRN instance has changed
Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ export const BlockQuotation = ( props ) => {
16
16
if ( child && child . props . identifier === 'citation' ) {
17
17
return cloneElement ( child , { style : styles . wpBlockQuoteCitation } ) ;
18
18
}
19
+ if ( child && child . props . identifier === 'value' ) {
20
+ return cloneElement ( child , { tagsToEliminate : [ 'div' ] } ) ;
21
+ }
19
22
return child ;
20
23
} ) ;
21
24
return (
You can’t perform that action at this time.
0 commit comments