Skip to content

Commit b43fbc0

Browse files
committed
Fix block exception in site editor
1 parent 295c743 commit b43fbc0

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

projects/plugins/jetpack/extensions/editor.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,21 @@ function setBetaBlockTitle( settings, name ) {
8686
const { title, keywords } = settings;
8787
const titleSuffix = '(beta)';
8888
const betaKeyword = 'beta';
89-
90-
return {
89+
const result = {
9190
...settings,
92-
title: title.toLowerCase().endsWith( titleSuffix )
93-
? title
94-
: `${ settings.title } ${ titleSuffix }`,
95-
kewords: keywords.includes( betaKeyword ) ? keywords : [ ...keywords, betaKeyword ],
9691
};
92+
93+
if ( title ) {
94+
result.title = title.toLowerCase().endsWith( titleSuffix )
95+
? title
96+
: `${ settings.title } ${ titleSuffix }`;
97+
}
98+
99+
if ( Array.isArray( keywords ) ) {
100+
result.keywords = keywords.includes( betaKeyword ) ? keywords : [ ...keywords, betaKeyword ];
101+
}
102+
103+
return result;
97104
}
98105

99106
addFilter( 'blocks.registerBlockType', 'jetpack/label-beta-blocks-title', setBetaBlockTitle );

0 commit comments

Comments
 (0)