From 2c2660a07813d9892c6c76c09cbd6239fc3f544d Mon Sep 17 00:00:00 2001 From: Milan Ricoul Date: Fri, 26 Jun 2026 15:16:53 +0200 Subject: [PATCH 1/5] Refactor FAQ block markup to align with blockparty-accordion. Replace faq__* classes with wp-block-blockparty-faq-* structure, add CSS custom properties, and register deprecated handlers so existing 2.0.x content keeps validating and rendering. --- README.md | 6 ++ blockparty-faq.php | 8 +-- package.json | 2 +- src/faq-answer/block.json | 2 +- src/faq-answer/deprecated.js | 42 ++++++++++++ src/faq-answer/edit.js | 32 ++++----- src/faq-answer/index.js | 6 ++ src/faq-answer/save.js | 17 +++-- src/faq-item/block.json | 2 +- src/faq-item/deprecated.js | 29 ++++++++ src/faq-item/edit.js | 27 +++----- src/faq-item/index.js | 6 ++ src/faq-item/save.js | 4 +- src/faq-question/block.json | 2 +- src/faq-question/deprecated.js | 53 +++++++++++++++ src/faq-question/edit.js | 72 +++++++++----------- src/faq-question/index.js | 6 ++ src/faq-question/save.js | 32 +++++---- src/faq/block.json | 2 +- src/faq/deprecated.js | 32 ++++++++- src/faq/edit.js | 18 ++--- src/faq/editor.scss | 42 +++++++----- src/faq/save.js | 11 +-- src/faq/script.js | 9 ++- src/faq/style.scss | 118 ++++++++++++++++++++++++++++++--- 25 files changed, 425 insertions(+), 155 deletions(-) create mode 100644 src/faq-answer/deprecated.js create mode 100644 src/faq-item/deprecated.js create mode 100644 src/faq-question/deprecated.js diff --git a/README.md b/README.md index 82b886d..8360985 100644 --- a/README.md +++ b/README.md @@ -90,3 +90,9 @@ Yoast SEO is required for the FAQ schema (JSON-LD) generation. It is installed a - Add spacing support for answers - Add font size support for the question - Strip HTML tags from the question in structured data + +### 2.0.4 - 2026-06-26 + +- Refactor block markup to align with `blockparty-accordion` structure (`wp-block-blockparty-faq-*` classes) +- Add CSS custom properties for styling (`--wp--blockparty--faq--*`) +- Add deprecated handlers for 2.0.x markup retrocompatibility diff --git a/blockparty-faq.php b/blockparty-faq.php index a0c11f4..b0ab6e9 100644 --- a/blockparty-faq.php +++ b/blockparty-faq.php @@ -4,7 +4,7 @@ * Description: A FAQ block for WordPress Editor that provided structured data based on FAQ schema. * Requires at least: 6.2 * Requires PHP: 8.1 - * Version: 2.0.3 + * Version: 2.0.4 * Plugin URI: https://beapi.fr * Author: Be API Technical team * Author URI: https://beapi.fr @@ -41,7 +41,7 @@ } // Plugin constants -define( 'BLOCKPARTY_FAQ_VERSION', '2.0.3' ); +define( 'BLOCKPARTY_FAQ_VERSION', '2.0.4' ); // Plugin URL and PATH define( 'BLOCKPARTY_FAQ_DIR', plugin_dir_path( __FILE__ ) ); @@ -83,9 +83,9 @@ function blockparty_faq_init(): void { 'forceExpand' => false, 'hasAnimation' => true, 'openMultiple' => false, - 'panelSelector' => '.faq__panel', + 'panelSelector' => '.wp-block-blockparty-faq-answer', 'prefixId' => 'block-faq', - 'triggerSelector' => '.faq__trigger', + 'triggerSelector' => '.wp-block-blockparty-faq-trigger', ] ), ]; diff --git a/package.json b/package.json index b604620..9b62690 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blockparty-faq", - "version": "2.0.3", + "version": "2.0.4", "description": "SEO friendly FAQ module in an accessible accordion", "author": "Be API Technical team", "license": "GPL-2.0-or-later", diff --git a/src/faq-answer/block.json b/src/faq-answer/block.json index bf79231..f9c6faf 100644 --- a/src/faq-answer/block.json +++ b/src/faq-answer/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "blockparty/faq-answer", - "version": "2.0.3", + "version": "2.0.4", "title": "FAQ Answer", "category": "design", "parent": [ "blockparty/faq-item" ], diff --git a/src/faq-answer/deprecated.js b/src/faq-answer/deprecated.js new file mode 100644 index 0000000..73a69df --- /dev/null +++ b/src/faq-answer/deprecated.js @@ -0,0 +1,42 @@ +/** + * WordPress dependencies + */ +import { useBlockProps, InnerBlocks } from '@wordpress/block-editor'; + +/** + * Save function for deprecated 2.0.x markup with faq__panel class. + * + * @param {Object} props Component props. + * @param {Object} props.attributes Block attributes. + * @return {JSX.Element} Saved block markup. + */ +function deprecatedSave( { attributes } ) { + const { isAccordion = true } = attributes; + const blockProps = useBlockProps.save( { + className: 'faq__panel', + } ); + + const divProps = isAccordion + ? { ...blockProps, role: 'region' } + : blockProps; + + return ( +
+ +
+ ); +} + +const deprecated = [ + { + attributes: { + isAccordion: { + type: 'boolean', + default: true, + }, + }, + save: deprecatedSave, + }, +]; + +export default deprecated; diff --git a/src/faq-answer/edit.js b/src/faq-answer/edit.js index e5ae80b..f86ab76 100644 --- a/src/faq-answer/edit.js +++ b/src/faq-answer/edit.js @@ -13,24 +13,24 @@ const ALLOWED_BLOCKS = [ ]; export default function Edit() { - const blockProps = useBlockProps( { - className: 'faq__panel', - } ); + const blockProps = useBlockProps(); return ( -
- +
+
+ +
); } diff --git a/src/faq-answer/index.js b/src/faq-answer/index.js index cb97459..66c6552 100644 --- a/src/faq-answer/index.js +++ b/src/faq-answer/index.js @@ -11,6 +11,7 @@ import './style.scss'; import './editor.scss'; import Edit from './edit'; import save from './save'; +import deprecated from './deprecated'; import metadata from './block.json'; registerBlockType( metadata.name, { @@ -24,5 +25,10 @@ registerBlockType( metadata.name, { * @see ./save.js */ save, + + /** + * @see ./deprecated.js + */ + deprecated, icon: postContent, } ); diff --git a/src/faq-answer/save.js b/src/faq-answer/save.js index 7a5afe0..8cff587 100644 --- a/src/faq-answer/save.js +++ b/src/faq-answer/save.js @@ -1,21 +1,20 @@ /** * WordPress dependencies */ -import { useBlockProps, InnerBlocks } from '@wordpress/block-editor'; +import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor'; export default function save( { attributes } ) { const { isAccordion = true } = attributes; - const blockProps = useBlockProps.save( { - className: 'faq__panel', + const blockProps = useBlockProps.save( + isAccordion ? { role: 'region' } : {} + ); + const innerBlocksProps = useInnerBlocksProps.save( { + className: 'wp-block-blockparty-faq-answer__inner', } ); - const divProps = isAccordion - ? { ...blockProps, role: 'region' } - : blockProps; - return ( -
- +
+
); } diff --git a/src/faq-item/block.json b/src/faq-item/block.json index a584901..7a0c25e 100644 --- a/src/faq-item/block.json +++ b/src/faq-item/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "blockparty/faq-item", - "version": "2.0.3", + "version": "2.0.4", "title": "FAQ Item", "category": "design", "parent": [ "blockparty/faq" ], diff --git a/src/faq-item/deprecated.js b/src/faq-item/deprecated.js new file mode 100644 index 0000000..63f4a2e --- /dev/null +++ b/src/faq-item/deprecated.js @@ -0,0 +1,29 @@ +/** + * WordPress dependencies + */ +import { useBlockProps, InnerBlocks } from '@wordpress/block-editor'; + +/** + * Save function for deprecated 2.0.x markup with faq__item class. + * + * @return {JSX.Element} Saved block markup. + */ +function deprecatedSave() { + const blockProps = useBlockProps.save( { + className: 'faq__item', + } ); + + return ( +
+ +
+ ); +} + +const deprecated = [ + { + save: deprecatedSave, + }, +]; + +export default deprecated; diff --git a/src/faq-item/edit.js b/src/faq-item/edit.js index a5d1b94..67ca7da 100644 --- a/src/faq-item/edit.js +++ b/src/faq-item/edit.js @@ -3,8 +3,8 @@ */ import { useBlockProps, + useInnerBlocksProps, BlockControls, - InnerBlocks, } from '@wordpress/block-editor'; import { ToolbarGroup, ToolbarButton } from '@wordpress/components'; import { addCard, trash } from '@wordpress/icons'; @@ -13,8 +13,14 @@ import { createBlock } from '@wordpress/blocks'; import { __ } from '@wordpress/i18n'; export default function Edit( { clientId } ) { - const blockProps = useBlockProps( { - className: 'faq__item', + const blockProps = useBlockProps(); + const innerBlocksProps = useInnerBlocksProps( blockProps, { + allowedBlocks: [ 'blockparty/faq-question', 'blockparty/faq-answer' ], + template: [ + [ 'blockparty/faq-question' ], + [ 'blockparty/faq-answer' ], + ], + templateLock: 'all', } ); const { insertBlock, removeBlock } = useDispatch( 'core/block-editor' ); @@ -26,7 +32,6 @@ export default function Edit( { clientId } ) { const rootClientId = getBlockRootClientId( clientId ); const blockIndex = getBlockIndex( clientId ); - // Get isAccordion from parent block (faq) const parentBlock = rootClientId ? getBlock( rootClientId ) : null; const isAccordion = parentBlock?.attributes?.isAccordion !== undefined @@ -61,18 +66,8 @@ export default function Edit( { clientId } ) { /> -
- +
+
); diff --git a/src/faq-item/index.js b/src/faq-item/index.js index 1d35264..1ebbd4d 100644 --- a/src/faq-item/index.js +++ b/src/faq-item/index.js @@ -11,6 +11,7 @@ import './style.scss'; import './editor.scss'; import Edit from './edit'; import save from './save'; +import deprecated from './deprecated'; import metadata from './block.json'; registerBlockType( metadata.name, { @@ -24,5 +25,10 @@ registerBlockType( metadata.name, { * @see ./save.js */ save, + + /** + * @see ./deprecated.js + */ + deprecated, icon: list, } ); diff --git a/src/faq-item/save.js b/src/faq-item/save.js index a3fd3fc..5314afe 100644 --- a/src/faq-item/save.js +++ b/src/faq-item/save.js @@ -4,9 +4,7 @@ import { useBlockProps, InnerBlocks } from '@wordpress/block-editor'; export default function save() { - const blockProps = useBlockProps.save( { - className: 'faq__item', - } ); + const blockProps = useBlockProps.save(); return (
diff --git a/src/faq-question/block.json b/src/faq-question/block.json index 907f8a1..5babff4 100644 --- a/src/faq-question/block.json +++ b/src/faq-question/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "blockparty/faq-question", - "version": "2.0.3", + "version": "2.0.4", "title": "FAQ Question", "category": "design", "parent": [ "blockparty/faq-item" ], diff --git a/src/faq-question/deprecated.js b/src/faq-question/deprecated.js new file mode 100644 index 0000000..935b0fd --- /dev/null +++ b/src/faq-question/deprecated.js @@ -0,0 +1,53 @@ +/** + * WordPress dependencies + */ +import { useBlockProps, RichText, InnerBlocks } from '@wordpress/block-editor'; + +/** + * Save function for deprecated 2.0.x markup with faq__title and faq__trigger classes. + * + * @param {Object} props Component props. + * @param {Object} props.attributes Block attributes. + * @return {JSX.Element} Saved block markup. + */ +function deprecatedSave( { attributes } ) { + const { question, isAccordion = true } = attributes; + const blockProps = useBlockProps.save( { + className: 'faq__title', + } ); + + const TriggerTag = isAccordion ? 'button' : 'span'; + const triggerProps = isAccordion + ? { className: 'faq__trigger', 'aria-expanded': 'false' } + : { className: 'faq__trigger' }; + + return ( +

+ + { isAccordion ? ( + + ) : ( + + ) } + +

+ ); +} + +const deprecated = [ + { + attributes: { + question: { + type: 'string', + default: '', + }, + isAccordion: { + type: 'boolean', + default: true, + }, + }, + save: deprecatedSave, + }, +]; + +export default deprecated; diff --git a/src/faq-question/edit.js b/src/faq-question/edit.js index 2b13fff..056b1eb 100644 --- a/src/faq-question/edit.js +++ b/src/faq-question/edit.js @@ -15,9 +15,7 @@ const ALLOWED_BLOCKS_SIMPLE = [ 'core/heading', 'core/paragraph' ]; export default function Edit( { attributes, setAttributes, clientId } ) { const { question, isAccordion = true } = attributes; - const blockProps = useBlockProps( { - className: 'faq__title', - } ); + const blockProps = useBlockProps(); const innerBlocks = useSelect( ( select ) => select( 'core/block-editor' ).getBlocks( clientId ), @@ -26,21 +24,14 @@ export default function Edit( { attributes, setAttributes, clientId } ) { const { replaceInnerBlocks } = useDispatch( 'core/block-editor' ); - // When isAccordion changes from true to false and innerBlocks are empty, - // create a core/heading block with the question attribute value - // When isAccordion changes from false to true, remove innerBlocks and - // transfer their content to the question attribute useEffect( () => { if ( ! isAccordion && innerBlocks.length === 0 && question ) { - // Switch from accordion to non-accordion: create heading block const headingBlock = createBlock( 'core/heading', { level: 3, content: question, } ); replaceInnerBlocks( clientId, [ headingBlock ] ); } else if ( isAccordion && innerBlocks.length > 0 ) { - // Switch from non-accordion to accordion: extract content from innerBlocks - // Get the text content from the first block (usually a heading or paragraph) const firstBlock = innerBlocks[ 0 ]; let extractedContent = ''; @@ -50,12 +41,10 @@ export default function Edit( { attributes, setAttributes, clientId } ) { extractedContent = firstBlock.attributes?.content || ''; } - // Update the question attribute with the extracted content if ( extractedContent && extractedContent !== question ) { setAttributes( { question: extractedContent } ); } - // Remove innerBlocks replaceInnerBlocks( clientId, [] ); } }, [ @@ -69,36 +58,35 @@ export default function Edit( { attributes, setAttributes, clientId } ) { return (

-
- { isAccordion ? ( - - setAttributes( { question: content } ) - } - placeholder={ __( 'Question…?', 'blockparty-faq' ) } - allowedFormats={ [] } - /> - ) : ( - - ) } -
+ { isAccordion ? ( + + setAttributes( { question: content } ) + } + placeholder={ __( 'Question…?', 'blockparty-faq' ) } + allowedFormats={ [] } + /> + ) : ( + + ) }

); } diff --git a/src/faq-question/index.js b/src/faq-question/index.js index 4ef60a3..c5bb7e1 100644 --- a/src/faq-question/index.js +++ b/src/faq-question/index.js @@ -11,6 +11,7 @@ import './style.scss'; import './editor.scss'; import Edit from './edit'; import save from './save'; +import deprecated from './deprecated'; import metadata from './block.json'; registerBlockType( metadata.name, { @@ -24,5 +25,10 @@ registerBlockType( metadata.name, { * @see ./save.js */ save, + + /** + * @see ./deprecated.js + */ + deprecated, icon: listItem, } ); diff --git a/src/faq-question/save.js b/src/faq-question/save.js index 4ae0e3b..4c1e590 100644 --- a/src/faq-question/save.js +++ b/src/faq-question/save.js @@ -5,24 +5,28 @@ import { useBlockProps, RichText, InnerBlocks } from '@wordpress/block-editor'; export default function save( { attributes } ) { const { question, isAccordion = true } = attributes; - const blockProps = useBlockProps.save( { - className: 'faq__title', - } ); + const blockProps = useBlockProps.save(); - const TriggerTag = isAccordion ? 'button' : 'span'; - const triggerProps = isAccordion - ? { className: 'faq__trigger', 'aria-expanded': 'false' } - : { className: 'faq__trigger' }; + if ( ! isAccordion ) { + return ( +

+ +

+ ); + } return (

- - { isAccordion ? ( - - ) : ( - - ) } - +

); } diff --git a/src/faq/block.json b/src/faq/block.json index 372550f..cb78053 100644 --- a/src/faq/block.json +++ b/src/faq/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "blockparty/faq", - "version": "2.0.3", + "version": "2.0.4", "title": "FAQ", "category": "design", "description": "A FAQ block for WordPress Editor that provided structured data based on FAQ schema.", diff --git a/src/faq/deprecated.js b/src/faq/deprecated.js index 89f2059..146cc5e 100644 --- a/src/faq/deprecated.js +++ b/src/faq/deprecated.js @@ -2,7 +2,7 @@ * WordPress dependencies */ import { createBlock, parse } from '@wordpress/blocks'; -import { useBlockProps, RichText } from '@wordpress/block-editor'; +import { useBlockProps, RichText, InnerBlocks } from '@wordpress/block-editor'; /** * Migration script to convert old FAQ format to new InnerBlocks format. @@ -184,6 +184,23 @@ function deprecatedSave( { attributes } ) { ); } +/** + * Save function for deprecated 2.0.x nested InnerBlocks format with faq__accordion wrapper. + * + * @return {JSX.Element} Saved block markup. + */ +function deprecatedNestedSave() { + const blockProps = useBlockProps.save(); + + return ( +
+
+ +
+
+ ); +} + /** * Deprecated block configuration for migration from old format. * @@ -191,6 +208,19 @@ function deprecatedSave( { attributes } ) { * New format: InnerBlocks with faq-item blocks */ const deprecated = [ + { + attributes: { + isAccordion: { + type: 'boolean', + default: true, + }, + }, + supports: { + html: false, + innerBlocks: true, + }, + save: deprecatedNestedSave, + }, { attributes: { questions: { diff --git a/src/faq/edit.js b/src/faq/edit.js index f8ec1ba..2ff1b4e 100644 --- a/src/faq/edit.js +++ b/src/faq/edit.js @@ -3,8 +3,8 @@ */ import { BlockControls, - InnerBlocks, useBlockProps, + useInnerBlocksProps, InspectorControls, } from '@wordpress/block-editor'; import { @@ -22,6 +22,11 @@ import { useEffect } from '@wordpress/element'; export default function Edit( { clientId, attributes, setAttributes } ) { const { isAccordion = true } = attributes; const blockProps = useBlockProps(); + const innerBlocksProps = useInnerBlocksProps( blockProps, { + allowedBlocks: [ 'blockparty/faq-item' ], + template: [ [ 'blockparty/faq-item' ] ], + templateLock: false, + } ); const { insertBlock, updateBlockAttributes } = useDispatch( 'core/block-editor' ); @@ -34,7 +39,6 @@ export default function Edit( { clientId, attributes, setAttributes } ) { useEffect( () => { const innerBlocks = getBlocks( clientId ); innerBlocks.forEach( ( block ) => { - // Update faq-item blocks if ( 'blockparty/faq-item' === block.name ) { const itemInnerBlocks = getBlocks( block.clientId ); itemInnerBlocks.forEach( ( itemBlock ) => { @@ -87,15 +91,7 @@ export default function Edit( { clientId, attributes, setAttributes } ) { /> -
-
- -
-
+
); } diff --git a/src/faq/editor.scss b/src/faq/editor.scss index a3367df..edb80b3 100644 --- a/src/faq/editor.scss +++ b/src/faq/editor.scss @@ -1,24 +1,34 @@ -.wp-block-blockparty-faq-block { +/* editor */ +.wp-block-blockparty-faq { - .faq-list { + &-item, + &-answer, + .wp-block { + max-width: 100% !important; + } - &__button { - float: right; - opacity: 0; - z-index: 999; - position: relative; + &-item, + &-answer { + margin-top: 0; + margin-bottom: 0; + } - &:hover { - color: #007cba; - } - } + &-answer { + display: none; + } - &__item:hover .faq-list__button { /* stylelint-disable-line */ - opacity: 1; - } + &-item.has-child-selected .wp-block-blockparty-faq-answer { + display: block; + } + + &-item.has-child-selected .wp-block-blockparty-faq-trigger::after { + transform: translateY(-50%) rotate(-135deg); + } + + &-question { - &__add-item svg { - margin-right: 0.25em; + .rich-text { + white-space: nowrap; } } } diff --git a/src/faq/save.js b/src/faq/save.js index 718f494..9b56627 100644 --- a/src/faq/save.js +++ b/src/faq/save.js @@ -1,16 +1,11 @@ /** * WordPress dependencies */ -import { useBlockProps, InnerBlocks } from '@wordpress/block-editor'; +import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor'; export default function save() { const blockProps = useBlockProps.save(); + const innerBlocksProps = useInnerBlocksProps.save( blockProps ); - return ( -
-
- -
-
- ); + return
; } diff --git a/src/faq/script.js b/src/faq/script.js index 9990707..9e2a33f 100644 --- a/src/faq/script.js +++ b/src/faq/script.js @@ -3,10 +3,15 @@ import { Accordion } from '@beapi/be-a11y'; // eslint-disable-next-line no-undef const accordionConfig = beapiFaqBlock.accordionConfig; -// Initialize beapi-accordion window.addEventListener( 'load', function () { Accordion.init( - '.wp-block-blockparty-faq:has(button.faq__trigger)', + '.wp-block-blockparty-faq:has(button.wp-block-blockparty-faq-trigger)', accordionConfig ); + + Accordion.init( '.wp-block-blockparty-faq:has(button.faq__trigger)', { + ...accordionConfig, + panelSelector: '.faq__panel', + triggerSelector: '.faq__trigger', + } ); } ); diff --git a/src/faq/style.scss b/src/faq/style.scss index 6cec69c..1c13bb9 100644 --- a/src/faq/style.scss +++ b/src/faq/style.scss @@ -1,13 +1,115 @@ -.wp-block-blockparty-faq-block { +/* style */ +.wp-block-blockparty-faq { + --wp--blockparty--faq--border: 1px solid #000; + --wp--blockparty--faq--font-size: var(--wp--preset--font-size--h-3); + --wp--blockparty--faq--font-weight: 400; + --wp--blockparty--faq--padding: 1rem 0; + --wp--blockparty--faq--padding-with-background: 1rem; + --wp--blockparty--faq--icon-size: 24px; - .faq { + &-question { + position: relative; + display: flex; + align-items: center; + padding: var(--wp--blockparty--faq--padding) !important; + border-bottom: var(--wp--blockparty--faq--border); + } + + &-item:where(:has([aria-expanded="false"])) &-answer { + display: none; + } + + &-answer__inner { + padding: var(--wp--blockparty--faq--padding); + } + + &-trigger { + position: relative; + display: flex; + align-items: center; + width: 100%; + padding: 0; + font-size: var(--wp--blockparty--faq--font-size); + font-weight: var(--wp--blockparty--faq--font-weight); + text-align: left; + background-color: transparent; + border: 0; + border-radius: 0; + box-shadow: none; + appearance: none; + + &::after { + position: absolute; + top: 50%; + right: 0.5rem; + width: 0.5rem; + height: 0.5rem; + pointer-events: none; + content: ""; + border: solid currentcolor; + border-width: 0 2px 2px 0; + transform: translateY(-60%) rotate(45deg); + } + + &[aria-expanded="true"]::after { + transform: translateY(-50%) rotate(-135deg); + } + } + + &-question.has-background, + .has-background &-question, + .has-background &-answer__inner { + padding: var(--wp--blockparty--faq--padding-with-background) !important; + } + + // Legacy markup (2.0.x) + .faq__title { + position: relative; + display: flex; + align-items: center; + padding: var(--wp--blockparty--faq--padding) !important; + border-bottom: var(--wp--blockparty--faq--border); + } + + .faq__item:where(:has([aria-expanded="false"])) .faq__panel { + display: none; + } + + .faq__panel { + padding: var(--wp--blockparty--faq--padding); + } + + .faq__trigger { + position: relative; + display: flex; + align-items: center; + width: 100%; + padding: 0; + font-size: var(--wp--blockparty--faq--font-size); + font-weight: var(--wp--blockparty--faq--font-weight); + text-align: left; + background-color: transparent; + border: 0; + border-radius: 0; + box-shadow: none; + appearance: none; + cursor: pointer; + + &::after { + position: absolute; + top: 50%; + right: 0.5rem; + width: 0.5rem; + height: 0.5rem; + pointer-events: none; + content: ""; + border: solid currentcolor; + border-width: 0 2px 2px 0; + transform: translateY(-60%) rotate(45deg); + } - &__trigger { - appearance: none; - background: transparent; - border: 0; - cursor: pointer; - width: 100%; + &[aria-expanded="true"]::after { + transform: translateY(-50%) rotate(-135deg); } } } From dd88ce37e11b8bc148b36481d89b817f9cf8a303 Mon Sep 17 00:00:00 2001 From: Milan Ricoul Date: Fri, 26 Jun 2026 15:20:45 +0200 Subject: [PATCH 2/5] =?UTF-8?q?Add=20configurable=20FAQ=20question=20headi?= =?UTF-8?q?ng=20level=20(h2=E2=80=93h6).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirror blockparty-accordion behavior: parent-level control synced to child questions, shown only when accordion mode is enabled. --- src/faq-item/edit.js | 6 +- src/faq-question/block.json | 6 ++ src/faq-question/edit.js | 52 +++++++++++------ src/faq-question/save.js | 7 ++- src/faq/block.json | 8 +++ src/faq/edit.js | 109 ++++++++++++++++++++++++++++++++++-- 6 files changed, 162 insertions(+), 26 deletions(-) diff --git a/src/faq-item/edit.js b/src/faq-item/edit.js index 67ca7da..0099fee 100644 --- a/src/faq-item/edit.js +++ b/src/faq-item/edit.js @@ -37,10 +37,14 @@ export default function Edit( { clientId } ) { parentBlock?.attributes?.isAccordion !== undefined ? parentBlock.attributes.isAccordion : true; + const headingLevel = parentBlock?.attributes?.headingLevel ?? 3; const onAddItem = () => { const newItem = createBlock( 'blockparty/faq-item', {}, [ - createBlock( 'blockparty/faq-question', { isAccordion } ), + createBlock( 'blockparty/faq-question', { + isAccordion, + headingLevel, + } ), createBlock( 'blockparty/faq-answer', { isAccordion } ), ] ); insertBlock( newItem, blockIndex + 1, rootClientId ); diff --git a/src/faq-question/block.json b/src/faq-question/block.json index 5babff4..d214f82 100644 --- a/src/faq-question/block.json +++ b/src/faq-question/block.json @@ -7,6 +7,7 @@ "category": "design", "parent": [ "blockparty/faq-item" ], "description": "Content of the FAQ question.", + "usesContext": [ "blockparty/headingLevel" ], "supports": { "html": false, "inserter": false, @@ -23,6 +24,11 @@ "isAccordion": { "type": "boolean", "default": true + }, + "headingLevel": { + "type": "number", + "default": 3, + "enum": [ 2, 3, 4, 5, 6 ] } }, "textdomain": "blockparty-faq", diff --git a/src/faq-question/edit.js b/src/faq-question/edit.js index 056b1eb..024725b 100644 --- a/src/faq-question/edit.js +++ b/src/faq-question/edit.js @@ -13,8 +13,20 @@ import { __ } from '@wordpress/i18n'; const ALLOWED_BLOCKS_SIMPLE = [ 'core/heading', 'core/paragraph' ]; -export default function Edit( { attributes, setAttributes, clientId } ) { - const { question, isAccordion = true } = attributes; +export default function Edit( { + attributes, + setAttributes, + clientId, + context = {}, +} ) { + const { + question, + isAccordion = true, + headingLevel: savedHeadingLevel, + } = attributes; + const headingLevel = + context[ 'blockparty/headingLevel' ] ?? savedHeadingLevel ?? 3; + const HeadingTag = `h${ headingLevel }`; const blockProps = useBlockProps(); const innerBlocks = useSelect( @@ -56,20 +68,9 @@ export default function Edit( { attributes, setAttributes, clientId } ) { setAttributes, ] ); - return ( -

- { isAccordion ? ( - - setAttributes( { question: content } ) - } - placeholder={ __( 'Question…?', 'blockparty-faq' ) } - allowedFormats={ [] } - /> - ) : ( + if ( ! isAccordion ) { + return ( +

- ) } -

+

+ ); + } + + return ( + + + setAttributes( { question: content } ) + } + placeholder={ __( 'Question…?', 'blockparty-faq' ) } + allowedFormats={ [] } + /> + ); } diff --git a/src/faq-question/save.js b/src/faq-question/save.js index 4c1e590..22276db 100644 --- a/src/faq-question/save.js +++ b/src/faq-question/save.js @@ -4,8 +4,9 @@ import { useBlockProps, RichText, InnerBlocks } from '@wordpress/block-editor'; export default function save( { attributes } ) { - const { question, isAccordion = true } = attributes; + const { question, isAccordion = true, headingLevel = 3 } = attributes; const blockProps = useBlockProps.save(); + const HeadingTag = `h${ headingLevel }`; if ( ! isAccordion ) { return ( @@ -16,7 +17,7 @@ export default function save( { attributes } ) { } return ( -

+ -

+ ); } diff --git a/src/faq/block.json b/src/faq/block.json index cb78053..b016aae 100644 --- a/src/faq/block.json +++ b/src/faq/block.json @@ -14,8 +14,16 @@ "isAccordion": { "type": "boolean", "default": true + }, + "headingLevel": { + "type": "number", + "default": 3, + "enum": [ 2, 3, 4, 5, 6 ] } }, + "providesContext": { + "blockparty/headingLevel": "headingLevel" + }, "example": { "attributes": { "isAccordion": true diff --git a/src/faq/edit.js b/src/faq/edit.js index 2ff1b4e..36cb8e7 100644 --- a/src/faq/edit.js +++ b/src/faq/edit.js @@ -6,21 +6,81 @@ import { useBlockProps, useInnerBlocksProps, InspectorControls, + useBlockEditContext, + store as blockEditorStore, } from '@wordpress/block-editor'; import { ToolbarGroup, ToolbarButton, PanelBody, ToggleControl, + // eslint-disable-next-line @wordpress/no-unsafe-wp-apis -- ToggleGroupControl is not yet a stable export in @wordpress/components 27. + __experimentalToggleGroupControl as ToggleGroupControl, + // eslint-disable-next-line @wordpress/no-unsafe-wp-apis + __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, } from '@wordpress/components'; -import { addCard } from '@wordpress/icons'; +import { + addCard, + headingLevel2, + headingLevel3, + headingLevel4, + headingLevel5, + headingLevel6, +} from '@wordpress/icons'; import { useDispatch, useSelect } from '@wordpress/data'; import { createBlock } from '@wordpress/blocks'; -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { useEffect } from '@wordpress/element'; +const QUESTION_BLOCK = 'blockparty/faq-question'; +const HEADING_LEVELS = [ 2, 3, 4, 5, 6 ]; + +const HEADING_LEVEL_ICONS = { + 2: headingLevel2, + 3: headingLevel3, + 4: headingLevel4, + 5: headingLevel5, + 6: headingLevel6, +}; + +function collectQuestionBlocks( blocks ) { + return blocks.flatMap( ( block ) => { + const questions = block.name === QUESTION_BLOCK ? [ block ] : []; + + return questions.concat( + collectQuestionBlocks( block.innerBlocks || [] ) + ); + } ); +} + +function useSyncQuestionHeadingLevels( headingLevel, isAccordion ) { + const { clientId } = useBlockEditContext(); + const { updateBlockAttributes } = useDispatch( blockEditorStore ); + const questionBlocks = useSelect( + ( select ) => { + const { getBlocksByClientId } = select( blockEditorStore ); + const [ faqBlock ] = getBlocksByClientId( clientId ); + + return collectQuestionBlocks( faqBlock?.innerBlocks || [] ); + }, + [ clientId ] + ); + + useEffect( () => { + if ( ! isAccordion ) { + return; + } + + questionBlocks.forEach( ( block ) => { + if ( block.attributes.headingLevel !== headingLevel ) { + updateBlockAttributes( block.clientId, { headingLevel } ); + } + } ); + }, [ headingLevel, isAccordion, questionBlocks, updateBlockAttributes ] ); +} + export default function Edit( { clientId, attributes, setAttributes } ) { - const { isAccordion = true } = attributes; + const { isAccordion = true, headingLevel = 3 } = attributes; const blockProps = useBlockProps(); const innerBlocksProps = useInnerBlocksProps( blockProps, { allowedBlocks: [ 'blockparty/faq-item' ], @@ -35,6 +95,8 @@ export default function Edit( { clientId, attributes, setAttributes } ) { [] ); + useSyncQuestionHeadingLevels( headingLevel, isAccordion ); + // Synchronize isAccordion attribute to all child blocks useEffect( () => { const innerBlocks = getBlocks( clientId ); @@ -58,7 +120,10 @@ export default function Edit( { clientId, attributes, setAttributes } ) { const onAddItem = () => { const newItem = createBlock( 'blockparty/faq-item', {}, [ - createBlock( 'blockparty/faq-question', { isAccordion } ), + createBlock( 'blockparty/faq-question', { + isAccordion, + headingLevel, + } ), createBlock( 'blockparty/faq-answer', { isAccordion } ), ] ); insertBlock( newItem, undefined, clientId ); @@ -89,6 +154,42 @@ export default function Edit( { clientId, attributes, setAttributes } ) { } __nextHasNoMarginBottom /> + { isAccordion && ( + + setAttributes( { + headingLevel: Number( value ), + } ) + } + > + { HEADING_LEVELS.map( ( level ) => ( + + ) ) } + + ) }
From 512e602734135172564542df3e3ad7aacf6e4ec2 Mon Sep 17 00:00:00 2001 From: mricoul Date: Fri, 26 Jun 2026 15:31:57 +0200 Subject: [PATCH 3/5] feat(languages): update french translations files --- ...r_FR-4ad5d476d786190bd86e6dbedf4bb86e.json | 1 + ...r_FR-79fbb2fc2e001b2243c4fd8903190184.json | 1 + ...r_FR-8adf06b76d6c09cb7e7b053a4d516d16.json | 1 + ...r_FR-a3c855d2ec3455f2223f2d3db0d980f8.json | 39 +++++++++ ...r_FR-dfbff627e6c248bcb3b61d7d06da9ca9.json | 1 - languages/blockparty-faq-fr_FR.mo | Bin 2128 -> 2310 bytes languages/blockparty-faq-fr_FR.po | 78 ++++++++++-------- languages/blockparty-faq.pot | 55 +++++++----- src/faq/edit.js | 4 +- src/index.js | 11 --- 10 files changed, 123 insertions(+), 68 deletions(-) create mode 100644 languages/blockparty-faq-fr_FR-4ad5d476d786190bd86e6dbedf4bb86e.json create mode 100644 languages/blockparty-faq-fr_FR-79fbb2fc2e001b2243c4fd8903190184.json create mode 100644 languages/blockparty-faq-fr_FR-8adf06b76d6c09cb7e7b053a4d516d16.json create mode 100644 languages/blockparty-faq-fr_FR-a3c855d2ec3455f2223f2d3db0d980f8.json delete mode 100644 languages/blockparty-faq-fr_FR-dfbff627e6c248bcb3b61d7d06da9ca9.json delete mode 100644 src/index.js diff --git a/languages/blockparty-faq-fr_FR-4ad5d476d786190bd86e6dbedf4bb86e.json b/languages/blockparty-faq-fr_FR-4ad5d476d786190bd86e6dbedf4bb86e.json new file mode 100644 index 0000000..0b47103 --- /dev/null +++ b/languages/blockparty-faq-fr_FR-4ad5d476d786190bd86e6dbedf4bb86e.json @@ -0,0 +1 @@ +{"translation-revision-date":"2026-06-26 15:28+0200","generator":"WP-CLI\/2.11.0","source":"build\/faq-answer\/index.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"fr_FR","plural-forms":"nplurals=2; plural=(n != 1);"},"Answer\u2026":["R\u00e9ponse\u2026"]}}} \ No newline at end of file diff --git a/languages/blockparty-faq-fr_FR-79fbb2fc2e001b2243c4fd8903190184.json b/languages/blockparty-faq-fr_FR-79fbb2fc2e001b2243c4fd8903190184.json new file mode 100644 index 0000000..738315e --- /dev/null +++ b/languages/blockparty-faq-fr_FR-79fbb2fc2e001b2243c4fd8903190184.json @@ -0,0 +1 @@ +{"translation-revision-date":"2026-06-26 15:28+0200","generator":"WP-CLI\/2.11.0","source":"build\/faq-item\/index.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"fr_FR","plural-forms":"nplurals=2; plural=(n != 1);"},"Add FAQ item":["Ajouter un \u00e9l\u00e9ment"],"Remove FAQ item":["Supprimer l\u2019\u00e9l\u00e9ment"]}}} \ No newline at end of file diff --git a/languages/blockparty-faq-fr_FR-8adf06b76d6c09cb7e7b053a4d516d16.json b/languages/blockparty-faq-fr_FR-8adf06b76d6c09cb7e7b053a4d516d16.json new file mode 100644 index 0000000..e22a3df --- /dev/null +++ b/languages/blockparty-faq-fr_FR-8adf06b76d6c09cb7e7b053a4d516d16.json @@ -0,0 +1 @@ +{"translation-revision-date":"2026-06-26 15:28+0200","generator":"WP-CLI\/2.11.0","source":"build\/faq-question\/index.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"fr_FR","plural-forms":"nplurals=2; plural=(n != 1);"},"Question\u2026?":["Question\u2026?"]}}} \ No newline at end of file diff --git a/languages/blockparty-faq-fr_FR-a3c855d2ec3455f2223f2d3db0d980f8.json b/languages/blockparty-faq-fr_FR-a3c855d2ec3455f2223f2d3db0d980f8.json new file mode 100644 index 0000000..478f0df --- /dev/null +++ b/languages/blockparty-faq-fr_FR-a3c855d2ec3455f2223f2d3db0d980f8.json @@ -0,0 +1,39 @@ +{ + "translation-revision-date": "2026-06-26 15:28+0200", + "generator": "WP-CLI\/2.11.0", + "source": "build\/faq\/index.js", + "domain": "messages", + "locale_data": { + "messages": { + "": { + "domain": "messages", + "lang": "fr_FR", + "plural-forms": "nplurals=2; plural=(n != 1);" + }, + "Add FAQ item": [ + "Ajouter un \u00e9l\u00e9ment" + ], + "Remove FAQ item": [ + "Supprimer l\u2019\u00e9l\u00e9ment" + ], + "Settings": [ + "R\u00e9glages" + ], + "Accordion behavior": [ + "Comportement d\u2019accord\u00e9on" + ], + "If enabled, the FAQ will be displayed as an accordion component.": [ + "Si cette option est activ\u00e9e, la FAQ s'affichera sous forme d'accord\u00e9on." + ], + "Question heading level": [ + "Niveau de titre de la question" + ], + "Define the heading level for each FAQ question.": [ + "D\u00e9finissez le niveau de titre pour chaque question de la FAQ." + ], + "Heading level %d": [ + "Niveau de titre %d" + ] + } + } +} diff --git a/languages/blockparty-faq-fr_FR-dfbff627e6c248bcb3b61d7d06da9ca9.json b/languages/blockparty-faq-fr_FR-dfbff627e6c248bcb3b61d7d06da9ca9.json deleted file mode 100644 index 0553b08..0000000 --- a/languages/blockparty-faq-fr_FR-dfbff627e6c248bcb3b61d7d06da9ca9.json +++ /dev/null @@ -1 +0,0 @@ -{"translation-revision-date":"2026-01-26 16:50+0100","generator":"WP-CLI\/2.11.0","source":"build\/index.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"fr_FR","plural-forms":"nplurals=2; plural=(n != 1);"},"Add FAQ item":["Ajouter un \u00e9l\u00e9ment"],"Remove FAQ item":["Supprimer l\u2019\u00e9l\u00e9ment"],"FAQ Settings":["R\u00e9glages de FAQ"],"Accordion behavior":["Comportement d\u2019accord\u00e9on"],"If enabled, the HTML structure will be interpreted as an accordion from screen readers.":["Si c\u2019est activ\u00e9, la structure HTML du bloc sera interpr\u00e9t\u00e9 en tant qu\u2019accord\u00e9on pour les technologies d\u2019assistance."],"Question\u2026?":["Question\u2026?"],"Answer\u2026":["R\u00e9ponse\u2026"]}}} \ No newline at end of file diff --git a/languages/blockparty-faq-fr_FR.mo b/languages/blockparty-faq-fr_FR.mo index 239529e74fe65c126d23030f7646294daad61b00..1ff2012f41fb56871f5689e71c2f00e8879bbdd4 100644 GIT binary patch delta 935 zcmZ9}F=!J}7{KwDnApZzQ(LuyVxNO_u*Mp&Xa%tl#EOV*7D0-<-n}#j*SnazR1_qG zpo4C~MNlUx0l}e*;NXx!7okH%1#!~BT|uOS|1U|!_QAW~-Me?+`@Zj12ks5lzYeAz zDaJ7KAajj5!hD$E!styZRm2Pq;vDY83TE&Q?#27K3!mU|e1Wp>3l889Jcoa9AD-FP zeqUF!++#d+;&t$CoGvy~C>{{~3Lr^V^j=fX`6& zzs5dX#Sv8}LvAGVbv%oGJ)J-oQ7XQM(-`0(e1%fkN0hF8L+Q{uPU4l`&VdiQE+e(5 z7Rq;TQ4(FlEa$85-GyH$U6-ITb}*$<;{F;rin;R*x zzq=q^;HdV42%TMSNCnxi#j*jOWzf;c>ryEbxKkJ27lN!7z zvbV`y2i}r3HSJQA7gw#Wgte-6%7z;L)gfPcByWwDGl5jy_3mCgI9FV Gc;YXXzPUjF delta 760 zcmYk&ziSjh6bJBkcll+^ndG8I@YhSBjpun6@Ca!nfc@cA?fD6VUY{M_G0I^;AdzT{)1=Xh9^<4!^_Zx zHsA|rzkdav;s5j=H+Dx0<3#hY2JMbl;WB&+ZR4*)e?w%W@sU|UPQ#+6+8`w~G#ORYXwm&&OuyH~b!bxU3ojZCt*e`Vk zkBcpDb!Cm)VvHa5G~L@|37u{rUX{(3@ZHXX`>c(MT@x$eJwFJzE9{3x)V2~M9y^+y zkR8{Jl;=kwZ>s1iYgdVctiDs|sX|7mqTwiQ*qq%&uey!dZ?2LXWEDh$z{`4QF zNiT4EqS+Hh9BTXQ{(SyMv_W6v@1{wW1Ls(dES48@H;7!;qMV~dX=2g@TVUgahIe9g n$&;lCqHRa9;sF0K;%\n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2026-01-26T15:49:49+00:00\n" +"POT-Creation-Date: 2026-06-26T13:28:07+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.11.0\n" "X-Domain: blockparty-faq\n" @@ -35,42 +35,47 @@ msgstr "" msgid "Be API Technical team" msgstr "" -#: build/index.js:1 +#: build/faq-answer/index.js:1 +msgid "Answer…" +msgstr "" + +#: build/faq-item/index.js:1 +#: build/faq/index.js:1 msgid "Add FAQ item" msgstr "" -#: build/index.js:1 +#: build/faq-item/index.js:1 +#: build/faq/index.js:1 msgid "Remove FAQ item" msgstr "" -#: build/index.js:1 -msgid "FAQ Settings" +#: build/faq-question/index.js:1 +msgid "Question…?" msgstr "" -#: build/index.js:1 -msgid "Accordion behavior" +#: build/faq/index.js:1 +msgid "Settings" msgstr "" -#: build/index.js:1 -msgid "If enabled, the HTML structure will be interpreted as an accordion from screen readers." +#: build/faq/index.js:1 +msgid "Accordion behavior" msgstr "" -#: build/index.js:1 -msgid "Question…?" +#: build/faq/index.js:1 +msgid "If enabled, the FAQ will be displayed as an accordion component." msgstr "" -#: build/index.js:1 -msgid "Answer…" +#: build/faq/index.js:1 +msgid "Question heading level" msgstr "" -#: block.json -msgctxt "block title" -msgid "FAQ" +#: build/faq/index.js:1 +msgid "Define the heading level for each FAQ question." msgstr "" -#: block.json -msgctxt "block description" -msgid "A FAQ block for WordPress Editor that provided structured data based on FAQ schema." +#. translators: %d: heading level number (2–6). +#: build/faq/index.js:2 +msgid "Heading level %d" msgstr "" #: build/faq-answer/block.json @@ -102,3 +107,13 @@ msgstr "" msgctxt "block description" msgid "Content of the FAQ question." msgstr "" + +#: build/faq/block.json +msgctxt "block title" +msgid "FAQ" +msgstr "" + +#: build/faq/block.json +msgctxt "block description" +msgid "A FAQ block for WordPress Editor that provided structured data based on FAQ schema." +msgstr "" diff --git a/src/faq/edit.js b/src/faq/edit.js index 36cb8e7..09d2423 100644 --- a/src/faq/edit.js +++ b/src/faq/edit.js @@ -141,11 +141,11 @@ export default function Edit( { clientId, attributes, setAttributes } ) { - + Date: Fri, 26 Jun 2026 15:34:39 +0200 Subject: [PATCH 4/5] fix: plugin version --- README.md | 6 ------ blockparty-faq.php | 4 ++-- languages/blockparty-faq.pot | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/faq-answer/block.json | 6 ++++-- src/faq-item/block.json | 6 ++++-- src/faq-question/block.json | 18 ++++++++++++++---- src/faq/block.json | 10 ++++++++-- 9 files changed, 36 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 8360985..82b886d 100644 --- a/README.md +++ b/README.md @@ -90,9 +90,3 @@ Yoast SEO is required for the FAQ schema (JSON-LD) generation. It is installed a - Add spacing support for answers - Add font size support for the question - Strip HTML tags from the question in structured data - -### 2.0.4 - 2026-06-26 - -- Refactor block markup to align with `blockparty-accordion` structure (`wp-block-blockparty-faq-*` classes) -- Add CSS custom properties for styling (`--wp--blockparty--faq--*`) -- Add deprecated handlers for 2.0.x markup retrocompatibility diff --git a/blockparty-faq.php b/blockparty-faq.php index b0ab6e9..dca702f 100644 --- a/blockparty-faq.php +++ b/blockparty-faq.php @@ -4,7 +4,7 @@ * Description: A FAQ block for WordPress Editor that provided structured data based on FAQ schema. * Requires at least: 6.2 * Requires PHP: 8.1 - * Version: 2.0.4 + * Version: 2.0.3 * Plugin URI: https://beapi.fr * Author: Be API Technical team * Author URI: https://beapi.fr @@ -41,7 +41,7 @@ } // Plugin constants -define( 'BLOCKPARTY_FAQ_VERSION', '2.0.4' ); +define( 'BLOCKPARTY_FAQ_VERSION', '2.0.3' ); // Plugin URL and PATH define( 'BLOCKPARTY_FAQ_DIR', plugin_dir_path( __FILE__ ) ); diff --git a/languages/blockparty-faq.pot b/languages/blockparty-faq.pot index de95b65..3bf6be4 100644 --- a/languages/blockparty-faq.pot +++ b/languages/blockparty-faq.pot @@ -2,7 +2,7 @@ # This file is distributed under the GPL-2.0-or-later. msgid "" msgstr "" -"Project-Id-Version: Blockparty FAQ 2.0.4\n" +"Project-Id-Version: Blockparty FAQ 2.0.3\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/blockparty-faq\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/package-lock.json b/package-lock.json index b42f093..57185aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "blockparty-faq", - "version": "1.0.2", + "version": "2.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "blockparty-faq", - "version": "1.0.2", + "version": "2.0.3", "license": "GPL-2.0-or-later", "dependencies": { "@beapi/be-a11y": "^1.7.2", diff --git a/package.json b/package.json index 9b62690..b604620 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blockparty-faq", - "version": "2.0.4", + "version": "2.0.3", "description": "SEO friendly FAQ module in an accessible accordion", "author": "Be API Technical team", "license": "GPL-2.0-or-later", diff --git a/src/faq-answer/block.json b/src/faq-answer/block.json index f9c6faf..711b7cb 100644 --- a/src/faq-answer/block.json +++ b/src/faq-answer/block.json @@ -2,10 +2,12 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "blockparty/faq-answer", - "version": "2.0.4", + "version": "2.0.3", "title": "FAQ Answer", "category": "design", - "parent": [ "blockparty/faq-item" ], + "parent": [ + "blockparty/faq-item" + ], "description": "Content of the FAQ answer.", "supports": { "html": false, diff --git a/src/faq-item/block.json b/src/faq-item/block.json index 7a0c25e..9e7b837 100644 --- a/src/faq-item/block.json +++ b/src/faq-item/block.json @@ -2,10 +2,12 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "blockparty/faq-item", - "version": "2.0.4", + "version": "2.0.3", "title": "FAQ Item", "category": "design", - "parent": [ "blockparty/faq" ], + "parent": [ + "blockparty/faq" + ], "description": "A FAQ item containing a question and an answer.", "supports": { "html": false, diff --git a/src/faq-question/block.json b/src/faq-question/block.json index d214f82..838af97 100644 --- a/src/faq-question/block.json +++ b/src/faq-question/block.json @@ -2,12 +2,16 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "blockparty/faq-question", - "version": "2.0.4", + "version": "2.0.3", "title": "FAQ Question", "category": "design", - "parent": [ "blockparty/faq-item" ], + "parent": [ + "blockparty/faq-item" + ], "description": "Content of the FAQ question.", - "usesContext": [ "blockparty/headingLevel" ], + "usesContext": [ + "blockparty/headingLevel" + ], "supports": { "html": false, "inserter": false, @@ -28,7 +32,13 @@ "headingLevel": { "type": "number", "default": 3, - "enum": [ 2, 3, 4, 5, 6 ] + "enum": [ + 2, + 3, + 4, + 5, + 6 + ] } }, "textdomain": "blockparty-faq", diff --git a/src/faq/block.json b/src/faq/block.json index b016aae..b637484 100644 --- a/src/faq/block.json +++ b/src/faq/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "blockparty/faq", - "version": "2.0.4", + "version": "2.0.3", "title": "FAQ", "category": "design", "description": "A FAQ block for WordPress Editor that provided structured data based on FAQ schema.", @@ -18,7 +18,13 @@ "headingLevel": { "type": "number", "default": 3, - "enum": [ 2, 3, 4, 5, 6 ] + "enum": [ + 2, + 3, + 4, + 5, + 6 + ] } }, "providesContext": { From 4a0bdae1ed00ca81cfc52efa314b917b5b03f50b Mon Sep 17 00:00:00 2001 From: mricoul Date: Fri, 26 Jun 2026 15:44:37 +0200 Subject: [PATCH 5/5] fix: edit js blockprops --- src/faq-answer/block.json | 4 +--- src/faq-item/block.json | 4 +--- src/faq-item/edit.js | 4 +--- src/faq-question/block.json | 16 +++------------- src/faq/block.json | 8 +------- 5 files changed, 7 insertions(+), 29 deletions(-) diff --git a/src/faq-answer/block.json b/src/faq-answer/block.json index 711b7cb..bf79231 100644 --- a/src/faq-answer/block.json +++ b/src/faq-answer/block.json @@ -5,9 +5,7 @@ "version": "2.0.3", "title": "FAQ Answer", "category": "design", - "parent": [ - "blockparty/faq-item" - ], + "parent": [ "blockparty/faq-item" ], "description": "Content of the FAQ answer.", "supports": { "html": false, diff --git a/src/faq-item/block.json b/src/faq-item/block.json index 9e7b837..a584901 100644 --- a/src/faq-item/block.json +++ b/src/faq-item/block.json @@ -5,9 +5,7 @@ "version": "2.0.3", "title": "FAQ Item", "category": "design", - "parent": [ - "blockparty/faq" - ], + "parent": [ "blockparty/faq" ], "description": "A FAQ item containing a question and an answer.", "supports": { "html": false, diff --git a/src/faq-item/edit.js b/src/faq-item/edit.js index 0099fee..039b97c 100644 --- a/src/faq-item/edit.js +++ b/src/faq-item/edit.js @@ -70,9 +70,7 @@ export default function Edit( { clientId } ) { /> -
-
-
+
); } diff --git a/src/faq-question/block.json b/src/faq-question/block.json index 838af97..b28917f 100644 --- a/src/faq-question/block.json +++ b/src/faq-question/block.json @@ -5,13 +5,9 @@ "version": "2.0.3", "title": "FAQ Question", "category": "design", - "parent": [ - "blockparty/faq-item" - ], + "parent": [ "blockparty/faq-item" ], "description": "Content of the FAQ question.", - "usesContext": [ - "blockparty/headingLevel" - ], + "usesContext": [ "blockparty/headingLevel" ], "supports": { "html": false, "inserter": false, @@ -32,13 +28,7 @@ "headingLevel": { "type": "number", "default": 3, - "enum": [ - 2, - 3, - 4, - 5, - 6 - ] + "enum": [ 2, 3, 4, 5, 6 ] } }, "textdomain": "blockparty-faq", diff --git a/src/faq/block.json b/src/faq/block.json index b637484..e744445 100644 --- a/src/faq/block.json +++ b/src/faq/block.json @@ -18,13 +18,7 @@ "headingLevel": { "type": "number", "default": 3, - "enum": [ - 2, - 3, - 4, - 5, - 6 - ] + "enum": [ 2, 3, 4, 5, 6 ] } }, "providesContext": {