Skip to content

Commit

Permalink
[not verified] Prevent duplication of beta suffix in blocks name
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieur-z committed Aug 28, 2023
1 parent 0fd246a commit 61f2abf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions projects/plugins/jetpack/extensions/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,16 @@ function setBetaBlockTitle( settings, name ) {
return settings;
}

const { title, keywords } = settings;
const titleSuffix = '(beta)';
const betaKeyword = 'beta';

return {
...settings,
title: `${ settings.title } (beta)`,
kewords: [ ...settings.keywords, 'beta' ],
title: title.toLowerCase().endsWith( titleSuffix )
? title
: `${ settings.title } ${ titleSuffix }`,
kewords: keywords.includes( betaKeyword ) ? keywords : [ ...keywords, betaKeyword ],
};
}

Expand Down

0 comments on commit 61f2abf

Please sign in to comment.