From 8ff27739ca7d8ee98e2f3aae3548dafb9d9a09da Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Wed, 25 Dec 2024 14:44:51 +0530 Subject: [PATCH 1/4] Read More: Add example preview --- packages/block-library/src/read-more/block.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/block-library/src/read-more/block.json b/packages/block-library/src/read-more/block.json index 9e4fc84d193f71..d4ab0dd8cace03 100644 --- a/packages/block-library/src/read-more/block.json +++ b/packages/block-library/src/read-more/block.json @@ -15,6 +15,11 @@ "default": "_self" } }, + "example": { + "attributes": { + "content": "Read More" + } + }, "usesContext": [ "postId" ], "supports": { "html": false, From 8c12ee508069448fa1bdcff7c0e63332f049f603 Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Mon, 30 Dec 2024 09:33:46 +0530 Subject: [PATCH 2/4] Read More: Update example to use localized text --- packages/block-library/src/read-more/block.json | 5 ----- packages/block-library/src/read-more/index.js | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/block-library/src/read-more/block.json b/packages/block-library/src/read-more/block.json index d4ab0dd8cace03..9e4fc84d193f71 100644 --- a/packages/block-library/src/read-more/block.json +++ b/packages/block-library/src/read-more/block.json @@ -15,11 +15,6 @@ "default": "_self" } }, - "example": { - "attributes": { - "content": "Read More" - } - }, "usesContext": [ "postId" ], "supports": { "html": false, diff --git a/packages/block-library/src/read-more/index.js b/packages/block-library/src/read-more/index.js index 497cd77f429e62..c6e825085d01ad 100644 --- a/packages/block-library/src/read-more/index.js +++ b/packages/block-library/src/read-more/index.js @@ -1,6 +1,7 @@ /** * WordPress dependencies */ +import { _x } from '@wordpress/i18n'; import { link as icon } from '@wordpress/icons'; /** @@ -16,6 +17,11 @@ export { metadata, name }; export const settings = { icon, edit, + example: { + attributes: { + content: _x( 'Read More', 'Example text for the Read More block' ), + }, + }, }; export const init = () => initBlock( { name, metadata, settings } ); From fbc113684933ed1ac17dcbb7bb1e43c9dcfd0292 Mon Sep 17 00:00:00 2001 From: Yogesh Bhutkar Date: Mon, 30 Dec 2024 12:56:58 +0530 Subject: [PATCH 3/4] refactor: remove the usage of context Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> --- packages/block-library/src/read-more/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/read-more/index.js b/packages/block-library/src/read-more/index.js index c6e825085d01ad..41b370bf6050c3 100644 --- a/packages/block-library/src/read-more/index.js +++ b/packages/block-library/src/read-more/index.js @@ -19,7 +19,7 @@ export const settings = { edit, example: { attributes: { - content: _x( 'Read More', 'Example text for the Read More block' ), + content: __( 'Read more' ), }, }, }; From 5ea80f7a57ab4d1fb8f58586a335aaa0de0d2ba9 Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Mon, 30 Dec 2024 12:59:00 +0530 Subject: [PATCH 4/4] fix: replace `_x` with `__` --- packages/block-library/src/read-more/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/read-more/index.js b/packages/block-library/src/read-more/index.js index 41b370bf6050c3..f982f35151b4b8 100644 --- a/packages/block-library/src/read-more/index.js +++ b/packages/block-library/src/read-more/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { _x } from '@wordpress/i18n'; +import { __ } from '@wordpress/i18n'; import { link as icon } from '@wordpress/icons'; /**