From 201d3d02c01a43e6edc53a47e02c6344ac14cbb4 Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Tue, 28 Mar 2023 18:42:13 +0200 Subject: [PATCH] Blocks: only use strings in block descriptions Closes #29402 Discussion: #26792 Until we have a better way to have custom descriptions for blocks, let's keep only strings to avoid notices. --- .../update-extensions-description-string | 4 +++ .../extensions/blocks/ai-image/index.js | 24 +++-------------- .../extensions/blocks/ai-paragraph/index.js | 25 +++-------------- .../extensions/blocks/markdown/index.js | 25 +++-------------- .../blocks/payment-buttons/index.js | 22 +++------------ .../extensions/blocks/recipe/details/index.js | 7 +---- .../extensions/blocks/recipe/hero/index.js | 7 +---- .../jetpack/extensions/blocks/recipe/index.js | 15 +++-------- .../blocks/recipe/ingredient-item/index.js | 7 +---- .../blocks/recipe/ingredients-list/index.js | 7 +---- .../extensions/blocks/recipe/step/index.js | 7 +---- .../extensions/blocks/recipe/steps/index.js | 7 +---- .../blocks/recurring-payments/index.js | 16 ++--------- .../simple-payments/deprecated/v2/index.js | 27 +++---------------- .../blocks/simple-payments/index.js | 27 +++---------------- .../extensions/blocks/subscriptions/index.js | 19 +++---------- .../extensions/blocks/wordads/index.js | 14 ++-------- 17 files changed, 44 insertions(+), 216 deletions(-) create mode 100644 projects/plugins/jetpack/changelog/update-extensions-description-string diff --git a/projects/plugins/jetpack/changelog/update-extensions-description-string b/projects/plugins/jetpack/changelog/update-extensions-description-string new file mode 100644 index 0000000000000..77d460ff452c7 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-extensions-description-string @@ -0,0 +1,4 @@ +Significance: patch +Type: compat + +Blocks: avoid using complex block descriptions to avoid notices with WordPress 6.2. diff --git a/projects/plugins/jetpack/extensions/blocks/ai-image/index.js b/projects/plugins/jetpack/extensions/blocks/ai-image/index.js index 4164b732be28e..392a7c33f5ec9 100644 --- a/projects/plugins/jetpack/extensions/blocks/ai-image/index.js +++ b/projects/plugins/jetpack/extensions/blocks/ai-image/index.js @@ -1,6 +1,3 @@ -import { getRedirectUrl } from '@automattic/jetpack-components'; -import { ExternalLink } from '@wordpress/components'; -import { Fragment } from '@wordpress/element'; import { __, _x } from '@wordpress/i18n'; import { getIconColor } from '../../shared/block-icons'; import attributes from './attributes'; @@ -16,24 +13,9 @@ export const title = __( 'AI Image (Experimental)', 'jetpack' ); export const settings = { apiVersion: 2, title, - description: ( - -

- { __( - 'Automatically generate an illustration for your post, powered by AI magic.', - 'jetpack' - ) } -

-

- { __( - 'We are experimenting with this feature and can tweak or remove it at any point.', - 'jetpack' - ) } -

- - { __( 'Share your feedback.', 'jetpack' ) } - -
+ description: __( + 'Automatically generate an illustration for your post, powered by AI magic. We are experimenting with this feature and can tweak or remove it at any point.', + 'jetpack' ), icon: { src: 'superhero', diff --git a/projects/plugins/jetpack/extensions/blocks/ai-paragraph/index.js b/projects/plugins/jetpack/extensions/blocks/ai-paragraph/index.js index 7036ae5603633..80e68dfbced1f 100644 --- a/projects/plugins/jetpack/extensions/blocks/ai-paragraph/index.js +++ b/projects/plugins/jetpack/extensions/blocks/ai-paragraph/index.js @@ -1,8 +1,6 @@ -import { getRedirectUrl } from '@automattic/jetpack-components'; import { useBlockProps } from '@wordpress/block-editor'; import { createBlock } from '@wordpress/blocks'; -import { ExternalLink } from '@wordpress/components'; -import { Fragment, RawHTML } from '@wordpress/element'; +import { RawHTML } from '@wordpress/element'; import { __, _x } from '@wordpress/i18n'; import { getIconColor } from '../../shared/block-icons'; import attributes from './attributes'; @@ -18,24 +16,9 @@ export const title = __( 'AI Paragraph (Experimental)', 'jetpack' ); export const settings = { apiVersion: 2, title, - description: ( - -

- { __( - 'Automatically generate new paragraphs using your existing content, powered by AI magic.', - 'jetpack' - ) } -

-

- { __( - 'We are experimenting with this feature and can tweak or remove it at any point.', - 'jetpack' - ) } -

- - { __( 'Share your feedback.', 'jetpack' ) } - -
+ description: __( + 'Automatically generate new paragraphs using your existing content, powered by AI magic. We are experimenting with this feature and can tweak or remove it at any point.', + 'jetpack' ), icon: { src: 'superhero', diff --git a/projects/plugins/jetpack/extensions/blocks/markdown/index.js b/projects/plugins/jetpack/extensions/blocks/markdown/index.js index 2af50b3ab9371..e7b97658d65de 100644 --- a/projects/plugins/jetpack/extensions/blocks/markdown/index.js +++ b/projects/plugins/jetpack/extensions/blocks/markdown/index.js @@ -1,6 +1,4 @@ -import { isAtomicSite, isSimpleSite } from '@automattic/jetpack-shared-extension-utils'; -import { ExternalLink, Path, Rect, SVG } from '@wordpress/components'; -import { Fragment } from '@wordpress/element'; +import { Path, Rect, SVG } from '@wordpress/components'; import { __, _x } from '@wordpress/i18n'; import { getIconColor } from '../../shared/block-icons'; import getCategoryWithFallbacks from '../../shared/get-category-with-fallbacks'; @@ -33,31 +31,16 @@ const icon = ( ); -const supportLink = - isSimpleSite() || isAtomicSite() - ? 'https://en.support.wordpress.com/markdown-quick-reference/' - : 'https://jetpack.com/support/jetpack-blocks/markdown-block/'; - export const settings = { title: __( 'Markdown', 'jetpack' ), - - description: ( - -

- { __( - 'Use regular characters and punctuation to style text, links, and lists.', - 'jetpack' - ) } -

- { __( 'Support reference', 'jetpack' ) } -
+ description: __( + 'Use regular characters and punctuation to style text, links, and lists.', + 'jetpack' ), - icon: { src: icon, foreground: getIconColor(), }, - category: getCategoryWithFallbacks( 'text', 'formatting' ), keywords: [ _x( 'formatting', 'block search term', 'jetpack' ), diff --git a/projects/plugins/jetpack/extensions/blocks/payment-buttons/index.js b/projects/plugins/jetpack/extensions/blocks/payment-buttons/index.js index 5c255b6d9114f..33263838753f3 100644 --- a/projects/plugins/jetpack/extensions/blocks/payment-buttons/index.js +++ b/projects/plugins/jetpack/extensions/blocks/payment-buttons/index.js @@ -1,6 +1,4 @@ -import { isAtomicSite, isSimpleSite } from '@automattic/jetpack-shared-extension-utils'; -import { Path, Rect, SVG, G, ExternalLink } from '@wordpress/components'; -import { Fragment } from '@wordpress/element'; +import { Path, Rect, SVG, G } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { getIconColor } from '../../shared/block-icons'; import { settings as paymentButtonSettings } from '../recurring-payments'; @@ -19,11 +17,6 @@ export const icon = ( ); -const supportLink = - isSimpleSite() || isAtomicSite() - ? 'https://wordpress.com/support/video-tutorials-add-payments-features-to-your-site-with-our-guides/#how-to-use-the-payments-block-video' - : 'https://jetpack.com/support/jetpack-blocks/payments-block/'; - export const settings = { apiVersion: 2, title, @@ -31,16 +24,9 @@ export const settings = { src: icon, foreground: getIconColor(), }, - description: ( - -

- { __( - 'Prompt visitors to purchase your products and subscriptions with a group of buttons.', - 'jetpack' - ) } -

- { __( 'Support reference', 'jetpack' ) } -
+ description: __( + 'Prompt visitors to purchase your products and subscriptions with a group of buttons.', + 'jetpack' ), category: 'earn', keywords: [ ...new Set( [ paymentButtonSettings.title, ...paymentButtonSettings.keywords ] ) ], diff --git a/projects/plugins/jetpack/extensions/blocks/recipe/details/index.js b/projects/plugins/jetpack/extensions/blocks/recipe/details/index.js index 7c4a62e2f79ff..532f6f23b1311 100644 --- a/projects/plugins/jetpack/extensions/blocks/recipe/details/index.js +++ b/projects/plugins/jetpack/extensions/blocks/recipe/details/index.js @@ -1,4 +1,3 @@ -import { Fragment } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { getIconColor } from '../../../shared/block-icons'; import icon from '../icon'; @@ -12,11 +11,7 @@ export const name = 'recipe-details'; export const settings = { title: __( 'Recipe Details', 'jetpack' ), - description: ( - -

{ __( 'Recipe Details', 'jetpack' ) }

-
- ), + description: __( 'Recipe Details', 'jetpack' ), keywords: [], supports: { align: [ 'left', 'right', 'center' ], diff --git a/projects/plugins/jetpack/extensions/blocks/recipe/hero/index.js b/projects/plugins/jetpack/extensions/blocks/recipe/hero/index.js index 044445d52ed72..faf631e7e06ea 100644 --- a/projects/plugins/jetpack/extensions/blocks/recipe/hero/index.js +++ b/projects/plugins/jetpack/extensions/blocks/recipe/hero/index.js @@ -1,4 +1,3 @@ -import { Fragment } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { getIconColor } from '../../../shared/block-icons'; import icon from '../icon'; @@ -9,11 +8,7 @@ export const name = 'recipe-hero'; export const title = __( 'Recipe Hero', 'jetpack' ); export const settings = { title, - description: ( - -

{ __( 'Image area for the recipe.', 'jetpack' ) }

-
- ), + description: __( 'Image area for the recipe.', 'jetpack' ), keywords: [], icon: { src: icon, diff --git a/projects/plugins/jetpack/extensions/blocks/recipe/index.js b/projects/plugins/jetpack/extensions/blocks/recipe/index.js index 6cf801a26c39d..1a7cc47b24ef7 100644 --- a/projects/plugins/jetpack/extensions/blocks/recipe/index.js +++ b/projects/plugins/jetpack/extensions/blocks/recipe/index.js @@ -1,5 +1,3 @@ -import { ExternalLink } from '@wordpress/components'; -import { Fragment } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { getIconColor } from '../../shared/block-icons'; import { name as detailsName, settings as detailsSettings } from './details/'; @@ -19,16 +17,9 @@ export const name = 'recipe'; export const title = __( 'Recipe', 'jetpack' ); export const settings = { title, - description: ( - -

- { __( - 'Add images, ingredients and cooking steps to display an easy to read recipe.', - 'jetpack' - ) } -

- { __( 'Learn more about Recipe', 'jetpack' ) } -
+ description: __( + 'Add images, ingredients and cooking steps to display an easy to read recipe.', + 'jetpack' ), icon: { src: icon, diff --git a/projects/plugins/jetpack/extensions/blocks/recipe/ingredient-item/index.js b/projects/plugins/jetpack/extensions/blocks/recipe/ingredient-item/index.js index 9b06e23969968..1e4fb31f4dbde 100644 --- a/projects/plugins/jetpack/extensions/blocks/recipe/ingredient-item/index.js +++ b/projects/plugins/jetpack/extensions/blocks/recipe/ingredient-item/index.js @@ -1,4 +1,3 @@ -import { Fragment } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { getIconColor } from '../../../shared/block-icons'; import icon from '../icon'; @@ -10,11 +9,7 @@ export const name = 'recipe-ingredient-item'; export const title = __( 'Recipe Ingredient Item', 'jetpack' ); export const settings = { title, - description: ( - -

{ __( 'A single ingredient associated with a recipe.', 'jetpack' ) }

-
- ), + description: __( 'A single ingredient associated with a recipe.', 'jetpack' ), keywords: [], icon: { src: icon, diff --git a/projects/plugins/jetpack/extensions/blocks/recipe/ingredients-list/index.js b/projects/plugins/jetpack/extensions/blocks/recipe/ingredients-list/index.js index 8a37e740439f2..d04b13d677540 100644 --- a/projects/plugins/jetpack/extensions/blocks/recipe/ingredients-list/index.js +++ b/projects/plugins/jetpack/extensions/blocks/recipe/ingredients-list/index.js @@ -1,4 +1,3 @@ -import { Fragment } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { getIconColor } from '../../../shared/block-icons'; import icon from '../icon'; @@ -12,11 +11,7 @@ export const name = 'recipe-ingredients-list'; export const title = __( 'Recipe Ingredients List', 'jetpack' ); export const settings = { title, - description: ( - -

{ __( 'Recipe ingredient list', 'jetpack' ) }

-
- ), + description: __( 'Recipe ingredient list', 'jetpack' ), icon: { src: icon, foreground: getIconColor(), diff --git a/projects/plugins/jetpack/extensions/blocks/recipe/step/index.js b/projects/plugins/jetpack/extensions/blocks/recipe/step/index.js index 2e49582401b6e..e91dd09ea1230 100644 --- a/projects/plugins/jetpack/extensions/blocks/recipe/step/index.js +++ b/projects/plugins/jetpack/extensions/blocks/recipe/step/index.js @@ -1,4 +1,3 @@ -import { Fragment } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { getIconColor } from '../../../shared/block-icons'; import icon from '../icon'; @@ -9,11 +8,7 @@ export const name = 'recipe-step'; export const title = __( 'Recipe Step', 'jetpack' ); export const settings = { title, - description: ( - -

{ __( 'A single recipe step.', 'jetpack' ) }

-
- ), + description: __( 'A single recipe step.', 'jetpack' ), keywords: [], icon: { src: icon, diff --git a/projects/plugins/jetpack/extensions/blocks/recipe/steps/index.js b/projects/plugins/jetpack/extensions/blocks/recipe/steps/index.js index 0d5653b11bd4f..ad21c6951624e 100644 --- a/projects/plugins/jetpack/extensions/blocks/recipe/steps/index.js +++ b/projects/plugins/jetpack/extensions/blocks/recipe/steps/index.js @@ -1,4 +1,3 @@ -import { Fragment } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { getIconColor } from '../../../shared/block-icons'; import icon from '../icon'; @@ -12,11 +11,7 @@ export const name = 'recipe-steps'; export const title = __( 'Recipe Steps', 'jetpack' ); export const settings = { title, - description: ( - -

{ __( 'Step by step instructions for the recipe.', 'jetpack' ) }

-
- ), + description: __( 'Step by step instructions for the recipe.', 'jetpack' ), keywords: [], icon: { src: icon, diff --git a/projects/plugins/jetpack/extensions/blocks/recurring-payments/index.js b/projects/plugins/jetpack/extensions/blocks/recurring-payments/index.js index 012c7896e99e7..4662ceab56102 100644 --- a/projects/plugins/jetpack/extensions/blocks/recurring-payments/index.js +++ b/projects/plugins/jetpack/extensions/blocks/recurring-payments/index.js @@ -1,7 +1,5 @@ -import { isAtomicSite, isSimpleSite } from '@automattic/jetpack-shared-extension-utils'; import { createBlock } from '@wordpress/blocks'; -import { Path, Rect, SVG, G, ExternalLink } from '@wordpress/components'; -import { Fragment } from '@wordpress/element'; +import { Path, Rect, SVG, G } from '@wordpress/components'; import { __, _x } from '@wordpress/i18n'; import { getIconColor } from '../../shared/block-icons'; import { isPriceValid } from '../../shared/currencies'; @@ -22,11 +20,6 @@ export const icon = ( ); -const supportLink = - isSimpleSite() || isAtomicSite() - ? 'https://wordpress.com/support/video-tutorials-add-payments-features-to-your-site-with-our-guides/#how-to-use-the-payments-block-video' - : 'https://jetpack.com/support/jetpack-blocks/payments-block/'; - export const settings = { apiVersion: 2, title, @@ -34,12 +27,7 @@ export const settings = { src: icon, foreground: getIconColor(), }, - description: ( - -

{ __( 'Button allowing you to sell products and subscriptions.', 'jetpack' ) }

- { __( 'Support reference', 'jetpack' ) } -
- ), + description: __( 'Button allowing you to sell products and subscriptions.', 'jetpack' ), category: 'earn', keywords: [ _x( 'buy', 'block search term', 'jetpack' ), diff --git a/projects/plugins/jetpack/extensions/blocks/simple-payments/deprecated/v2/index.js b/projects/plugins/jetpack/extensions/blocks/simple-payments/deprecated/v2/index.js index efd93cceff991..7bdd5c7d05c33 100644 --- a/projects/plugins/jetpack/extensions/blocks/simple-payments/deprecated/v2/index.js +++ b/projects/plugins/jetpack/extensions/blocks/simple-payments/deprecated/v2/index.js @@ -1,6 +1,4 @@ -import { isAtomicSite, isSimpleSite } from '@automattic/jetpack-shared-extension-utils'; -import { ExternalLink, Path, SVG } from '@wordpress/components'; -import { Fragment } from '@wordpress/element'; +import { Path, SVG } from '@wordpress/components'; import { __, _x } from '@wordpress/i18n'; import { getIconColor } from '../../../../shared/block-icons'; import { DEFAULT_CURRENCY } from '../../constants'; @@ -14,29 +12,12 @@ export const icon = ( ); -const supportLink = - isSimpleSite() || isAtomicSite() - ? 'https://wordpress.com/support/pay-with-paypal/' - : 'https://jetpack.com/support/jetpack-blocks/pay-with-paypal/'; - const settings = { title: __( 'Pay with PayPal', 'jetpack' ), - - description: ( - -

- { __( - 'Lets you add credit and debit card payment buttons with minimal setup.', - 'jetpack' - ) } -

-

- { __( 'Good for collecting donations or payments for products and services.', 'jetpack' ) } -

- { __( 'Support reference', 'jetpack' ) } -
+ description: __( + 'Lets you add credit and debit card payment buttons with minimal setup. Good for collecting donations or payments for products and services.', + 'jetpack' ), - icon: { src: icon, foreground: getIconColor(), diff --git a/projects/plugins/jetpack/extensions/blocks/simple-payments/index.js b/projects/plugins/jetpack/extensions/blocks/simple-payments/index.js index 6bffc9ad3565e..6cd163bc6391c 100644 --- a/projects/plugins/jetpack/extensions/blocks/simple-payments/index.js +++ b/projects/plugins/jetpack/extensions/blocks/simple-payments/index.js @@ -1,6 +1,4 @@ -import { isAtomicSite, isSimpleSite } from '@automattic/jetpack-shared-extension-utils'; -import { ExternalLink, Path, SVG } from '@wordpress/components'; -import { Fragment } from '@wordpress/element'; +import { Path, SVG } from '@wordpress/components'; import { __, _x } from '@wordpress/i18n'; import { getIconColor } from '../../shared/block-icons'; import { DEFAULT_CURRENCY } from './constants'; @@ -21,29 +19,12 @@ export const icon = ( ); -const supportLink = - isSimpleSite() || isAtomicSite() - ? 'https://wordpress.com/support/pay-with-paypal/' - : 'https://jetpack.com/support/jetpack-blocks/pay-with-paypal/'; - export const settings = { title: __( 'Pay with PayPal', 'jetpack' ), - - description: ( - -

- { __( - 'Lets you add credit and debit card payment buttons with minimal setup.', - 'jetpack' - ) } -

-

- { __( 'Good for collecting donations or payments for products and services.', 'jetpack' ) } -

- { __( 'Support reference', 'jetpack' ) } -
+ description: __( + 'Lets you add credit and debit card payment buttons with minimal setup. Good for collecting donations or payments for products and services.', + 'jetpack' ), - icon: { src: icon, foreground: getIconColor(), diff --git a/projects/plugins/jetpack/extensions/blocks/subscriptions/index.js b/projects/plugins/jetpack/extensions/blocks/subscriptions/index.js index a5d29acf46d9c..cee889cee3eec 100644 --- a/projects/plugins/jetpack/extensions/blocks/subscriptions/index.js +++ b/projects/plugins/jetpack/extensions/blocks/subscriptions/index.js @@ -1,6 +1,5 @@ import { createBlock } from '@wordpress/blocks'; -import { ExternalLink, Path, SVG } from '@wordpress/components'; -import { createInterpolateElement } from '@wordpress/element'; +import { Path, SVG } from '@wordpress/components'; import { __, _x } from '@wordpress/i18n'; import { getIconColor } from '../../shared/block-icons'; import attributes from './attributes'; @@ -21,19 +20,9 @@ export const icon = ( ); export const settings = { title: __( 'Subscribe', 'jetpack' ), - description: ( - <> -

{ __( "Let readers subscribe to this blog's posts as a newsletter.", 'jetpack' ) }

-

- { createInterpolateElement( - __( - 'Subscribers can read the posts in their email inbox or the Reader app.', - 'jetpack' - ), - { ExternalLink: } - ) } -

- + description: __( + 'Let readers subscribe to this blog’s posts as a newsletter. Subscribers can read the posts in their email inbox or the WordPress.com Reader app.', + 'jetpack' ), icon: { src: icon, diff --git a/projects/plugins/jetpack/extensions/blocks/wordads/index.js b/projects/plugins/jetpack/extensions/blocks/wordads/index.js index 25b8661973878..69288ba4c8310 100644 --- a/projects/plugins/jetpack/extensions/blocks/wordads/index.js +++ b/projects/plugins/jetpack/extensions/blocks/wordads/index.js @@ -1,5 +1,4 @@ -import { ExternalLink, Path, SVG } from '@wordpress/components'; -import { Fragment } from '@wordpress/element'; +import { Path, SVG } from '@wordpress/components'; import { __, _x } from '@wordpress/i18n'; import { getIconColor } from '../../shared/block-icons'; import { DEFAULT_FORMAT } from './constants'; @@ -20,16 +19,7 @@ export const icon = ( export const settings = { title, - - description: ( - -

{ __( 'Earn income by adding high quality ads to your post', 'jetpack' ) }

- - { __( 'Learn all about WordAds', 'jetpack' ) } - -
- ), - + description: __( 'Earn income by adding high quality ads to your post', 'jetpack' ), icon: { src: icon, foreground: getIconColor(),