From 63f81c1e9cbb3b0513abca2b8cb579fef374ed7b Mon Sep 17 00:00:00 2001 From: karthick-murugan Date: Tue, 3 Dec 2024 19:25:14 +0530 Subject: [PATCH 1/7] Image size fix in lightbox --- lib/block-supports/layout.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index ddbd1917c30547..ca75f479dd67b5 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -1106,15 +1106,14 @@ function gutenberg_restore_image_outer_container( $block_content, $block ) { $wrapper_classnames = array( 'wp-block-image' ); - // If the block has a classNames attribute these classnames need to be removed from the content and added back + // If the block has a classNames attribute these classnames need to be added back // to the new wrapper div also. if ( ! empty( $block['attrs']['className'] ) ) { $wrapper_classnames = array_merge( $wrapper_classnames, explode( ' ', $block['attrs']['className'] ) ); } - $content_classnames = explode( ' ', $matches[2] ); - $filtered_content_classnames = array_diff( $content_classnames, $wrapper_classnames ); - return '
' . $matches[1] . implode( ' ', $filtered_content_classnames ) . $matches[3] . '
'; + // Wrap the existing content with the new wrapper div. + return '
' . $block_content . '
'; } if ( function_exists( 'wp_restore_image_outer_container' ) ) { From 0e19583c619fda88a7db00352e2813357281f3ef Mon Sep 17 00:00:00 2001 From: karthick-murugan Date: Tue, 3 Dec 2024 19:56:00 +0530 Subject: [PATCH 2/7] Revert "Image size fix in lightbox" This reverts commit 63f81c1e9cbb3b0513abca2b8cb579fef374ed7b. --- lib/block-supports/layout.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index ca75f479dd67b5..ddbd1917c30547 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -1106,14 +1106,15 @@ function gutenberg_restore_image_outer_container( $block_content, $block ) { $wrapper_classnames = array( 'wp-block-image' ); - // If the block has a classNames attribute these classnames need to be added back + // If the block has a classNames attribute these classnames need to be removed from the content and added back // to the new wrapper div also. if ( ! empty( $block['attrs']['className'] ) ) { $wrapper_classnames = array_merge( $wrapper_classnames, explode( ' ', $block['attrs']['className'] ) ); } + $content_classnames = explode( ' ', $matches[2] ); + $filtered_content_classnames = array_diff( $content_classnames, $wrapper_classnames ); - // Wrap the existing content with the new wrapper div. - return '
' . $block_content . '
'; + return '
' . $matches[1] . implode( ' ', $filtered_content_classnames ) . $matches[3] . '
'; } if ( function_exists( 'wp_restore_image_outer_container' ) ) { From d5e09104b9fbbd68b917fd2815ed359343d0630c Mon Sep 17 00:00:00 2001 From: karthick-murugan Date: Fri, 13 Dec 2024 12:49:01 +0530 Subject: [PATCH 3/7] Update toolspanel to archive title block --- .../block-library/src/query-title/edit.js | 75 ++++++++++++++----- 1 file changed, 56 insertions(+), 19 deletions(-) diff --git a/packages/block-library/src/query-title/edit.js b/packages/block-library/src/query-title/edit.js index 21d23081837cdf..745ccd489f110b 100644 --- a/packages/block-library/src/query-title/edit.js +++ b/packages/block-library/src/query-title/edit.js @@ -14,7 +14,11 @@ import { Warning, HeadingLevelDropdown, } from '@wordpress/block-editor'; -import { ToggleControl, PanelBody } from '@wordpress/components'; +import { + ToggleControl, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, +} from '@wordpress/components'; import { __, _x, sprintf } from '@wordpress/i18n'; /** @@ -89,16 +93,34 @@ export default function QueryTitleEdit( { titleElement = ( <> - - + setAttributes( { + showPrefix: false, + } ) + } + > + showPrefix !== undefined } label={ __( 'Show archive type in title' ) } - onChange={ () => - setAttributes( { showPrefix: ! showPrefix } ) + onDeselect={ () => + setAttributes( { showPrefix: false } ) } - checked={ showPrefix } - /> - + resetAllFilter="core/filter-reset-all-settings" + > + + setAttributes( { + showPrefix: ! showPrefix, + } ) + } + checked={ showPrefix } + /> + + { title } @@ -109,18 +131,33 @@ export default function QueryTitleEdit( { titleElement = ( <> - - + setAttributes( { + showSearchTerm: false, + } ) + } + > + showSearchTerm !== undefined } label={ __( 'Show search term in title' ) } - onChange={ () => - setAttributes( { - showSearchTerm: ! showSearchTerm, - } ) + onDeselect={ () => + setAttributes( { showSearchTerm: false } ) } - checked={ showSearchTerm } - /> - + > + + setAttributes( { + showSearchTerm: ! showSearchTerm, + } ) + } + checked={ showSearchTerm } + /> + + From 846b7cba4caac8537924d5eba0fdc2a987e9a91e Mon Sep 17 00:00:00 2001 From: karthick-murugan Date: Mon, 16 Dec 2024 10:42:14 +0530 Subject: [PATCH 4/7] Feedback changes updated --- packages/block-library/src/query-title/edit.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/query-title/edit.js b/packages/block-library/src/query-title/edit.js index 745ccd489f110b..319244683023ba 100644 --- a/packages/block-library/src/query-title/edit.js +++ b/packages/block-library/src/query-title/edit.js @@ -108,6 +108,7 @@ export default function QueryTitleEdit( { setAttributes( { showPrefix: false } ) } resetAllFilter="core/filter-reset-all-settings" + isShownByDefault > Date: Mon, 13 Jan 2025 15:37:59 +0530 Subject: [PATCH 5/7] Feedback changes updated --- packages/block-library/src/query-title/edit.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/block-library/src/query-title/edit.js b/packages/block-library/src/query-title/edit.js index 319244683023ba..ae565f6ca82a71 100644 --- a/packages/block-library/src/query-title/edit.js +++ b/packages/block-library/src/query-title/edit.js @@ -97,17 +97,16 @@ export default function QueryTitleEdit( { label={ __( 'Settings' ) } resetAll={ () => setAttributes( { - showPrefix: false, + showPrefix: true, } ) } > showPrefix !== undefined } + hasValue={ () => showPrefix === false } label={ __( 'Show archive type in title' ) } onDeselect={ () => - setAttributes( { showPrefix: false } ) + setAttributes( { showPrefix: true } ) } - resetAllFilter="core/filter-reset-all-settings" isShownByDefault > setAttributes( { - showSearchTerm: false, + showSearchTerm: true, } ) } > showSearchTerm !== undefined } + hasValue={ () => showSearchTerm === false } label={ __( 'Show search term in title' ) } onDeselect={ () => - setAttributes( { showSearchTerm: false } ) + setAttributes( { showSearchTerm: true } ) } + isShownByDefault > Date: Mon, 13 Jan 2025 15:45:57 +0530 Subject: [PATCH 6/7] Feedback changes updated --- packages/block-library/src/query-title/edit.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/block-library/src/query-title/edit.js b/packages/block-library/src/query-title/edit.js index ae565f6ca82a71..43c12d096aa3be 100644 --- a/packages/block-library/src/query-title/edit.js +++ b/packages/block-library/src/query-title/edit.js @@ -25,6 +25,7 @@ import { __, _x, sprintf } from '@wordpress/i18n'; * Internal dependencies */ import { useArchiveLabel } from './use-archive-label'; +import { useToolsPanelDropdownMenuProps } from '../utils/hooks'; const SUPPORTED_TYPES = [ 'archive', 'search' ]; @@ -40,6 +41,7 @@ export default function QueryTitleEdit( { setAttributes, } ) { const { archiveTypeLabel, archiveNameLabel } = useArchiveLabel(); + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const TagName = `h${ level }`; const blockProps = useBlockProps( { @@ -100,6 +102,7 @@ export default function QueryTitleEdit( { showPrefix: true, } ) } + dropdownMenuProps={ dropdownMenuProps } > showPrefix === false } From 2679c197457e5fe8a5783d4a08469a02954f9ea9 Mon Sep 17 00:00:00 2001 From: karthick-murugan Date: Tue, 14 Jan 2025 13:09:40 +0530 Subject: [PATCH 7/7] Feedback updates --- packages/block-library/src/query-title/edit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/query-title/edit.js b/packages/block-library/src/query-title/edit.js index 43c12d096aa3be..3b739e2b20b4f9 100644 --- a/packages/block-library/src/query-title/edit.js +++ b/packages/block-library/src/query-title/edit.js @@ -105,7 +105,7 @@ export default function QueryTitleEdit( { dropdownMenuProps={ dropdownMenuProps } > showPrefix === false } + hasValue={ () => ! showPrefix } label={ __( 'Show archive type in title' ) } onDeselect={ () => setAttributes( { showPrefix: true } ) @@ -143,7 +143,7 @@ export default function QueryTitleEdit( { } > showSearchTerm === false } + hasValue={ () => ! showSearchTerm } label={ __( 'Show search term in title' ) } onDeselect={ () => setAttributes( { showSearchTerm: true } )