From 6736bd75eb02457f27089ac8f55c1066dbbc181a Mon Sep 17 00:00:00 2001 From: Takshil Kunadia Date: Fri, 14 Feb 2025 18:07:15 +0530 Subject: [PATCH 01/17] feat(corrections-box): add corrections box block to display corrections for the post --- .../blocks/correction-box-block/block.json | 29 +++++ .../class-correction-box-block.php | 105 ++++++++++++++++++ includes/blocks/correction-box-block/edit.jsx | 75 +++++++++++++ includes/blocks/correction-box-block/index.js | 24 ++++ includes/blocks/index.php | 4 + 5 files changed, 237 insertions(+) create mode 100644 includes/blocks/correction-box-block/block.json create mode 100644 includes/blocks/correction-box-block/class-correction-box-block.php create mode 100644 includes/blocks/correction-box-block/edit.jsx create mode 100644 includes/blocks/correction-box-block/index.js diff --git a/includes/blocks/correction-box-block/block.json b/includes/blocks/correction-box-block/block.json new file mode 100644 index 0000000..879d939 --- /dev/null +++ b/includes/blocks/correction-box-block/block.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "name": "newspack-block-theme/correction-box", + "title": "Corrections Box", + "category": "newspack", + "description": "A box to display corrections.", + "attributes": {}, + "supports": { + "html": false, + "color": { + "gradients": true, + "__experimentalDefaultControls": { + "background": true, + "text": true, + "link": true + } + }, + "spacing": { + "margin": true, + "padding": true + }, + "typography": { + "fontSize": true, + "lineHeight": true + } + }, + "usesContext": [ "postId" ], + "textdomain": "newspack-block-theme" +} diff --git a/includes/blocks/correction-box-block/class-correction-box-block.php b/includes/blocks/correction-box-block/class-correction-box-block.php new file mode 100644 index 0000000..044211c --- /dev/null +++ b/includes/blocks/correction-box-block/class-correction-box-block.php @@ -0,0 +1,105 @@ + [ __CLASS__, 'render_block' ], + 'uses_context' => [ 'postId' ], + ] + ); + } + + /** + * Enqueues block editor assets. + */ + public static function enqueue_block_editor_assets() { + $handle = 'newspack-block-theme-correction-box-block'; + wp_enqueue_script( $handle, \get_theme_file_uri( 'dist/correction-box-block-index.js' ), [ 'wp-blocks', 'wp-i18n', 'wp-element' ], NEWSPACK_BLOCK_THEME_VERSION, true ); + } + + /** + * Block render callback. + * + * @param array $attributes The block attributes. + * @param string $content The block content. + * @param object $block The block. + * + * @return string The block HTML. + */ + public static function render_block( array $attributes, string $content, $block ) { + $post_id = $block->context['postId'] ?? null; + + if ( empty( $post_id ) ) { + return ''; + } + + // Fetch corrections. + $corrections = Corrections::get_corrections( $post_id ); + + if ( empty( $corrections ) ) { + return ''; + } + + $corrections_archive_url = get_post_type_archive_link( Corrections::POST_TYPE ); + + ob_start(); + ?> +
+ post_content; + $correction_date = \get_the_date( get_option( 'date_format' ), $correction->ID ); + $correction_time = \get_the_time( get_option( 'time_format' ), $correction->ID ); + $timezone = \wp_timezone()->getName(); + $correction_heading = sprintf( + '%s, %s %s %s:', + Corrections::get_correction_type( $correction->ID ), + $correction_date, + $correction_time, + $timezone + ); + ?> +

+ + + + + + +

+ +
+ + + + + ); + } + + /** + * Toggle Refresh state. + */ + const toggleRefresh = () => { + setIsRefreshing( ! isRefreshing ); + }; + + return ( + <> + + + + + +
+ +
+ + ); +} diff --git a/includes/blocks/correction-box-block/index.js b/includes/blocks/correction-box-block/index.js new file mode 100644 index 0000000..89dcfd1 --- /dev/null +++ b/includes/blocks/correction-box-block/index.js @@ -0,0 +1,24 @@ +/** + * WordPress dependencies + */ +import { registerBlockType } from '@wordpress/blocks'; +import { __ } from '@wordpress/i18n'; +import { Icon, receipt } from '@wordpress/icons'; + +/** + * Internal dependencies + */ +import blockData from './block.json'; +import Edit from './edit'; + +blockData = { + title: __( 'Correction Box', 'newspack-block-theme' ), + icon: { + src: , + }, + usesContext: [ 'postId' ], + edit: Edit, + ...blockData, +}; + +registerBlockType( blockData.name, blockData ); diff --git a/includes/blocks/index.php b/includes/blocks/index.php index b0edf92..baf3a4a 100644 --- a/includes/blocks/index.php +++ b/includes/blocks/index.php @@ -10,3 +10,7 @@ defined( 'ABSPATH' ) || exit; require_once NEWSPACK_BLOCK_THEME_FILE_PATH . '/includes/blocks/subtitle-block/class-subtitle-block.php'; + +if ( class_exists( 'Newspack\Corrections' ) && defined( 'NEWSPACK_CORRECTIONS_ENABLED' ) && NEWSPACK_CORRECTIONS_ENABLED ) { + require_once NEWSPACK_BLOCK_THEME_FILE_PATH . '/includes/blocks/correction-box-block/class-correction-box-block.php'; +} From 49f1831d08092a37614369f086029790b45ddb7f Mon Sep 17 00:00:00 2001 From: Takshil Kunadia Date: Fri, 14 Feb 2025 18:07:46 +0530 Subject: [PATCH 02/17] feat(corrections-box): add styles for corrections box block --- includes/blocks/correction-box-block/style.scss | 10 ++++++++++ src/scss/blocks/_blocks.scss | 1 + 2 files changed, 11 insertions(+) create mode 100644 includes/blocks/correction-box-block/style.scss diff --git a/includes/blocks/correction-box-block/style.scss b/includes/blocks/correction-box-block/style.scss new file mode 100644 index 0000000..0765bfa --- /dev/null +++ b/includes/blocks/correction-box-block/style.scss @@ -0,0 +1,10 @@ +.newspack-corrections-module { + .correction { + color: var(--newspack-theme-color-text-light, var(--wp--preset--color--contrast-3)); + font-size: var(--newspack-theme-font-size-sm, var(--wp--preset--font-size--small)); + + a { + color: var(--newspack-theme-color-text-light, var(--wp--preset--color--contrast-3)); + } + } +} diff --git a/src/scss/blocks/_blocks.scss b/src/scss/blocks/_blocks.scss index dfe2d9e..8f16a15 100644 --- a/src/scss/blocks/_blocks.scss +++ b/src/scss/blocks/_blocks.scss @@ -35,3 +35,4 @@ @import url('./yoast/_how-to.scss'); @import url('../../../includes/blocks/subtitle-block/style.scss'); +@import url('../../../includes/blocks/correction-box-block/style.scss'); From c06f9387450f78e3f877b35a9c7c3f026e3ce81b Mon Sep 17 00:00:00 2001 From: Takshil Kunadia Date: Mon, 17 Feb 2025 12:22:24 +0530 Subject: [PATCH 03/17] feat(corrections-loop-item): add corrections item block to display corrections on archive --- .../blocks/correction-item-block/block.json | 30 ++++++ .../class-correction-item-block.php | 99 +++++++++++++++++++ .../blocks/correction-item-block/editor.js | 59 +++++++++++ .../blocks/correction-item-block/style.scss | 6 ++ includes/blocks/index.php | 1 + src/scss/blocks/_blocks.scss | 1 + templates/archive-newspack_correction.html | 38 +++++++ 7 files changed, 234 insertions(+) create mode 100644 includes/blocks/correction-item-block/block.json create mode 100644 includes/blocks/correction-item-block/class-correction-item-block.php create mode 100644 includes/blocks/correction-item-block/editor.js create mode 100644 includes/blocks/correction-item-block/style.scss create mode 100644 templates/archive-newspack_correction.html diff --git a/includes/blocks/correction-item-block/block.json b/includes/blocks/correction-item-block/block.json new file mode 100644 index 0000000..ce2e04c --- /dev/null +++ b/includes/blocks/correction-item-block/block.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "name": "newspack-block-theme/correction-item", + "title": "Correction Item", + "category": "newspack", + "description": "An item in the list of corrections.", + "attributes": {}, + "supports": { + "html": false, + "color": { + "gradients": true, + "__experimentalDefaultControls": { + "background": true, + "text": true, + "link": true + } + }, + "spacing": { + "margin": true, + "padding": true + }, + "typography": { + "fontSize": true, + "lineHeight": true + } + }, + "parent": [ "core/post-template" ], + "usesContext": [ "postId", "postType" ], + "textdomain": "newspack-block-theme" +} diff --git a/includes/blocks/correction-item-block/class-correction-item-block.php b/includes/blocks/correction-item-block/class-correction-item-block.php new file mode 100644 index 0000000..4b17b69 --- /dev/null +++ b/includes/blocks/correction-item-block/class-correction-item-block.php @@ -0,0 +1,99 @@ + [ __CLASS__, 'render_block' ], + ] + ); + } + + /** + * Enqueues block editor assets. + */ + public static function enqueue_block_editor_assets() { + $handle = 'newspack-block-theme-correction-item-block'; + wp_enqueue_script( $handle, \get_theme_file_uri( 'dist/correction-item-block-editor.js' ), [ 'wp-blocks', 'wp-i18n', 'wp-element' ], NEWSPACK_BLOCK_THEME_VERSION, true ); + } + + /** + * Block render callback. + * + * @param array $attributes The block attributes. + * @param string $content The block content. + * @param object $block The block. + * + * @return string The block HTML. + */ + public static function render_block( array $attributes, string $content, $block ) { + $correction_id = $block->context['postId'] ?? null; + + if ( empty( $correction_id ) || Corrections::POST_TYPE !== $block->context['postType'] ) { + return ''; + } + + $correction = get_post( $correction_id ); + + if ( empty( $correction ) ) { + return ''; + } + + ob_start(); + $correction_content = $correction->post_content; + $correction_date = \get_the_date( get_option( 'date_format' ), $correction->ID ); + $correction_time = \get_the_time( get_option( 'time_format' ), $correction->ID ); + $timezone = \wp_timezone()->getName(); + $correction_heading = sprintf( + '%s, %s %s %s:', + Corrections::get_correction_type( $correction->ID ), + $correction_date, + $correction_time, + $timezone + ); + $correction_related_post = get_post_meta( $correction->ID, Corrections::CORRECTION_POST_ID_META, true ); + $corrections_post_url = get_permalink( $correction_related_post ); + ?> +
+ + + + + + +
+ + + + { + if ( 'newspack_correction' !== postType ) { + return ( + + ); + } + + return ( + <> +
+ + { __( ' Correction Type, Date, and Time: ', 'newspack-block-theme' ) } + + + { __( + 'Correction content - What was wrong & what was corrected.', + 'newspack-block-theme' + ) } + +
+ + { __( 'Relates Post Title', 'newspack-block-theme' ) } + + + ); +}; + +blockData = { + title: __( 'Correction Item', 'newspack-block-theme' ), + icon: { + src: , + }, + usesContext: [ 'postType' ], + edit: EditComponent, + ...blockData, +}; + +registerBlockType( blockData.name, blockData ); diff --git a/includes/blocks/correction-item-block/style.scss b/includes/blocks/correction-item-block/style.scss new file mode 100644 index 0000000..88f8fb6 --- /dev/null +++ b/includes/blocks/correction-item-block/style.scss @@ -0,0 +1,6 @@ +.correction { + + &__post-link { + color: var(--newspack-ui-color-neutral-90, var(--wp--preset--color--contrast)); + } +} diff --git a/includes/blocks/index.php b/includes/blocks/index.php index baf3a4a..fda4097 100644 --- a/includes/blocks/index.php +++ b/includes/blocks/index.php @@ -13,4 +13,5 @@ if ( class_exists( 'Newspack\Corrections' ) && defined( 'NEWSPACK_CORRECTIONS_ENABLED' ) && NEWSPACK_CORRECTIONS_ENABLED ) { require_once NEWSPACK_BLOCK_THEME_FILE_PATH . '/includes/blocks/correction-box-block/class-correction-box-block.php'; + require_once NEWSPACK_BLOCK_THEME_FILE_PATH . '/includes/blocks/correction-item-block/class-correction-item-block.php'; } diff --git a/src/scss/blocks/_blocks.scss b/src/scss/blocks/_blocks.scss index 8f16a15..85e87c6 100644 --- a/src/scss/blocks/_blocks.scss +++ b/src/scss/blocks/_blocks.scss @@ -36,3 +36,4 @@ @import url('../../../includes/blocks/subtitle-block/style.scss'); @import url('../../../includes/blocks/correction-box-block/style.scss'); +@import url('../../../includes/blocks/correction-item-block/style.scss'); diff --git a/templates/archive-newspack_correction.html b/templates/archive-newspack_correction.html new file mode 100644 index 0000000..67b2a0e --- /dev/null +++ b/templates/archive-newspack_correction.html @@ -0,0 +1,38 @@ + + + +
+ +
+ +

Corrections & Clarifications

+ + + +

Write a description for the Corrections & Clarifications page here.

+
+ + + + + + + +
+ +
+ + + + + + + + + +
+ +
+ + + From a35285dba43b9f48806006bb0db0f3c7917088c3 Mon Sep 17 00:00:00 2001 From: Thomas Guillot Date: Thu, 20 Feb 2025 16:03:15 +0000 Subject: [PATCH 04/17] feat: update archive page --- templates/archive-newspack_correction.html | 39 ++++++++++++++++------ 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/templates/archive-newspack_correction.html b/templates/archive-newspack_correction.html index 67b2a0e..913ce1b 100644 --- a/templates/archive-newspack_correction.html +++ b/templates/archive-newspack_correction.html @@ -1,37 +1,56 @@ - +
+

Corrections & Clarifications

- +

Write a description for the Corrections & Clarifications page here.

-
+ + - - - + +
+ +
+ + + +
+ + + +
+ + + +
+ +
+
-
+
- - + + - +
+
From 8019e3efd4976024e74fdd984933618b72a3bf9e Mon Sep 17 00:00:00 2001 From: Thomas Guillot Date: Thu, 20 Feb 2025 17:21:22 +0000 Subject: [PATCH 05/17] feat: install wordpress icons --- package-lock.json | 331 +++++++++++++++++++++++++++++++++------------- package.json | 3 + 2 files changed, 240 insertions(+), 94 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1bdee98..3fc826e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,9 @@ "version": "1.14.0", "hasInstallScript": true, "license": "GPL-3.0", + "dependencies": { + "@wordpress/icons": "^10.18.0" + }, "devDependencies": { "@rushstack/eslint-patch": "^1.10.5", "eslint": "^7.32.0", @@ -2263,12 +2266,11 @@ "dev": true }, "node_modules/@babel/runtime": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz", - "integrity": "sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==", - "dev": true, + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.7.tgz", + "integrity": "sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==", "dependencies": { - "regenerator-runtime": "^0.13.11" + "regenerator-runtime": "^0.14.0" }, "engines": { "node": ">=6.9.0" @@ -5935,8 +5937,7 @@ "node_modules/@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", - "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==", - "dev": true + "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==" }, "node_modules/@types/q": { "version": "1.5.5", @@ -5945,13 +5946,11 @@ "dev": true }, "node_modules/@types/react": { - "version": "18.0.37", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.37.tgz", - "integrity": "sha512-4yaZZtkRN3ZIQD3KSEwkfcik8s0SWV+82dlJot1AbGYHCzJkWP3ENBY6wYeDRmKZ6HkrgoGAmR2HqdwYGp6OEw==", - "dev": true, + "version": "18.3.18", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.18.tgz", + "integrity": "sha512-t4yC+vtgnkYjNSKlFx1jkAhH8LgTo2N/7Qvi83kdEaUtMDiwpbLAktKDaAMlRcJ5eSxZkH74eEGt1ky31d7kfQ==", "dependencies": { "@types/prop-types": "*", - "@types/scheduler": "*", "csstype": "^3.0.2" } }, @@ -6750,17 +6749,104 @@ } }, "node_modules/@wordpress/icons": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-6.3.0.tgz", - "integrity": "sha512-Vliw7QsFuTsrA05GZov4i3PQiLQOGO97PR2keUeY53fVZdeoJKv/nfDqOZxZCIts5jR2Mfje6P6hc/KlurxsKg==", - "dev": true, + "version": "10.18.0", + "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-10.18.0.tgz", + "integrity": "sha512-stWW0msTspv6wCB3Pcu7PtVoFQBRr4R+oOvXlxVnpsUKuUz+mIAS08Sme9bTkHiVtHBZRK6YGpt4wYK6W0FXcw==", "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/element": "^4.1.1", - "@wordpress/primitives": "^3.1.1" + "@babel/runtime": "7.25.7", + "@wordpress/element": "^6.18.0", + "@wordpress/primitives": "^4.18.0" }, "engines": { - "node": ">=12" + "node": ">=18.12.0", + "npm": ">=8.19.2" + } + }, + "node_modules/@wordpress/icons/node_modules/@types/react-dom": { + "version": "18.3.5", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.5.tgz", + "integrity": "sha512-P4t6saawp+b/dFrUr2cvkVsfvPguwsxtH6dNIYRllMsefqFzkZk5UIjzyDOv5g1dXIPdG4Sp1yCR4Z6RCUsG/Q==", + "peerDependencies": { + "@types/react": "^18.0.0" + } + }, + "node_modules/@wordpress/icons/node_modules/@wordpress/element": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-6.18.0.tgz", + "integrity": "sha512-38wA2ta4GGOxuKofmyNP+EWA03bqBwUufQNQNd8GgcaKo4N/j+0wQMouLC/2g6n9MU5B0DH4tIv9uP9qR1miYg==", + "dependencies": { + "@babel/runtime": "7.25.7", + "@types/react": "^18.2.79", + "@types/react-dom": "^18.2.25", + "@wordpress/escape-html": "^3.18.0", + "change-case": "^4.1.2", + "is-plain-object": "^5.0.0", + "react": "^18.3.0", + "react-dom": "^18.3.0" + }, + "engines": { + "node": ">=18.12.0", + "npm": ">=8.19.2" + } + }, + "node_modules/@wordpress/icons/node_modules/@wordpress/escape-html": { + "version": "3.18.0", + "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-3.18.0.tgz", + "integrity": "sha512-5hcsoIin5IYAEejuRJqnFQB5q5C0q8VII/H7wWOWoe8IXiRQCiju/DWRC25AL2xWdUdaqiG84JuiPq+7Npb8gw==", + "dependencies": { + "@babel/runtime": "7.25.7" + }, + "engines": { + "node": ">=18.12.0", + "npm": ">=8.19.2" + } + }, + "node_modules/@wordpress/icons/node_modules/@wordpress/primitives": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-4.18.0.tgz", + "integrity": "sha512-c/8wC1MgbiQc/8kQlxuNuzeDeEW65jHSK0/qZ/afvHL1T4AmYmyC791nabpyGM+Le1kwe1LCDbPo/x2Oig0nbA==", + "dependencies": { + "@babel/runtime": "7.25.7", + "@wordpress/element": "^6.18.0", + "clsx": "^2.1.1" + }, + "engines": { + "node": ">=18.12.0", + "npm": ">=8.19.2" + }, + "peerDependencies": { + "react": "^18.0.0" + } + }, + "node_modules/@wordpress/icons/node_modules/react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@wordpress/icons/node_modules/react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + }, + "peerDependencies": { + "react": "^18.3.1" + } + }, + "node_modules/@wordpress/icons/node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "dependencies": { + "loose-envify": "^1.1.0" } }, "node_modules/@wordpress/is-shallow-equal": { @@ -8455,7 +8541,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", - "dev": true, "dependencies": { "pascal-case": "^3.1.2", "tslib": "^2.0.3" @@ -8523,7 +8608,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/capital-case/-/capital-case-1.0.4.tgz", "integrity": "sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==", - "dev": true, "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3", @@ -8581,7 +8665,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/change-case/-/change-case-4.1.2.tgz", "integrity": "sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==", - "dev": true, "dependencies": { "camel-case": "^4.1.2", "capital-case": "^1.0.4", @@ -9033,6 +9116,14 @@ "node": ">=0.10.0" } }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "engines": { + "node": ">=6" + } + }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -9357,7 +9448,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", "integrity": "sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==", - "dev": true, "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3", @@ -10148,8 +10238,7 @@ "node_modules/csstype": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", - "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==", - "dev": true + "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" }, "node_modules/cz-conventional-changelog": { "version": "3.3.0", @@ -10806,7 +10895,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", - "dev": true, "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3" @@ -13699,7 +13787,6 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", "integrity": "sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==", - "dev": true, "dependencies": { "capital-case": "^1.0.4", "tslib": "^2.0.3" @@ -14591,7 +14678,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -18732,8 +18818,7 @@ "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "node_modules/js-yaml": { "version": "4.1.0", @@ -19676,7 +19761,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, @@ -19688,7 +19772,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dev": true, "dependencies": { "tslib": "^2.0.3" } @@ -22169,6 +22252,20 @@ "node": ">=10.13.0" } }, + "node_modules/newspack-scripts/node_modules/@wordpress/icons": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-6.3.0.tgz", + "integrity": "sha512-Vliw7QsFuTsrA05GZov4i3PQiLQOGO97PR2keUeY53fVZdeoJKv/nfDqOZxZCIts5jR2Mfje6P6hc/KlurxsKg==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.16.0", + "@wordpress/element": "^4.1.1", + "@wordpress/primitives": "^3.1.1" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/newspack-scripts/node_modules/@wordpress/plugins": { "version": "4.20.0", "resolved": "https://registry.npmjs.org/@wordpress/plugins/-/plugins-4.20.0.tgz", @@ -22638,7 +22735,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dev": true, "dependencies": { "lower-case": "^2.0.2", "tslib": "^2.0.3" @@ -25829,7 +25925,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", - "dev": true, "dependencies": { "dot-case": "^3.0.4", "tslib": "^2.0.3" @@ -25918,7 +26013,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", - "dev": true, "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3" @@ -25937,7 +26031,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/path-case/-/path-case-3.0.4.tgz", "integrity": "sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==", - "dev": true, "dependencies": { "dot-case": "^3.0.4", "tslib": "^2.0.3" @@ -28759,10 +28852,9 @@ } }, "node_modules/regenerator-runtime": { - "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", - "dev": true + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" }, "node_modules/regenerator-transform": { "version": "0.15.1", @@ -30087,7 +30179,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-3.0.4.tgz", "integrity": "sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==", - "dev": true, "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3", @@ -30616,7 +30707,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", - "dev": true, "dependencies": { "dot-case": "^3.0.4", "tslib": "^2.0.3" @@ -32733,8 +32823,7 @@ "node_modules/tslib": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", - "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==", - "dev": true + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" }, "node_modules/tsutils": { "version": "3.21.0", @@ -33162,7 +33251,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-2.0.2.tgz", "integrity": "sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==", - "dev": true, "dependencies": { "tslib": "^2.0.3" } @@ -33171,7 +33259,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-2.0.2.tgz", "integrity": "sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==", - "dev": true, "dependencies": { "tslib": "^2.0.3" } @@ -35547,12 +35634,11 @@ "dev": true }, "@babel/runtime": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz", - "integrity": "sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==", - "dev": true, + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.7.tgz", + "integrity": "sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==", "requires": { - "regenerator-runtime": "^0.13.11" + "regenerator-runtime": "^0.14.0" } }, "@babel/template": { @@ -38464,8 +38550,7 @@ "@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", - "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==", - "dev": true + "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==" }, "@types/q": { "version": "1.5.5", @@ -38474,13 +38559,11 @@ "dev": true }, "@types/react": { - "version": "18.0.37", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.37.tgz", - "integrity": "sha512-4yaZZtkRN3ZIQD3KSEwkfcik8s0SWV+82dlJot1AbGYHCzJkWP3ENBY6wYeDRmKZ6HkrgoGAmR2HqdwYGp6OEw==", - "dev": true, + "version": "18.3.18", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.18.tgz", + "integrity": "sha512-t4yC+vtgnkYjNSKlFx1jkAhH8LgTo2N/7Qvi83kdEaUtMDiwpbLAktKDaAMlRcJ5eSxZkH74eEGt1ky31d7kfQ==", "requires": { "@types/prop-types": "*", - "@types/scheduler": "*", "csstype": "^3.0.2" } }, @@ -39098,14 +39181,79 @@ } }, "@wordpress/icons": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-6.3.0.tgz", - "integrity": "sha512-Vliw7QsFuTsrA05GZov4i3PQiLQOGO97PR2keUeY53fVZdeoJKv/nfDqOZxZCIts5jR2Mfje6P6hc/KlurxsKg==", - "dev": true, + "version": "10.18.0", + "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-10.18.0.tgz", + "integrity": "sha512-stWW0msTspv6wCB3Pcu7PtVoFQBRr4R+oOvXlxVnpsUKuUz+mIAS08Sme9bTkHiVtHBZRK6YGpt4wYK6W0FXcw==", "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/element": "^4.1.1", - "@wordpress/primitives": "^3.1.1" + "@babel/runtime": "7.25.7", + "@wordpress/element": "^6.18.0", + "@wordpress/primitives": "^4.18.0" + }, + "dependencies": { + "@types/react-dom": { + "version": "18.3.5", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.5.tgz", + "integrity": "sha512-P4t6saawp+b/dFrUr2cvkVsfvPguwsxtH6dNIYRllMsefqFzkZk5UIjzyDOv5g1dXIPdG4Sp1yCR4Z6RCUsG/Q==", + "requires": {} + }, + "@wordpress/element": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-6.18.0.tgz", + "integrity": "sha512-38wA2ta4GGOxuKofmyNP+EWA03bqBwUufQNQNd8GgcaKo4N/j+0wQMouLC/2g6n9MU5B0DH4tIv9uP9qR1miYg==", + "requires": { + "@babel/runtime": "7.25.7", + "@types/react": "^18.2.79", + "@types/react-dom": "^18.2.25", + "@wordpress/escape-html": "^3.18.0", + "change-case": "^4.1.2", + "is-plain-object": "^5.0.0", + "react": "^18.3.0", + "react-dom": "^18.3.0" + } + }, + "@wordpress/escape-html": { + "version": "3.18.0", + "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-3.18.0.tgz", + "integrity": "sha512-5hcsoIin5IYAEejuRJqnFQB5q5C0q8VII/H7wWOWoe8IXiRQCiju/DWRC25AL2xWdUdaqiG84JuiPq+7Npb8gw==", + "requires": { + "@babel/runtime": "7.25.7" + } + }, + "@wordpress/primitives": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-4.18.0.tgz", + "integrity": "sha512-c/8wC1MgbiQc/8kQlxuNuzeDeEW65jHSK0/qZ/afvHL1T4AmYmyC791nabpyGM+Le1kwe1LCDbPo/x2Oig0nbA==", + "requires": { + "@babel/runtime": "7.25.7", + "@wordpress/element": "^6.18.0", + "clsx": "^2.1.1" + } + }, + "react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "requires": { + "loose-envify": "^1.1.0" + } + }, + "react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "requires": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + } + }, + "scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "requires": { + "loose-envify": "^1.1.0" + } + } } }, "@wordpress/is-shallow-equal": { @@ -40412,7 +40560,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", - "dev": true, "requires": { "pascal-case": "^3.1.2", "tslib": "^2.0.3" @@ -40457,7 +40604,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/capital-case/-/capital-case-1.0.4.tgz", "integrity": "sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==", - "dev": true, "requires": { "no-case": "^3.0.4", "tslib": "^2.0.3", @@ -40503,7 +40649,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/change-case/-/change-case-4.1.2.tgz", "integrity": "sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==", - "dev": true, "requires": { "camel-case": "^4.1.2", "capital-case": "^1.0.4", @@ -40854,6 +40999,11 @@ } } }, + "clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==" + }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -41132,7 +41282,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", "integrity": "sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==", - "dev": true, "requires": { "no-case": "^3.0.4", "tslib": "^2.0.3", @@ -41733,8 +41882,7 @@ "csstype": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", - "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==", - "dev": true + "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" }, "cz-conventional-changelog": { "version": "3.3.0", @@ -42227,7 +42375,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", - "dev": true, "requires": { "no-case": "^3.0.4", "tslib": "^2.0.3" @@ -44484,7 +44631,6 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", "integrity": "sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==", - "dev": true, "requires": { "capital-case": "^1.0.4", "tslib": "^2.0.3" @@ -45147,8 +45293,7 @@ "is-plain-object": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "dev": true + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" }, "is-potential-custom-element-name": { "version": "1.0.1", @@ -48427,8 +48572,7 @@ "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "js-yaml": { "version": "4.1.0", @@ -49157,7 +49301,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, "requires": { "js-tokens": "^3.0.0 || ^4.0.0" } @@ -49166,7 +49309,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dev": true, "requires": { "tslib": "^2.0.3" } @@ -51112,6 +51254,17 @@ } } }, + "@wordpress/icons": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-6.3.0.tgz", + "integrity": "sha512-Vliw7QsFuTsrA05GZov4i3PQiLQOGO97PR2keUeY53fVZdeoJKv/nfDqOZxZCIts5jR2Mfje6P6hc/KlurxsKg==", + "dev": true, + "requires": { + "@babel/runtime": "^7.16.0", + "@wordpress/element": "^4.1.1", + "@wordpress/primitives": "^3.1.1" + } + }, "@wordpress/plugins": { "version": "4.20.0", "resolved": "https://registry.npmjs.org/@wordpress/plugins/-/plugins-4.20.0.tgz", @@ -51484,7 +51637,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dev": true, "requires": { "lower-case": "^2.0.2", "tslib": "^2.0.3" @@ -53732,7 +53884,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", - "dev": true, "requires": { "dot-case": "^3.0.4", "tslib": "^2.0.3" @@ -53800,7 +53951,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", - "dev": true, "requires": { "no-case": "^3.0.4", "tslib": "^2.0.3" @@ -53816,7 +53966,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/path-case/-/path-case-3.0.4.tgz", "integrity": "sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==", - "dev": true, "requires": { "dot-case": "^3.0.4", "tslib": "^2.0.3" @@ -55980,10 +56129,9 @@ } }, "regenerator-runtime": { - "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", - "dev": true + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" }, "regenerator-transform": { "version": "0.15.1", @@ -56976,7 +57124,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-3.0.4.tgz", "integrity": "sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==", - "dev": true, "requires": { "no-case": "^3.0.4", "tslib": "^2.0.3", @@ -57410,7 +57557,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", - "dev": true, "requires": { "dot-case": "^3.0.4", "tslib": "^2.0.3" @@ -59031,8 +59177,7 @@ "tslib": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", - "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==", - "dev": true + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" }, "tsutils": { "version": "3.21.0", @@ -59351,7 +59496,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-2.0.2.tgz", "integrity": "sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==", - "dev": true, "requires": { "tslib": "^2.0.3" } @@ -59360,7 +59504,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-2.0.2.tgz", "integrity": "sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==", - "dev": true, "requires": { "tslib": "^2.0.3" } diff --git a/package.json b/package.json index 87231db..4c1f69a 100644 --- a/package.json +++ b/package.json @@ -48,5 +48,8 @@ "postcss-scss": "^4.0.9", "prettier": "npm:wp-prettier@^2.6.2-beta-1", "stylelint": "^16.14.0" + }, + "dependencies": { + "@wordpress/icons": "^10.18.0" } } From 04b2c09f13cb5f2babe070a913a08b0eeab2558f Mon Sep 17 00:00:00 2001 From: Thomas Guillot Date: Thu, 20 Feb 2025 17:21:42 +0000 Subject: [PATCH 06/17] feat: update archive description --- templates/archive-newspack_correction.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/archive-newspack_correction.html b/templates/archive-newspack_correction.html index 913ce1b..fdf7b6b 100644 --- a/templates/archive-newspack_correction.html +++ b/templates/archive-newspack_correction.html @@ -10,7 +10,7 @@

Corrections & Clarifications

-

Write a description for the Corrections & Clarifications page here.

+

We are committed to truthful, transparent, and accurate reporting. When we make a mistake, we correct it promptly and note the change clearly. Clarifications, when needed, provide additional context.

From 1312559d9c147950eb19778286dab915b25948b3 Mon Sep 17 00:00:00 2001 From: Thomas Guillot Date: Thu, 20 Feb 2025 17:25:49 +0000 Subject: [PATCH 07/17] feat(correction-box-block): add more block-support and update icon --- .../blocks/correction-box-block/block.json | 33 ++++++++++++++----- includes/blocks/correction-box-block/edit.jsx | 5 ++- includes/blocks/correction-box-block/index.js | 20 +++++++++-- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/includes/blocks/correction-box-block/block.json b/includes/blocks/correction-box-block/block.json index 879d939..a17ba55 100644 --- a/includes/blocks/correction-box-block/block.json +++ b/includes/blocks/correction-box-block/block.json @@ -1,27 +1,42 @@ { - "$schema": "https://schemas.wp.org/trunk/block.json", "name": "newspack-block-theme/correction-box", - "title": "Corrections Box", "category": "newspack", - "description": "A box to display corrections.", "attributes": {}, "supports": { "html": false, + "__experimentalBorder": { + "color": true, + "radius": true, + "style": true, + "width": true + }, "color": { - "gradients": true, + "link": true, "__experimentalDefaultControls": { - "background": true, - "text": true, - "link": true + "background": true, + "text": true } }, "spacing": { "margin": true, - "padding": true + "padding": true, + "blockGap": true }, + "shadow": true, "typography": { "fontSize": true, - "lineHeight": true + "lineHeight": true, + "textAlign": true, + "__experimentalFontFamily": true, + "__experimentalTextDecoration": true, + "__experimentalFontStyle": true, + "__experimentalFontWeight": true, + "__experimentalLetterSpacing": true, + "__experimentalTextTransform": true, + "__experimentalWritingMode": true, + "__experimentalDefaultControls": { + "fontSize": true + } } }, "usesContext": [ "postId" ], diff --git a/includes/blocks/correction-box-block/edit.jsx b/includes/blocks/correction-box-block/edit.jsx index c093f10..39a6518 100644 --- a/includes/blocks/correction-box-block/edit.jsx +++ b/includes/blocks/correction-box-block/edit.jsx @@ -33,10 +33,9 @@ export default function Edit() { function LoadingPlaceholder() { return ( diff --git a/includes/blocks/correction-box-block/index.js b/includes/blocks/correction-box-block/index.js index 89dcfd1..59a06aa 100644 --- a/includes/blocks/correction-box-block/index.js +++ b/includes/blocks/correction-box-block/index.js @@ -2,8 +2,8 @@ * WordPress dependencies */ import { registerBlockType } from '@wordpress/blocks'; +import { Path, SVG } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; -import { Icon, receipt } from '@wordpress/icons'; /** * Internal dependencies @@ -11,11 +11,25 @@ import { Icon, receipt } from '@wordpress/icons'; import blockData from './block.json'; import Edit from './edit'; +export const title = __( 'Corrections', 'newspack-blocks' ); + +export const icon = ( + + + +); + blockData = { - title: __( 'Correction Box', 'newspack-block-theme' ), + title, icon: { - src: , + src: icon, + foreground: '#406ebc', }, + keywords: [ __( 'clarifications', 'newspack-blocks' ), __( 'updates', 'newspack-blocks' ) ], + description: __( + 'Display all corrections and clarifications made to a post.', + 'newspack-blocks' + ), usesContext: [ 'postId' ], edit: Edit, ...blockData, From b0f4949ee3ec3339c1aeb0a54e61a64674791804 Mon Sep 17 00:00:00 2001 From: Thomas Guillot Date: Thu, 20 Feb 2025 17:29:32 +0000 Subject: [PATCH 08/17] feat(correction-item-block): add more block-support and update icon --- .../blocks/correction-item-block/block.json | 33 +++++++++++++----- .../blocks/correction-item-block/editor.js | 34 +++++++++++++------ 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/includes/blocks/correction-item-block/block.json b/includes/blocks/correction-item-block/block.json index ce2e04c..9a9cfe6 100644 --- a/includes/blocks/correction-item-block/block.json +++ b/includes/blocks/correction-item-block/block.json @@ -1,27 +1,42 @@ { - "$schema": "https://schemas.wp.org/trunk/block.json", "name": "newspack-block-theme/correction-item", - "title": "Correction Item", "category": "newspack", - "description": "An item in the list of corrections.", "attributes": {}, "supports": { "html": false, + "__experimentalBorder": { + "color": true, + "radius": true, + "style": true, + "width": true + }, "color": { - "gradients": true, + "link": true, "__experimentalDefaultControls": { - "background": true, - "text": true, - "link": true + "background": true, + "text": true } }, "spacing": { "margin": true, - "padding": true + "padding": true, + "blockGap": true }, + "shadow": true, "typography": { "fontSize": true, - "lineHeight": true + "lineHeight": true, + "textAlign": true, + "__experimentalFontFamily": true, + "__experimentalTextDecoration": true, + "__experimentalFontStyle": true, + "__experimentalFontWeight": true, + "__experimentalLetterSpacing": true, + "__experimentalTextTransform": true, + "__experimentalWritingMode": true, + "__experimentalDefaultControls": { + "fontSize": true + } } }, "parent": [ "core/post-template" ], diff --git a/includes/blocks/correction-item-block/editor.js b/includes/blocks/correction-item-block/editor.js index 3773040..926b193 100644 --- a/includes/blocks/correction-item-block/editor.js +++ b/includes/blocks/correction-item-block/editor.js @@ -2,9 +2,8 @@ * WordPress dependencies */ import { registerBlockType } from '@wordpress/blocks'; -import { Placeholder } from '@wordpress/components'; +import { Path, Placeholder, SVG } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; -import { Icon, receipt } from '@wordpress/icons'; /** * Internal dependencies @@ -12,14 +11,22 @@ import { Icon, receipt } from '@wordpress/icons'; import blockData from './block.json'; import './style.scss'; +export const title = __( 'Correction Item', 'newspack-blocks' ); + +export const icon = ( + + + +); + const EditComponent = ( { context: { postType } } ) => { if ( 'newspack_correction' !== postType ) { return ( @@ -30,27 +37,32 @@ const EditComponent = ( { context: { postType } } ) => { <>
- { __( ' Correction Type, Date, and Time: ', 'newspack-block-theme' ) } + { __( 'Correction Type, Date, and Time: ', 'newspack-block-theme' ) } { __( - 'Correction content - What was wrong & what was corrected.', + 'This is where the content will appear, providing details about the update, whether correcting an error or offering additional context.', 'newspack-block-theme' ) }
- - { __( 'Relates Post Title', 'newspack-block-theme' ) } + + { __( 'Post Title', 'newspack-block-theme' ) } ); }; blockData = { - title: __( 'Correction Item', 'newspack-block-theme' ), + title, icon: { - src: , + src: icon, + foreground: '#406ebc', }, + description: __( + 'Display an archive of all the corrections and clarifications.', + 'newspack-blocks' + ), usesContext: [ 'postType' ], edit: EditComponent, ...blockData, From a28ebc0bc0a2544532318e8eff7208fb6f53f7e1 Mon Sep 17 00:00:00 2001 From: Thomas Guillot Date: Thu, 20 Feb 2025 17:33:48 +0000 Subject: [PATCH 09/17] fix(correction-item-block): block-gap not needed --- includes/blocks/correction-item-block/block.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/blocks/correction-item-block/block.json b/includes/blocks/correction-item-block/block.json index 9a9cfe6..f467cbd 100644 --- a/includes/blocks/correction-item-block/block.json +++ b/includes/blocks/correction-item-block/block.json @@ -19,8 +19,7 @@ }, "spacing": { "margin": true, - "padding": true, - "blockGap": true + "padding": true }, "shadow": true, "typography": { From 74bb52cfa7d282f7ab1d985e3f225ac9d65097c5 Mon Sep 17 00:00:00 2001 From: Takshil Kunadia Date: Fri, 21 Feb 2025 19:53:49 +0530 Subject: [PATCH 10/17] fix(correction-box-block): block settings, add layout support --- .../blocks/correction-box-block/block.json | 1 + .../class-correction-box-block.php | 4 ++-- includes/blocks/correction-box-block/edit.jsx | 18 ++++++------------ .../blocks/correction-box-block/style.scss | 10 ---------- src/scss/blocks/_blocks.scss | 1 - 5 files changed, 9 insertions(+), 25 deletions(-) delete mode 100644 includes/blocks/correction-box-block/style.scss diff --git a/includes/blocks/correction-box-block/block.json b/includes/blocks/correction-box-block/block.json index a17ba55..28ed96f 100644 --- a/includes/blocks/correction-box-block/block.json +++ b/includes/blocks/correction-box-block/block.json @@ -22,6 +22,7 @@ "padding": true, "blockGap": true }, + "layout": true, "shadow": true, "typography": { "fontSize": true, diff --git a/includes/blocks/correction-box-block/class-correction-box-block.php b/includes/blocks/correction-box-block/class-correction-box-block.php index 044211c..d7b015f 100644 --- a/includes/blocks/correction-box-block/class-correction-box-block.php +++ b/includes/blocks/correction-box-block/class-correction-box-block.php @@ -67,11 +67,12 @@ public static function render_block( array $attributes, string $content, $block return ''; } + $block_wrapper_attributes = get_block_wrapper_attributes(); $corrections_archive_url = get_post_type_archive_link( Corrections::POST_TYPE ); ob_start(); ?> -
+
> post_content; @@ -96,7 +97,6 @@ public static function render_block( array $attributes, string $content, $block

- -
- -
+ ); } diff --git a/includes/blocks/correction-box-block/style.scss b/includes/blocks/correction-box-block/style.scss deleted file mode 100644 index 0765bfa..0000000 --- a/includes/blocks/correction-box-block/style.scss +++ /dev/null @@ -1,10 +0,0 @@ -.newspack-corrections-module { - .correction { - color: var(--newspack-theme-color-text-light, var(--wp--preset--color--contrast-3)); - font-size: var(--newspack-theme-font-size-sm, var(--wp--preset--font-size--small)); - - a { - color: var(--newspack-theme-color-text-light, var(--wp--preset--color--contrast-3)); - } - } -} diff --git a/src/scss/blocks/_blocks.scss b/src/scss/blocks/_blocks.scss index 85e87c6..3936103 100644 --- a/src/scss/blocks/_blocks.scss +++ b/src/scss/blocks/_blocks.scss @@ -35,5 +35,4 @@ @import url('./yoast/_how-to.scss'); @import url('../../../includes/blocks/subtitle-block/style.scss'); -@import url('../../../includes/blocks/correction-box-block/style.scss'); @import url('../../../includes/blocks/correction-item-block/style.scss'); From 8e4610a6889d3bdb2f4db7877e567525beb0b902 Mon Sep 17 00:00:00 2001 From: Takshil Kunadia Date: Fri, 21 Feb 2025 19:54:59 +0530 Subject: [PATCH 11/17] feat(corrections-item): rename corrections archive template --- ...{archive-newspack_correction.html => corrections-archive.html} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename templates/{archive-newspack_correction.html => corrections-archive.html} (100%) diff --git a/templates/archive-newspack_correction.html b/templates/corrections-archive.html similarity index 100% rename from templates/archive-newspack_correction.html rename to templates/corrections-archive.html From 0883bbb353ff7fc0618486ee70766cbcdfc134df Mon Sep 17 00:00:00 2001 From: Takshil Kunadia Date: Fri, 21 Feb 2025 20:05:33 +0530 Subject: [PATCH 12/17] fix(correction-box-block): remove unnecessary escaping --- .../blocks/correction-box-block/class-correction-box-block.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/blocks/correction-box-block/class-correction-box-block.php b/includes/blocks/correction-box-block/class-correction-box-block.php index d7b015f..c06a596 100644 --- a/includes/blocks/correction-box-block/class-correction-box-block.php +++ b/includes/blocks/correction-box-block/class-correction-box-block.php @@ -72,7 +72,7 @@ public static function render_block( array $attributes, string $content, $block ob_start(); ?> -
> +
> post_content; From 6fde9892f26dad5068a81e9bb5d33fa8d314a903 Mon Sep 17 00:00:00 2001 From: Takshil Kunadia Date: Fri, 21 Feb 2025 20:14:37 +0530 Subject: [PATCH 13/17] feat(correction-box-block): add empty placeholder for template --- includes/blocks/correction-box-block/edit.jsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/includes/blocks/correction-box-block/edit.jsx b/includes/blocks/correction-box-block/edit.jsx index b30ff16..d2ce57a 100644 --- a/includes/blocks/correction-box-block/edit.jsx +++ b/includes/blocks/correction-box-block/edit.jsx @@ -40,6 +40,23 @@ export default function Edit() { ); } + /** + * Placeholder when no Corrections are available. + * + * @return {JSX.Element} The Empty Placeholder JSX. + */ + function EmptyPlaceholder() { + return ( + + ); + } + /** * Toggle Refresh state. */ @@ -61,6 +78,7 @@ export default function Edit() { From fcfcbe5130f3612b882d63e8b4b0c59012ae6f76 Mon Sep 17 00:00:00 2001 From: Takshil Kunadia Date: Tue, 25 Feb 2025 16:58:54 +0530 Subject: [PATCH 14/17] feat(correction-box): add site editor UI --- .../class-correction-box-block.php | 8 +++ .../correction-box-block/site-editor.js | 49 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 includes/blocks/correction-box-block/site-editor.js diff --git a/includes/blocks/correction-box-block/class-correction-box-block.php b/includes/blocks/correction-box-block/class-correction-box-block.php index c06a596..9ff21a0 100644 --- a/includes/blocks/correction-box-block/class-correction-box-block.php +++ b/includes/blocks/correction-box-block/class-correction-box-block.php @@ -40,6 +40,14 @@ public static function register_block() { * Enqueues block editor assets. */ public static function enqueue_block_editor_assets() { + global $pagenow; + $handle = ''; + if ( 'site-editor.php' === $pagenow ) { + $handle = 'newspack-block-theme-correction-box-site-editor'; + wp_enqueue_script( $handle, \get_theme_file_uri( 'dist/correction-box-block-site-editor.js' ), [ 'wp-blocks', 'wp-i18n', 'wp-element' ], NEWSPACK_BLOCK_THEME_VERSION, true ); + return; + } + $handle = 'newspack-block-theme-correction-box-block'; wp_enqueue_script( $handle, \get_theme_file_uri( 'dist/correction-box-block-index.js' ), [ 'wp-blocks', 'wp-i18n', 'wp-element' ], NEWSPACK_BLOCK_THEME_VERSION, true ); } diff --git a/includes/blocks/correction-box-block/site-editor.js b/includes/blocks/correction-box-block/site-editor.js new file mode 100644 index 0000000..54d7f66 --- /dev/null +++ b/includes/blocks/correction-box-block/site-editor.js @@ -0,0 +1,49 @@ +/** + * WordPress dependencies + */ +import { registerBlockType } from '@wordpress/blocks'; +import { Path, SVG, Placeholder } from '@wordpress/components'; +import { __ } from '@wordpress/i18n'; + +/** + * Internal dependencies + */ +import blockData from './block.json'; + +export const title = __( 'Corrections', 'newspack-block-theme' ); + +export const icon = ( + + + +); + +const EditComponent = () => { + return ( + + ); +}; + +const siteEditorBlockData = { + title, + icon: { + src: icon, + foreground: '#406ebc', + }, + attributes: {}, + supports: {}, + keywords: [ __( 'clarifications', 'newspack-blocks' ), __( 'updates', 'newspack-blocks' ) ], + description: __( + 'Display all corrections and clarifications made to a post.', + 'newspack-blocks' + ), + edit: EditComponent, +}; + +registerBlockType( blockData.name, siteEditorBlockData ); From 56ba2444ab93f0f4cb82e9fbf22e5aa64bdb18a0 Mon Sep 17 00:00:00 2001 From: Takshil Kunadia Date: Wed, 26 Feb 2025 15:24:29 +0530 Subject: [PATCH 15/17] feat(correction-box): update edit component for dislaying default message on template edit --- includes/blocks/correction-box-block/edit.jsx | 34 +++++++------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/includes/blocks/correction-box-block/edit.jsx b/includes/blocks/correction-box-block/edit.jsx index d2ce57a..c66abf4 100644 --- a/includes/blocks/correction-box-block/edit.jsx +++ b/includes/blocks/correction-box-block/edit.jsx @@ -3,10 +3,11 @@ */ import { __ } from '@wordpress/i18n'; import { update } from '@wordpress/icons'; +import { useSelect } from '@wordpress/data'; import { useState } from '@wordpress/element'; import ServerSideRender from '@wordpress/server-side-render'; import { BlockControls } from '@wordpress/block-editor'; -import { Placeholder, Spinner, ToolbarGroup, ToolbarButton } from '@wordpress/components'; +import { Placeholder, ToolbarGroup, ToolbarButton } from '@wordpress/components'; /** * Internal dependencies @@ -20,25 +21,7 @@ import meta from './block.json'; */ export default function Edit() { const [ isRefreshing, setIsRefreshing ] = useState( false ); - - /** - * Placeholder when Corrections are loading/Refreshed. - * - * @return {JSX.Element} The Loading Placeholder JSX. - */ - function LoadingPlaceholder() { - return ( - - - - ); - } + const postType = useSelect( select => select( 'core/editor' ).getCurrentPostType(), [] ); /** * Placeholder when no Corrections are available. @@ -64,7 +47,15 @@ export default function Edit() { setIsRefreshing( ! isRefreshing ); }; - return ( + return 'wp_template' === postType ? ( + + ) : ( <> @@ -77,7 +68,6 @@ export default function Edit() { From d3684088d714b86dbf803b56240aa0ad40ece737 Mon Sep 17 00:00:00 2001 From: Takshil Kunadia Date: Wed, 26 Feb 2025 15:48:32 +0530 Subject: [PATCH 16/17] feat(correction-box): enable supports on site editor --- includes/blocks/correction-box-block/site-editor.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/blocks/correction-box-block/site-editor.js b/includes/blocks/correction-box-block/site-editor.js index 54d7f66..c53bd3d 100644 --- a/includes/blocks/correction-box-block/site-editor.js +++ b/includes/blocks/correction-box-block/site-editor.js @@ -36,13 +36,12 @@ const siteEditorBlockData = { src: icon, foreground: '#406ebc', }, - attributes: {}, - supports: {}, keywords: [ __( 'clarifications', 'newspack-blocks' ), __( 'updates', 'newspack-blocks' ) ], description: __( 'Display all corrections and clarifications made to a post.', 'newspack-blocks' ), + ...blockData, edit: EditComponent, }; From 925b5493db512e7aa9cf3db463855c9bfa7fe7e6 Mon Sep 17 00:00:00 2001 From: Takshil Kunadia Date: Wed, 26 Feb 2025 20:31:20 +0530 Subject: [PATCH 17/17] refactor(correction-boc): remove Placeholder in edit component --- includes/blocks/correction-box-block/edit.jsx | 31 ++++++++++--------- .../correction-box-block/site-editor.js | 23 +++++++++----- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/includes/blocks/correction-box-block/edit.jsx b/includes/blocks/correction-box-block/edit.jsx index c66abf4..2cb9148 100644 --- a/includes/blocks/correction-box-block/edit.jsx +++ b/includes/blocks/correction-box-block/edit.jsx @@ -7,7 +7,7 @@ import { useSelect } from '@wordpress/data'; import { useState } from '@wordpress/element'; import ServerSideRender from '@wordpress/server-side-render'; import { BlockControls } from '@wordpress/block-editor'; -import { Placeholder, ToolbarGroup, ToolbarButton } from '@wordpress/components'; +import { ToolbarGroup, ToolbarButton } from '@wordpress/components'; /** * Internal dependencies @@ -30,13 +30,20 @@ export default function Edit() { */ function EmptyPlaceholder() { return ( - + <> +

+ { __( + 'This is the Corrections block, it will display all the corrections and clarifications.', + 'newspack-block-theme' + ) } +

+

+ { __( + 'If there are no corrections or clarifications, this block will not be displayed.', + 'newspack-block-theme' + ) } +

+ ); } @@ -48,13 +55,7 @@ export default function Edit() { }; return 'wp_template' === postType ? ( - + ) : ( <> diff --git a/includes/blocks/correction-box-block/site-editor.js b/includes/blocks/correction-box-block/site-editor.js index c53bd3d..9348460 100644 --- a/includes/blocks/correction-box-block/site-editor.js +++ b/includes/blocks/correction-box-block/site-editor.js @@ -2,7 +2,7 @@ * WordPress dependencies */ import { registerBlockType } from '@wordpress/blocks'; -import { Path, SVG, Placeholder } from '@wordpress/components'; +import { Path, SVG } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; /** @@ -20,13 +20,20 @@ export const icon = ( const EditComponent = () => { return ( - + <> +

+ { __( + 'This is the Corrections block, it will display all the corrections and clarifications.', + 'newspack-block-theme' + ) } +

+

+ { __( + 'If there are no corrections or clarifications, this block will not be displayed.', + 'newspack-block-theme' + ) } +

+ ); };