From 8bf341a8fb4440fb4a1c38a9152233167a278106 Mon Sep 17 00:00:00 2001 From: Nick Diego Date: Tue, 30 Jul 2024 11:08:22 -0500 Subject: [PATCH] Add `levelOptions` attribute to Query Title block. --- docs/reference-guides/core-blocks.md | 2 +- packages/block-library/src/query-title/block.json | 3 +++ packages/block-library/src/query-title/edit.js | 10 +++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index dfe0f224c8f36..65c4e5cd0fcd8 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -775,7 +775,7 @@ Display the query title. ([Source](https://github.com/WordPress/gutenberg/tree/t - **Name:** core/query-title - **Category:** theme - **Supports:** align (full, wide), color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** level, showPrefix, showSearchTerm, textAlign, type +- **Attributes:** level, levelOptions, showPrefix, showSearchTerm, textAlign, type ## Quote diff --git a/packages/block-library/src/query-title/block.json b/packages/block-library/src/query-title/block.json index 674daadee3bb6..2a3c7d9f23699 100644 --- a/packages/block-library/src/query-title/block.json +++ b/packages/block-library/src/query-title/block.json @@ -17,6 +17,9 @@ "type": "number", "default": 1 }, + "levelOptions": { + "type": "array" + }, "showPrefix": { "type": "boolean", "default": true diff --git a/packages/block-library/src/query-title/edit.js b/packages/block-library/src/query-title/edit.js index 71f0e26d70684..845809a930013 100644 --- a/packages/block-library/src/query-title/edit.js +++ b/packages/block-library/src/query-title/edit.js @@ -25,7 +25,14 @@ import { useArchiveLabel } from './use-archive-label'; const SUPPORTED_TYPES = [ 'archive', 'search' ]; export default function QueryTitleEdit( { - attributes: { type, level, textAlign, showPrefix, showSearchTerm }, + attributes: { + type, + level, + levelOptions, + textAlign, + showPrefix, + showSearchTerm, + }, setAttributes, } ) { const { archiveTypeLabel, archiveNameLabel } = useArchiveLabel(); @@ -130,6 +137,7 @@ export default function QueryTitleEdit( { setAttributes( { level: newLevel } ) }