Skip to content

Commit

Permalink
Blocks: getBlockLabel: use RichTextData.toPlainText if available (#58524
Browse files Browse the repository at this point in the history
)


Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
Co-authored-by: dmsnell <dmsnell@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
  • Loading branch information
4 people authored Mar 19, 2024
1 parent 998bd28 commit f3c0586
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/blocks/src/api/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ export function getBlockLabel( blockType, attributes, context = 'visual' ) {
return title;
}

if ( label.toPlainText ) {
return label.toPlainText();
}

// Strip any HTML (i.e. RichText formatting) before returning.
return stripHTML( label );
}
Expand Down

0 comments on commit f3c0586

Please sign in to comment.