From 3d55cfa7638eb5482c8cde12182b063e7f2eb584 Mon Sep 17 00:00:00 2001 From: Jorge Date: Sun, 21 Sep 2025 15:09:51 +0200 Subject: [PATCH 01/19] Add: Fit text/stretch text block supports and variation. --- docs/reference-guides/core-blocks.md | 4 +- lib/block-supports/typography.php | 4 + packages/block-editor/package.json | 3 + packages/block-editor/src/content.scss | 1 + packages/block-editor/src/hooks/fit-text.js | 269 ++++++++++++++++++ packages/block-editor/src/hooks/fit-text.scss | 3 + packages/block-editor/src/hooks/index.js | 4 + packages/block-editor/src/hooks/typography.js | 2 + packages/block-editor/src/style.scss | 1 + .../src/utils/fit-text-frontend.js | 94 ++++++ .../block-editor/src/utils/fit-text-utils.js | 119 ++++++++ packages/block-library/src/common.scss | 5 + packages/block-library/src/heading/block.json | 1 + .../block-library/src/paragraph/block.json | 1 + packages/block-library/src/paragraph/index.js | 2 + .../block-library/src/paragraph/variations.js | 29 ++ 16 files changed, 540 insertions(+), 2 deletions(-) create mode 100644 packages/block-editor/src/hooks/fit-text.js create mode 100644 packages/block-editor/src/hooks/fit-text.scss create mode 100644 packages/block-editor/src/utils/fit-text-frontend.js create mode 100644 packages/block-editor/src/utils/fit-text-utils.js create mode 100644 packages/block-library/src/paragraph/variations.js diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 411c02135ff22f..74d810290a9084 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -409,7 +409,7 @@ Introduce new sections and organize content to help visitors (and search engines - **Name:** core/heading - **Category:** text -- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, className, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), splitting, typography (fontSize, lineHeight) +- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, className, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), splitting, typography (fitText, fontSize, lineHeight) - **Attributes:** content, level, levelOptions, placeholder, textAlign ## Home Link @@ -581,7 +581,7 @@ Start with the basic building block of all narrative. ([Source](https://github.c - **Name:** core/paragraph - **Category:** text -- **Supports:** __unstablePasteTextInline, anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), splitting, typography (fontSize, lineHeight), ~~className~~ +- **Supports:** __unstablePasteTextInline, anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), splitting, typography (fitText, fontSize, lineHeight), ~~className~~ - **Attributes:** align, content, direction, dropCap, placeholder ## Pattern Placeholder diff --git a/lib/block-supports/typography.php b/lib/block-supports/typography.php index a4719b7bdd4099..e7005714cb9b51 100644 --- a/lib/block-supports/typography.php +++ b/lib/block-supports/typography.php @@ -244,6 +244,10 @@ function gutenberg_typography_get_preset_inline_style_value( $style_value, $css_ * @return string Filtered block content. */ function gutenberg_render_typography_support( $block_content, $block ) { + if ( isset( $block['attrs']['fitText'] ) ) { + wp_enqueue_script_module( '@wordpress/block-editor/utils/fit-text-frontend' ); + } + if ( ! isset( $block['attrs']['style']['typography']['fontSize'] ) ) { return $block_content; } diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index 0628b480c3f6f0..687226c02b8271 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -27,6 +27,9 @@ "module": "build-module/index.js", "react-native": "src/index", "wpScript": true, + "wpScriptModuleExports": { + "./utils/fit-text-frontend": "./build-module/utils/fit-text-frontend.js" + }, "sideEffects": [ "build-style/**", "src/**/*.scss", diff --git a/packages/block-editor/src/content.scss b/packages/block-editor/src/content.scss index 1ef4e118fb1bbe..fd1b775cadce07 100644 --- a/packages/block-editor/src/content.scss +++ b/packages/block-editor/src/content.scss @@ -12,6 +12,7 @@ @import "./components/plain-text/content.scss"; @import "./components/rich-text/content.scss"; @import "./components/warning/content.scss"; +@import "./hooks/fit-text.scss"; // To do: ideally the iframe does not contain UI, but there's still the block // placeholders that will be moved to shadow DOM in the future. diff --git a/packages/block-editor/src/hooks/fit-text.js b/packages/block-editor/src/hooks/fit-text.js new file mode 100644 index 00000000000000..56e5f5b837af05 --- /dev/null +++ b/packages/block-editor/src/hooks/fit-text.js @@ -0,0 +1,269 @@ +/** + * WordPress dependencies + */ +import { addFilter } from '@wordpress/hooks'; +import { hasBlockSupport } from '@wordpress/blocks'; +import { useEffect, useCallback } from '@wordpress/element'; +import { useSelect } from '@wordpress/data'; +import { __ } from '@wordpress/i18n'; +import { + ToggleControl, + __experimentalToolsPanelItem as ToolsPanelItem, +} from '@wordpress/components'; + +/** + * Internal dependencies + */ +import { optimizeFitText } from '../utils/fit-text-utils'; +import { store as blockEditorStore } from '../store'; +import { useBlockElement } from '../components/block-list/use-block-props/use-block-refs'; +import InspectorControls from '../components/inspector-controls'; + +export const FIT_TEXT_SUPPORT_KEY = 'typography.fitText'; + +/** + * Filters registered block settings, extending attributes to include + * the `fitText` attribute. + * + * @param {Object} settings Original block settings. + * @return {Object} Filtered block settings. + */ +function addAttributes( settings ) { + if ( ! hasBlockSupport( settings, FIT_TEXT_SUPPORT_KEY ) ) { + return settings; + } + + // Allow blocks to specify their own attribute definition. + if ( settings.attributes?.fitText ) { + return settings; + } + + // Add fitText attribute. + return { + ...settings, + attributes: { + ...settings.attributes, + fitText: { + type: 'boolean', + default: false, + }, + }, + }; +} + +/** + * Custom hook to handle fit text functionality in the editor. + * + * @param {Object} props Component props. + * @param {?boolean} props.fitText Fit text attribute. + * @param {string} props.name Block name. + * @param {string} props.clientId Block client ID. + */ +function useFitText( { fitText, name, clientId } ) { + const hasFitTextSupport = hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY ); + const blockElement = useBlockElement( clientId ); + + // Monitor inner content changes for text blocks + const blockContent = useSelect( + ( select ) => { + if ( ! clientId ) { + return ''; + } + const { getBlockAttributes } = select( blockEditorStore ); + const blockAttributes = getBlockAttributes( clientId ); + // Get content from common content attributes + return blockAttributes?.content || blockAttributes?.value || ''; + }, + [ clientId ] + ); + + // Apply fit text optimization + const applyFitText = useCallback( () => { + if ( ! blockElement || ! hasFitTextSupport || ! fitText ) { + return; + } + + // Get or create style element with unique ID + const styleId = `fit-text-${ clientId }`; + let styleElement = blockElement.ownerDocument.getElementById( styleId ); + if ( ! styleElement ) { + styleElement = blockElement.ownerDocument.createElement( 'style' ); + styleElement.id = styleId; + blockElement.ownerDocument.head.appendChild( styleElement ); + } + + // Use WordPress block ID for targeting + const blockSelector = `#block-${ clientId }`; + + // Style management callback + const applyStylesFn = ( css ) => { + styleElement.textContent = css; + }; + + // Use shared utility for complete optimization + optimizeFitText( blockElement, blockSelector, applyStylesFn ); + }, [ blockElement, clientId, hasFitTextSupport, fitText ] ); + + useEffect( () => { + if ( + ! fitText || + ! blockElement || + ! clientId || + ! hasFitTextSupport + ) { + return; + } + + // Apply initially + applyFitText(); + + // Store current element value for cleanup + const currentElement = blockElement; + + // Watch for size changes + let resizeObserver; + if ( window.ResizeObserver && currentElement.parentElement ) { + resizeObserver = new window.ResizeObserver( applyFitText ); + resizeObserver.observe( currentElement.parentElement ); + } + + // Cleanup function + return () => { + if ( resizeObserver ) { + resizeObserver.disconnect(); + } + + // Clean up styles for this block + const styleId = `fit-text-${ clientId }`; + const styleElement = + currentElement.ownerDocument.getElementById( styleId ); + if ( styleElement ) { + styleElement.remove(); + } + }; + }, [ fitText, clientId, applyFitText, blockElement, hasFitTextSupport ] ); + + // Trigger fit text recalculation when content changes + useEffect( () => { + if ( fitText && blockElement && hasFitTextSupport ) { + // Small delay to ensure DOM has updated after content changes + const timer = setTimeout( () => { + if ( blockElement ) { + applyFitText(); + } + }, 100 ); + + return () => clearTimeout( timer ); + } + }, [ + blockContent, + fitText, + applyFitText, + blockElement, + hasFitTextSupport, + ] ); +} + +/** + * Fit text control component for the typography panel. + * + * @param {Object} props Component props. + * @param {string} props.clientId Block client ID. + * @param {Function} props.setAttributes Function to set block attributes. + * @param {string} props.name Block name. + * @param {boolean} props.fitText Whether fit text is enabled. + */ +export function FitTextControl( { clientId, fitText, setAttributes, name } ) { + if ( ! hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY ) ) { + return null; + } + return ( + + !! fitText } + label={ __( 'Fit text' ) } + onDeselect={ () => setAttributes( { fitText: false } ) } + resetAllFilter={ () => ( { fitText: false } ) } + panelId={ clientId } + > + setAttributes( { fitText: ! fitText } ) } + help={ + fitText + ? __( 'Text will resize to fit its container.' ) + : __( 'Resize text to fit its container.' ) + } + /> + + + ); +} + +/** + * Override props applied to the block element on save. + * + * @param {Object} props Additional props applied to the block element. + * @param {Object} blockType Block type. + * @param {Object} attributes Block attributes. + * @return {Object} Filtered props applied to the block element. + */ +function addSaveProps( props, blockType, attributes ) { + if ( ! hasBlockSupport( blockType, FIT_TEXT_SUPPORT_KEY ) ) { + return props; + } + + const { fitText } = attributes; + + if ( ! fitText ) { + return props; + } + + // Add CSS class for frontend detection and styling + const className = props.className + ? `${ props.className } has-fit-text` + : 'has-fit-text'; + + return { + ...props, + className, + }; +} +/** + * Override props applied to the block element in the editor. + * + * @param {Object} props Component props including block attributes. + * @param {string} props.name Block name. + * @param {boolean} props.fitText Whether fit text is enabled. + * @param {string} props.clientId Block client ID. + * @return {Object} Filtered props applied to the block element. + */ +function useBlockProps( { name, fitText, clientId } ) { + useFitText( { fitText, name, clientId } ); + if ( ! fitText || ! hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY ) ) { + return {}; + } + return { + className: 'has-fit-text', + }; +} + +addFilter( + 'blocks.registerBlockType', + 'core/fit-text/addAttribute', + addAttributes +); + +const hasFitTextSupport = ( blockNameOrType ) => { + return hasBlockSupport( blockNameOrType, FIT_TEXT_SUPPORT_KEY ); +}; + +export default { + useBlockProps, + addSaveProps, + attributeKeys: [ 'fitText' ], + hasSupport: hasFitTextSupport, + edit: FitTextControl, +}; diff --git a/packages/block-editor/src/hooks/fit-text.scss b/packages/block-editor/src/hooks/fit-text.scss new file mode 100644 index 00000000000000..c8b671b44fddff --- /dev/null +++ b/packages/block-editor/src/hooks/fit-text.scss @@ -0,0 +1,3 @@ +.has-fit-text { + white-space: nowrap !important; +} diff --git a/packages/block-editor/src/hooks/index.js b/packages/block-editor/src/hooks/index.js index 7f9b29376ad1fb..37aab8d27ef185 100644 --- a/packages/block-editor/src/hooks/index.js +++ b/packages/block-editor/src/hooks/index.js @@ -22,6 +22,7 @@ import duotone from './duotone'; import fontFamily from './font-family'; import fontSize from './font-size'; import textAlign from './text-align'; +import fitText from './fit-text'; import border from './border'; import position from './position'; import blockStyleVariation from './block-style-variation'; @@ -42,6 +43,7 @@ createBlockEditFilter( customClassName, style, duotone, + fitText, position, layout, contentLockUI, @@ -60,6 +62,7 @@ createBlockListBlockFilter( [ duotone, fontFamily, fontSize, + fitText, border, position, blockStyleVariation, @@ -72,6 +75,7 @@ createBlockSaveFilter( [ ariaLabel, customClassName, border, + fitText, color, style, fontFamily, diff --git a/packages/block-editor/src/hooks/typography.js b/packages/block-editor/src/hooks/typography.js index 2607f6d9301067..066211c15aafe9 100644 --- a/packages/block-editor/src/hooks/typography.js +++ b/packages/block-editor/src/hooks/typography.js @@ -18,6 +18,7 @@ import { LINE_HEIGHT_SUPPORT_KEY } from './line-height'; import { FONT_FAMILY_SUPPORT_KEY } from './font-family'; import { FONT_SIZE_SUPPORT_KEY } from './font-size'; import { TEXT_ALIGN_SUPPORT_KEY } from './text-align'; +import { FIT_TEXT_SUPPORT_KEY } from './fit-text'; import { cleanEmptyObject } from './utils'; import { store as blockEditorStore } from '../store'; @@ -47,6 +48,7 @@ export const TYPOGRAPHY_SUPPORT_KEYS = [ WRITING_MODE_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY, + FIT_TEXT_SUPPORT_KEY, ]; function styleToAttributes( style ) { diff --git a/packages/block-editor/src/style.scss b/packages/block-editor/src/style.scss index 5d9298c34ed9f2..4bf2fec708f17a 100644 --- a/packages/block-editor/src/style.scss +++ b/packages/block-editor/src/style.scss @@ -54,6 +54,7 @@ @import "./hooks/border.scss"; @import "./hooks/color.scss"; @import "./hooks/dimensions.scss"; +@import "./hooks/fit-text.scss"; @import "./hooks/layout.scss"; @import "./hooks/spacing.scss"; @import "./hooks/typography.scss"; diff --git a/packages/block-editor/src/utils/fit-text-frontend.js b/packages/block-editor/src/utils/fit-text-frontend.js new file mode 100644 index 00000000000000..fa27c044bf5eb6 --- /dev/null +++ b/packages/block-editor/src/utils/fit-text-frontend.js @@ -0,0 +1,94 @@ +/** + * Frontend fit text functionality. + * Automatically detects and initializes fit text on blocks with the has-fit-text class. + */ + +/** + * Internal dependencies + */ +import { optimizeFitText } from './fit-text-utils'; + +/** + * Get or create a unique style element for a fit text element. + * + * @param {string} elementId Unique identifier for the element. + * @return {HTMLElement} Style element. + */ +function getOrCreateStyleElement( elementId ) { + const styleId = `fit-text-${ elementId }`; + let styleElement = document.getElementById( styleId ); + if ( ! styleElement ) { + styleElement = document.createElement( 'style' ); + styleElement.id = styleId; + document.head.appendChild( styleElement ); + } + return styleElement; +} + +/** + * Generate a unique identifier for a fit text element. + * + * @param {HTMLElement} element The element to identify. + * @return {string} Unique identifier. + */ +function getElementIdentifier( element ) { + // Use existing ID or create one + if ( ! element.dataset.fitTextId ) { + element.dataset.fitTextId = + // Here Math.random is ok to generate ids they don't need to cryptographically secure. + // eslint-disable-next-line no-restricted-syntax + 'fit-text-' + Math.random().toString( 36 ).substring( 2, 11 ); + } + return element.dataset.fitTextId; +} + +/** + * Initialize fit text functionality for a single element. + * + * @param {HTMLElement} element Element with fit text enabled. + */ +function initializeFitText( element ) { + // Get unique ID for this element + const elementId = getElementIdentifier( element ); + + // Apply fit text optimization + const applyFitText = () => { + // Get style element for this element + const styleElement = getOrCreateStyleElement( elementId ); + const elementSelector = `[data-fit-text-id=\"${ elementId }\"]`; + + // Style management callback + const applyStylesFn = ( css ) => { + styleElement.textContent = css; + }; + + // Use shared utility for complete optimization + optimizeFitText( element, elementSelector, applyStylesFn ); + }; + + // Initial sizing + applyFitText(); + + // Watch for parent container resize + if ( window.ResizeObserver && element.parentElement ) { + const resizeObserver = new window.ResizeObserver( applyFitText ); + resizeObserver.observe( element.parentElement ); + + // Store observer for cleanup if needed + element._fitTextObserver = resizeObserver; + } +} + +/** + * Initialize fit text on all elements with the has-fit-text class. + */ +function initializeAllFitText() { + const elements = document.querySelectorAll( '.has-fit-text' ); + elements.forEach( initializeFitText ); +} + +// Initialize on DOM content loaded +document.addEventListener( 'DOMContentLoaded', initializeAllFitText ); + +// Also initialize on window load for cases where DOMContentLoaded has already fired +window.addEventListener( 'load', initializeAllFitText ); diff --git a/packages/block-editor/src/utils/fit-text-utils.js b/packages/block-editor/src/utils/fit-text-utils.js new file mode 100644 index 00000000000000..2c0ba3f21aa742 --- /dev/null +++ b/packages/block-editor/src/utils/fit-text-utils.js @@ -0,0 +1,119 @@ +/** + * Shared utility functions for fit text functionality. + * Uses callback-based approach for maximum code reuse between editor and frontend. + */ + +/** + * Generate CSS rule for single text element. + * + * @param {string} elementSelector CSS selector for the text element + * @param {number} fontSize Font size in pixels + * @return {string} CSS rule string + */ +export function generateCSSRule( elementSelector, fontSize ) { + return `${ elementSelector } { font-size: ${ fontSize }px !important; }`; +} + +/** + * Get original font size of a single text element. + * + * @param {HTMLElement} textElement The text element (paragraph, heading, etc.) + * @param {Function} applyStylesFn Function to apply/clear styles + * @return {number} Original font size in pixels + */ +export function getOriginalFontSize( textElement, applyStylesFn ) { + if ( ! textElement ) { + return 16; // Default fallback + } + + // Clear existing fit text styles to measure natural size + applyStylesFn( '' ); + + // Measure natural font size + const computedStyle = window.getComputedStyle( textElement ); + const fontSize = parseFloat( computedStyle.fontSize ); + + return fontSize || 16; // Fallback to 16px +} + +/** + * Find optimal font size using simple binary search between 5-200px. + * + * @param {HTMLElement} textElement The text element + * @param {string} elementSelector CSS selector for the text element + * @param {Function} applyStylesFn Function to apply test styles + * @return {number} Optimal font size + */ +export function findOptimalFontSize( + textElement, + elementSelector, + applyStylesFn +) { + if ( ! textElement || ! textElement.parentElement ) { + return 16; + } + + const parentElement = textElement.parentElement; + const alreadyHasScrollableHeight = + parentElement.scrollHeight > parentElement.clientHeight; + let minSize = 5; + let maxSize = 200; + let bestSize = minSize; + + while ( minSize <= maxSize ) { + const midSize = Math.floor( ( minSize + maxSize ) / 2 ); + applyStylesFn( generateCSSRule( elementSelector, midSize ) ); + + const fitsWidth = + parentElement.scrollWidth <= parentElement.clientWidth; + const fitsHeight = + alreadyHasScrollableHeight || + parentElement.scrollHeight <= parentElement.clientHeight; + + if ( fitsWidth && fitsHeight ) { + bestSize = midSize; + minSize = midSize + 1; + } else { + maxSize = midSize - 1; + } + } + + return bestSize; +} + +/** + * Complete fit text optimization for a single text element. + * Handles the full flow using callbacks for style management. + * + * @param {HTMLElement} textElement The text element (paragraph, heading, etc.) + * @param {string} elementSelector CSS selector for the text element + * @param {Function} applyStylesFn Function to apply CSS styles (pass empty string to clear) + * @return {Object} Object with cssRule, originalSize, and optimalSize + */ +export function optimizeFitText( textElement, elementSelector, applyStylesFn ) { + if ( ! textElement ) { + return { cssRule: '', originalSize: 16, optimalSize: 16 }; + } + + // Get original font size (clears styles internally) + const originalSize = getOriginalFontSize( textElement, applyStylesFn ); + + // Find optimal font size using binary search + const optimalSize = findOptimalFontSize( + textElement, + elementSelector, + applyStylesFn + ); + + // Generate final CSS rule + const cssRule = generateCSSRule( elementSelector, optimalSize ); + + // Apply final styles + applyStylesFn( cssRule ); + + return { + cssRule, + originalSize, + optimalSize, + }; +} diff --git a/packages/block-library/src/common.scss b/packages/block-library/src/common.scss index 15c2cd52b76aad..cbaf80543801e2 100644 --- a/packages/block-library/src/common.scss +++ b/packages/block-library/src/common.scss @@ -46,6 +46,11 @@ text-align: right; } +// Fit Text +.has-fit-text { + white-space: nowrap; +} + // This tag marks the end of the styles that apply to editing canvas contents and need to be manipulated when we resize the editor. #end-resizable-editor-section { display: none; diff --git a/packages/block-library/src/heading/block.json b/packages/block-library/src/heading/block.json index 2869ee85c55206..d9488a3156528d 100644 --- a/packages/block-library/src/heading/block.json +++ b/packages/block-library/src/heading/block.json @@ -65,6 +65,7 @@ "__experimentalTextTransform": true, "__experimentalTextDecoration": true, "__experimentalWritingMode": true, + "fitText": true, "__experimentalDefaultControls": { "fontSize": true } diff --git a/packages/block-library/src/paragraph/block.json b/packages/block-library/src/paragraph/block.json index 7e004019cbf282..9617627ef5d0da 100644 --- a/packages/block-library/src/paragraph/block.json +++ b/packages/block-library/src/paragraph/block.json @@ -65,6 +65,7 @@ "__experimentalLetterSpacing": true, "__experimentalTextTransform": true, "__experimentalWritingMode": true, + "fitText": true, "__experimentalDefaultControls": { "fontSize": true } diff --git a/packages/block-library/src/paragraph/index.js b/packages/block-library/src/paragraph/index.js index 715fb35ec05ab1..a2328b1ecdf82d 100644 --- a/packages/block-library/src/paragraph/index.js +++ b/packages/block-library/src/paragraph/index.js @@ -13,6 +13,7 @@ import edit from './edit'; import metadata from './block.json'; import save from './save'; import transforms from './transforms'; +import variations from './variations'; const { name } = metadata; @@ -54,6 +55,7 @@ export const settings = { }, edit, save, + variations, }; export const init = () => initBlock( { name, metadata, settings } ); diff --git a/packages/block-library/src/paragraph/variations.js b/packages/block-library/src/paragraph/variations.js new file mode 100644 index 00000000000000..f40a90cbcfd3d7 --- /dev/null +++ b/packages/block-library/src/paragraph/variations.js @@ -0,0 +1,29 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; +import { textColor } from '@wordpress/icons'; + +const variations = [ + { + name: 'Stretchy Paragraph', + title: __( 'Stretchy Paragraph' ), + description: __( + 'Text automatically resizes to fit the container width.' + ), + attributes: { fitText: true }, + scope: [ 'block', 'inserter' ], + isActive: ( blockAttributes ) => blockAttributes.fitText, + icon: textColor, + example: { + attributes: { + content: __( + 'This text will automatically resize to fit its container width.' + ), + fitText: true, + }, + }, + }, +]; + +export default variations; From b5907676e032ef5009593b793d9bf6f29c326d84 Mon Sep 17 00:00:00 2001 From: Jorge Date: Thu, 25 Sep 2025 21:34:30 +0200 Subject: [PATCH 02/19] Update fixtures --- test/integration/fixtures/blocks/core__column.json | 6 ++++-- .../fixtures/blocks/core__column__deprecated-1.json | 6 ++++-- test/integration/fixtures/blocks/core__columns.json | 12 ++++++++---- .../fixtures/blocks/core__columns__deprecated.json | 4 ++++ .../core__columns__is-not-stacked-on-mobile.json | 12 ++++++++---- test/integration/fixtures/blocks/core__cover.json | 3 ++- .../blocks/core__cover__alt-fixed-background.json | 3 ++- .../fixtures/blocks/core__cover__deprecated-1.json | 3 ++- .../fixtures/blocks/core__cover__deprecated-10.json | 3 ++- .../fixtures/blocks/core__cover__deprecated-12.json | 3 ++- .../fixtures/blocks/core__cover__deprecated-14.json | 3 ++- .../fixtures/blocks/core__cover__deprecated-2.json | 3 ++- .../fixtures/blocks/core__cover__deprecated-3.json | 3 ++- .../fixtures/blocks/core__cover__deprecated-4.json | 3 ++- .../fixtures/blocks/core__cover__deprecated-5.json | 3 ++- .../fixtures/blocks/core__cover__deprecated-6.json | 9 ++++++--- .../fixtures/blocks/core__cover__deprecated-7.json | 3 ++- .../fixtures/blocks/core__cover__deprecated-8.json | 3 ++- .../fixtures/blocks/core__cover__deprecated-9.json | 3 ++- .../core__cover__duotone-fixed-background.json | 3 ++- .../blocks/core__cover__gradient-custom.json | 3 ++- .../fixtures/blocks/core__cover__gradient-image.json | 3 ++- .../fixtures/blocks/core__cover__gradient-video.json | 3 ++- .../fixtures/blocks/core__cover__gradient.json | 3 ++- .../blocks/core__cover__gradient__deprecated-8.json | 3 ++- .../fixtures/blocks/core__cover__solid-color.json | 3 ++- .../fixtures/blocks/core__cover__video-overlay.json | 3 ++- .../fixtures/blocks/core__cover__video.json | 3 ++- test/integration/fixtures/blocks/core__details.json | 3 ++- .../blocks/core__form-submission-notification.json | 1 + .../blocks/core__group-layout-content-size.json | 6 ++++-- .../core__group-layout-content-size__deprecated.json | 6 ++++-- test/integration/fixtures/blocks/core__group.json | 6 ++++-- .../fixtures/blocks/core__group__deprecated-2.json | 3 ++- .../fixtures/blocks/core__group__deprecated-3.json | 6 ++++-- .../core__group__deprecated-inner-container.json | 6 ++++-- .../fixtures/blocks/core__group__deprecated.json | 3 ++- .../fixtures/blocks/core__heading__h2-color.json | 3 ++- .../fixtures/blocks/core__heading__h2.json | 3 ++- .../fixtures/blocks/core__heading__h4-em.json | 3 ++- .../blocks/core__heading_align-textalign.json | 3 ++- .../fixtures/blocks/core__media-text.json | 3 ++- .../blocks/core__media-text__deprecated-v2.json | 3 ++- .../blocks/core__media-text__deprecated-v5.json | 3 ++- ...media-text__deprecated-v6-wide-default-align.json | 3 ++- ...ecated-v7-image-fill-no-focal-point-selected.json | 3 ++- ...ated-v7-image-fill-with-focal-point-selected.json | 3 ++- .../blocks/core__media-text__deprecated-v7.json | 3 ++- .../blocks/core__media-text__image-alt-no-align.json | 3 ++- ...dia-text__image-fill-no-focal-point-selected.json | 3 ++- ...a-text__image-fill-with-focal-point-selected.json | 3 ++- .../core__media-text__is-stacked-on-mobile.json | 3 ++- ...a-text__media-right-custom-width__deprecated.json | 3 ++- .../core__media-text__vertical-align-bottom.json | 3 ++- .../fixtures/blocks/core__media-text__video.json | 3 ++- .../blocks/core__paragraph__align-right.json | 3 ++- .../fixtures/blocks/core__query-no-results.json | 3 ++- .../fixtures/blocks/core__query__deprecated-3.json | 3 ++- .../fixtures/blocks/core__quote__deprecated-1.json | 3 ++- .../fixtures/blocks/core__quote__deprecated-2.json | 3 ++- .../core__quote__deprecated-4-align-attribute.json | 3 ++- .../fixtures/blocks/core__quote__style-1.json | 3 ++- .../fixtures/blocks/core__quote__style-2.json | 3 ++- .../blocks/core__text__converts-to-paragraph.json | 3 ++- 64 files changed, 159 insertions(+), 77 deletions(-) diff --git a/test/integration/fixtures/blocks/core__column.json b/test/integration/fixtures/blocks/core__column.json index 3e0d7cecf90eac..ae2b4dceec8427 100644 --- a/test/integration/fixtures/blocks/core__column.json +++ b/test/integration/fixtures/blocks/core__column.json @@ -9,7 +9,8 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph One", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] }, @@ -18,7 +19,8 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph Two", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__column__deprecated-1.json b/test/integration/fixtures/blocks/core__column__deprecated-1.json index 0f0076d3799cf9..f5bbbf68ac94cd 100644 --- a/test/integration/fixtures/blocks/core__column__deprecated-1.json +++ b/test/integration/fixtures/blocks/core__column__deprecated-1.json @@ -11,7 +11,8 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph One", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] }, @@ -20,7 +21,8 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph Two", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__columns.json b/test/integration/fixtures/blocks/core__columns.json index 806f59ef3a17f9..cf7ef3a093a80f 100644 --- a/test/integration/fixtures/blocks/core__columns.json +++ b/test/integration/fixtures/blocks/core__columns.json @@ -17,7 +17,8 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph One", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] }, @@ -26,7 +27,8 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph Two", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } @@ -42,7 +44,8 @@ "isValid": true, "attributes": { "content": "Column Two, Paragraph One", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] }, @@ -51,7 +54,8 @@ "isValid": true, "attributes": { "content": "Column Three, Paragraph One", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__columns__deprecated.json b/test/integration/fixtures/blocks/core__columns__deprecated.json index ed354852b13923..395205a0cf565e 100644 --- a/test/integration/fixtures/blocks/core__columns__deprecated.json +++ b/test/integration/fixtures/blocks/core__columns__deprecated.json @@ -17,6 +17,7 @@ "attributes": { "content": "Column One, Paragraph One", "dropCap": false, + "fitText": false, "className": "layout-column-1" }, "innerBlocks": [] @@ -27,6 +28,7 @@ "attributes": { "content": "Column One, Paragraph Two", "dropCap": false, + "fitText": false, "className": "layout-column-1" }, "innerBlocks": [] @@ -44,6 +46,7 @@ "attributes": { "content": "Column Two, Paragraph One", "dropCap": false, + "fitText": false, "className": "layout-column-2" }, "innerBlocks": [] @@ -61,6 +64,7 @@ "attributes": { "content": "Column Three, Paragraph One", "dropCap": false, + "fitText": false, "className": "layout-column-3" }, "innerBlocks": [] diff --git a/test/integration/fixtures/blocks/core__columns__is-not-stacked-on-mobile.json b/test/integration/fixtures/blocks/core__columns__is-not-stacked-on-mobile.json index a9b02a6151cb24..691772a44891e4 100644 --- a/test/integration/fixtures/blocks/core__columns__is-not-stacked-on-mobile.json +++ b/test/integration/fixtures/blocks/core__columns__is-not-stacked-on-mobile.json @@ -17,7 +17,8 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph One", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] }, @@ -26,7 +27,8 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph Two", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } @@ -42,7 +44,8 @@ "isValid": true, "attributes": { "content": "Column Two, Paragraph One", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] }, @@ -51,7 +54,8 @@ "isValid": true, "attributes": { "content": "Column Three, Paragraph One", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover.json b/test/integration/fixtures/blocks/core__cover.json index a7ed06e153012d..d7b0af89981a65 100644 --- a/test/integration/fixtures/blocks/core__cover.json +++ b/test/integration/fixtures/blocks/core__cover.json @@ -22,7 +22,8 @@ "content": "\n\t\t\tGuten Berg!\n\t\t", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__alt-fixed-background.json b/test/integration/fixtures/blocks/core__cover__alt-fixed-background.json index d848174278dabe..a7864e802e9595 100644 --- a/test/integration/fixtures/blocks/core__cover__alt-fixed-background.json +++ b/test/integration/fixtures/blocks/core__cover__alt-fixed-background.json @@ -26,7 +26,8 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-1.json b/test/integration/fixtures/blocks/core__cover__deprecated-1.json index a432e9992fd33a..884a9bf6735e50 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-1.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-1.json @@ -19,7 +19,8 @@ "content": "Cover Image", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-10.json b/test/integration/fixtures/blocks/core__cover__deprecated-10.json index ce3dc9eb1d553e..1835893d73e247 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-10.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-10.json @@ -23,7 +23,8 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-12.json b/test/integration/fixtures/blocks/core__cover__deprecated-12.json index 5991bbfd165bfb..4595e8ef125989 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-12.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-12.json @@ -26,7 +26,8 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-14.json b/test/integration/fixtures/blocks/core__cover__deprecated-14.json index 206e3e4c0d7e14..706dd1feb99380 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-14.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-14.json @@ -28,7 +28,8 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-2.json b/test/integration/fixtures/blocks/core__cover__deprecated-2.json index 7b9f5696d34ae2..c66b9d7226acee 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-2.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-2.json @@ -19,7 +19,8 @@ "content": "Cover Block", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-3.json b/test/integration/fixtures/blocks/core__cover__deprecated-3.json index d2fcf5074b1dd3..b9ff296b1cc0a2 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-3.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-3.json @@ -19,7 +19,8 @@ "content": "Cover Block", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-4.json b/test/integration/fixtures/blocks/core__cover__deprecated-4.json index 48c677038ba872..477a7de23084a3 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-4.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-4.json @@ -23,7 +23,8 @@ "content": "Cover Block", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-5.json b/test/integration/fixtures/blocks/core__cover__deprecated-5.json index 9eee3c4a016840..449cc288c3ed9b 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-5.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-5.json @@ -19,7 +19,8 @@ "content": "Cover", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-6.json b/test/integration/fixtures/blocks/core__cover__deprecated-6.json index 62bea629e8efe6..b8cd717c8383c9 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-6.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-6.json @@ -19,7 +19,8 @@ "content": "\n\t\t\tGuten Berg!\n\t\t", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } @@ -50,7 +51,8 @@ "isValid": true, "attributes": { "content": "", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } @@ -79,7 +81,8 @@ "content": "test", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-7.json b/test/integration/fixtures/blocks/core__cover__deprecated-7.json index 1ebd864bd38301..8408fe2d4432e2 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-7.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-7.json @@ -20,7 +20,8 @@ "content": "\n\t\t\tGuten Berg!\n\t\t", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-8.json b/test/integration/fixtures/blocks/core__cover__deprecated-8.json index 9d5142e60fdd53..3be6d43c73c6cb 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-8.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-8.json @@ -21,7 +21,8 @@ "content": "\n Guten Berg!\n ", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-9.json b/test/integration/fixtures/blocks/core__cover__deprecated-9.json index 0f492be44c9681..52a03dcbd59002 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-9.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-9.json @@ -22,7 +22,8 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__duotone-fixed-background.json b/test/integration/fixtures/blocks/core__cover__duotone-fixed-background.json index a85f0b4554f2a1..6e5117df21b28e 100644 --- a/test/integration/fixtures/blocks/core__cover__duotone-fixed-background.json +++ b/test/integration/fixtures/blocks/core__cover__duotone-fixed-background.json @@ -28,7 +28,8 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__gradient-custom.json b/test/integration/fixtures/blocks/core__cover__gradient-custom.json index f2d911a74be4cb..c6cad971238533 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-custom.json +++ b/test/integration/fixtures/blocks/core__cover__gradient-custom.json @@ -22,7 +22,8 @@ "content": "Cover!", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__gradient-image.json b/test/integration/fixtures/blocks/core__cover__gradient-image.json index 5be874e5064346..ca7d82d0b25e48 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-image.json +++ b/test/integration/fixtures/blocks/core__cover__gradient-image.json @@ -23,7 +23,8 @@ "content": " Cover! ", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__gradient-video.json b/test/integration/fixtures/blocks/core__cover__gradient-video.json index fac1cefde8cd04..6df8e4f26386d6 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-video.json +++ b/test/integration/fixtures/blocks/core__cover__gradient-video.json @@ -23,7 +23,8 @@ "content": "Cover!", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__gradient.json b/test/integration/fixtures/blocks/core__cover__gradient.json index fe217953d90fb9..76af9167cf3669 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient.json +++ b/test/integration/fixtures/blocks/core__cover__gradient.json @@ -22,7 +22,8 @@ "content": "Cover!", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__gradient__deprecated-8.json b/test/integration/fixtures/blocks/core__cover__gradient__deprecated-8.json index e4db2a2ece377e..1591aa19bdde84 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient__deprecated-8.json +++ b/test/integration/fixtures/blocks/core__cover__gradient__deprecated-8.json @@ -21,7 +21,8 @@ "content": "Cover!", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__solid-color.json b/test/integration/fixtures/blocks/core__cover__solid-color.json index 4d06b3e616e164..d1eff41c910846 100644 --- a/test/integration/fixtures/blocks/core__cover__solid-color.json +++ b/test/integration/fixtures/blocks/core__cover__solid-color.json @@ -23,7 +23,8 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__video-overlay.json b/test/integration/fixtures/blocks/core__cover__video-overlay.json index a4171b22c98423..85e025d7db152c 100644 --- a/test/integration/fixtures/blocks/core__cover__video-overlay.json +++ b/test/integration/fixtures/blocks/core__cover__video-overlay.json @@ -24,7 +24,8 @@ "content": "\n\t\t\tGuten Berg!\n\t\t", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__video.json b/test/integration/fixtures/blocks/core__cover__video.json index 698239ef191838..df233b1d35706b 100644 --- a/test/integration/fixtures/blocks/core__cover__video.json +++ b/test/integration/fixtures/blocks/core__cover__video.json @@ -22,7 +22,8 @@ "content": "\n\t\t\tGuten Berg!\n\t\t", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__details.json b/test/integration/fixtures/blocks/core__details.json index e3873e4702db3f..85aeb539684256 100644 --- a/test/integration/fixtures/blocks/core__details.json +++ b/test/integration/fixtures/blocks/core__details.json @@ -13,7 +13,8 @@ "attributes": { "content": "Details Content", "dropCap": false, - "placeholder": "Type / to add a hidden block" + "placeholder": "Type / to add a hidden block", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__form-submission-notification.json b/test/integration/fixtures/blocks/core__form-submission-notification.json index dac7502e9716ca..79678077d2092d 100644 --- a/test/integration/fixtures/blocks/core__form-submission-notification.json +++ b/test/integration/fixtures/blocks/core__form-submission-notification.json @@ -14,6 +14,7 @@ "dropCap": false, "backgroundColor": "#00D084", "textColor": "#000000", + "fitText": false, "style": { "elements": { "link": { diff --git a/test/integration/fixtures/blocks/core__group-layout-content-size.json b/test/integration/fixtures/blocks/core__group-layout-content-size.json index ebc317f895e148..725b33a8ded6d4 100644 --- a/test/integration/fixtures/blocks/core__group-layout-content-size.json +++ b/test/integration/fixtures/blocks/core__group-layout-content-size.json @@ -16,7 +16,8 @@ "isValid": true, "attributes": { "content": "This is a group block.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] }, @@ -25,7 +26,8 @@ "isValid": true, "attributes": { "content": "Group block content.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__group-layout-content-size__deprecated.json b/test/integration/fixtures/blocks/core__group-layout-content-size__deprecated.json index 152c3e1750778d..4ecfe78c8cb26a 100644 --- a/test/integration/fixtures/blocks/core__group-layout-content-size__deprecated.json +++ b/test/integration/fixtures/blocks/core__group-layout-content-size__deprecated.json @@ -17,7 +17,8 @@ "isValid": true, "attributes": { "content": "This is a group block.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] }, @@ -26,7 +27,8 @@ "isValid": true, "attributes": { "content": "Group block content.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__group.json b/test/integration/fixtures/blocks/core__group.json index 7abd6688a7eb80..d80af404cedbf3 100644 --- a/test/integration/fixtures/blocks/core__group.json +++ b/test/integration/fixtures/blocks/core__group.json @@ -16,7 +16,8 @@ "isValid": true, "attributes": { "content": "This is a group block.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] }, @@ -25,7 +26,8 @@ "isValid": true, "attributes": { "content": "Group block content.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__group__deprecated-2.json b/test/integration/fixtures/blocks/core__group__deprecated-2.json index e281b0eaa56f00..408cf721d51eda 100644 --- a/test/integration/fixtures/blocks/core__group__deprecated-2.json +++ b/test/integration/fixtures/blocks/core__group__deprecated-2.json @@ -12,7 +12,8 @@ "isValid": true, "attributes": { "content": "My paragraph", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__group__deprecated-3.json b/test/integration/fixtures/blocks/core__group__deprecated-3.json index 2582fe6b87c4e7..9daa8e625fb053 100644 --- a/test/integration/fixtures/blocks/core__group__deprecated-3.json +++ b/test/integration/fixtures/blocks/core__group__deprecated-3.json @@ -13,7 +13,8 @@ "isValid": true, "attributes": { "content": "This is a group block.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] }, @@ -22,7 +23,8 @@ "isValid": true, "attributes": { "content": "Group block content.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__group__deprecated-inner-container.json b/test/integration/fixtures/blocks/core__group__deprecated-inner-container.json index 2582fe6b87c4e7..9daa8e625fb053 100644 --- a/test/integration/fixtures/blocks/core__group__deprecated-inner-container.json +++ b/test/integration/fixtures/blocks/core__group__deprecated-inner-container.json @@ -13,7 +13,8 @@ "isValid": true, "attributes": { "content": "This is a group block.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] }, @@ -22,7 +23,8 @@ "isValid": true, "attributes": { "content": "Group block content.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__group__deprecated.json b/test/integration/fixtures/blocks/core__group__deprecated.json index 66ae1d8fd1d999..f9ab9b2bde813b 100644 --- a/test/integration/fixtures/blocks/core__group__deprecated.json +++ b/test/integration/fixtures/blocks/core__group__deprecated.json @@ -14,7 +14,8 @@ "isValid": true, "attributes": { "content": "test", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__heading__h2-color.json b/test/integration/fixtures/blocks/core__heading__h2-color.json index da2b13f048aea8..a1f6b3abd07971 100644 --- a/test/integration/fixtures/blocks/core__heading__h2-color.json +++ b/test/integration/fixtures/blocks/core__heading__h2-color.json @@ -5,7 +5,8 @@ "attributes": { "content": "Text", "level": 2, - "textColor": "accent" + "textColor": "accent", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__heading__h2.json b/test/integration/fixtures/blocks/core__heading__h2.json index caac4208bf0c52..36627c7d5f87a2 100644 --- a/test/integration/fixtures/blocks/core__heading__h2.json +++ b/test/integration/fixtures/blocks/core__heading__h2.json @@ -4,7 +4,8 @@ "isValid": true, "attributes": { "content": "A picture is worth a thousand words, or so the saying goes", - "level": 2 + "level": 2, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__heading__h4-em.json b/test/integration/fixtures/blocks/core__heading__h4-em.json index 82eb02851bfe80..46b6fc35528b2b 100644 --- a/test/integration/fixtures/blocks/core__heading__h4-em.json +++ b/test/integration/fixtures/blocks/core__heading__h4-em.json @@ -4,7 +4,8 @@ "isValid": true, "attributes": { "content": "The Inserter Tool", - "level": 4 + "level": 4, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__heading_align-textalign.json b/test/integration/fixtures/blocks/core__heading_align-textalign.json index d4bd2d918ba7ed..a73eef64bd64f6 100644 --- a/test/integration/fixtures/blocks/core__heading_align-textalign.json +++ b/test/integration/fixtures/blocks/core__heading_align-textalign.json @@ -6,7 +6,8 @@ "textAlign": "center", "content": "Text", "level": 2, - "align": "wide" + "align": "wide", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text.json b/test/integration/fixtures/blocks/core__media-text.json index dd86e7d9dd8dd0..f4d55914033fc3 100644 --- a/test/integration/fixtures/blocks/core__media-text.json +++ b/test/integration/fixtures/blocks/core__media-text.json @@ -20,7 +20,8 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__deprecated-v2.json b/test/integration/fixtures/blocks/core__media-text__deprecated-v2.json index ca2b0016872687..3ff193b968839b 100644 --- a/test/integration/fixtures/blocks/core__media-text__deprecated-v2.json +++ b/test/integration/fixtures/blocks/core__media-text__deprecated-v2.json @@ -18,7 +18,8 @@ "attributes": { "content": "My Content", "dropCap": false, - "placeholder": "Content…" + "placeholder": "Content…", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__deprecated-v5.json b/test/integration/fixtures/blocks/core__media-text__deprecated-v5.json index 1f252de69c1ad7..9a07b387e25dd0 100644 --- a/test/integration/fixtures/blocks/core__media-text__deprecated-v5.json +++ b/test/integration/fixtures/blocks/core__media-text__deprecated-v5.json @@ -23,7 +23,8 @@ "attributes": { "content": "My Content", "dropCap": false, - "placeholder": "Content…" + "placeholder": "Content…", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__deprecated-v6-wide-default-align.json b/test/integration/fixtures/blocks/core__media-text__deprecated-v6-wide-default-align.json index bbe1bf7fc90ded..58a83d34c964a0 100644 --- a/test/integration/fixtures/blocks/core__media-text__deprecated-v6-wide-default-align.json +++ b/test/integration/fixtures/blocks/core__media-text__deprecated-v6-wide-default-align.json @@ -19,7 +19,8 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-no-focal-point-selected.json b/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-no-focal-point-selected.json index bf195f6fa1c953..c22ad8a886059d 100644 --- a/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-no-focal-point-selected.json +++ b/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-no-focal-point-selected.json @@ -20,7 +20,8 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-with-focal-point-selected.json b/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-with-focal-point-selected.json index 986e049099541f..62e005e109a415 100644 --- a/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-with-focal-point-selected.json +++ b/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-with-focal-point-selected.json @@ -24,7 +24,8 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__deprecated-v7.json b/test/integration/fixtures/blocks/core__media-text__deprecated-v7.json index a6f0dff927874d..66daf39b011c79 100644 --- a/test/integration/fixtures/blocks/core__media-text__deprecated-v7.json +++ b/test/integration/fixtures/blocks/core__media-text__deprecated-v7.json @@ -21,7 +21,8 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__image-alt-no-align.json b/test/integration/fixtures/blocks/core__media-text__image-alt-no-align.json index e8a9ad70ae0132..2f851ba4c32fe1 100644 --- a/test/integration/fixtures/blocks/core__media-text__image-alt-no-align.json +++ b/test/integration/fixtures/blocks/core__media-text__image-alt-no-align.json @@ -20,7 +20,8 @@ "content": "Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__image-fill-no-focal-point-selected.json b/test/integration/fixtures/blocks/core__media-text__image-fill-no-focal-point-selected.json index bb57f08ad5cfa7..7b9a6500408087 100644 --- a/test/integration/fixtures/blocks/core__media-text__image-fill-no-focal-point-selected.json +++ b/test/integration/fixtures/blocks/core__media-text__image-fill-no-focal-point-selected.json @@ -21,7 +21,8 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__image-fill-with-focal-point-selected.json b/test/integration/fixtures/blocks/core__media-text__image-fill-with-focal-point-selected.json index 0de71c867457ef..7ea01d591f001d 100644 --- a/test/integration/fixtures/blocks/core__media-text__image-fill-with-focal-point-selected.json +++ b/test/integration/fixtures/blocks/core__media-text__image-fill-with-focal-point-selected.json @@ -25,7 +25,8 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__is-stacked-on-mobile.json b/test/integration/fixtures/blocks/core__media-text__is-stacked-on-mobile.json index cce4ca41239c5f..f1e4bf47756f71 100644 --- a/test/integration/fixtures/blocks/core__media-text__is-stacked-on-mobile.json +++ b/test/integration/fixtures/blocks/core__media-text__is-stacked-on-mobile.json @@ -19,7 +19,8 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__media-right-custom-width__deprecated.json b/test/integration/fixtures/blocks/core__media-text__media-right-custom-width__deprecated.json index 746a1cb641dbd9..28c1009c1c2307 100644 --- a/test/integration/fixtures/blocks/core__media-text__media-right-custom-width__deprecated.json +++ b/test/integration/fixtures/blocks/core__media-text__media-right-custom-width__deprecated.json @@ -20,7 +20,8 @@ "content": "My video", "dropCap": false, "placeholder": "Content…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__vertical-align-bottom.json b/test/integration/fixtures/blocks/core__media-text__vertical-align-bottom.json index f7d0516a85a648..1204aedbbd5fa8 100644 --- a/test/integration/fixtures/blocks/core__media-text__vertical-align-bottom.json +++ b/test/integration/fixtures/blocks/core__media-text__vertical-align-bottom.json @@ -20,7 +20,8 @@ "content": "My content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__video.json b/test/integration/fixtures/blocks/core__media-text__video.json index cce4ca41239c5f..f1e4bf47756f71 100644 --- a/test/integration/fixtures/blocks/core__media-text__video.json +++ b/test/integration/fixtures/blocks/core__media-text__video.json @@ -19,7 +19,8 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large" + "fontSize": "large", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__paragraph__align-right.json b/test/integration/fixtures/blocks/core__paragraph__align-right.json index fb3015a8530550..a90f0ddc12dc7e 100644 --- a/test/integration/fixtures/blocks/core__paragraph__align-right.json +++ b/test/integration/fixtures/blocks/core__paragraph__align-right.json @@ -5,7 +5,8 @@ "attributes": { "align": "right", "content": "... like this one, which is separate from the above and right aligned.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__query-no-results.json b/test/integration/fixtures/blocks/core__query-no-results.json index 7331bcdeb58e30..f87247f3695edc 100644 --- a/test/integration/fixtures/blocks/core__query-no-results.json +++ b/test/integration/fixtures/blocks/core__query-no-results.json @@ -10,7 +10,8 @@ "attributes": { "content": "", "dropCap": false, - "placeholder": "Add a text or blocks that will display when the query returns no results." + "placeholder": "Add a text or blocks that will display when the query returns no results.", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__query__deprecated-3.json b/test/integration/fixtures/blocks/core__query__deprecated-3.json index d3ed27ec4fac33..fd5cd028e745ef 100644 --- a/test/integration/fixtures/blocks/core__query__deprecated-3.json +++ b/test/integration/fixtures/blocks/core__query__deprecated-3.json @@ -133,7 +133,8 @@ "attributes": { "content": "No results found.", "dropCap": false, - "placeholder": "Add text or blocks that will display when a query returns no results." + "placeholder": "Add text or blocks that will display when a query returns no results.", + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__quote__deprecated-1.json b/test/integration/fixtures/blocks/core__quote__deprecated-1.json index ea4a9a23196586..ede3193b924be0 100644 --- a/test/integration/fixtures/blocks/core__quote__deprecated-1.json +++ b/test/integration/fixtures/blocks/core__quote__deprecated-1.json @@ -11,7 +11,8 @@ "isValid": true, "attributes": { "content": "Testing deprecated quote block...", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__quote__deprecated-2.json b/test/integration/fixtures/blocks/core__quote__deprecated-2.json index 2af2f38fa9e937..6109ffc3f4fdc0 100644 --- a/test/integration/fixtures/blocks/core__quote__deprecated-2.json +++ b/test/integration/fixtures/blocks/core__quote__deprecated-2.json @@ -12,7 +12,8 @@ "isValid": true, "attributes": { "content": "Testing deprecated quote block...", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__quote__deprecated-4-align-attribute.json b/test/integration/fixtures/blocks/core__quote__deprecated-4-align-attribute.json index c5b6d35aa427fc..2939f0fcece5bf 100644 --- a/test/integration/fixtures/blocks/core__quote__deprecated-4-align-attribute.json +++ b/test/integration/fixtures/blocks/core__quote__deprecated-4-align-attribute.json @@ -13,7 +13,8 @@ "isValid": true, "attributes": { "content": "Quote with the align attribute. Example: {\"align\":\"right\"}", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__quote__style-1.json b/test/integration/fixtures/blocks/core__quote__style-1.json index d262a2fefc6f3e..8574680467b389 100644 --- a/test/integration/fixtures/blocks/core__quote__style-1.json +++ b/test/integration/fixtures/blocks/core__quote__style-1.json @@ -12,7 +12,8 @@ "isValid": true, "attributes": { "content": "The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__quote__style-2.json b/test/integration/fixtures/blocks/core__quote__style-2.json index c7c699e4caf422..71a29fc7792a5f 100644 --- a/test/integration/fixtures/blocks/core__quote__style-2.json +++ b/test/integration/fixtures/blocks/core__quote__style-2.json @@ -13,7 +13,8 @@ "isValid": true, "attributes": { "content": "There is no greater agony than bearing an untold story inside you.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__text__converts-to-paragraph.json b/test/integration/fixtures/blocks/core__text__converts-to-paragraph.json index 2e4cd5c6444d47..93acc454bfb76f 100644 --- a/test/integration/fixtures/blocks/core__text__converts-to-paragraph.json +++ b/test/integration/fixtures/blocks/core__text__converts-to-paragraph.json @@ -4,7 +4,8 @@ "isValid": true, "attributes": { "content": "This is an old-style text block. Changed to paragraph in #2135.", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } From 9a016a9e0689761e27b473e8fdd9731152f80253 Mon Sep 17 00:00:00 2001 From: Jorge Date: Fri, 26 Sep 2025 16:36:57 +0100 Subject: [PATCH 03/19] Improve calculation logic --- packages/block-editor/src/utils/fit-text-utils.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/block-editor/src/utils/fit-text-utils.js b/packages/block-editor/src/utils/fit-text-utils.js index 2c0ba3f21aa742..29e19d951ffd5b 100644 --- a/packages/block-editor/src/utils/fit-text-utils.js +++ b/packages/block-editor/src/utils/fit-text-utils.js @@ -49,13 +49,12 @@ export function findOptimalFontSize( elementSelector, applyStylesFn ) { - if ( ! textElement || ! textElement.parentElement ) { + if ( ! textElement ) { return 16; } - const parentElement = textElement.parentElement; const alreadyHasScrollableHeight = - parentElement.scrollHeight > parentElement.clientHeight; + textElement.scrollHeight > textElement.clientHeight; let minSize = 5; let maxSize = 200; let bestSize = minSize; @@ -64,11 +63,10 @@ export function findOptimalFontSize( const midSize = Math.floor( ( minSize + maxSize ) / 2 ); applyStylesFn( generateCSSRule( elementSelector, midSize ) ); - const fitsWidth = - parentElement.scrollWidth <= parentElement.clientWidth; + const fitsWidth = textElement.scrollWidth <= textElement.clientWidth; const fitsHeight = alreadyHasScrollableHeight || - parentElement.scrollHeight <= parentElement.clientHeight; + textElement.scrollHeight <= textElement.clientHeight; if ( fitsWidth && fitsHeight ) { bestSize = midSize; From e83bab79adcc377a55222614db20fc61e8d8130d Mon Sep 17 00:00:00 2001 From: Jorge Date: Mon, 29 Sep 2025 15:28:43 +0100 Subject: [PATCH 04/19] Make maximum stretching of font size of 600 --- packages/block-editor/src/utils/fit-text-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-editor/src/utils/fit-text-utils.js b/packages/block-editor/src/utils/fit-text-utils.js index 29e19d951ffd5b..2f1ef4d1e637dc 100644 --- a/packages/block-editor/src/utils/fit-text-utils.js +++ b/packages/block-editor/src/utils/fit-text-utils.js @@ -56,7 +56,7 @@ export function findOptimalFontSize( const alreadyHasScrollableHeight = textElement.scrollHeight > textElement.clientHeight; let minSize = 5; - let maxSize = 200; + let maxSize = 600; let bestSize = minSize; while ( minSize <= maxSize ) { From 959246ee7b048ff9bbcddfdea2b646cae6780615 Mon Sep 17 00:00:00 2001 From: Jorge Date: Tue, 30 Sep 2025 15:14:18 +0100 Subject: [PATCH 05/19] feedback round 1 --- lib/block-supports/typography.php | 2 +- packages/block-editor/src/hooks/fit-text.js | 4 ++-- .../block-editor/src/utils/fit-text-frontend.js | 3 --- .../block-editor/src/utils/fit-text-utils.js | 17 +++++------------ 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/lib/block-supports/typography.php b/lib/block-supports/typography.php index e7005714cb9b51..3e21b1555c27fb 100644 --- a/lib/block-supports/typography.php +++ b/lib/block-supports/typography.php @@ -244,7 +244,7 @@ function gutenberg_typography_get_preset_inline_style_value( $style_value, $css_ * @return string Filtered block content. */ function gutenberg_render_typography_support( $block_content, $block ) { - if ( isset( $block['attrs']['fitText'] ) ) { + if ( ! empty( $block['attrs']['fitText'] ) ) { wp_enqueue_script_module( '@wordpress/block-editor/utils/fit-text-frontend' ); } diff --git a/packages/block-editor/src/hooks/fit-text.js b/packages/block-editor/src/hooks/fit-text.js index 56e5f5b837af05..e66b228344d2fb 100644 --- a/packages/block-editor/src/hooks/fit-text.js +++ b/packages/block-editor/src/hooks/fit-text.js @@ -180,7 +180,7 @@ export function FitTextControl( { clientId, fitText, setAttributes, name } ) { return ( !! fitText } + hasValue={ () => fitText } label={ __( 'Fit text' ) } onDeselect={ () => setAttributes( { fitText: false } ) } resetAllFilter={ () => ( { fitText: false } ) } @@ -189,7 +189,7 @@ export function FitTextControl( { clientId, fitText, setAttributes, name } ) { setAttributes( { fitText: ! fitText } ) } help={ fitText diff --git a/packages/block-editor/src/utils/fit-text-frontend.js b/packages/block-editor/src/utils/fit-text-frontend.js index fa27c044bf5eb6..383b338cfe72bf 100644 --- a/packages/block-editor/src/utils/fit-text-frontend.js +++ b/packages/block-editor/src/utils/fit-text-frontend.js @@ -73,9 +73,6 @@ function initializeFitText( element ) { if ( window.ResizeObserver && element.parentElement ) { const resizeObserver = new window.ResizeObserver( applyFitText ); resizeObserver.observe( element.parentElement ); - - // Store observer for cleanup if needed - element._fitTextObserver = resizeObserver; } } diff --git a/packages/block-editor/src/utils/fit-text-utils.js b/packages/block-editor/src/utils/fit-text-utils.js index 2f1ef4d1e637dc..e3bea4c7999045 100644 --- a/packages/block-editor/src/utils/fit-text-utils.js +++ b/packages/block-editor/src/utils/fit-text-utils.js @@ -10,7 +10,7 @@ * @param {number} fontSize Font size in pixels * @return {string} CSS rule string */ -export function generateCSSRule( elementSelector, fontSize ) { +function generateCSSRule( elementSelector, fontSize ) { return `${ elementSelector } { font-size: ${ fontSize }px !important; }`; } @@ -37,7 +37,7 @@ export function getOriginalFontSize( textElement, applyStylesFn ) { } /** - * Find optimal font size using simple binary search between 5-200px. + * Find optimal font size using simple binary search between 5-600px. * * @param {HTMLElement} textElement The text element * @param {string} elementSelector CSS selector for the text element @@ -86,15 +86,14 @@ export function findOptimalFontSize( * @param {HTMLElement} textElement The text element (paragraph, heading, etc.) * @param {string} elementSelector CSS selector for the text element * @param {Function} applyStylesFn Function to apply CSS styles (pass empty string to clear) - * @return {Object} Object with cssRule, originalSize, and optimalSize */ export function optimizeFitText( textElement, elementSelector, applyStylesFn ) { if ( ! textElement ) { - return { cssRule: '', originalSize: 16, optimalSize: 16 }; + return; } - // Get original font size (clears styles internally) - const originalSize = getOriginalFontSize( textElement, applyStylesFn ); + // Clear existing styles to measure natural size + getOriginalFontSize( textElement, applyStylesFn ); // Find optimal font size using binary search const optimalSize = findOptimalFontSize( @@ -108,10 +107,4 @@ export function optimizeFitText( textElement, elementSelector, applyStylesFn ) { // Apply final styles applyStylesFn( cssRule ); - - return { - cssRule, - originalSize, - optimalSize, - }; } From 923a4b0905006fe8bbe22c69c150d95e88f612bf Mon Sep 17 00:00:00 2001 From: Jorge Date: Tue, 30 Sep 2025 15:38:59 +0100 Subject: [PATCH 06/19] feedback round 2 --- packages/block-editor/src/hooks/fit-text.js | 19 ++++------ .../src/utils/fit-text-frontend.js | 18 ++++------ .../block-editor/src/utils/fit-text-utils.js | 35 ++----------------- 3 files changed, 14 insertions(+), 58 deletions(-) diff --git a/packages/block-editor/src/hooks/fit-text.js b/packages/block-editor/src/hooks/fit-text.js index e66b228344d2fb..499b5e78a39567 100644 --- a/packages/block-editor/src/hooks/fit-text.js +++ b/packages/block-editor/src/hooks/fit-text.js @@ -63,21 +63,18 @@ function useFitText( { fitText, name, clientId } ) { const hasFitTextSupport = hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY ); const blockElement = useBlockElement( clientId ); - // Monitor inner content changes for text blocks - const blockContent = useSelect( + // Monitor block attribute changes + // Any attribute may change the available space. + const blockAttributes = useSelect( ( select ) => { if ( ! clientId ) { - return ''; + return; } - const { getBlockAttributes } = select( blockEditorStore ); - const blockAttributes = getBlockAttributes( clientId ); - // Get content from common content attributes - return blockAttributes?.content || blockAttributes?.value || ''; + return select( blockEditorStore ).getBlockAttributes( clientId ); }, [ clientId ] ); - // Apply fit text optimization const applyFitText = useCallback( () => { if ( ! blockElement || ! hasFitTextSupport || ! fitText ) { return; @@ -92,15 +89,12 @@ function useFitText( { fitText, name, clientId } ) { blockElement.ownerDocument.head.appendChild( styleElement ); } - // Use WordPress block ID for targeting const blockSelector = `#block-${ clientId }`; - // Style management callback const applyStylesFn = ( css ) => { styleElement.textContent = css; }; - // Use shared utility for complete optimization optimizeFitText( blockElement, blockSelector, applyStylesFn ); }, [ blockElement, clientId, hasFitTextSupport, fitText ] ); @@ -133,7 +127,6 @@ function useFitText( { fitText, name, clientId } ) { resizeObserver.disconnect(); } - // Clean up styles for this block const styleId = `fit-text-${ clientId }`; const styleElement = currentElement.ownerDocument.getElementById( styleId ); @@ -156,7 +149,7 @@ function useFitText( { fitText, name, clientId } ) { return () => clearTimeout( timer ); } }, [ - blockContent, + blockAttributes, fitText, applyFitText, blockElement, diff --git a/packages/block-editor/src/utils/fit-text-frontend.js b/packages/block-editor/src/utils/fit-text-frontend.js index 383b338cfe72bf..1af44bd6e2dc24 100644 --- a/packages/block-editor/src/utils/fit-text-frontend.js +++ b/packages/block-editor/src/utils/fit-text-frontend.js @@ -8,6 +8,11 @@ */ import { optimizeFitText } from './fit-text-utils'; +/** + * Counter for generating unique element IDs. + */ +let idCounter = 0; + /** * Get or create a unique style element for a fit text element. * @@ -32,12 +37,8 @@ function getOrCreateStyleElement( elementId ) { * @return {string} Unique identifier. */ function getElementIdentifier( element ) { - // Use existing ID or create one if ( ! element.dataset.fitTextId ) { - element.dataset.fitTextId = - // Here Math.random is ok to generate ids they don't need to cryptographically secure. - // eslint-disable-next-line no-restricted-syntax - 'fit-text-' + Math.random().toString( 36 ).substring( 2, 11 ); + element.dataset.fitTextId = `fit-text-${ ++idCounter }`; } return element.dataset.fitTextId; } @@ -48,12 +49,9 @@ function getElementIdentifier( element ) { * @param {HTMLElement} element Element with fit text enabled. */ function initializeFitText( element ) { - // Get unique ID for this element const elementId = getElementIdentifier( element ); - // Apply fit text optimization const applyFitText = () => { - // Get style element for this element const styleElement = getOrCreateStyleElement( elementId ); const elementSelector = `[data-fit-text-id=\"${ elementId }\"]`; @@ -62,7 +60,6 @@ function initializeFitText( element ) { styleElement.textContent = css; }; - // Use shared utility for complete optimization optimizeFitText( element, elementSelector, applyStylesFn ); }; @@ -84,8 +81,5 @@ function initializeAllFitText() { elements.forEach( initializeFitText ); } -// Initialize on DOM content loaded document.addEventListener( 'DOMContentLoaded', initializeAllFitText ); - -// Also initialize on window load for cases where DOMContentLoaded has already fired window.addEventListener( 'load', initializeAllFitText ); diff --git a/packages/block-editor/src/utils/fit-text-utils.js b/packages/block-editor/src/utils/fit-text-utils.js index e3bea4c7999045..91525d8b71440b 100644 --- a/packages/block-editor/src/utils/fit-text-utils.js +++ b/packages/block-editor/src/utils/fit-text-utils.js @@ -14,28 +14,6 @@ function generateCSSRule( elementSelector, fontSize ) { return `${ elementSelector } { font-size: ${ fontSize }px !important; }`; } -/** - * Get original font size of a single text element. - * - * @param {HTMLElement} textElement The text element (paragraph, heading, etc.) - * @param {Function} applyStylesFn Function to apply/clear styles - * @return {number} Original font size in pixels - */ -export function getOriginalFontSize( textElement, applyStylesFn ) { - if ( ! textElement ) { - return 16; // Default fallback - } - - // Clear existing fit text styles to measure natural size - applyStylesFn( '' ); - - // Measure natural font size - const computedStyle = window.getComputedStyle( textElement ); - const fontSize = parseFloat( computedStyle.fontSize ); - - return fontSize || 16; // Fallback to 16px -} - /** * Find optimal font size using simple binary search between 5-600px. * @@ -44,11 +22,7 @@ export function getOriginalFontSize( textElement, applyStylesFn ) { * @param {Function} applyStylesFn Function to apply test styles * @return {number} Optimal font size */ -export function findOptimalFontSize( - textElement, - elementSelector, - applyStylesFn -) { +function findOptimalFontSize( textElement, elementSelector, applyStylesFn ) { if ( ! textElement ) { return 16; } @@ -92,19 +66,14 @@ export function optimizeFitText( textElement, elementSelector, applyStylesFn ) { return; } - // Clear existing styles to measure natural size - getOriginalFontSize( textElement, applyStylesFn ); + applyStylesFn( '' ); - // Find optimal font size using binary search const optimalSize = findOptimalFontSize( textElement, elementSelector, applyStylesFn ); - // Generate final CSS rule const cssRule = generateCSSRule( elementSelector, optimalSize ); - - // Apply final styles applyStylesFn( cssRule ); } From 5dc8fdb96bad51c7ea4307d1e7f4e046a977757b Mon Sep 17 00:00:00 2001 From: Jorge Date: Tue, 30 Sep 2025 15:43:15 +0100 Subject: [PATCH 07/19] simplification --- packages/block-editor/src/utils/fit-text-utils.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/block-editor/src/utils/fit-text-utils.js b/packages/block-editor/src/utils/fit-text-utils.js index 91525d8b71440b..64b128171559c2 100644 --- a/packages/block-editor/src/utils/fit-text-utils.js +++ b/packages/block-editor/src/utils/fit-text-utils.js @@ -23,10 +23,6 @@ function generateCSSRule( elementSelector, fontSize ) { * @return {number} Optimal font size */ function findOptimalFontSize( textElement, elementSelector, applyStylesFn ) { - if ( ! textElement ) { - return 16; - } - const alreadyHasScrollableHeight = textElement.scrollHeight > textElement.clientHeight; let minSize = 5; From f3345235b779b05f6817c587114ae0169f63b37e Mon Sep 17 00:00:00 2001 From: Jorge Date: Tue, 30 Sep 2025 15:51:21 +0100 Subject: [PATCH 08/19] remove css duplication --- packages/block-editor/src/content.scss | 1 - packages/block-editor/src/hooks/fit-text.scss | 3 --- packages/block-editor/src/style.scss | 1 - packages/block-library/src/common.scss | 2 +- 4 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 packages/block-editor/src/hooks/fit-text.scss diff --git a/packages/block-editor/src/content.scss b/packages/block-editor/src/content.scss index fd1b775cadce07..1ef4e118fb1bbe 100644 --- a/packages/block-editor/src/content.scss +++ b/packages/block-editor/src/content.scss @@ -12,7 +12,6 @@ @import "./components/plain-text/content.scss"; @import "./components/rich-text/content.scss"; @import "./components/warning/content.scss"; -@import "./hooks/fit-text.scss"; // To do: ideally the iframe does not contain UI, but there's still the block // placeholders that will be moved to shadow DOM in the future. diff --git a/packages/block-editor/src/hooks/fit-text.scss b/packages/block-editor/src/hooks/fit-text.scss deleted file mode 100644 index c8b671b44fddff..00000000000000 --- a/packages/block-editor/src/hooks/fit-text.scss +++ /dev/null @@ -1,3 +0,0 @@ -.has-fit-text { - white-space: nowrap !important; -} diff --git a/packages/block-editor/src/style.scss b/packages/block-editor/src/style.scss index 4bf2fec708f17a..5d9298c34ed9f2 100644 --- a/packages/block-editor/src/style.scss +++ b/packages/block-editor/src/style.scss @@ -54,7 +54,6 @@ @import "./hooks/border.scss"; @import "./hooks/color.scss"; @import "./hooks/dimensions.scss"; -@import "./hooks/fit-text.scss"; @import "./hooks/layout.scss"; @import "./hooks/spacing.scss"; @import "./hooks/typography.scss"; diff --git a/packages/block-library/src/common.scss b/packages/block-library/src/common.scss index cbaf80543801e2..f4791a9d58b83a 100644 --- a/packages/block-library/src/common.scss +++ b/packages/block-library/src/common.scss @@ -48,7 +48,7 @@ // Fit Text .has-fit-text { - white-space: nowrap; + white-space: nowrap !important; } // This tag marks the end of the styles that apply to editing canvas contents and need to be manipulated when we resize the editor. From 13b211b861796d05ddc09b758fe6f41461740551 Mon Sep 17 00:00:00 2001 From: Jorge Date: Tue, 7 Oct 2025 17:06:42 +0100 Subject: [PATCH 09/19] feedback application --- packages/block-editor/src/hooks/fit-text.js | 7 ++++++- packages/block-editor/src/utils/fit-text-frontend.js | 1 - packages/block-library/src/paragraph/variations.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/block-editor/src/hooks/fit-text.js b/packages/block-editor/src/hooks/fit-text.js index 499b5e78a39567..d5e3809be33ef0 100644 --- a/packages/block-editor/src/hooks/fit-text.js +++ b/packages/block-editor/src/hooks/fit-text.js @@ -166,7 +166,12 @@ function useFitText( { fitText, name, clientId } ) { * @param {string} props.name Block name. * @param {boolean} props.fitText Whether fit text is enabled. */ -export function FitTextControl( { clientId, fitText, setAttributes, name } ) { +export function FitTextControl( { + clientId, + fitText = false, + setAttributes, + name, +} ) { if ( ! hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY ) ) { return null; } diff --git a/packages/block-editor/src/utils/fit-text-frontend.js b/packages/block-editor/src/utils/fit-text-frontend.js index 1af44bd6e2dc24..d8095643aad502 100644 --- a/packages/block-editor/src/utils/fit-text-frontend.js +++ b/packages/block-editor/src/utils/fit-text-frontend.js @@ -81,5 +81,4 @@ function initializeAllFitText() { elements.forEach( initializeFitText ); } -document.addEventListener( 'DOMContentLoaded', initializeAllFitText ); window.addEventListener( 'load', initializeAllFitText ); diff --git a/packages/block-library/src/paragraph/variations.js b/packages/block-library/src/paragraph/variations.js index f40a90cbcfd3d7..ddb4f436987159 100644 --- a/packages/block-library/src/paragraph/variations.js +++ b/packages/block-library/src/paragraph/variations.js @@ -12,7 +12,7 @@ const variations = [ 'Text automatically resizes to fit the container width.' ), attributes: { fitText: true }, - scope: [ 'block', 'inserter' ], + scope: [ 'inserter' ], isActive: ( blockAttributes ) => blockAttributes.fitText, icon: textColor, example: { From aff8a7711b880971caaef4f9d9594b025001f480 Mon Sep 17 00:00:00 2001 From: Jorge Date: Tue, 7 Oct 2025 17:18:39 +0100 Subject: [PATCH 10/19] Added Stretchy Heading variation. --- packages/block-library/src/heading/index.js | 2 ++ .../block-library/src/heading/variations.js | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 packages/block-library/src/heading/variations.js diff --git a/packages/block-library/src/heading/index.js b/packages/block-library/src/heading/index.js index d591dc94ed97d9..2ab252c6c9c18f 100644 --- a/packages/block-library/src/heading/index.js +++ b/packages/block-library/src/heading/index.js @@ -13,6 +13,7 @@ import edit from './edit'; import metadata from './block.json'; import save from './save'; import transforms from './transforms'; +import variations from './variations'; const { name } = metadata; @@ -65,6 +66,7 @@ export const settings = { }, edit, save, + variations, }; export const init = () => initBlock( { name, metadata, settings } ); diff --git a/packages/block-library/src/heading/variations.js b/packages/block-library/src/heading/variations.js new file mode 100644 index 00000000000000..e1778749ccea7f --- /dev/null +++ b/packages/block-library/src/heading/variations.js @@ -0,0 +1,29 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; +import { textColor } from '@wordpress/icons'; + +const variations = [ + { + name: 'Stretchy Heading', + title: __( 'Stretchy Heading' ), + description: __( + 'Heading text automatically resizes to fit the container width.' + ), + attributes: { fitText: true }, + scope: [ 'inserter' ], + isActive: ( blockAttributes ) => blockAttributes.fitText, + icon: textColor, + example: { + attributes: { + content: __( + 'This heading will automatically resize to fit its container width.' + ), + fitText: true, + }, + }, + }, +]; + +export default variations; From 29844e14aba10231969cc88700239167af01f252 Mon Sep 17 00:00:00 2001 From: Jorge Date: Tue, 7 Oct 2025 17:22:31 +0100 Subject: [PATCH 11/19] Increase delay between typing and text fitting Avoids the editor feeling a bit disorienting when users type. --- packages/block-editor/src/hooks/fit-text.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-editor/src/hooks/fit-text.js b/packages/block-editor/src/hooks/fit-text.js index d5e3809be33ef0..986c13ec548b61 100644 --- a/packages/block-editor/src/hooks/fit-text.js +++ b/packages/block-editor/src/hooks/fit-text.js @@ -144,7 +144,7 @@ function useFitText( { fitText, name, clientId } ) { if ( blockElement ) { applyFitText(); } - }, 100 ); + }, 1000 ); return () => clearTimeout( timer ); } From adb1fa5e686f03fa00bc1890619e26ea38fc01ef Mon Sep 17 00:00:00 2001 From: Jorge Date: Tue, 7 Oct 2025 17:26:39 +0100 Subject: [PATCH 12/19] fixtures update --- test/integration/fixtures/blocks/core__accordion-item.json | 3 ++- test/integration/fixtures/blocks/core__accordion-panel.json | 3 ++- test/integration/fixtures/blocks/core__accordion.json | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/integration/fixtures/blocks/core__accordion-item.json b/test/integration/fixtures/blocks/core__accordion-item.json index 23af2da88cd145..d8c95aee6b14c7 100644 --- a/test/integration/fixtures/blocks/core__accordion-item.json +++ b/test/integration/fixtures/blocks/core__accordion-item.json @@ -31,7 +31,8 @@ "isValid": true, "attributes": { "content": "Accordion Panel Content", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__accordion-panel.json b/test/integration/fixtures/blocks/core__accordion-panel.json index ed8a1531cf6ab5..060f9ed4cb6865 100644 --- a/test/integration/fixtures/blocks/core__accordion-panel.json +++ b/test/integration/fixtures/blocks/core__accordion-panel.json @@ -13,7 +13,8 @@ "isValid": true, "attributes": { "content": "Accordion Panel Content", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__accordion.json b/test/integration/fixtures/blocks/core__accordion.json index 35434ce48c0410..d7264b048b508a 100644 --- a/test/integration/fixtures/blocks/core__accordion.json +++ b/test/integration/fixtures/blocks/core__accordion.json @@ -41,7 +41,8 @@ "isValid": true, "attributes": { "content": "Accordion Panel Content", - "dropCap": false + "dropCap": false, + "fitText": false }, "innerBlocks": [] } From 11b487d944accd1ce5f0262eff611c72d3489a51 Mon Sep 17 00:00:00 2001 From: Jorge Date: Wed, 8 Oct 2025 11:41:12 +0100 Subject: [PATCH 13/19] some e2e test fixes using exactmatch on a selector --- test/e2e/specs/editor/blocks/details.spec.js | 2 ++ test/e2e/specs/editor/blocks/list.spec.js | 4 +++- .../specs/editor/plugins/allowed-blocks.spec.js | 2 +- .../specs/editor/plugins/block-variations.spec.js | 7 ++++++- .../editor/plugins/post-type-locking.spec.js | 4 ++-- .../various/block-hierarchy-navigation.spec.js | 15 ++++++++++++--- .../specs/editor/various/block-switcher.spec.js | 2 +- .../specs/editor/various/inserting-blocks.spec.js | 4 ++-- test/e2e/specs/editor/various/list-view.spec.js | 2 +- .../editor/various/navigable-toolbar.spec.js | 2 +- test/e2e/specs/site-editor/template-part.spec.js | 1 + test/e2e/specs/widgets/editing-widgets.spec.js | 1 + 12 files changed, 33 insertions(+), 13 deletions(-) diff --git a/test/e2e/specs/editor/blocks/details.spec.js b/test/e2e/specs/editor/blocks/details.spec.js index 2b7e954b6eeaad..da54e99f3d063f 100644 --- a/test/e2e/specs/editor/blocks/details.spec.js +++ b/test/e2e/specs/editor/blocks/details.spec.js @@ -123,6 +123,7 @@ test.describe( 'Details', () => { await expect( listView.getByRole( 'link', { name: 'Paragraph', + exact: true, } ) ).toBeVisible(); @@ -131,6 +132,7 @@ test.describe( 'Details', () => { await expect( listView.getByRole( 'link', { name: 'Paragraph', + exact: true, } ) ).toBeFocused(); diff --git a/test/e2e/specs/editor/blocks/list.spec.js b/test/e2e/specs/editor/blocks/list.spec.js index 2736c6c645c2f9..5b51ad0c44708b 100644 --- a/test/e2e/specs/editor/blocks/list.spec.js +++ b/test/e2e/specs/editor/blocks/list.spec.js @@ -1422,7 +1422,9 @@ test.describe( 'List (@firefox)', () => { ); await page.getByRole( 'button', { name: 'List', exact: true } ).click(); - await page.getByRole( 'menuitem', { name: 'Paragraph' } ).click(); + await page + .getByRole( 'menuitem', { name: 'Paragraph', exact: true } ) + .click(); expect( await editor.getEditedPostContent() ) .toBe( ` diff --git a/test/e2e/specs/editor/plugins/allowed-blocks.spec.js b/test/e2e/specs/editor/plugins/allowed-blocks.spec.js index ed7490afe84fe9..e7939ca90685cc 100644 --- a/test/e2e/specs/editor/plugins/allowed-blocks.spec.js +++ b/test/e2e/specs/editor/plugins/allowed-blocks.spec.js @@ -33,7 +33,7 @@ test.describe( 'Allowed Blocks Filter', () => { await searchbox.fill( 'Paragraph' ); await expect( - page.getByRole( 'option', { name: 'Paragraph' } ) + page.getByRole( 'option', { name: 'Paragraph', exact: true } ) ).toBeVisible(); // The gallery block is not available. diff --git a/test/e2e/specs/editor/plugins/block-variations.spec.js b/test/e2e/specs/editor/plugins/block-variations.spec.js index 2b26aeb0404eaa..da65f7cc13e7bd 100644 --- a/test/e2e/specs/editor/plugins/block-variations.spec.js +++ b/test/e2e/specs/editor/plugins/block-variations.spec.js @@ -77,7 +77,12 @@ test.describe( 'Block variations', () => { page .getByRole( 'listbox', { name: 'Blocks' } ) .getByRole( 'option' ) - ).toHaveText( [ 'Paragraph', 'Success Message', 'Warning Message' ] ); + ).toHaveText( [ + 'Paragraph', + 'Stretchy Paragraph', + 'Success Message', + 'Warning Message', + ] ); } ); test( 'Insert the Success Message block variation', async ( { diff --git a/test/e2e/specs/editor/plugins/post-type-locking.spec.js b/test/e2e/specs/editor/plugins/post-type-locking.spec.js index 68cbdfb89f4537..452a4d19bcc870 100644 --- a/test/e2e/specs/editor/plugins/post-type-locking.spec.js +++ b/test/e2e/specs/editor/plugins/post-type-locking.spec.js @@ -337,7 +337,7 @@ test.describe( 'Post-type locking', () => { const blockSwitcher = page .getByRole( 'toolbar', { name: 'Block tools' } ) - .getByRole( 'button', { name: 'Paragraph' } ); + .getByRole( 'button', { name: 'Paragraph', exact: true } ); // Verify the block switcher exists. await expect( blockSwitcher ).toHaveAttribute( @@ -349,7 +349,7 @@ test.describe( 'Post-type locking', () => { await blockSwitcher.click(); await expect( page - .getByRole( 'menu', { name: 'Paragraph' } ) + .getByRole( 'menu', { name: 'Paragraph', exact: true } ) .getByRole( 'menuitem' ) ).toHaveText( [ 'Heading', diff --git a/test/e2e/specs/editor/various/block-hierarchy-navigation.spec.js b/test/e2e/specs/editor/various/block-hierarchy-navigation.spec.js index f0bfe5bff203fb..5e2c19645bd61e 100644 --- a/test/e2e/specs/editor/various/block-hierarchy-navigation.spec.js +++ b/test/e2e/specs/editor/various/block-hierarchy-navigation.spec.js @@ -53,7 +53,10 @@ test.describe( 'Navigating the block hierarchy', () => { await page.keyboard.press( 'Enter' ); // Add a paragraph in the first column. - const paragraph = page.getByRole( 'option', { name: 'Paragraph' } ); + const paragraph = page.getByRole( 'option', { + name: 'Paragraph', + exact: true, + } ); await expect( paragraph ).toBeVisible(); await paragraph.click(); await page.keyboard.type( 'First column' ); @@ -108,7 +111,10 @@ test.describe( 'Navigating the block hierarchy', () => { await page.keyboard.press( 'Enter' ); // Add a paragraph in the first column. - const paragraph = page.getByRole( 'option', { name: 'Paragraph' } ); + const paragraph = page.getByRole( 'option', { + name: 'Paragraph', + exact: true, + } ); await expect( paragraph ).toBeVisible(); await paragraph.click(); await page.keyboard.type( 'First column' ); @@ -204,7 +210,10 @@ test.describe( 'Navigating the block hierarchy', () => { await page.keyboard.press( 'Enter' ); // Add some random blocks. - const paragraph = page.getByRole( 'option', { name: 'Paragraph' } ); + const paragraph = page.getByRole( 'option', { + name: 'Paragraph', + exact: true, + } ); await expect( paragraph ).toBeVisible(); await paragraph.click(); await page.keyboard.type( 'just a paragraph' ); diff --git a/test/e2e/specs/editor/various/block-switcher.spec.js b/test/e2e/specs/editor/various/block-switcher.spec.js index cb95c4d395c664..490ca7483d17fe 100644 --- a/test/e2e/specs/editor/various/block-switcher.spec.js +++ b/test/e2e/specs/editor/various/block-switcher.spec.js @@ -103,7 +103,7 @@ test.describe( 'Block Switcher', () => { await pageUtils.pressKeys( 'alt+F10' ); const button = page .getByRole( 'toolbar', { name: 'Block tools' } ) - .getByRole( 'button', { name: 'Paragraph' } ); + .getByRole( 'button', { name: 'Paragraph', exact: true } ); await expect( button ).toBeEnabled(); await editor.clickBlockOptionsMenuItem( 'Lock' ); diff --git a/test/e2e/specs/editor/various/inserting-blocks.spec.js b/test/e2e/specs/editor/various/inserting-blocks.spec.js index 4de9f736ceafa1..c3c8eed543e444 100644 --- a/test/e2e/specs/editor/various/inserting-blocks.spec.js +++ b/test/e2e/specs/editor/various/inserting-blocks.spec.js @@ -553,7 +553,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => { await page.getByRole( 'button', { name: 'Browse All' } ).click(); await page .getByRole( 'listbox', { name: 'Text' } ) - .getByRole( 'option', { name: 'Paragraph' } ) + .getByRole( 'option', { name: 'Paragraph', exact: true } ) .click(); await editor.canvas .getByRole( 'document', { name: 'Empty block' } ) @@ -655,7 +655,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => { .click(); await page .getByRole( 'listbox', { name: 'Text' } ) - .getByRole( 'option', { name: 'Paragraph' } ) + .getByRole( 'option', { name: 'Paragraph', exact: true } ) .hover(); await expect( diff --git a/test/e2e/specs/editor/various/list-view.spec.js b/test/e2e/specs/editor/various/list-view.spec.js index 2d5c0a9ee67298..7cc306b4464629 100644 --- a/test/e2e/specs/editor/various/list-view.spec.js +++ b/test/e2e/specs/editor/various/list-view.spec.js @@ -1163,7 +1163,7 @@ test.describe( 'List View', () => { window.wp.data.dispatch( 'core/block-editor' ).clearSelectedBlock() ); await listView - .getByRole( 'gridcell', { name: 'Paragraph' } ) + .getByRole( 'gridcell', { name: 'Paragraph', exact: true } ) .getByRole( 'link' ) .focus(); await expect diff --git a/test/e2e/specs/editor/various/navigable-toolbar.spec.js b/test/e2e/specs/editor/various/navigable-toolbar.spec.js index 0d087536530e69..a87eef6a056f01 100644 --- a/test/e2e/specs/editor/various/navigable-toolbar.spec.js +++ b/test/e2e/specs/editor/various/navigable-toolbar.spec.js @@ -140,7 +140,7 @@ test.describe( 'Block Toolbar', () => { await expect( page .getByRole( 'toolbar', { name: 'Block Tools' } ) - .getByRole( 'button', { name: 'Paragraph' } ) + .getByRole( 'button', { name: 'Paragraph', exact: true } ) ).toBeFocused(); } ); diff --git a/test/e2e/specs/site-editor/template-part.spec.js b/test/e2e/specs/site-editor/template-part.spec.js index d88273574bc4b0..01cf1bd4ba4f27 100644 --- a/test/e2e/specs/site-editor/template-part.spec.js +++ b/test/e2e/specs/site-editor/template-part.spec.js @@ -389,6 +389,7 @@ test.describe( 'Template Part', () => { // Type within a first block. const paragraph = editor.canvas.getByRole( 'document', { name: 'Paragraph', + exact: true, } ); await editor.selectBlocks( paragraph ); await page.keyboard.type( 'Modify' ); diff --git a/test/e2e/specs/widgets/editing-widgets.spec.js b/test/e2e/specs/widgets/editing-widgets.spec.js index 019e07fe87daac..460b156857eb19 100644 --- a/test/e2e/specs/widgets/editing-widgets.spec.js +++ b/test/e2e/specs/widgets/editing-widgets.spec.js @@ -162,6 +162,7 @@ test.describe( 'Widgets screen', () => { const paragraphBlock = inlineQuickInserter.getByRole( 'option', { name: 'Paragraph', + exact: true, } ); await paragraphBlock.click(); From ae7361d7c118df6cb6f46cf3be9bddf712c4d39a Mon Sep 17 00:00:00 2001 From: Jorge Date: Wed, 8 Oct 2025 11:45:55 +0100 Subject: [PATCH 14/19] remove fixtures changes --- packages/block-editor/src/hooks/fit-text.js | 9 +++++---- .../fixtures/blocks/core__accordion-item.json | 3 +-- .../fixtures/blocks/core__accordion-panel.json | 3 +-- .../integration/fixtures/blocks/core__accordion.json | 3 +-- test/integration/fixtures/blocks/core__column.json | 6 ++---- .../fixtures/blocks/core__column__deprecated-1.json | 6 ++---- test/integration/fixtures/blocks/core__columns.json | 12 ++++-------- .../fixtures/blocks/core__columns__deprecated.json | 4 ---- .../core__columns__is-not-stacked-on-mobile.json | 12 ++++-------- test/integration/fixtures/blocks/core__cover.json | 3 +-- .../blocks/core__cover__alt-fixed-background.json | 3 +-- .../fixtures/blocks/core__cover__deprecated-1.json | 3 +-- .../fixtures/blocks/core__cover__deprecated-10.json | 3 +-- .../fixtures/blocks/core__cover__deprecated-12.json | 3 +-- .../fixtures/blocks/core__cover__deprecated-14.json | 3 +-- .../fixtures/blocks/core__cover__deprecated-2.json | 3 +-- .../fixtures/blocks/core__cover__deprecated-3.json | 3 +-- .../fixtures/blocks/core__cover__deprecated-4.json | 3 +-- .../fixtures/blocks/core__cover__deprecated-5.json | 3 +-- .../fixtures/blocks/core__cover__deprecated-6.json | 9 +++------ .../fixtures/blocks/core__cover__deprecated-7.json | 3 +-- .../fixtures/blocks/core__cover__deprecated-8.json | 3 +-- .../fixtures/blocks/core__cover__deprecated-9.json | 3 +-- .../core__cover__duotone-fixed-background.json | 3 +-- .../blocks/core__cover__gradient-custom.json | 3 +-- .../fixtures/blocks/core__cover__gradient-image.json | 3 +-- .../fixtures/blocks/core__cover__gradient-video.json | 3 +-- .../fixtures/blocks/core__cover__gradient.json | 3 +-- .../blocks/core__cover__gradient__deprecated-8.json | 3 +-- .../fixtures/blocks/core__cover__solid-color.json | 3 +-- .../fixtures/blocks/core__cover__video-overlay.json | 3 +-- .../fixtures/blocks/core__cover__video.json | 3 +-- test/integration/fixtures/blocks/core__details.json | 3 +-- .../blocks/core__form-submission-notification.json | 1 - .../blocks/core__group-layout-content-size.json | 6 ++---- .../core__group-layout-content-size__deprecated.json | 6 ++---- test/integration/fixtures/blocks/core__group.json | 6 ++---- .../fixtures/blocks/core__group__deprecated-2.json | 3 +-- .../fixtures/blocks/core__group__deprecated-3.json | 6 ++---- .../core__group__deprecated-inner-container.json | 6 ++---- .../fixtures/blocks/core__group__deprecated.json | 3 +-- .../fixtures/blocks/core__heading__h2-color.json | 3 +-- .../fixtures/blocks/core__heading__h2.json | 3 +-- .../fixtures/blocks/core__heading__h4-em.json | 3 +-- .../blocks/core__heading_align-textalign.json | 3 +-- .../fixtures/blocks/core__media-text.json | 3 +-- .../blocks/core__media-text__deprecated-v2.json | 3 +-- .../blocks/core__media-text__deprecated-v5.json | 3 +-- ...media-text__deprecated-v6-wide-default-align.json | 3 +-- ...ecated-v7-image-fill-no-focal-point-selected.json | 3 +-- ...ated-v7-image-fill-with-focal-point-selected.json | 3 +-- .../blocks/core__media-text__deprecated-v7.json | 3 +-- .../blocks/core__media-text__image-alt-no-align.json | 3 +-- ...dia-text__image-fill-no-focal-point-selected.json | 3 +-- ...a-text__image-fill-with-focal-point-selected.json | 3 +-- .../core__media-text__is-stacked-on-mobile.json | 3 +-- ...a-text__media-right-custom-width__deprecated.json | 3 +-- .../core__media-text__vertical-align-bottom.json | 3 +-- .../fixtures/blocks/core__media-text__video.json | 3 +-- .../blocks/core__paragraph__align-right.json | 3 +-- .../fixtures/blocks/core__query-no-results.json | 3 +-- .../fixtures/blocks/core__query__deprecated-3.json | 3 +-- .../fixtures/blocks/core__quote__deprecated-1.json | 3 +-- .../fixtures/blocks/core__quote__deprecated-2.json | 3 +-- .../core__quote__deprecated-4-align-attribute.json | 3 +-- .../fixtures/blocks/core__quote__style-1.json | 3 +-- .../fixtures/blocks/core__quote__style-2.json | 3 +-- .../blocks/core__text__converts-to-paragraph.json | 3 +-- 68 files changed, 85 insertions(+), 169 deletions(-) diff --git a/packages/block-editor/src/hooks/fit-text.js b/packages/block-editor/src/hooks/fit-text.js index 986c13ec548b61..69fab7282bbde8 100644 --- a/packages/block-editor/src/hooks/fit-text.js +++ b/packages/block-editor/src/hooks/fit-text.js @@ -45,7 +45,6 @@ function addAttributes( settings ) { ...settings.attributes, fitText: { type: 'boolean', - default: false, }, }, }; @@ -180,15 +179,17 @@ export function FitTextControl( { fitText } label={ __( 'Fit text' ) } - onDeselect={ () => setAttributes( { fitText: false } ) } - resetAllFilter={ () => ( { fitText: false } ) } + onDeselect={ () => setAttributes( { fitText: undefined } ) } + resetAllFilter={ () => ( { fitText: undefined } ) } panelId={ clientId } > setAttributes( { fitText: ! fitText } ) } + onChange={ () => + setAttributes( { fitText: ! fitText || undefined } ) + } help={ fitText ? __( 'Text will resize to fit its container.' ) diff --git a/test/integration/fixtures/blocks/core__accordion-item.json b/test/integration/fixtures/blocks/core__accordion-item.json index d8c95aee6b14c7..23af2da88cd145 100644 --- a/test/integration/fixtures/blocks/core__accordion-item.json +++ b/test/integration/fixtures/blocks/core__accordion-item.json @@ -31,8 +31,7 @@ "isValid": true, "attributes": { "content": "Accordion Panel Content", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__accordion-panel.json b/test/integration/fixtures/blocks/core__accordion-panel.json index 060f9ed4cb6865..ed8a1531cf6ab5 100644 --- a/test/integration/fixtures/blocks/core__accordion-panel.json +++ b/test/integration/fixtures/blocks/core__accordion-panel.json @@ -13,8 +13,7 @@ "isValid": true, "attributes": { "content": "Accordion Panel Content", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__accordion.json b/test/integration/fixtures/blocks/core__accordion.json index d7264b048b508a..35434ce48c0410 100644 --- a/test/integration/fixtures/blocks/core__accordion.json +++ b/test/integration/fixtures/blocks/core__accordion.json @@ -41,8 +41,7 @@ "isValid": true, "attributes": { "content": "Accordion Panel Content", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__column.json b/test/integration/fixtures/blocks/core__column.json index ae2b4dceec8427..3e0d7cecf90eac 100644 --- a/test/integration/fixtures/blocks/core__column.json +++ b/test/integration/fixtures/blocks/core__column.json @@ -9,8 +9,7 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph One", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] }, @@ -19,8 +18,7 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph Two", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__column__deprecated-1.json b/test/integration/fixtures/blocks/core__column__deprecated-1.json index f5bbbf68ac94cd..0f0076d3799cf9 100644 --- a/test/integration/fixtures/blocks/core__column__deprecated-1.json +++ b/test/integration/fixtures/blocks/core__column__deprecated-1.json @@ -11,8 +11,7 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph One", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] }, @@ -21,8 +20,7 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph Two", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__columns.json b/test/integration/fixtures/blocks/core__columns.json index cf7ef3a093a80f..806f59ef3a17f9 100644 --- a/test/integration/fixtures/blocks/core__columns.json +++ b/test/integration/fixtures/blocks/core__columns.json @@ -17,8 +17,7 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph One", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] }, @@ -27,8 +26,7 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph Two", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } @@ -44,8 +42,7 @@ "isValid": true, "attributes": { "content": "Column Two, Paragraph One", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] }, @@ -54,8 +51,7 @@ "isValid": true, "attributes": { "content": "Column Three, Paragraph One", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__columns__deprecated.json b/test/integration/fixtures/blocks/core__columns__deprecated.json index 395205a0cf565e..ed354852b13923 100644 --- a/test/integration/fixtures/blocks/core__columns__deprecated.json +++ b/test/integration/fixtures/blocks/core__columns__deprecated.json @@ -17,7 +17,6 @@ "attributes": { "content": "Column One, Paragraph One", "dropCap": false, - "fitText": false, "className": "layout-column-1" }, "innerBlocks": [] @@ -28,7 +27,6 @@ "attributes": { "content": "Column One, Paragraph Two", "dropCap": false, - "fitText": false, "className": "layout-column-1" }, "innerBlocks": [] @@ -46,7 +44,6 @@ "attributes": { "content": "Column Two, Paragraph One", "dropCap": false, - "fitText": false, "className": "layout-column-2" }, "innerBlocks": [] @@ -64,7 +61,6 @@ "attributes": { "content": "Column Three, Paragraph One", "dropCap": false, - "fitText": false, "className": "layout-column-3" }, "innerBlocks": [] diff --git a/test/integration/fixtures/blocks/core__columns__is-not-stacked-on-mobile.json b/test/integration/fixtures/blocks/core__columns__is-not-stacked-on-mobile.json index 691772a44891e4..a9b02a6151cb24 100644 --- a/test/integration/fixtures/blocks/core__columns__is-not-stacked-on-mobile.json +++ b/test/integration/fixtures/blocks/core__columns__is-not-stacked-on-mobile.json @@ -17,8 +17,7 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph One", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] }, @@ -27,8 +26,7 @@ "isValid": true, "attributes": { "content": "Column One, Paragraph Two", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } @@ -44,8 +42,7 @@ "isValid": true, "attributes": { "content": "Column Two, Paragraph One", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] }, @@ -54,8 +51,7 @@ "isValid": true, "attributes": { "content": "Column Three, Paragraph One", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover.json b/test/integration/fixtures/blocks/core__cover.json index d7b0af89981a65..a7ed06e153012d 100644 --- a/test/integration/fixtures/blocks/core__cover.json +++ b/test/integration/fixtures/blocks/core__cover.json @@ -22,8 +22,7 @@ "content": "\n\t\t\tGuten Berg!\n\t\t", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__alt-fixed-background.json b/test/integration/fixtures/blocks/core__cover__alt-fixed-background.json index a7864e802e9595..d848174278dabe 100644 --- a/test/integration/fixtures/blocks/core__cover__alt-fixed-background.json +++ b/test/integration/fixtures/blocks/core__cover__alt-fixed-background.json @@ -26,8 +26,7 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-1.json b/test/integration/fixtures/blocks/core__cover__deprecated-1.json index 884a9bf6735e50..a432e9992fd33a 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-1.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-1.json @@ -19,8 +19,7 @@ "content": "Cover Image", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-10.json b/test/integration/fixtures/blocks/core__cover__deprecated-10.json index 1835893d73e247..ce3dc9eb1d553e 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-10.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-10.json @@ -23,8 +23,7 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-12.json b/test/integration/fixtures/blocks/core__cover__deprecated-12.json index 4595e8ef125989..5991bbfd165bfb 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-12.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-12.json @@ -26,8 +26,7 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-14.json b/test/integration/fixtures/blocks/core__cover__deprecated-14.json index 706dd1feb99380..206e3e4c0d7e14 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-14.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-14.json @@ -28,8 +28,7 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-2.json b/test/integration/fixtures/blocks/core__cover__deprecated-2.json index c66b9d7226acee..7b9f5696d34ae2 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-2.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-2.json @@ -19,8 +19,7 @@ "content": "Cover Block", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-3.json b/test/integration/fixtures/blocks/core__cover__deprecated-3.json index b9ff296b1cc0a2..d2fcf5074b1dd3 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-3.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-3.json @@ -19,8 +19,7 @@ "content": "Cover Block", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-4.json b/test/integration/fixtures/blocks/core__cover__deprecated-4.json index 477a7de23084a3..48c677038ba872 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-4.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-4.json @@ -23,8 +23,7 @@ "content": "Cover Block", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-5.json b/test/integration/fixtures/blocks/core__cover__deprecated-5.json index 449cc288c3ed9b..9eee3c4a016840 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-5.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-5.json @@ -19,8 +19,7 @@ "content": "Cover", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-6.json b/test/integration/fixtures/blocks/core__cover__deprecated-6.json index b8cd717c8383c9..62bea629e8efe6 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-6.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-6.json @@ -19,8 +19,7 @@ "content": "\n\t\t\tGuten Berg!\n\t\t", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } @@ -51,8 +50,7 @@ "isValid": true, "attributes": { "content": "", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } @@ -81,8 +79,7 @@ "content": "test", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-7.json b/test/integration/fixtures/blocks/core__cover__deprecated-7.json index 8408fe2d4432e2..1ebd864bd38301 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-7.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-7.json @@ -20,8 +20,7 @@ "content": "\n\t\t\tGuten Berg!\n\t\t", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-8.json b/test/integration/fixtures/blocks/core__cover__deprecated-8.json index 3be6d43c73c6cb..9d5142e60fdd53 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-8.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-8.json @@ -21,8 +21,7 @@ "content": "\n Guten Berg!\n ", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-9.json b/test/integration/fixtures/blocks/core__cover__deprecated-9.json index 52a03dcbd59002..0f492be44c9681 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-9.json +++ b/test/integration/fixtures/blocks/core__cover__deprecated-9.json @@ -22,8 +22,7 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__duotone-fixed-background.json b/test/integration/fixtures/blocks/core__cover__duotone-fixed-background.json index 6e5117df21b28e..a85f0b4554f2a1 100644 --- a/test/integration/fixtures/blocks/core__cover__duotone-fixed-background.json +++ b/test/integration/fixtures/blocks/core__cover__duotone-fixed-background.json @@ -28,8 +28,7 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__gradient-custom.json b/test/integration/fixtures/blocks/core__cover__gradient-custom.json index c6cad971238533..f2d911a74be4cb 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-custom.json +++ b/test/integration/fixtures/blocks/core__cover__gradient-custom.json @@ -22,8 +22,7 @@ "content": "Cover!", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__gradient-image.json b/test/integration/fixtures/blocks/core__cover__gradient-image.json index ca7d82d0b25e48..5be874e5064346 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-image.json +++ b/test/integration/fixtures/blocks/core__cover__gradient-image.json @@ -23,8 +23,7 @@ "content": " Cover! ", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__gradient-video.json b/test/integration/fixtures/blocks/core__cover__gradient-video.json index 6df8e4f26386d6..fac1cefde8cd04 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-video.json +++ b/test/integration/fixtures/blocks/core__cover__gradient-video.json @@ -23,8 +23,7 @@ "content": "Cover!", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__gradient.json b/test/integration/fixtures/blocks/core__cover__gradient.json index 76af9167cf3669..fe217953d90fb9 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient.json +++ b/test/integration/fixtures/blocks/core__cover__gradient.json @@ -22,8 +22,7 @@ "content": "Cover!", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__gradient__deprecated-8.json b/test/integration/fixtures/blocks/core__cover__gradient__deprecated-8.json index 1591aa19bdde84..e4db2a2ece377e 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient__deprecated-8.json +++ b/test/integration/fixtures/blocks/core__cover__gradient__deprecated-8.json @@ -21,8 +21,7 @@ "content": "Cover!", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__solid-color.json b/test/integration/fixtures/blocks/core__cover__solid-color.json index d1eff41c910846..4d06b3e616e164 100644 --- a/test/integration/fixtures/blocks/core__cover__solid-color.json +++ b/test/integration/fixtures/blocks/core__cover__solid-color.json @@ -23,8 +23,7 @@ "content": "", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__video-overlay.json b/test/integration/fixtures/blocks/core__cover__video-overlay.json index 85e025d7db152c..a4171b22c98423 100644 --- a/test/integration/fixtures/blocks/core__cover__video-overlay.json +++ b/test/integration/fixtures/blocks/core__cover__video-overlay.json @@ -24,8 +24,7 @@ "content": "\n\t\t\tGuten Berg!\n\t\t", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__cover__video.json b/test/integration/fixtures/blocks/core__cover__video.json index df233b1d35706b..698239ef191838 100644 --- a/test/integration/fixtures/blocks/core__cover__video.json +++ b/test/integration/fixtures/blocks/core__cover__video.json @@ -22,8 +22,7 @@ "content": "\n\t\t\tGuten Berg!\n\t\t", "dropCap": false, "placeholder": "Write title…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__details.json b/test/integration/fixtures/blocks/core__details.json index 85aeb539684256..e3873e4702db3f 100644 --- a/test/integration/fixtures/blocks/core__details.json +++ b/test/integration/fixtures/blocks/core__details.json @@ -13,8 +13,7 @@ "attributes": { "content": "Details Content", "dropCap": false, - "placeholder": "Type / to add a hidden block", - "fitText": false + "placeholder": "Type / to add a hidden block" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__form-submission-notification.json b/test/integration/fixtures/blocks/core__form-submission-notification.json index 79678077d2092d..dac7502e9716ca 100644 --- a/test/integration/fixtures/blocks/core__form-submission-notification.json +++ b/test/integration/fixtures/blocks/core__form-submission-notification.json @@ -14,7 +14,6 @@ "dropCap": false, "backgroundColor": "#00D084", "textColor": "#000000", - "fitText": false, "style": { "elements": { "link": { diff --git a/test/integration/fixtures/blocks/core__group-layout-content-size.json b/test/integration/fixtures/blocks/core__group-layout-content-size.json index 725b33a8ded6d4..ebc317f895e148 100644 --- a/test/integration/fixtures/blocks/core__group-layout-content-size.json +++ b/test/integration/fixtures/blocks/core__group-layout-content-size.json @@ -16,8 +16,7 @@ "isValid": true, "attributes": { "content": "This is a group block.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] }, @@ -26,8 +25,7 @@ "isValid": true, "attributes": { "content": "Group block content.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__group-layout-content-size__deprecated.json b/test/integration/fixtures/blocks/core__group-layout-content-size__deprecated.json index 4ecfe78c8cb26a..152c3e1750778d 100644 --- a/test/integration/fixtures/blocks/core__group-layout-content-size__deprecated.json +++ b/test/integration/fixtures/blocks/core__group-layout-content-size__deprecated.json @@ -17,8 +17,7 @@ "isValid": true, "attributes": { "content": "This is a group block.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] }, @@ -27,8 +26,7 @@ "isValid": true, "attributes": { "content": "Group block content.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__group.json b/test/integration/fixtures/blocks/core__group.json index d80af404cedbf3..7abd6688a7eb80 100644 --- a/test/integration/fixtures/blocks/core__group.json +++ b/test/integration/fixtures/blocks/core__group.json @@ -16,8 +16,7 @@ "isValid": true, "attributes": { "content": "This is a group block.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] }, @@ -26,8 +25,7 @@ "isValid": true, "attributes": { "content": "Group block content.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__group__deprecated-2.json b/test/integration/fixtures/blocks/core__group__deprecated-2.json index 408cf721d51eda..e281b0eaa56f00 100644 --- a/test/integration/fixtures/blocks/core__group__deprecated-2.json +++ b/test/integration/fixtures/blocks/core__group__deprecated-2.json @@ -12,8 +12,7 @@ "isValid": true, "attributes": { "content": "My paragraph", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__group__deprecated-3.json b/test/integration/fixtures/blocks/core__group__deprecated-3.json index 9daa8e625fb053..2582fe6b87c4e7 100644 --- a/test/integration/fixtures/blocks/core__group__deprecated-3.json +++ b/test/integration/fixtures/blocks/core__group__deprecated-3.json @@ -13,8 +13,7 @@ "isValid": true, "attributes": { "content": "This is a group block.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] }, @@ -23,8 +22,7 @@ "isValid": true, "attributes": { "content": "Group block content.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__group__deprecated-inner-container.json b/test/integration/fixtures/blocks/core__group__deprecated-inner-container.json index 9daa8e625fb053..2582fe6b87c4e7 100644 --- a/test/integration/fixtures/blocks/core__group__deprecated-inner-container.json +++ b/test/integration/fixtures/blocks/core__group__deprecated-inner-container.json @@ -13,8 +13,7 @@ "isValid": true, "attributes": { "content": "This is a group block.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] }, @@ -23,8 +22,7 @@ "isValid": true, "attributes": { "content": "Group block content.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__group__deprecated.json b/test/integration/fixtures/blocks/core__group__deprecated.json index f9ab9b2bde813b..66ae1d8fd1d999 100644 --- a/test/integration/fixtures/blocks/core__group__deprecated.json +++ b/test/integration/fixtures/blocks/core__group__deprecated.json @@ -14,8 +14,7 @@ "isValid": true, "attributes": { "content": "test", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__heading__h2-color.json b/test/integration/fixtures/blocks/core__heading__h2-color.json index a1f6b3abd07971..da2b13f048aea8 100644 --- a/test/integration/fixtures/blocks/core__heading__h2-color.json +++ b/test/integration/fixtures/blocks/core__heading__h2-color.json @@ -5,8 +5,7 @@ "attributes": { "content": "Text", "level": 2, - "textColor": "accent", - "fitText": false + "textColor": "accent" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__heading__h2.json b/test/integration/fixtures/blocks/core__heading__h2.json index 36627c7d5f87a2..caac4208bf0c52 100644 --- a/test/integration/fixtures/blocks/core__heading__h2.json +++ b/test/integration/fixtures/blocks/core__heading__h2.json @@ -4,8 +4,7 @@ "isValid": true, "attributes": { "content": "A picture is worth a thousand words, or so the saying goes", - "level": 2, - "fitText": false + "level": 2 }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__heading__h4-em.json b/test/integration/fixtures/blocks/core__heading__h4-em.json index 46b6fc35528b2b..82eb02851bfe80 100644 --- a/test/integration/fixtures/blocks/core__heading__h4-em.json +++ b/test/integration/fixtures/blocks/core__heading__h4-em.json @@ -4,8 +4,7 @@ "isValid": true, "attributes": { "content": "The Inserter Tool", - "level": 4, - "fitText": false + "level": 4 }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__heading_align-textalign.json b/test/integration/fixtures/blocks/core__heading_align-textalign.json index a73eef64bd64f6..d4bd2d918ba7ed 100644 --- a/test/integration/fixtures/blocks/core__heading_align-textalign.json +++ b/test/integration/fixtures/blocks/core__heading_align-textalign.json @@ -6,8 +6,7 @@ "textAlign": "center", "content": "Text", "level": 2, - "align": "wide", - "fitText": false + "align": "wide" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text.json b/test/integration/fixtures/blocks/core__media-text.json index f4d55914033fc3..dd86e7d9dd8dd0 100644 --- a/test/integration/fixtures/blocks/core__media-text.json +++ b/test/integration/fixtures/blocks/core__media-text.json @@ -20,8 +20,7 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__deprecated-v2.json b/test/integration/fixtures/blocks/core__media-text__deprecated-v2.json index 3ff193b968839b..ca2b0016872687 100644 --- a/test/integration/fixtures/blocks/core__media-text__deprecated-v2.json +++ b/test/integration/fixtures/blocks/core__media-text__deprecated-v2.json @@ -18,8 +18,7 @@ "attributes": { "content": "My Content", "dropCap": false, - "placeholder": "Content…", - "fitText": false + "placeholder": "Content…" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__deprecated-v5.json b/test/integration/fixtures/blocks/core__media-text__deprecated-v5.json index 9a07b387e25dd0..1f252de69c1ad7 100644 --- a/test/integration/fixtures/blocks/core__media-text__deprecated-v5.json +++ b/test/integration/fixtures/blocks/core__media-text__deprecated-v5.json @@ -23,8 +23,7 @@ "attributes": { "content": "My Content", "dropCap": false, - "placeholder": "Content…", - "fitText": false + "placeholder": "Content…" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__deprecated-v6-wide-default-align.json b/test/integration/fixtures/blocks/core__media-text__deprecated-v6-wide-default-align.json index 58a83d34c964a0..bbe1bf7fc90ded 100644 --- a/test/integration/fixtures/blocks/core__media-text__deprecated-v6-wide-default-align.json +++ b/test/integration/fixtures/blocks/core__media-text__deprecated-v6-wide-default-align.json @@ -19,8 +19,7 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-no-focal-point-selected.json b/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-no-focal-point-selected.json index c22ad8a886059d..bf195f6fa1c953 100644 --- a/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-no-focal-point-selected.json +++ b/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-no-focal-point-selected.json @@ -20,8 +20,7 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-with-focal-point-selected.json b/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-with-focal-point-selected.json index 62e005e109a415..986e049099541f 100644 --- a/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-with-focal-point-selected.json +++ b/test/integration/fixtures/blocks/core__media-text__deprecated-v7-image-fill-with-focal-point-selected.json @@ -24,8 +24,7 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__deprecated-v7.json b/test/integration/fixtures/blocks/core__media-text__deprecated-v7.json index 66daf39b011c79..a6f0dff927874d 100644 --- a/test/integration/fixtures/blocks/core__media-text__deprecated-v7.json +++ b/test/integration/fixtures/blocks/core__media-text__deprecated-v7.json @@ -21,8 +21,7 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__image-alt-no-align.json b/test/integration/fixtures/blocks/core__media-text__image-alt-no-align.json index 2f851ba4c32fe1..e8a9ad70ae0132 100644 --- a/test/integration/fixtures/blocks/core__media-text__image-alt-no-align.json +++ b/test/integration/fixtures/blocks/core__media-text__image-alt-no-align.json @@ -20,8 +20,7 @@ "content": "Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__image-fill-no-focal-point-selected.json b/test/integration/fixtures/blocks/core__media-text__image-fill-no-focal-point-selected.json index 7b9a6500408087..bb57f08ad5cfa7 100644 --- a/test/integration/fixtures/blocks/core__media-text__image-fill-no-focal-point-selected.json +++ b/test/integration/fixtures/blocks/core__media-text__image-fill-no-focal-point-selected.json @@ -21,8 +21,7 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__image-fill-with-focal-point-selected.json b/test/integration/fixtures/blocks/core__media-text__image-fill-with-focal-point-selected.json index 7ea01d591f001d..0de71c867457ef 100644 --- a/test/integration/fixtures/blocks/core__media-text__image-fill-with-focal-point-selected.json +++ b/test/integration/fixtures/blocks/core__media-text__image-fill-with-focal-point-selected.json @@ -25,8 +25,7 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__is-stacked-on-mobile.json b/test/integration/fixtures/blocks/core__media-text__is-stacked-on-mobile.json index f1e4bf47756f71..cce4ca41239c5f 100644 --- a/test/integration/fixtures/blocks/core__media-text__is-stacked-on-mobile.json +++ b/test/integration/fixtures/blocks/core__media-text__is-stacked-on-mobile.json @@ -19,8 +19,7 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__media-right-custom-width__deprecated.json b/test/integration/fixtures/blocks/core__media-text__media-right-custom-width__deprecated.json index 28c1009c1c2307..746a1cb641dbd9 100644 --- a/test/integration/fixtures/blocks/core__media-text__media-right-custom-width__deprecated.json +++ b/test/integration/fixtures/blocks/core__media-text__media-right-custom-width__deprecated.json @@ -20,8 +20,7 @@ "content": "My video", "dropCap": false, "placeholder": "Content…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__vertical-align-bottom.json b/test/integration/fixtures/blocks/core__media-text__vertical-align-bottom.json index 1204aedbbd5fa8..f7d0516a85a648 100644 --- a/test/integration/fixtures/blocks/core__media-text__vertical-align-bottom.json +++ b/test/integration/fixtures/blocks/core__media-text__vertical-align-bottom.json @@ -20,8 +20,7 @@ "content": "My content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__media-text__video.json b/test/integration/fixtures/blocks/core__media-text__video.json index f1e4bf47756f71..cce4ca41239c5f 100644 --- a/test/integration/fixtures/blocks/core__media-text__video.json +++ b/test/integration/fixtures/blocks/core__media-text__video.json @@ -19,8 +19,7 @@ "content": "My Content", "dropCap": false, "placeholder": "Content…", - "fontSize": "large", - "fitText": false + "fontSize": "large" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__paragraph__align-right.json b/test/integration/fixtures/blocks/core__paragraph__align-right.json index a90f0ddc12dc7e..fb3015a8530550 100644 --- a/test/integration/fixtures/blocks/core__paragraph__align-right.json +++ b/test/integration/fixtures/blocks/core__paragraph__align-right.json @@ -5,8 +5,7 @@ "attributes": { "align": "right", "content": "... like this one, which is separate from the above and right aligned.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__query-no-results.json b/test/integration/fixtures/blocks/core__query-no-results.json index f87247f3695edc..7331bcdeb58e30 100644 --- a/test/integration/fixtures/blocks/core__query-no-results.json +++ b/test/integration/fixtures/blocks/core__query-no-results.json @@ -10,8 +10,7 @@ "attributes": { "content": "", "dropCap": false, - "placeholder": "Add a text or blocks that will display when the query returns no results.", - "fitText": false + "placeholder": "Add a text or blocks that will display when the query returns no results." }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__query__deprecated-3.json b/test/integration/fixtures/blocks/core__query__deprecated-3.json index fd5cd028e745ef..d3ed27ec4fac33 100644 --- a/test/integration/fixtures/blocks/core__query__deprecated-3.json +++ b/test/integration/fixtures/blocks/core__query__deprecated-3.json @@ -133,8 +133,7 @@ "attributes": { "content": "No results found.", "dropCap": false, - "placeholder": "Add text or blocks that will display when a query returns no results.", - "fitText": false + "placeholder": "Add text or blocks that will display when a query returns no results." }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__quote__deprecated-1.json b/test/integration/fixtures/blocks/core__quote__deprecated-1.json index ede3193b924be0..ea4a9a23196586 100644 --- a/test/integration/fixtures/blocks/core__quote__deprecated-1.json +++ b/test/integration/fixtures/blocks/core__quote__deprecated-1.json @@ -11,8 +11,7 @@ "isValid": true, "attributes": { "content": "Testing deprecated quote block...", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__quote__deprecated-2.json b/test/integration/fixtures/blocks/core__quote__deprecated-2.json index 6109ffc3f4fdc0..2af2f38fa9e937 100644 --- a/test/integration/fixtures/blocks/core__quote__deprecated-2.json +++ b/test/integration/fixtures/blocks/core__quote__deprecated-2.json @@ -12,8 +12,7 @@ "isValid": true, "attributes": { "content": "Testing deprecated quote block...", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__quote__deprecated-4-align-attribute.json b/test/integration/fixtures/blocks/core__quote__deprecated-4-align-attribute.json index 2939f0fcece5bf..c5b6d35aa427fc 100644 --- a/test/integration/fixtures/blocks/core__quote__deprecated-4-align-attribute.json +++ b/test/integration/fixtures/blocks/core__quote__deprecated-4-align-attribute.json @@ -13,8 +13,7 @@ "isValid": true, "attributes": { "content": "Quote with the align attribute. Example: {\"align\":\"right\"}", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__quote__style-1.json b/test/integration/fixtures/blocks/core__quote__style-1.json index 8574680467b389..d262a2fefc6f3e 100644 --- a/test/integration/fixtures/blocks/core__quote__style-1.json +++ b/test/integration/fixtures/blocks/core__quote__style-1.json @@ -12,8 +12,7 @@ "isValid": true, "attributes": { "content": "The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__quote__style-2.json b/test/integration/fixtures/blocks/core__quote__style-2.json index 71a29fc7792a5f..c7c699e4caf422 100644 --- a/test/integration/fixtures/blocks/core__quote__style-2.json +++ b/test/integration/fixtures/blocks/core__quote__style-2.json @@ -13,8 +13,7 @@ "isValid": true, "attributes": { "content": "There is no greater agony than bearing an untold story inside you.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__text__converts-to-paragraph.json b/test/integration/fixtures/blocks/core__text__converts-to-paragraph.json index 93acc454bfb76f..2e4cd5c6444d47 100644 --- a/test/integration/fixtures/blocks/core__text__converts-to-paragraph.json +++ b/test/integration/fixtures/blocks/core__text__converts-to-paragraph.json @@ -4,8 +4,7 @@ "isValid": true, "attributes": { "content": "This is an old-style text block. Changed to paragraph in #2135.", - "dropCap": false, - "fitText": false + "dropCap": false }, "innerBlocks": [] } From 431450354e298fb7584d592198935849ff166ca5 Mon Sep 17 00:00:00 2001 From: Jorge Date: Wed, 8 Oct 2025 12:13:53 +0100 Subject: [PATCH 15/19] additional e2e fixes --- test/e2e/specs/editor/plugins/block-variations.spec.js | 4 +++- test/e2e/specs/site-editor/template-part.spec.js | 1 - test/e2e/specs/widgets/editing-widgets.spec.js | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/e2e/specs/editor/plugins/block-variations.spec.js b/test/e2e/specs/editor/plugins/block-variations.spec.js index da65f7cc13e7bd..7dc69322a702b3 100644 --- a/test/e2e/specs/editor/plugins/block-variations.spec.js +++ b/test/e2e/specs/editor/plugins/block-variations.spec.js @@ -93,7 +93,9 @@ test.describe( 'Block variations', () => { .locator( 'role=button[name="Add default block"i]' ) .click(); await page.keyboard.type( '/Heading' ); - await page.getByRole( 'option', { name: 'Heading' } ).click(); + await page + .getByRole( 'option', { name: 'Heading', exact: true } ) + .click(); await page.keyboard.type( '/Success Message' ); await page.getByRole( 'option', { name: 'Success Message' } ).click(); diff --git a/test/e2e/specs/site-editor/template-part.spec.js b/test/e2e/specs/site-editor/template-part.spec.js index 01cf1bd4ba4f27..d88273574bc4b0 100644 --- a/test/e2e/specs/site-editor/template-part.spec.js +++ b/test/e2e/specs/site-editor/template-part.spec.js @@ -389,7 +389,6 @@ test.describe( 'Template Part', () => { // Type within a first block. const paragraph = editor.canvas.getByRole( 'document', { name: 'Paragraph', - exact: true, } ); await editor.selectBlocks( paragraph ); await page.keyboard.type( 'Modify' ); diff --git a/test/e2e/specs/widgets/editing-widgets.spec.js b/test/e2e/specs/widgets/editing-widgets.spec.js index 460b156857eb19..0da979e2a4e80d 100644 --- a/test/e2e/specs/widgets/editing-widgets.spec.js +++ b/test/e2e/specs/widgets/editing-widgets.spec.js @@ -709,7 +709,10 @@ class WidgetsScreen { } ) .fill( blockName ); - return blockLibrary.getByRole( 'option', { name: blockName } ); + return blockLibrary.getByRole( 'option', { + name: blockName, + exact: true, + } ); }; saveWidgets = async () => { From 9445eec9b4ad4461bce07340a411653a0212782d Mon Sep 17 00:00:00 2001 From: Jorge Date: Wed, 8 Oct 2025 12:31:22 +0100 Subject: [PATCH 16/19] e2e fixes --- test/e2e/specs/editor/plugins/block-variations.spec.js | 2 +- test/e2e/specs/editor/plugins/child-blocks.spec.js | 1 + .../specs/editor/plugins/inner-blocks-allowed-blocks.spec.js | 2 ++ test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js | 2 +- test/e2e/specs/editor/various/block-visibility.spec.js | 2 +- test/e2e/specs/editor/various/inserting-blocks.spec.js | 2 +- test/e2e/specs/site-editor/template-part.spec.js | 1 + 7 files changed, 8 insertions(+), 4 deletions(-) diff --git a/test/e2e/specs/editor/plugins/block-variations.spec.js b/test/e2e/specs/editor/plugins/block-variations.spec.js index 7dc69322a702b3..8efe468dabe63d 100644 --- a/test/e2e/specs/editor/plugins/block-variations.spec.js +++ b/test/e2e/specs/editor/plugins/block-variations.spec.js @@ -210,7 +210,7 @@ test.describe( 'Block variations', () => { .locator( 'role=button[name="Add default block"i]' ) .click(); await page.keyboard.type( '/Heading' ); - await page.getByRole( 'option', { name: 'Heading' } ).click(); + await page.getByRole( 'option', { name: 'Heading', exact: true } ).click(); await page.keyboard.type( '/Warning Message' ); await page.getByRole( 'option', { name: 'Warning Message' } ).click(); diff --git a/test/e2e/specs/editor/plugins/child-blocks.spec.js b/test/e2e/specs/editor/plugins/child-blocks.spec.js index 765b4040a4b976..eff8c1cd207d25 100644 --- a/test/e2e/specs/editor/plugins/child-blocks.spec.js +++ b/test/e2e/specs/editor/plugins/child-blocks.spec.js @@ -98,6 +98,7 @@ test.describe( 'Child Blocks', () => { await expect( blockLibrary ).toBeVisible(); await expect( blockLibrary.getByRole( 'option' ) ).toHaveText( [ 'Paragraph', + 'Stretchy Paragraph', 'Child Blocks Child', 'Image', ] ); diff --git a/test/e2e/specs/editor/plugins/inner-blocks-allowed-blocks.spec.js b/test/e2e/specs/editor/plugins/inner-blocks-allowed-blocks.spec.js index 4ee6d7a0fc4fec..b1b681a8003e99 100644 --- a/test/e2e/specs/editor/plugins/inner-blocks-allowed-blocks.spec.js +++ b/test/e2e/specs/editor/plugins/inner-blocks-allowed-blocks.spec.js @@ -105,7 +105,9 @@ test.describe( 'Allowed Blocks Setting on InnerBlocks', () => { await expect( blockLibrary ).toBeVisible(); await expect( blockLibrary.getByRole( 'option' ) ).toHaveText( [ 'Paragraph', + 'Stretchy Paragraph', 'Heading', + 'Stretchy Heading', 'Image', ] ); } ); diff --git a/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js b/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js index 7143f3dfc96b7b..ccfae994a4cfbf 100644 --- a/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js +++ b/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js @@ -571,7 +571,7 @@ test.describe( 'Autocomplete (@firefox, @webkit)', () => { // Get the assertive live region screen reader announcement. await expect( page.getByText( - '3 results found, use up and down arrow keys to navigate.' + '4 results found, use up and down arrow keys to navigate.' ) ).toBeVisible(); } ); diff --git a/test/e2e/specs/editor/various/block-visibility.spec.js b/test/e2e/specs/editor/various/block-visibility.spec.js index 6e4163f4ed5839..7a62916f9c2c8c 100644 --- a/test/e2e/specs/editor/various/block-visibility.spec.js +++ b/test/e2e/specs/editor/various/block-visibility.spec.js @@ -96,7 +96,7 @@ test.describe( 'Block Visibility', () => { await expect( page .getByRole( 'tabpanel', { name: 'Blocks' } ) - .getByRole( 'option', { name: 'Heading' } ), + .getByRole( 'option', { name: 'Heading', exact: true } ), 'Heading block should be visible' ).toBeVisible(); } ); diff --git a/test/e2e/specs/editor/various/inserting-blocks.spec.js b/test/e2e/specs/editor/various/inserting-blocks.spec.js index c3c8eed543e444..cd6d7ae2b743fc 100644 --- a/test/e2e/specs/editor/various/inserting-blocks.spec.js +++ b/test/e2e/specs/editor/various/inserting-blocks.spec.js @@ -512,7 +512,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => { .click(); await page .getByRole( 'listbox', { name: 'Text' } ) - .getByRole( 'option', { name: 'Heading' } ) + .getByRole( 'option', { name: 'Heading', exact: true } ) .hover(); await expect( insertingBlocksUtils.indicator ).toBeVisible(); diff --git a/test/e2e/specs/site-editor/template-part.spec.js b/test/e2e/specs/site-editor/template-part.spec.js index d88273574bc4b0..01cf1bd4ba4f27 100644 --- a/test/e2e/specs/site-editor/template-part.spec.js +++ b/test/e2e/specs/site-editor/template-part.spec.js @@ -389,6 +389,7 @@ test.describe( 'Template Part', () => { // Type within a first block. const paragraph = editor.canvas.getByRole( 'document', { name: 'Paragraph', + exact: true, } ); await editor.selectBlocks( paragraph ); await page.keyboard.type( 'Modify' ); From cdfb3e883e49c781e273879f434d97e9eb8cda90 Mon Sep 17 00:00:00 2001 From: Jorge Date: Wed, 8 Oct 2025 13:27:54 +0100 Subject: [PATCH 17/19] e2e fixes --- test/e2e/specs/editor/plugins/block-variations.spec.js | 2 +- test/e2e/specs/site-editor/template-part.spec.js | 1 - test/e2e/specs/widgets/editing-widgets.spec.js | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test/e2e/specs/editor/plugins/block-variations.spec.js b/test/e2e/specs/editor/plugins/block-variations.spec.js index 8efe468dabe63d..78c5d4b22b938c 100644 --- a/test/e2e/specs/editor/plugins/block-variations.spec.js +++ b/test/e2e/specs/editor/plugins/block-variations.spec.js @@ -174,7 +174,7 @@ test.describe( 'Block variations', () => { .locator( 'role=button[name="Add default block"i]' ) .click(); await page.keyboard.type( '/Heading' ); - await page.getByRole( 'option', { name: 'Heading' } ).click(); + await page.getByRole( 'option', { name: 'Heading', exact: true } ).click(); await page.keyboard.type( '/Success Message' ); await page.getByRole( 'option', { name: 'Success Message' } ).click(); diff --git a/test/e2e/specs/site-editor/template-part.spec.js b/test/e2e/specs/site-editor/template-part.spec.js index 01cf1bd4ba4f27..d88273574bc4b0 100644 --- a/test/e2e/specs/site-editor/template-part.spec.js +++ b/test/e2e/specs/site-editor/template-part.spec.js @@ -389,7 +389,6 @@ test.describe( 'Template Part', () => { // Type within a first block. const paragraph = editor.canvas.getByRole( 'document', { name: 'Paragraph', - exact: true, } ); await editor.selectBlocks( paragraph ); await page.keyboard.type( 'Modify' ); diff --git a/test/e2e/specs/widgets/editing-widgets.spec.js b/test/e2e/specs/widgets/editing-widgets.spec.js index 0da979e2a4e80d..bb1734ffaf3dcf 100644 --- a/test/e2e/specs/widgets/editing-widgets.spec.js +++ b/test/e2e/specs/widgets/editing-widgets.spec.js @@ -215,7 +215,7 @@ test.describe( 'Widgets screen', () => { await page.keyboard.type( 'Heading' ); await inlineQuickInserter - .getByRole( 'option', { name: 'Heading' } ) + .getByRole( 'option', { name: 'Heading', exact: true } ) .click(); await expect( From c9c8abb060922ca27b28b1cd1b0a6a2079a3aece Mon Sep 17 00:00:00 2001 From: Jorge Date: Wed, 8 Oct 2025 13:56:59 +0100 Subject: [PATCH 18/19] fix lint issue --- test/e2e/specs/editor/plugins/block-variations.spec.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/e2e/specs/editor/plugins/block-variations.spec.js b/test/e2e/specs/editor/plugins/block-variations.spec.js index 78c5d4b22b938c..c1d90f49a28c42 100644 --- a/test/e2e/specs/editor/plugins/block-variations.spec.js +++ b/test/e2e/specs/editor/plugins/block-variations.spec.js @@ -174,7 +174,9 @@ test.describe( 'Block variations', () => { .locator( 'role=button[name="Add default block"i]' ) .click(); await page.keyboard.type( '/Heading' ); - await page.getByRole( 'option', { name: 'Heading', exact: true } ).click(); + await page + .getByRole( 'option', { name: 'Heading', exact: true } ) + .click(); await page.keyboard.type( '/Success Message' ); await page.getByRole( 'option', { name: 'Success Message' } ).click(); @@ -210,7 +212,9 @@ test.describe( 'Block variations', () => { .locator( 'role=button[name="Add default block"i]' ) .click(); await page.keyboard.type( '/Heading' ); - await page.getByRole( 'option', { name: 'Heading', exact: true } ).click(); + await page + .getByRole( 'option', { name: 'Heading', exact: true } ) + .click(); await page.keyboard.type( '/Warning Message' ); await page.getByRole( 'option', { name: 'Warning Message' } ).click(); From 94a6927f63fce2240f8ae7c42bbc65f1855a6e62 Mon Sep 17 00:00:00 2001 From: Jorge Date: Wed, 8 Oct 2025 14:28:59 +0100 Subject: [PATCH 19/19] include backport information --- backport-changelog/6.9/10190.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 backport-changelog/6.9/10190.md diff --git a/backport-changelog/6.9/10190.md b/backport-changelog/6.9/10190.md new file mode 100644 index 00000000000000..248656d33cfabd --- /dev/null +++ b/backport-changelog/6.9/10190.md @@ -0,0 +1,3 @@ +https://github.com/WordPress/wordpress-develop/pull/10190 + +* https://github.com/WordPress/gutenberg/pull/71904