@wordpress/block-editor 15.10.1-next.79a2f3cdd.0 → 15.10.1-next.ba3aee3a2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/block-edit/context.cjs +5 -5
- package/build/components/block-edit/context.cjs.map +1 -1
- package/build/components/block-list/block.cjs +24 -12
- package/build/components/block-list/block.cjs.map +3 -3
- package/build/components/block-list/use-block-props/index.cjs +8 -2
- package/build/components/block-list/use-block-props/index.cjs.map +2 -2
- package/build/components/block-visibility/constants.cjs +49 -0
- package/build/components/block-visibility/constants.cjs.map +7 -0
- package/build/components/block-visibility/index.cjs +5 -2
- package/build/components/block-visibility/index.cjs.map +2 -2
- package/build/components/block-visibility/use-block-visibility.cjs +69 -0
- package/build/components/block-visibility/use-block-visibility.cjs.map +7 -0
- package/build/components/collab/block-comment-icon-slot.cjs +1 -1
- package/build/components/collab/block-comment-icon-slot.cjs.map +1 -1
- package/build/components/collab/block-comment-icon-toolbar-slot.cjs +1 -1
- package/build/components/collab/block-comment-icon-toolbar-slot.cjs.map +1 -1
- package/build/components/inspector-controls/groups.cjs +1 -1
- package/build/components/inspector-controls/groups.cjs.map +1 -1
- package/build/components/inspector-controls-tabs/content-tab.cjs +1 -1
- package/build/components/inspector-controls-tabs/content-tab.cjs.map +2 -2
- package/build/components/list-view/index.cjs +11 -6
- package/build/components/list-view/index.cjs.map +2 -2
- package/build/components/list-view/utils.cjs +24 -17
- package/build/components/list-view/utils.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/input-rules.cjs +13 -1
- package/build/components/rich-text/event-listeners/input-rules.cjs.map +2 -2
- package/build/components/rich-text/format-edit.cjs +1 -1
- package/build/components/rich-text/format-edit.cjs.map +1 -1
- package/build/components/rich-text/index.cjs +1 -1
- package/build/components/rich-text/index.cjs.map +1 -1
- package/build/components/writing-flow/utils.cjs +1 -1
- package/build/components/writing-flow/utils.cjs.map +1 -1
- package/build/hooks/block-fields/index.cjs +1 -1
- package/build/hooks/block-fields/index.cjs.map +2 -2
- package/build/hooks/fit-text.cjs +1 -1
- package/build/hooks/fit-text.cjs.map +1 -1
- package/build/store/private-keys.cjs +10 -10
- package/build/store/private-keys.cjs.map +1 -1
- package/build/store/utils.cjs +1 -1
- package/build/store/utils.cjs.map +1 -1
- package/build-module/components/block-edit/context.mjs +5 -5
- package/build-module/components/block-edit/context.mjs.map +1 -1
- package/build-module/components/block-list/block.mjs +24 -12
- package/build-module/components/block-list/block.mjs.map +3 -3
- package/build-module/components/block-list/use-block-props/index.mjs +8 -2
- package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
- package/build-module/components/block-visibility/constants.mjs +24 -0
- package/build-module/components/block-visibility/constants.mjs.map +7 -0
- package/build-module/components/block-visibility/index.mjs +3 -1
- package/build-module/components/block-visibility/index.mjs.map +2 -2
- package/build-module/components/block-visibility/use-block-visibility.mjs +44 -0
- package/build-module/components/block-visibility/use-block-visibility.mjs.map +7 -0
- package/build-module/components/collab/block-comment-icon-slot.mjs +1 -1
- package/build-module/components/collab/block-comment-icon-slot.mjs.map +1 -1
- package/build-module/components/collab/block-comment-icon-toolbar-slot.mjs +1 -1
- package/build-module/components/collab/block-comment-icon-toolbar-slot.mjs.map +1 -1
- package/build-module/components/inspector-controls/groups.mjs +1 -1
- package/build-module/components/inspector-controls/groups.mjs.map +1 -1
- package/build-module/components/inspector-controls-tabs/content-tab.mjs +1 -1
- package/build-module/components/inspector-controls-tabs/content-tab.mjs.map +2 -2
- package/build-module/components/list-view/index.mjs +11 -7
- package/build-module/components/list-view/index.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs +24 -17
- package/build-module/components/list-view/utils.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs +13 -1
- package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/format-edit.mjs +1 -1
- package/build-module/components/rich-text/format-edit.mjs.map +1 -1
- package/build-module/components/rich-text/index.mjs +1 -1
- package/build-module/components/rich-text/index.mjs.map +1 -1
- package/build-module/components/writing-flow/utils.mjs +1 -1
- package/build-module/components/writing-flow/utils.mjs.map +1 -1
- package/build-module/hooks/block-fields/index.mjs +1 -1
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/fit-text.mjs +1 -1
- package/build-module/hooks/fit-text.mjs.map +1 -1
- package/build-module/store/private-keys.mjs +10 -10
- package/build-module/store/private-keys.mjs.map +1 -1
- package/build-module/store/utils.mjs +1 -1
- package/build-module/store/utils.mjs.map +1 -1
- package/build-style/style-rtl.css +6 -1
- package/build-style/style.css +6 -1
- package/package.json +39 -39
- package/src/components/block-list/block.js +23 -9
- package/src/components/block-list/use-block-props/index.js +10 -2
- package/src/components/block-toolbar/style.scss +0 -1
- package/src/components/block-tools/style.scss +10 -0
- package/src/components/block-visibility/constants.js +29 -0
- package/src/components/block-visibility/index.js +1 -0
- package/src/components/block-visibility/test/use-block-visibility.js +360 -0
- package/src/components/block-visibility/use-block-visibility.js +73 -0
- package/src/components/inspector-controls-tabs/content-tab.js +0 -1
- package/src/components/list-view/index.js +15 -11
- package/src/components/list-view/utils.js +31 -23
- package/src/components/rich-text/event-listeners/input-rules.js +17 -0
- package/src/hooks/block-fields/index.js +0 -1
- package/src/hooks/fit-text.js +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/block-fields/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { DataForm } from '@wordpress/dataviews';\nimport { useContext, useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport BlockIcon from '../../components/block-icon';\nimport useBlockDisplayTitle from '../../components/block-title/use-block-display-title';\nimport useBlockDisplayInformation from '../../components/use-block-display-information';\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\nimport FieldsDropdownMenu from './fields-dropdown-menu';\nimport { PrivateBlockContext } from '../../components/block-list/private-block-context';\nimport { PrivateInspectorControlsFill } from '../../components/inspector-controls/fill';\n\n// controls\nimport RichText from './rich-text';\nimport Media from './media';\nimport Link from './link';\n\nconst CONTROLS = {\n\trichtext: RichText,\n\tmedia: Media,\n\tlink: Link,\n};\n\n/**\n * Creates a configured control component that wraps a custom control\n * and passes configuration as props.\n *\n * @param {Object} config - The control configuration\n * @param {string} config.control - The control type (key in CONTROLS map)\n * @return {Function} A wrapped control component\n */\nfunction createConfiguredControl( config ) {\n\tconst { control, ...controlConfig } = config;\n\tconst ControlComponent = CONTROLS[ control ];\n\n\tif ( ! ControlComponent ) {\n\t\tthrow new Error( `Control type \"${ control }\" not found` );\n\t}\n\n\treturn function ConfiguredControl( props ) {\n\t\treturn <ControlComponent { ...props } config={ controlConfig } />;\n\t};\n}\n\n/**\n * Normalize a media value to a canonical structure.\n * Only includes properties that are present in the field's mapping (if provided).\n *\n * @param {Object} value - The mapped value from the block attributes (with canonical keys)\n * @param {Object} fieldDef - Optional field definition containing the mapping\n * @return {Object} Normalized media value with canonical properties\n */\nfunction normalizeMediaValue( value, fieldDef ) {\n\tconst defaults = {\n\t\tid: null,\n\t\turl: '',\n\t\tcaption: '',\n\t\talt: '',\n\t\ttype: 'image',\n\t\tposter: '',\n\t\tfeaturedImage: false,\n\t\tlink: '',\n\t};\n\n\tconst result = {};\n\n\t// If there's a mapping, only include properties that are in it\n\tif ( fieldDef?.mapping ) {\n\t\tObject.keys( fieldDef.mapping ).forEach( ( key ) => {\n\t\t\tresult[ key ] = value?.[ key ] ?? defaults[ key ] ?? '';\n\t\t} );\n\t\treturn result;\n\t}\n\n\t// Without mapping, include all default properties\n\tObject.keys( defaults ).forEach( ( key ) => {\n\t\tresult[ key ] = value?.[ key ] ?? defaults[ key ];\n\t} );\n\treturn result;\n}\n\n/**\n * Denormalize a media value from canonical structure back to mapped keys.\n * Only includes properties that are present in the field's mapping.\n *\n * @param {Object} value - The normalized media value\n * @param {Object} fieldDef - The field definition containing the mapping\n * @return {Object} Value with only mapped properties\n */\nfunction denormalizeMediaValue( value, fieldDef ) {\n\tif ( ! fieldDef.mapping ) {\n\t\treturn value;\n\t}\n\n\tconst result = {};\n\tObject.entries( fieldDef.mapping ).forEach( ( [ key ] ) => {\n\t\tif ( key in value ) {\n\t\t\tresult[ key ] = value[ key ];\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Normalize a link value to a canonical structure.\n * Only includes properties that are present in the field's mapping (if provided).\n *\n * @param {Object} value - The mapped value from the block attributes (with canonical keys)\n * @param {Object} fieldDef - Optional field definition containing the mapping\n * @return {Object} Normalized link value with canonical properties\n */\nfunction normalizeLinkValue( value, fieldDef ) {\n\tconst defaults = {\n\t\turl: '',\n\t\trel: '',\n\t\tlinkTarget: '',\n\t\tdestination: '',\n\t};\n\n\tconst result = {};\n\n\t// If there's a mapping, only include properties that are in it\n\tif ( fieldDef?.mapping ) {\n\t\tObject.keys( fieldDef.mapping ).forEach( ( key ) => {\n\t\t\tresult[ key ] = value?.[ key ] ?? defaults[ key ] ?? '';\n\t\t} );\n\t\treturn result;\n\t}\n\n\t// Without mapping, include all default properties\n\tObject.keys( defaults ).forEach( ( key ) => {\n\t\tresult[ key ] = value?.[ key ] ?? defaults[ key ];\n\t} );\n\treturn result;\n}\n\n/**\n * Denormalize a link value from canonical structure back to mapped keys.\n * Only includes properties that are present in the field's mapping.\n *\n * @param {Object} value - The normalized link value\n * @param {Object} fieldDef - The field definition containing the mapping\n * @return {Object} Value with only mapped properties\n */\nfunction denormalizeLinkValue( value, fieldDef ) {\n\tif ( ! fieldDef.mapping ) {\n\t\treturn value;\n\t}\n\n\tconst result = {};\n\tObject.entries( fieldDef.mapping ).forEach( ( [ key ] ) => {\n\t\tif ( key in value ) {\n\t\t\tresult[ key ] = value[ key ];\n\t\t}\n\t} );\n\treturn result;\n}\n\nfunction BlockFields( { clientId, blockType, attributes, setAttributes } ) {\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\tconst blockTypeFields = blockType?.[ fieldsKey ];\n\n\tconst [ form, setForm ] = useState( () => {\n\t\treturn blockType?.[ formKey ];\n\t} );\n\n\t// Build DataForm fields with proper structure\n\tconst dataFormFields = useMemo( () => {\n\t\tif ( ! blockTypeFields?.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn blockTypeFields.map( ( fieldDef ) => {\n\t\t\tconst ControlComponent = CONTROLS[ fieldDef.type ];\n\n\t\t\tconst defaultValues = {};\n\t\t\tif ( fieldDef.mapping && blockType?.attributes ) {\n\t\t\t\tObject.entries( fieldDef.mapping ).forEach(\n\t\t\t\t\t( [ key, attrKey ] ) => {\n\t\t\t\t\t\tdefaultValues[ key ] =\n\t\t\t\t\t\t\tblockType.attributes[ attrKey ]?.defaultValue ??\n\t\t\t\t\t\t\tundefined;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst field = {\n\t\t\t\tid: fieldDef.id,\n\t\t\t\tlabel: fieldDef.label,\n\t\t\t\ttype: fieldDef.type, // Use the field's type; DataForm will use built-in or custom Edit\n\t\t\t\tconfig: { ...fieldDef.args, defaultValues },\n\t\t\t\thideLabelFromVision: fieldDef.id === 'content',\n\t\t\t\t// getValue and setValue handle the mapping to block attributes\n\t\t\t\tgetValue: ( { item } ) => {\n\t\t\t\t\tif ( fieldDef.mapping ) {\n\t\t\t\t\t\t// Extract mapped properties from the block attributes\n\t\t\t\t\t\tconst mappedValue = {};\n\t\t\t\t\t\tObject.entries( fieldDef.mapping ).forEach(\n\t\t\t\t\t\t\t( [ key, attrKey ] ) => {\n\t\t\t\t\t\t\t\tmappedValue[ key ] = item[ attrKey ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Normalize to canonical structure based on field type\n\t\t\t\t\t\tif ( fieldDef.type === 'media' ) {\n\t\t\t\t\t\t\treturn normalizeMediaValue( mappedValue, fieldDef );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( fieldDef.type === 'link' ) {\n\t\t\t\t\t\t\treturn normalizeLinkValue( mappedValue, fieldDef );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// For other types, return as-is\n\t\t\t\t\t\treturn mappedValue;\n\t\t\t\t\t}\n\t\t\t\t\t// For simple id-based fields, use the id as the attribute key\n\t\t\t\t\treturn item[ fieldDef.id ];\n\t\t\t\t},\n\t\t\t\tsetValue: ( { item, value } ) => {\n\t\t\t\t\tif ( fieldDef.mapping ) {\n\t\t\t\t\t\t// Denormalize from canonical structure back to mapped keys\n\t\t\t\t\t\tlet denormalizedValue = value;\n\t\t\t\t\t\tif ( fieldDef.type === 'media' ) {\n\t\t\t\t\t\t\tdenormalizedValue = denormalizeMediaValue(\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tfieldDef\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( fieldDef.type === 'link' ) {\n\t\t\t\t\t\t\tdenormalizedValue = denormalizeLinkValue(\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tfieldDef\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Build an object with all mapped attributes\n\t\t\t\t\t\tconst updates = {};\n\t\t\t\t\t\tObject.entries( fieldDef.mapping ).forEach(\n\t\t\t\t\t\t\t( [ key, attrKey ] ) => {\n\t\t\t\t\t\t\t\t// If key is explicitly in value, use it (even if undefined to allow clearing)\n\t\t\t\t\t\t\t\t// Otherwise, preserve the old value\n\t\t\t\t\t\t\t\tif ( key in denormalizedValue ) {\n\t\t\t\t\t\t\t\t\tupdates[ attrKey ] =\n\t\t\t\t\t\t\t\t\t\tdenormalizedValue[ key ];\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tupdates[ attrKey ] = item[ attrKey ];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn updates;\n\t\t\t\t\t}\n\t\t\t\t\t// For simple id-based fields, use the id as the attribute key\n\t\t\t\t\treturn { [ fieldDef.id ]: value };\n\t\t\t\t},\n\t\t\t};\n\n\t\t\t// Only add custom Edit component if one exists for this type\n\t\t\tif ( ControlComponent ) {\n\t\t\t\t// Use EditConfig pattern: Edit is an object with control type and config props\n\t\t\t\tfield.Edit = createConfiguredControl( {\n\t\t\t\t\tcontrol: fieldDef.type,\n\t\t\t\t\tclientId,\n\t\t\t\t\tfieldDef,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn field;\n\t\t} );\n\t}, [ blockTypeFields, blockType?.attributes, clientId ] );\n\n\tconst handleToggleField = ( fieldId ) => {\n\t\tsetForm( ( prev ) => {\n\t\t\tif ( prev.fields?.includes( fieldId ) ) {\n\t\t\t\treturn {\n\t\t\t\t\t...prev,\n\t\t\t\t\tfields: prev.fields.filter( ( id ) => id !== fieldId ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfields: [ ...( prev.fields || [] ), fieldId ],\n\t\t\t};\n\t\t} );\n\t};\n\n\tif ( ! blockTypeFields?.length ) {\n\t\t// TODO - we might still want to show a placeholder for blocks with no fields.\n\t\t// for example, a way to select the block.\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-block-fields__container\">\n\t\t\t<div className=\"block-editor-block-fields__header\">\n\t\t\t\t<HStack spacing={ 1 }>\n\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\tclassName=\"block-editor-block-fields__header-icon\"\n\t\t\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\t\t/>\n\t\t\t\t\t<Truncate\n\t\t\t\t\t\tclassName=\"block-editor-block-fields__header-title\"\n\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ blockTitle }\n\t\t\t\t\t</Truncate>\n\t\t\t\t\t<FieldsDropdownMenu\n\t\t\t\t\t\tfields={ dataFormFields }\n\t\t\t\t\t\tvisibleFields={ form.fields }\n\t\t\t\t\t\tonToggleField={ handleToggleField }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t</div>\n\t\t\t<DataForm\n\t\t\t\tdata={ attributes }\n\t\t\t\tfields={ dataFormFields }\n\t\t\t\tform={ form }\n\t\t\t\tonChange={ setAttributes }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nconst withBlockFields = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst {\n\t\t\tblockType,\n\t\t\tisSelectionWithinCurrentSection,\n\t\t\tisSectionBlock,\n\t\t\tblockEditingMode,\n\t\t\tisSelected,\n\t\t} = useContext( PrivateBlockContext );\n\n\t\tconst shouldShowBlockFields =\n\t\t\twindow?.__experimentalContentOnlyPatternInsertion &&\n\t\t\twindow?.__experimentalContentOnlyInspectorFields;\n\t\tconst blockTypeFields = blockType?.[ fieldsKey ];\n\n\t\tif ( ! shouldShowBlockFields || ! blockTypeFields?.length ) {\n\t\t\treturn <BlockEdit key=\"edit\" { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t\t{\n\t\t\t\t\t// Display the controls of all inner blocks for section/pattern editing.\n\t\t\t\t\tisSelectionWithinCurrentSection &&\n\t\t\t\t\t\t( isSectionBlock ||\n\t\t\t\t\t\t\tblockEditingMode === 'contentOnly' ) && (\n\t\t\t\t\t\t\t<PrivateInspectorControlsFill\n\t\t\t\t\t\t\t\tgroup=\"content\"\n\t\t\t\t\t\t\t\tforceDisplayControls\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BlockFields\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tblockType={ blockType }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PrivateInspectorControlsFill>\n\t\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\t{ ! isSelectionWithinCurrentSection && isSelected && (\n\t\t\t\t\t<PrivateInspectorControlsFill group=\"content\">\n\t\t\t\t\t\t<BlockFields { ...props } blockType={ blockType } />\n\t\t\t\t\t</PrivateInspectorControlsFill>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/content-only-controls/block-fields',\n\twithBlockFields\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,mBAA0B;AAC1B,oBAAiD;AACjD,wBAGO;AACP,qBAA2C;AAC3C,uBAAyB;AACzB,qBAA8C;AAK9C,yBAAuB;AACvB,wBAAsB;AACtB,qCAAiC;AACjC,2CAAuC;AAEvC,kCAA+B;AAC/B,mCAAoC;AACpC,kBAA6C;AAG7C,uBAAqB;AACrB,mBAAkB;AAClB,kBAAiB;AAyBR;AAjCT,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAA,WAAkB;AAUzD,IAAM,WAAW;AAAA,EAChB,UAAU,iBAAAC;AAAA,EACV,OAAO,aAAAC;AAAA,EACP,MAAM,YAAAC;AACP;AAUA,SAAS,wBAAyB,QAAS;AAC1C,QAAM,EAAE,SAAS,GAAG,cAAc,IAAI;AACtC,QAAM,mBAAmB,SAAU,OAAQ;AAE3C,MAAK,CAAE,kBAAmB;AACzB,UAAM,IAAI,MAAO,iBAAkB,OAAQ,aAAc;AAAA,EAC1D;AAEA,SAAO,SAAS,kBAAmB,OAAQ;AAC1C,WAAO,4CAAC,oBAAmB,GAAG,OAAQ,QAAS,eAAgB;AAAA,EAChE;AACD;AAUA,S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EpC,UAAM,wBACL,QAAQ
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { DataForm } from '@wordpress/dataviews';\nimport { useContext, useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport BlockIcon from '../../components/block-icon';\nimport useBlockDisplayTitle from '../../components/block-title/use-block-display-title';\nimport useBlockDisplayInformation from '../../components/use-block-display-information';\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\nimport FieldsDropdownMenu from './fields-dropdown-menu';\nimport { PrivateBlockContext } from '../../components/block-list/private-block-context';\nimport { PrivateInspectorControlsFill } from '../../components/inspector-controls/fill';\n\n// controls\nimport RichText from './rich-text';\nimport Media from './media';\nimport Link from './link';\n\nconst CONTROLS = {\n\trichtext: RichText,\n\tmedia: Media,\n\tlink: Link,\n};\n\n/**\n * Creates a configured control component that wraps a custom control\n * and passes configuration as props.\n *\n * @param {Object} config - The control configuration\n * @param {string} config.control - The control type (key in CONTROLS map)\n * @return {Function} A wrapped control component\n */\nfunction createConfiguredControl( config ) {\n\tconst { control, ...controlConfig } = config;\n\tconst ControlComponent = CONTROLS[ control ];\n\n\tif ( ! ControlComponent ) {\n\t\tthrow new Error( `Control type \"${ control }\" not found` );\n\t}\n\n\treturn function ConfiguredControl( props ) {\n\t\treturn <ControlComponent { ...props } config={ controlConfig } />;\n\t};\n}\n\n/**\n * Normalize a media value to a canonical structure.\n * Only includes properties that are present in the field's mapping (if provided).\n *\n * @param {Object} value - The mapped value from the block attributes (with canonical keys)\n * @param {Object} fieldDef - Optional field definition containing the mapping\n * @return {Object} Normalized media value with canonical properties\n */\nfunction normalizeMediaValue( value, fieldDef ) {\n\tconst defaults = {\n\t\tid: null,\n\t\turl: '',\n\t\tcaption: '',\n\t\talt: '',\n\t\ttype: 'image',\n\t\tposter: '',\n\t\tfeaturedImage: false,\n\t\tlink: '',\n\t};\n\n\tconst result = {};\n\n\t// If there's a mapping, only include properties that are in it\n\tif ( fieldDef?.mapping ) {\n\t\tObject.keys( fieldDef.mapping ).forEach( ( key ) => {\n\t\t\tresult[ key ] = value?.[ key ] ?? defaults[ key ] ?? '';\n\t\t} );\n\t\treturn result;\n\t}\n\n\t// Without mapping, include all default properties\n\tObject.keys( defaults ).forEach( ( key ) => {\n\t\tresult[ key ] = value?.[ key ] ?? defaults[ key ];\n\t} );\n\treturn result;\n}\n\n/**\n * Denormalize a media value from canonical structure back to mapped keys.\n * Only includes properties that are present in the field's mapping.\n *\n * @param {Object} value - The normalized media value\n * @param {Object} fieldDef - The field definition containing the mapping\n * @return {Object} Value with only mapped properties\n */\nfunction denormalizeMediaValue( value, fieldDef ) {\n\tif ( ! fieldDef.mapping ) {\n\t\treturn value;\n\t}\n\n\tconst result = {};\n\tObject.entries( fieldDef.mapping ).forEach( ( [ key ] ) => {\n\t\tif ( key in value ) {\n\t\t\tresult[ key ] = value[ key ];\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Normalize a link value to a canonical structure.\n * Only includes properties that are present in the field's mapping (if provided).\n *\n * @param {Object} value - The mapped value from the block attributes (with canonical keys)\n * @param {Object} fieldDef - Optional field definition containing the mapping\n * @return {Object} Normalized link value with canonical properties\n */\nfunction normalizeLinkValue( value, fieldDef ) {\n\tconst defaults = {\n\t\turl: '',\n\t\trel: '',\n\t\tlinkTarget: '',\n\t\tdestination: '',\n\t};\n\n\tconst result = {};\n\n\t// If there's a mapping, only include properties that are in it\n\tif ( fieldDef?.mapping ) {\n\t\tObject.keys( fieldDef.mapping ).forEach( ( key ) => {\n\t\t\tresult[ key ] = value?.[ key ] ?? defaults[ key ] ?? '';\n\t\t} );\n\t\treturn result;\n\t}\n\n\t// Without mapping, include all default properties\n\tObject.keys( defaults ).forEach( ( key ) => {\n\t\tresult[ key ] = value?.[ key ] ?? defaults[ key ];\n\t} );\n\treturn result;\n}\n\n/**\n * Denormalize a link value from canonical structure back to mapped keys.\n * Only includes properties that are present in the field's mapping.\n *\n * @param {Object} value - The normalized link value\n * @param {Object} fieldDef - The field definition containing the mapping\n * @return {Object} Value with only mapped properties\n */\nfunction denormalizeLinkValue( value, fieldDef ) {\n\tif ( ! fieldDef.mapping ) {\n\t\treturn value;\n\t}\n\n\tconst result = {};\n\tObject.entries( fieldDef.mapping ).forEach( ( [ key ] ) => {\n\t\tif ( key in value ) {\n\t\t\tresult[ key ] = value[ key ];\n\t\t}\n\t} );\n\treturn result;\n}\n\nfunction BlockFields( { clientId, blockType, attributes, setAttributes } ) {\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\tconst blockTypeFields = blockType?.[ fieldsKey ];\n\n\tconst [ form, setForm ] = useState( () => {\n\t\treturn blockType?.[ formKey ];\n\t} );\n\n\t// Build DataForm fields with proper structure\n\tconst dataFormFields = useMemo( () => {\n\t\tif ( ! blockTypeFields?.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn blockTypeFields.map( ( fieldDef ) => {\n\t\t\tconst ControlComponent = CONTROLS[ fieldDef.type ];\n\n\t\t\tconst defaultValues = {};\n\t\t\tif ( fieldDef.mapping && blockType?.attributes ) {\n\t\t\t\tObject.entries( fieldDef.mapping ).forEach(\n\t\t\t\t\t( [ key, attrKey ] ) => {\n\t\t\t\t\t\tdefaultValues[ key ] =\n\t\t\t\t\t\t\tblockType.attributes[ attrKey ]?.defaultValue ??\n\t\t\t\t\t\t\tundefined;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst field = {\n\t\t\t\tid: fieldDef.id,\n\t\t\t\tlabel: fieldDef.label,\n\t\t\t\ttype: fieldDef.type, // Use the field's type; DataForm will use built-in or custom Edit\n\t\t\t\tconfig: { ...fieldDef.args, defaultValues },\n\t\t\t\thideLabelFromVision: fieldDef.id === 'content',\n\t\t\t\t// getValue and setValue handle the mapping to block attributes\n\t\t\t\tgetValue: ( { item } ) => {\n\t\t\t\t\tif ( fieldDef.mapping ) {\n\t\t\t\t\t\t// Extract mapped properties from the block attributes\n\t\t\t\t\t\tconst mappedValue = {};\n\t\t\t\t\t\tObject.entries( fieldDef.mapping ).forEach(\n\t\t\t\t\t\t\t( [ key, attrKey ] ) => {\n\t\t\t\t\t\t\t\tmappedValue[ key ] = item[ attrKey ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Normalize to canonical structure based on field type\n\t\t\t\t\t\tif ( fieldDef.type === 'media' ) {\n\t\t\t\t\t\t\treturn normalizeMediaValue( mappedValue, fieldDef );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( fieldDef.type === 'link' ) {\n\t\t\t\t\t\t\treturn normalizeLinkValue( mappedValue, fieldDef );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// For other types, return as-is\n\t\t\t\t\t\treturn mappedValue;\n\t\t\t\t\t}\n\t\t\t\t\t// For simple id-based fields, use the id as the attribute key\n\t\t\t\t\treturn item[ fieldDef.id ];\n\t\t\t\t},\n\t\t\t\tsetValue: ( { item, value } ) => {\n\t\t\t\t\tif ( fieldDef.mapping ) {\n\t\t\t\t\t\t// Denormalize from canonical structure back to mapped keys\n\t\t\t\t\t\tlet denormalizedValue = value;\n\t\t\t\t\t\tif ( fieldDef.type === 'media' ) {\n\t\t\t\t\t\t\tdenormalizedValue = denormalizeMediaValue(\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tfieldDef\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( fieldDef.type === 'link' ) {\n\t\t\t\t\t\t\tdenormalizedValue = denormalizeLinkValue(\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tfieldDef\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Build an object with all mapped attributes\n\t\t\t\t\t\tconst updates = {};\n\t\t\t\t\t\tObject.entries( fieldDef.mapping ).forEach(\n\t\t\t\t\t\t\t( [ key, attrKey ] ) => {\n\t\t\t\t\t\t\t\t// If key is explicitly in value, use it (even if undefined to allow clearing)\n\t\t\t\t\t\t\t\t// Otherwise, preserve the old value\n\t\t\t\t\t\t\t\tif ( key in denormalizedValue ) {\n\t\t\t\t\t\t\t\t\tupdates[ attrKey ] =\n\t\t\t\t\t\t\t\t\t\tdenormalizedValue[ key ];\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tupdates[ attrKey ] = item[ attrKey ];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn updates;\n\t\t\t\t\t}\n\t\t\t\t\t// For simple id-based fields, use the id as the attribute key\n\t\t\t\t\treturn { [ fieldDef.id ]: value };\n\t\t\t\t},\n\t\t\t};\n\n\t\t\t// Only add custom Edit component if one exists for this type\n\t\t\tif ( ControlComponent ) {\n\t\t\t\t// Use EditConfig pattern: Edit is an object with control type and config props\n\t\t\t\tfield.Edit = createConfiguredControl( {\n\t\t\t\t\tcontrol: fieldDef.type,\n\t\t\t\t\tclientId,\n\t\t\t\t\tfieldDef,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn field;\n\t\t} );\n\t}, [ blockTypeFields, blockType?.attributes, clientId ] );\n\n\tconst handleToggleField = ( fieldId ) => {\n\t\tsetForm( ( prev ) => {\n\t\t\tif ( prev.fields?.includes( fieldId ) ) {\n\t\t\t\treturn {\n\t\t\t\t\t...prev,\n\t\t\t\t\tfields: prev.fields.filter( ( id ) => id !== fieldId ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfields: [ ...( prev.fields || [] ), fieldId ],\n\t\t\t};\n\t\t} );\n\t};\n\n\tif ( ! blockTypeFields?.length ) {\n\t\t// TODO - we might still want to show a placeholder for blocks with no fields.\n\t\t// for example, a way to select the block.\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-block-fields__container\">\n\t\t\t<div className=\"block-editor-block-fields__header\">\n\t\t\t\t<HStack spacing={ 1 }>\n\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\tclassName=\"block-editor-block-fields__header-icon\"\n\t\t\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\t\t/>\n\t\t\t\t\t<Truncate\n\t\t\t\t\t\tclassName=\"block-editor-block-fields__header-title\"\n\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ blockTitle }\n\t\t\t\t\t</Truncate>\n\t\t\t\t\t<FieldsDropdownMenu\n\t\t\t\t\t\tfields={ dataFormFields }\n\t\t\t\t\t\tvisibleFields={ form.fields }\n\t\t\t\t\t\tonToggleField={ handleToggleField }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t</div>\n\t\t\t<DataForm\n\t\t\t\tdata={ attributes }\n\t\t\t\tfields={ dataFormFields }\n\t\t\t\tform={ form }\n\t\t\t\tonChange={ setAttributes }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nconst withBlockFields = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst {\n\t\t\tblockType,\n\t\t\tisSelectionWithinCurrentSection,\n\t\t\tisSectionBlock,\n\t\t\tblockEditingMode,\n\t\t\tisSelected,\n\t\t} = useContext( PrivateBlockContext );\n\n\t\tconst shouldShowBlockFields =\n\t\t\twindow?.__experimentalContentOnlyInspectorFields;\n\t\tconst blockTypeFields = blockType?.[ fieldsKey ];\n\n\t\tif ( ! shouldShowBlockFields || ! blockTypeFields?.length ) {\n\t\t\treturn <BlockEdit key=\"edit\" { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t\t{\n\t\t\t\t\t// Display the controls of all inner blocks for section/pattern editing.\n\t\t\t\t\tisSelectionWithinCurrentSection &&\n\t\t\t\t\t\t( isSectionBlock ||\n\t\t\t\t\t\t\tblockEditingMode === 'contentOnly' ) && (\n\t\t\t\t\t\t\t<PrivateInspectorControlsFill\n\t\t\t\t\t\t\t\tgroup=\"content\"\n\t\t\t\t\t\t\t\tforceDisplayControls\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BlockFields\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tblockType={ blockType }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PrivateInspectorControlsFill>\n\t\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\t{ ! isSelectionWithinCurrentSection && isSelected && (\n\t\t\t\t\t<PrivateInspectorControlsFill group=\"content\">\n\t\t\t\t\t\t<BlockFields { ...props } blockType={ blockType } />\n\t\t\t\t\t</PrivateInspectorControlsFill>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/content-only-controls/block-fields',\n\twithBlockFields\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,mBAA0B;AAC1B,oBAAiD;AACjD,wBAGO;AACP,qBAA2C;AAC3C,uBAAyB;AACzB,qBAA8C;AAK9C,yBAAuB;AACvB,wBAAsB;AACtB,qCAAiC;AACjC,2CAAuC;AAEvC,kCAA+B;AAC/B,mCAAoC;AACpC,kBAA6C;AAG7C,uBAAqB;AACrB,mBAAkB;AAClB,kBAAiB;AAyBR;AAjCT,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAA,WAAkB;AAUzD,IAAM,WAAW;AAAA,EAChB,UAAU,iBAAAC;AAAA,EACV,OAAO,aAAAC;AAAA,EACP,MAAM,YAAAC;AACP;A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B;AAAA,OACD,GACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAO;AAAA,QACP,QAAS;AAAA,QACT;AAAA,QACA,UAAW;AAAA;AAAA,IACZ;AAAA,KACD;AAEF;AAEA,IAAM,sBAAkB;AAAA,EACvB,CAAE,cAAe,CAAE,UAAW;AAC7B,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,QAAI,2BAAY,gDAAoB;AAEpC,UAAM,wBACL,QAAQ;AACT,UAAM,kBAAkB,YAAa,SAAU;AAE/C,QAAK,CAAE,yBAAyB,CAAE,iBAAiB,QAAS;AAC3D,aAAO,4CAAC,aAAuB,GAAG,SAAZ,MAAoB;AAAA,IAC3C;AAEA,WACC,4EACC;AAAA,kDAAC,aAAuB,GAAG,SAAZ,MAAoB;AAAA;AAAA,MAGlC,oCACG,kBACD,qBAAqB,kBACrB;AAAA,QAAC;AAAA;AAAA,UACA,OAAM;AAAA,UACN,sBAAoB;AAAA,UAEpB;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACL;AAAA;AAAA,UACD;AAAA;AAAA,MACD;AAAA,MAGD,CAAE,mCAAmC,cACtC,4CAAC,4CAA6B,OAAM,WACnC,sDAAC,eAAc,GAAG,OAAQ,WAAwB,GACnD;AAAA,OAEF;AAAA,EAEF;AACD;AAAA,IAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
6
|
"names": ["blocksPrivateApis", "RichText", "Media", "Link", "useBlockDisplayTitle", "useBlockDisplayInformation", "HStack", "BlockIcon", "Truncate", "FieldsDropdownMenu"]
|
|
7
7
|
}
|
package/build/hooks/fit-text.cjs
CHANGED
|
@@ -49,7 +49,7 @@ var import_inspector_controls = __toESM(require("../components/inspector-control
|
|
|
49
49
|
var import_fit_text_size_warning = __toESM(require("../components/fit-text-size-warning/index.cjs"));
|
|
50
50
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
51
51
|
var EMPTY_OBJECT = {};
|
|
52
|
-
var MIN_FONT_SIZE_FOR_WARNING =
|
|
52
|
+
var MIN_FONT_SIZE_FOR_WARNING = 12;
|
|
53
53
|
var FIT_TEXT_SUPPORT_KEY = "typography.fitText";
|
|
54
54
|
function addAttributes(settings) {
|
|
55
55
|
if (!(0, import_blocks.hasBlockSupport)(settings, FIT_TEXT_SUPPORT_KEY)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/fit-text.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { useEffect, useCallback, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\nconst EMPTY_OBJECT = {};\nconst MIN_FONT_SIZE_FOR_WARNING = 6;\n\n/**\n * Internal dependencies\n */\nimport { optimizeFitText } from '../utils/fit-text-utils';\nimport { store as blockEditorStore } from '../store';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\nimport InspectorControls from '../components/inspector-controls';\nimport FitTextSizeWarning from '../components/fit-text-size-warning';\n\nexport const FIT_TEXT_SUPPORT_KEY = 'typography.fitText';\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `fitText` attribute.\n *\n * @param {Object} settings Original block settings.\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FIT_TEXT_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition.\n\tif ( settings.attributes?.fitText ) {\n\t\treturn settings;\n\t}\n\n\t// Add fitText attribute.\n\treturn {\n\t\t...settings,\n\t\tattributes: {\n\t\t\t...settings.attributes,\n\t\t\tfitText: {\n\t\t\t\ttype: 'boolean',\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * Custom hook to handle fit text functionality in the editor.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.fitText Fit text attribute.\n * @param {string} props.name Block name.\n * @param {string} props.clientId Block client ID.\n */\nfunction useFitText( { fitText, name, clientId } ) {\n\tconst [ fontSize, setFontSize ] = useState( null );\n\tconst hasFitTextSupport = hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY );\n\tconst blockElement = useBlockElement( clientId );\n\n\t// Monitor block attribute changes, and parent changes.\n\t// Any attribute or parent change may change the available space.\n\tconst { blockAttributes, parentId } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId || ! hasFitTextSupport || ! fitText ) {\n\t\t\t\treturn EMPTY_OBJECT;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tblockAttributes:\n\t\t\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId ),\n\t\t\t\tparentId:\n\t\t\t\t\tselect( blockEditorStore ).getBlockRootClientId( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, hasFitTextSupport, fitText ]\n\t);\n\n\tconst applyFitText = useCallback( () => {\n\t\tif ( ! blockElement || ! hasFitTextSupport || ! fitText ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Get or create style element with unique ID\n\t\tconst styleId = `fit-text-${ clientId }`;\n\t\tlet styleElement = blockElement.ownerDocument.getElementById( styleId );\n\t\tif ( ! styleElement ) {\n\t\t\tstyleElement = blockElement.ownerDocument.createElement( 'style' );\n\t\t\tstyleElement.id = styleId;\n\t\t\tblockElement.ownerDocument.head.appendChild( styleElement );\n\t\t}\n\n\t\tconst blockSelector = `#block-${ clientId }`;\n\n\t\tconst applyFontSizeStyle = ( size ) => {\n\t\t\tif ( size === 0 ) {\n\t\t\t\tstyleElement.textContent = '';\n\t\t\t} else {\n\t\t\t\tstyleElement.textContent = `${ blockSelector } { font-size: ${ size }px !important; }`;\n\t\t\t}\n\t\t};\n\n\t\tconst optimalSize = optimizeFitText( blockElement, applyFontSizeStyle );\n\t\tsetFontSize( optimalSize );\n\t}, [ blockElement, clientId, hasFitTextSupport, fitText ] );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! fitText ||\n\t\t\t! blockElement ||\n\t\t\t! clientId ||\n\t\t\t! hasFitTextSupport\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Store current element value for cleanup\n\t\tconst currentElement = blockElement;\n\t\tconst previousVisibility = currentElement.style.visibility;\n\n\t\t// Store IDs for cleanup\n\t\tlet hideFrameId = null;\n\t\tlet calculateFrameId = null;\n\t\tlet showTimeoutId = null;\n\n\t\t// We are hiding the element doing the calculation of fit text\n\t\t// and then showing it again to avoid the user noticing a flash of potentially\n\t\t// big fitText while the binary search is happening.\n\t\thideFrameId = window.requestAnimationFrame( () => {\n\t\t\tcurrentElement.style.visibility = 'hidden';\n\t\t\t// Wait for browser to render the hidden state\n\t\t\tcalculateFrameId = window.requestAnimationFrame( () => {\n\t\t\t\tapplyFitText();\n\n\t\t\t\t// Using a timeout instead of requestAnimationFrame, because\n\t\t\t\t// with requestAnimationFrame a flash of very high size\n\t\t\t\t// can still occur although rare.\n\t\t\t\tshowTimeoutId = setTimeout( () => {\n\t\t\t\t\tcurrentElement.style.visibility = previousVisibility;\n\t\t\t\t}, 10 );\n\t\t\t} );\n\t\t} );\n\n\t\t// Watch for size changes\n\t\tlet resizeObserver;\n\t\tif ( window.ResizeObserver && currentElement.parentElement ) {\n\t\t\tresizeObserver = new window.ResizeObserver( applyFitText );\n\t\t\tresizeObserver.observe( currentElement.parentElement );\n\t\t\tresizeObserver.observe( currentElement );\n\t\t}\n\n\t\t// Cleanup function\n\t\treturn () => {\n\t\t\t// Cancel pending async operations\n\t\t\tif ( hideFrameId !== null ) {\n\t\t\t\twindow.cancelAnimationFrame( hideFrameId );\n\t\t\t}\n\t\t\tif ( calculateFrameId !== null ) {\n\t\t\t\twindow.cancelAnimationFrame( calculateFrameId );\n\t\t\t}\n\t\t\tif ( showTimeoutId !== null ) {\n\t\t\t\tclearTimeout( showTimeoutId );\n\t\t\t}\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\n\t\t\tconst styleId = `fit-text-${ clientId }`;\n\t\t\tconst styleElement =\n\t\t\t\tcurrentElement.ownerDocument.getElementById( styleId );\n\t\t\tif ( styleElement ) {\n\t\t\t\tstyleElement.remove();\n\t\t\t}\n\t\t};\n\t}, [\n\t\tfitText,\n\t\tclientId,\n\t\tparentId,\n\t\tapplyFitText,\n\t\tblockElement,\n\t\thasFitTextSupport,\n\t] );\n\n\t// Trigger fit text recalculation when content changes\n\tuseEffect( () => {\n\t\tif ( fitText && blockElement && hasFitTextSupport ) {\n\t\t\t// Wait for next frame to ensure DOM has updated after content changes\n\t\t\tconst frameId = window.requestAnimationFrame( () => {\n\t\t\t\tif ( blockElement ) {\n\t\t\t\t\tapplyFitText();\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn () => window.cancelAnimationFrame( frameId );\n\t\t}\n\t}, [\n\t\tblockAttributes,\n\t\tfitText,\n\t\tapplyFitText,\n\t\tblockElement,\n\t\thasFitTextSupport,\n\t] );\n\n\treturn { fontSize };\n}\n\n/**\n * Fit text control component for the typography panel.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId Block client ID.\n * @param {Function} props.setAttributes Function to set block attributes.\n * @param {string} props.name Block name.\n * @param {boolean} props.fitText Whether fit text is enabled.\n * @param {string} props.fontSize Font size slug.\n * @param {Object} props.style Block style object.\n * @param {JSX.Element} props.warning Warning component to display.\n */\nexport function FitTextControl( {\n\tclientId,\n\tfitText = false,\n\tsetAttributes,\n\tname,\n\tfontSize,\n\tstyle,\n\twarning,\n} ) {\n\tif ( ! hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY ) ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<InspectorControls group=\"typography\">\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => fitText }\n\t\t\t\tlabel={ __( 'Fit text' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { fitText: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( { fitText: undefined } ) }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Fit text' ) }\n\t\t\t\t\tchecked={ fitText }\n\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\tconst newFitText = ! fitText || undefined;\n\t\t\t\t\t\tconst updates = { fitText: newFitText };\n\n\t\t\t\t\t\t// When enabling fit text, clear font size if it has a value\n\t\t\t\t\t\tif ( newFitText ) {\n\t\t\t\t\t\t\tif ( fontSize ) {\n\t\t\t\t\t\t\t\tupdates.fontSize = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( style?.typography?.fontSize ) {\n\t\t\t\t\t\t\t\tupdates.style = {\n\t\t\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\t\t\t\t...style?.typography,\n\t\t\t\t\t\t\t\t\t\tfontSize: undefined,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsetAttributes( updates );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={\n\t\t\t\t\t\tfitText\n\t\t\t\t\t\t\t? __( 'Text will resize to fit its container.' )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'The text will resize to fit its container, resetting other font size settings.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ warning }\n\t\t\t</ToolsPanelItem>\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Override props applied to the block element on save.\n *\n * @param {Object} props Additional props applied to the block element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @return {Object} Filtered props applied to the block element.\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FIT_TEXT_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tconst { fitText } = attributes;\n\n\tif ( ! fitText ) {\n\t\treturn props;\n\t}\n\n\t// Add CSS class for frontend detection and styling\n\tconst className = props.className\n\t\t? `${ props.className } has-fit-text`\n\t\t: 'has-fit-text';\n\n\treturn {\n\t\t...props,\n\t\tclassName,\n\t};\n}\n\n/**\n * Override props applied to the block element in the editor.\n *\n * @param {Object} props Component props including block attributes.\n * @param {string} props.name Block name.\n * @param {boolean} props.fitText Whether fit text is enabled.\n * @return {Object} Filtered props applied to the block element.\n */\nfunction useBlockProps( { name, fitText } ) {\n\tif ( fitText && hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY ) ) {\n\t\treturn {\n\t\t\tclassName: 'has-fit-text',\n\t\t};\n\t}\n\treturn {};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/fit-text/addAttribute',\n\taddAttributes\n);\n\nconst hasFitTextSupport = ( blockNameOrType ) => {\n\treturn hasBlockSupport( blockNameOrType, FIT_TEXT_SUPPORT_KEY );\n};\n\n/*\n * Helper to encapsulate calls to the relatively expensive `useFitText` hook.\n * Used in `addFitTextControl` so that the hook is only called when a block's\n * `fitText` attribute is set.\n */\nfunction WithFitTextFontSize( { fitText, name, clientId, children } ) {\n\tconst { fontSize } = useFitText( { fitText, name, clientId } );\n\treturn children( fontSize );\n}\n\n/*\n * Fit-text requires that layout calculations be done even when a block is not\n * currently selected. Therefore, the regular hooking approach using an\n * exported `edit` method is not enough, and we must use this HoC with the\n * `editor.BlockEdit` filter.\n */\nconst addFitTextControl = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn ( props ) => {\n\t\tconst { name, attributes, clientId, isSelected, setAttributes } = props;\n\t\tconst { fitText } = attributes;\n\t\tconst supportsFitText = hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY );\n\t\tif ( ! supportsFitText ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ fitText && (\n\t\t\t\t\t<WithFitTextFontSize\n\t\t\t\t\t\tfitText={ fitText }\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( fontSize ) =>\n\t\t\t\t\t\t\tisSelected && (\n\t\t\t\t\t\t\t\t<FitTextControl\n\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\tfitText={ fitText }\n\t\t\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\t\tfontSize={ attributes.fontSize }\n\t\t\t\t\t\t\t\t\tstyle={ attributes.style }\n\t\t\t\t\t\t\t\t\twarning={\n\t\t\t\t\t\t\t\t\t\tfontSize <\n\t\t\t\t\t\t\t\t\t\t\tMIN_FONT_SIZE_FOR_WARNING && (\n\t\t\t\t\t\t\t\t\t\t\t<FitTextSizeWarning />\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t</WithFitTextFontSize>\n\t\t\t\t) }\n\t\t\t\t{ ! fitText && isSelected && (\n\t\t\t\t\t<FitTextControl\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tfitText={ fitText }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tfontSize={ attributes.fontSize }\n\t\t\t\t\t\tstyle={ attributes.style }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n}, 'addFitTextControl' );\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/fit-text/add-fit-text-control',\n\taddFitTextControl\n);\n\nexport default {\n\tuseBlockProps,\n\taddSaveProps,\n\tattributeKeys: [ 'fitText', 'fontSize', 'style' ],\n\thasSupport: hasFitTextSupport,\n\tedit: () => null,\n};\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { useEffect, useCallback, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\nconst EMPTY_OBJECT = {};\nconst MIN_FONT_SIZE_FOR_WARNING = 12;\n\n/**\n * Internal dependencies\n */\nimport { optimizeFitText } from '../utils/fit-text-utils';\nimport { store as blockEditorStore } from '../store';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\nimport InspectorControls from '../components/inspector-controls';\nimport FitTextSizeWarning from '../components/fit-text-size-warning';\n\nexport const FIT_TEXT_SUPPORT_KEY = 'typography.fitText';\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `fitText` attribute.\n *\n * @param {Object} settings Original block settings.\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FIT_TEXT_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition.\n\tif ( settings.attributes?.fitText ) {\n\t\treturn settings;\n\t}\n\n\t// Add fitText attribute.\n\treturn {\n\t\t...settings,\n\t\tattributes: {\n\t\t\t...settings.attributes,\n\t\t\tfitText: {\n\t\t\t\ttype: 'boolean',\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * Custom hook to handle fit text functionality in the editor.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.fitText Fit text attribute.\n * @param {string} props.name Block name.\n * @param {string} props.clientId Block client ID.\n */\nfunction useFitText( { fitText, name, clientId } ) {\n\tconst [ fontSize, setFontSize ] = useState( null );\n\tconst hasFitTextSupport = hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY );\n\tconst blockElement = useBlockElement( clientId );\n\n\t// Monitor block attribute changes, and parent changes.\n\t// Any attribute or parent change may change the available space.\n\tconst { blockAttributes, parentId } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId || ! hasFitTextSupport || ! fitText ) {\n\t\t\t\treturn EMPTY_OBJECT;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tblockAttributes:\n\t\t\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId ),\n\t\t\t\tparentId:\n\t\t\t\t\tselect( blockEditorStore ).getBlockRootClientId( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, hasFitTextSupport, fitText ]\n\t);\n\n\tconst applyFitText = useCallback( () => {\n\t\tif ( ! blockElement || ! hasFitTextSupport || ! fitText ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Get or create style element with unique ID\n\t\tconst styleId = `fit-text-${ clientId }`;\n\t\tlet styleElement = blockElement.ownerDocument.getElementById( styleId );\n\t\tif ( ! styleElement ) {\n\t\t\tstyleElement = blockElement.ownerDocument.createElement( 'style' );\n\t\t\tstyleElement.id = styleId;\n\t\t\tblockElement.ownerDocument.head.appendChild( styleElement );\n\t\t}\n\n\t\tconst blockSelector = `#block-${ clientId }`;\n\n\t\tconst applyFontSizeStyle = ( size ) => {\n\t\t\tif ( size === 0 ) {\n\t\t\t\tstyleElement.textContent = '';\n\t\t\t} else {\n\t\t\t\tstyleElement.textContent = `${ blockSelector } { font-size: ${ size }px !important; }`;\n\t\t\t}\n\t\t};\n\n\t\tconst optimalSize = optimizeFitText( blockElement, applyFontSizeStyle );\n\t\tsetFontSize( optimalSize );\n\t}, [ blockElement, clientId, hasFitTextSupport, fitText ] );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! fitText ||\n\t\t\t! blockElement ||\n\t\t\t! clientId ||\n\t\t\t! hasFitTextSupport\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Store current element value for cleanup\n\t\tconst currentElement = blockElement;\n\t\tconst previousVisibility = currentElement.style.visibility;\n\n\t\t// Store IDs for cleanup\n\t\tlet hideFrameId = null;\n\t\tlet calculateFrameId = null;\n\t\tlet showTimeoutId = null;\n\n\t\t// We are hiding the element doing the calculation of fit text\n\t\t// and then showing it again to avoid the user noticing a flash of potentially\n\t\t// big fitText while the binary search is happening.\n\t\thideFrameId = window.requestAnimationFrame( () => {\n\t\t\tcurrentElement.style.visibility = 'hidden';\n\t\t\t// Wait for browser to render the hidden state\n\t\t\tcalculateFrameId = window.requestAnimationFrame( () => {\n\t\t\t\tapplyFitText();\n\n\t\t\t\t// Using a timeout instead of requestAnimationFrame, because\n\t\t\t\t// with requestAnimationFrame a flash of very high size\n\t\t\t\t// can still occur although rare.\n\t\t\t\tshowTimeoutId = setTimeout( () => {\n\t\t\t\t\tcurrentElement.style.visibility = previousVisibility;\n\t\t\t\t}, 10 );\n\t\t\t} );\n\t\t} );\n\n\t\t// Watch for size changes\n\t\tlet resizeObserver;\n\t\tif ( window.ResizeObserver && currentElement.parentElement ) {\n\t\t\tresizeObserver = new window.ResizeObserver( applyFitText );\n\t\t\tresizeObserver.observe( currentElement.parentElement );\n\t\t\tresizeObserver.observe( currentElement );\n\t\t}\n\n\t\t// Cleanup function\n\t\treturn () => {\n\t\t\t// Cancel pending async operations\n\t\t\tif ( hideFrameId !== null ) {\n\t\t\t\twindow.cancelAnimationFrame( hideFrameId );\n\t\t\t}\n\t\t\tif ( calculateFrameId !== null ) {\n\t\t\t\twindow.cancelAnimationFrame( calculateFrameId );\n\t\t\t}\n\t\t\tif ( showTimeoutId !== null ) {\n\t\t\t\tclearTimeout( showTimeoutId );\n\t\t\t}\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\n\t\t\tconst styleId = `fit-text-${ clientId }`;\n\t\t\tconst styleElement =\n\t\t\t\tcurrentElement.ownerDocument.getElementById( styleId );\n\t\t\tif ( styleElement ) {\n\t\t\t\tstyleElement.remove();\n\t\t\t}\n\t\t};\n\t}, [\n\t\tfitText,\n\t\tclientId,\n\t\tparentId,\n\t\tapplyFitText,\n\t\tblockElement,\n\t\thasFitTextSupport,\n\t] );\n\n\t// Trigger fit text recalculation when content changes\n\tuseEffect( () => {\n\t\tif ( fitText && blockElement && hasFitTextSupport ) {\n\t\t\t// Wait for next frame to ensure DOM has updated after content changes\n\t\t\tconst frameId = window.requestAnimationFrame( () => {\n\t\t\t\tif ( blockElement ) {\n\t\t\t\t\tapplyFitText();\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn () => window.cancelAnimationFrame( frameId );\n\t\t}\n\t}, [\n\t\tblockAttributes,\n\t\tfitText,\n\t\tapplyFitText,\n\t\tblockElement,\n\t\thasFitTextSupport,\n\t] );\n\n\treturn { fontSize };\n}\n\n/**\n * Fit text control component for the typography panel.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId Block client ID.\n * @param {Function} props.setAttributes Function to set block attributes.\n * @param {string} props.name Block name.\n * @param {boolean} props.fitText Whether fit text is enabled.\n * @param {string} props.fontSize Font size slug.\n * @param {Object} props.style Block style object.\n * @param {JSX.Element} props.warning Warning component to display.\n */\nexport function FitTextControl( {\n\tclientId,\n\tfitText = false,\n\tsetAttributes,\n\tname,\n\tfontSize,\n\tstyle,\n\twarning,\n} ) {\n\tif ( ! hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY ) ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<InspectorControls group=\"typography\">\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => fitText }\n\t\t\t\tlabel={ __( 'Fit text' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { fitText: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( { fitText: undefined } ) }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Fit text' ) }\n\t\t\t\t\tchecked={ fitText }\n\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\tconst newFitText = ! fitText || undefined;\n\t\t\t\t\t\tconst updates = { fitText: newFitText };\n\n\t\t\t\t\t\t// When enabling fit text, clear font size if it has a value\n\t\t\t\t\t\tif ( newFitText ) {\n\t\t\t\t\t\t\tif ( fontSize ) {\n\t\t\t\t\t\t\t\tupdates.fontSize = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( style?.typography?.fontSize ) {\n\t\t\t\t\t\t\t\tupdates.style = {\n\t\t\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\t\t\t\t...style?.typography,\n\t\t\t\t\t\t\t\t\t\tfontSize: undefined,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsetAttributes( updates );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={\n\t\t\t\t\t\tfitText\n\t\t\t\t\t\t\t? __( 'Text will resize to fit its container.' )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'The text will resize to fit its container, resetting other font size settings.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ warning }\n\t\t\t</ToolsPanelItem>\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Override props applied to the block element on save.\n *\n * @param {Object} props Additional props applied to the block element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @return {Object} Filtered props applied to the block element.\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FIT_TEXT_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tconst { fitText } = attributes;\n\n\tif ( ! fitText ) {\n\t\treturn props;\n\t}\n\n\t// Add CSS class for frontend detection and styling\n\tconst className = props.className\n\t\t? `${ props.className } has-fit-text`\n\t\t: 'has-fit-text';\n\n\treturn {\n\t\t...props,\n\t\tclassName,\n\t};\n}\n\n/**\n * Override props applied to the block element in the editor.\n *\n * @param {Object} props Component props including block attributes.\n * @param {string} props.name Block name.\n * @param {boolean} props.fitText Whether fit text is enabled.\n * @return {Object} Filtered props applied to the block element.\n */\nfunction useBlockProps( { name, fitText } ) {\n\tif ( fitText && hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY ) ) {\n\t\treturn {\n\t\t\tclassName: 'has-fit-text',\n\t\t};\n\t}\n\treturn {};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/fit-text/addAttribute',\n\taddAttributes\n);\n\nconst hasFitTextSupport = ( blockNameOrType ) => {\n\treturn hasBlockSupport( blockNameOrType, FIT_TEXT_SUPPORT_KEY );\n};\n\n/*\n * Helper to encapsulate calls to the relatively expensive `useFitText` hook.\n * Used in `addFitTextControl` so that the hook is only called when a block's\n * `fitText` attribute is set.\n */\nfunction WithFitTextFontSize( { fitText, name, clientId, children } ) {\n\tconst { fontSize } = useFitText( { fitText, name, clientId } );\n\treturn children( fontSize );\n}\n\n/*\n * Fit-text requires that layout calculations be done even when a block is not\n * currently selected. Therefore, the regular hooking approach using an\n * exported `edit` method is not enough, and we must use this HoC with the\n * `editor.BlockEdit` filter.\n */\nconst addFitTextControl = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn ( props ) => {\n\t\tconst { name, attributes, clientId, isSelected, setAttributes } = props;\n\t\tconst { fitText } = attributes;\n\t\tconst supportsFitText = hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY );\n\t\tif ( ! supportsFitText ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ fitText && (\n\t\t\t\t\t<WithFitTextFontSize\n\t\t\t\t\t\tfitText={ fitText }\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( fontSize ) =>\n\t\t\t\t\t\t\tisSelected && (\n\t\t\t\t\t\t\t\t<FitTextControl\n\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\tfitText={ fitText }\n\t\t\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\t\tfontSize={ attributes.fontSize }\n\t\t\t\t\t\t\t\t\tstyle={ attributes.style }\n\t\t\t\t\t\t\t\t\twarning={\n\t\t\t\t\t\t\t\t\t\tfontSize <\n\t\t\t\t\t\t\t\t\t\t\tMIN_FONT_SIZE_FOR_WARNING && (\n\t\t\t\t\t\t\t\t\t\t\t<FitTextSizeWarning />\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t</WithFitTextFontSize>\n\t\t\t\t) }\n\t\t\t\t{ ! fitText && isSelected && (\n\t\t\t\t\t<FitTextControl\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tfitText={ fitText }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tfontSize={ attributes.fontSize }\n\t\t\t\t\t\tstyle={ attributes.style }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n}, 'addFitTextControl' );\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/fit-text/add-fit-text-control',\n\taddFitTextControl\n);\n\nexport default {\n\tuseBlockProps,\n\taddSaveProps,\n\tattributeKeys: [ 'fitText', 'fontSize', 'style' ],\n\thasSupport: hasFitTextSupport,\n\tedit: () => null,\n};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;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;AAC3B;AAQA,IAAM,wBAAoB,2CAA4B,CAAE,cAAe;AACtE,SAAO,CAAE,UAAW;AACnB,UAAM,EAAE,MAAM,YAAY,UAAU,YAAY,cAAc,IAAI;AAClE,UAAM,EAAE,QAAQ,IAAI;AACpB,UAAM,sBAAkB,+BAAiB,MAAM,oBAAqB;AACpE,QAAK,CAAE,iBAAkB;AACxB,aAAO,4CAAC,aAAY,GAAG,OAAQ;AAAA,IAChC;AACA,WACC,4EACC;AAAA,kDAAC,aAAY,GAAG,OAAQ;AAAA,MACtB,WACD;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UAEE,WAAE,aACH,cACC;AAAA,YAAC;AAAA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA,UAAW,WAAW;AAAA,cACtB,OAAQ,WAAW;AAAA,cACnB,SACC,WACC,6BACA,4CAAC,6BAAAC,SAAA,EAAmB;AAAA;AAAA,UAGvB;AAAA;AAAA,MAGH;AAAA,MAEC,CAAE,WAAW,cACd;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,UAAW,WAAW;AAAA,UACtB,OAAQ,WAAW;AAAA;AAAA,MACpB;AAAA,OAEF;AAAA,EAEF;AACD,GAAG,mBAAoB;AAAA,IAEvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAO,mBAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA,eAAe,CAAE,WAAW,YAAY,OAAQ;AAAA,EAChD,YAAY;AAAA,EACZ,MAAM,MAAM;AACb;",
|
|
6
6
|
"names": ["hasFitTextSupport", "blockEditorStore", "InspectorControls", "ToolsPanelItem", "FitTextSizeWarning"]
|
|
7
7
|
}
|
|
@@ -32,16 +32,16 @@ __export(private_keys_exports, {
|
|
|
32
32
|
selectBlockPatternsKey: () => selectBlockPatternsKey
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(private_keys_exports);
|
|
35
|
-
var globalStylesDataKey = Symbol("globalStylesDataKey");
|
|
36
|
-
var globalStylesLinksDataKey = Symbol("globalStylesLinks");
|
|
37
|
-
var selectBlockPatternsKey = Symbol("selectBlockPatternsKey");
|
|
38
|
-
var reusableBlocksSelectKey = Symbol("reusableBlocksSelect");
|
|
39
|
-
var sectionRootClientIdKey = Symbol("sectionRootClientIdKey");
|
|
40
|
-
var mediaEditKey = Symbol("mediaEditKey");
|
|
41
|
-
var getMediaSelectKey = Symbol("getMediaSelect");
|
|
42
|
-
var essentialFormatKey = Symbol("essentialFormat");
|
|
43
|
-
var isIsolatedEditorKey = Symbol("isIsolatedEditor");
|
|
44
|
-
var deviceTypeKey = Symbol("deviceTypeKey");
|
|
35
|
+
var globalStylesDataKey = /* @__PURE__ */ Symbol("globalStylesDataKey");
|
|
36
|
+
var globalStylesLinksDataKey = /* @__PURE__ */ Symbol("globalStylesLinks");
|
|
37
|
+
var selectBlockPatternsKey = /* @__PURE__ */ Symbol("selectBlockPatternsKey");
|
|
38
|
+
var reusableBlocksSelectKey = /* @__PURE__ */ Symbol("reusableBlocksSelect");
|
|
39
|
+
var sectionRootClientIdKey = /* @__PURE__ */ Symbol("sectionRootClientIdKey");
|
|
40
|
+
var mediaEditKey = /* @__PURE__ */ Symbol("mediaEditKey");
|
|
41
|
+
var getMediaSelectKey = /* @__PURE__ */ Symbol("getMediaSelect");
|
|
42
|
+
var essentialFormatKey = /* @__PURE__ */ Symbol("essentialFormat");
|
|
43
|
+
var isIsolatedEditorKey = /* @__PURE__ */ Symbol("isIsolatedEditor");
|
|
44
|
+
var deviceTypeKey = /* @__PURE__ */ Symbol("deviceTypeKey");
|
|
45
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
46
|
0 && (module.exports = {
|
|
47
47
|
deviceTypeKey,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/private-keys.js"],
|
|
4
4
|
"sourcesContent": ["export const globalStylesDataKey = Symbol( 'globalStylesDataKey' );\nexport const globalStylesLinksDataKey = Symbol( 'globalStylesLinks' );\nexport const selectBlockPatternsKey = Symbol( 'selectBlockPatternsKey' );\nexport const reusableBlocksSelectKey = Symbol( 'reusableBlocksSelect' );\nexport const sectionRootClientIdKey = Symbol( 'sectionRootClientIdKey' );\nexport const mediaEditKey = Symbol( 'mediaEditKey' );\nexport const getMediaSelectKey = Symbol( 'getMediaSelect' );\nexport const essentialFormatKey = Symbol( 'essentialFormat' );\nexport const isIsolatedEditorKey = Symbol( 'isIsolatedEditor' );\nexport const deviceTypeKey = Symbol( 'deviceTypeKey' );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,sBAAsB,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,sBAAsB,uBAAQ,qBAAsB;AAC1D,IAAM,2BAA2B,uBAAQ,mBAAoB;AAC7D,IAAM,yBAAyB,uBAAQ,wBAAyB;AAChE,IAAM,0BAA0B,uBAAQ,sBAAuB;AAC/D,IAAM,yBAAyB,uBAAQ,wBAAyB;AAChE,IAAM,eAAe,uBAAQ,cAAe;AAC5C,IAAM,oBAAoB,uBAAQ,gBAAiB;AACnD,IAAM,qBAAqB,uBAAQ,iBAAkB;AACrD,IAAM,sBAAsB,uBAAQ,kBAAmB;AACvD,IAAM,gBAAgB,uBAAQ,eAAgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/store/utils.cjs
CHANGED
|
@@ -38,7 +38,7 @@ var import_constants = require("./constants.cjs");
|
|
|
38
38
|
var import_private_selectors = require("./private-selectors.cjs");
|
|
39
39
|
var import_selectors = require("./selectors.cjs");
|
|
40
40
|
var import_utils = require("../components/inserter/block-patterns-tab/utils.cjs");
|
|
41
|
-
var isFiltered = Symbol("isFiltered");
|
|
41
|
+
var isFiltered = /* @__PURE__ */ Symbol("isFiltered");
|
|
42
42
|
var parsedPatternCache = /* @__PURE__ */ new WeakMap();
|
|
43
43
|
var grammarMapCache = /* @__PURE__ */ new WeakMap();
|
|
44
44
|
function mapUserPattern(userPattern, __experimentalUserPatternCategories = []) {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/utils.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\nimport { parse as grammarParse } from '@wordpress/block-serialization-default-parser';\n\n/**\n * Internal dependencies\n */\nimport { selectBlockPatternsKey } from './private-keys';\nimport { unlock } from '../lock-unlock';\nimport { STORE_NAME } from './constants';\nimport { getSectionRootClientId, isSectionBlock } from './private-selectors';\nimport { getBlockEditingMode } from './selectors';\nimport { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';\n\nexport const isFiltered = Symbol( 'isFiltered' );\nconst parsedPatternCache = new WeakMap();\nconst grammarMapCache = new WeakMap();\n\nexport function mapUserPattern(\n\tuserPattern,\n\t__experimentalUserPatternCategories = []\n) {\n\treturn {\n\t\tname: `core/block/${ userPattern.id }`,\n\t\tid: userPattern.id,\n\t\ttype: INSERTER_PATTERN_TYPES.user,\n\t\ttitle: userPattern.title?.raw,\n\t\tcategories: userPattern.wp_pattern_category?.map( ( catId ) => {\n\t\t\tconst category = __experimentalUserPatternCategories.find(\n\t\t\t\t( { id } ) => id === catId\n\t\t\t);\n\t\t\treturn category ? category.slug : catId;\n\t\t} ),\n\t\tcontent: userPattern.content?.raw,\n\t\tsyncStatus: userPattern.wp_pattern_sync_status,\n\t};\n}\n\nfunction parsePattern( pattern ) {\n\tconst blocks = parse( pattern.content, {\n\t\t__unstableSkipMigrationLogs: true,\n\t} );\n\tif ( blocks.length === 1 ) {\n\t\tblocks[ 0 ].attributes = {\n\t\t\t...blocks[ 0 ].attributes,\n\t\t\tmetadata: {\n\t\t\t\t...( blocks[ 0 ].attributes.metadata || {} ),\n\t\t\t\tcategories: pattern.categories,\n\t\t\t\tpatternName: pattern.name,\n\t\t\t\tname: blocks[ 0 ].attributes.metadata?.name || pattern.title,\n\t\t\t},\n\t\t};\n\t}\n\treturn {\n\t\t...pattern,\n\t\tblocks,\n\t};\n}\n\nexport function getParsedPattern( pattern ) {\n\tlet parsedPattern = parsedPatternCache.get( pattern );\n\tif ( ! parsedPattern ) {\n\t\tparsedPattern = parsePattern( pattern );\n\t\tparsedPatternCache.set( pattern, parsedPattern );\n\t}\n\treturn parsedPattern;\n}\n\nexport function getGrammar( pattern ) {\n\tlet grammarMap = grammarMapCache.get( pattern );\n\tif ( ! grammarMap ) {\n\t\tgrammarMap = grammarParse( pattern.content );\n\t\t// Block names are null only at the top level for whitespace.\n\t\tgrammarMap = grammarMap.filter( ( block ) => block.blockName !== null );\n\t\tgrammarMapCache.set( pattern, grammarMap );\n\t}\n\treturn grammarMap;\n}\n\nexport const checkAllowList = ( list, item, defaultResult = null ) => {\n\tif ( typeof list === 'boolean' ) {\n\t\treturn list;\n\t}\n\tif ( Array.isArray( list ) ) {\n\t\t// TODO: when there is a canonical way to detect that we are editing a post\n\t\t// the following check should be changed to something like:\n\t\t// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )\n\t\tif ( list.includes( 'core/post-content' ) && item === null ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn list.includes( item );\n\t}\n\treturn defaultResult;\n};\n\nexport const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {\n\tif ( typeof allowedBlockTypes === 'boolean' ) {\n\t\treturn allowedBlockTypes;\n\t}\n\n\tconst blocksQueue = [ ...blocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\n\t\tconst isAllowed = checkAllowList(\n\t\t\tallowedBlockTypes,\n\t\t\tblock.name || block.blockName,\n\t\t\ttrue\n\t\t);\n\t\tif ( ! isAllowed ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\n\treturn true;\n};\n\nexport const getAllPatternsDependants = ( select ) => ( state ) => {\n\treturn [\n\t\tstate.settings.__experimentalBlockPatterns,\n\t\tstate.settings.__experimentalUserPatternCategories,\n\t\tstate.settings.__experimentalReusableBlocks,\n\t\tstate.settings[ selectBlockPatternsKey ]?.( select ),\n\t\tstate.blockPatterns,\n\t\tunlock( select( STORE_NAME ) ).getReusableBlocks(),\n\t];\n};\n\nexport const getInsertBlockTypeDependants = () => ( state, rootClientId ) => {\n\treturn [\n\t\tstate.blockListSettings[ rootClientId ],\n\t\tstate.blocks.byClientId.get( rootClientId ),\n\t\tstate.settings.allowedBlockTypes,\n\t\tstate.settings.templateLock,\n\t\tgetBlockEditingMode( state, rootClientId ),\n\t\tgetSectionRootClientId( state ),\n\t\tisSectionBlock( state, rootClientId ),\n\t];\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAsB;AACtB,gDAAsC;AAKtC,0BAAuC;AACvC,yBAAuB;AACvB,uBAA2B;AAC3B,+BAAuD;AACvD,uBAAoC;AACpC,mBAAuC;AAEhC,IAAM,aAAa,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAsB;AACtB,gDAAsC;AAKtC,0BAAuC;AACvC,yBAAuB;AACvB,uBAA2B;AAC3B,+BAAuD;AACvD,uBAAoC;AACpC,mBAAuC;AAEhC,IAAM,aAAa,uBAAQ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YAAa;AAAA,IACtC,MAAM,OAAO,WAAW,IAAK,YAAa;AAAA,IAC1C,MAAM,SAAS;AAAA,IACf,MAAM,SAAS;AAAA,QACf,sCAAqB,OAAO,YAAa;AAAA,QACzC,iDAAwB,KAAM;AAAA,QAC9B,yCAAgB,OAAO,YAAa;AAAA,EACrC;AACD;",
|
|
6
6
|
"names": ["grammarParse"]
|
|
7
7
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// packages/block-editor/src/components/block-edit/context.js
|
|
2
2
|
import { createContext, useContext } from "@wordpress/element";
|
|
3
|
-
var mayDisplayControlsKey = Symbol("mayDisplayControls");
|
|
4
|
-
var mayDisplayParentControlsKey = Symbol("mayDisplayParentControls");
|
|
5
|
-
var blockEditingModeKey = Symbol("blockEditingMode");
|
|
6
|
-
var blockBindingsKey = Symbol("blockBindings");
|
|
7
|
-
var isPreviewModeKey = Symbol("isPreviewMode");
|
|
3
|
+
var mayDisplayControlsKey = /* @__PURE__ */ Symbol("mayDisplayControls");
|
|
4
|
+
var mayDisplayParentControlsKey = /* @__PURE__ */ Symbol("mayDisplayParentControls");
|
|
5
|
+
var blockEditingModeKey = /* @__PURE__ */ Symbol("blockEditingMode");
|
|
6
|
+
var blockBindingsKey = /* @__PURE__ */ Symbol("blockBindings");
|
|
7
|
+
var isPreviewModeKey = /* @__PURE__ */ Symbol("isPreviewMode");
|
|
8
8
|
var DEFAULT_BLOCK_EDIT_CONTEXT = {
|
|
9
9
|
name: "",
|
|
10
10
|
isSelected: false
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-edit/context.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nexport const mayDisplayControlsKey = Symbol( 'mayDisplayControls' );\nexport const mayDisplayParentControlsKey = Symbol( 'mayDisplayParentControls' );\nexport const blockEditingModeKey = Symbol( 'blockEditingMode' );\nexport const blockBindingsKey = Symbol( 'blockBindings' );\nexport const isPreviewModeKey = Symbol( 'isPreviewMode' );\n\nexport const DEFAULT_BLOCK_EDIT_CONTEXT = {\n\tname: '',\n\tisSelected: false,\n};\n\nconst Context = createContext( DEFAULT_BLOCK_EDIT_CONTEXT );\nContext.displayName = 'BlockEditContext';\n\nconst { Provider } = Context;\n\nexport { Provider as BlockEditContextProvider };\n\n/**\n * A hook that returns the block edit context.\n *\n * @return {Object} Block edit context\n */\nexport function useBlockEditContext() {\n\treturn useContext( Context );\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,eAAe,kBAAkB;AAEnC,IAAM,wBAAwB,
|
|
5
|
+
"mappings": ";AAGA,SAAS,eAAe,kBAAkB;AAEnC,IAAM,wBAAwB,uBAAQ,oBAAqB;AAC3D,IAAM,8BAA8B,uBAAQ,0BAA2B;AACvE,IAAM,sBAAsB,uBAAQ,kBAAmB;AACvD,IAAM,mBAAmB,uBAAQ,eAAgB;AACjD,IAAM,mBAAmB,uBAAQ,eAAgB;AAEjD,IAAM,6BAA6B;AAAA,EACzC,MAAM;AAAA,EACN,YAAY;AACb;AAEA,IAAM,UAAU,cAAe,0BAA2B;AAC1D,QAAQ,cAAc;AAEtB,IAAM,EAAE,SAAS,IAAI;AASd,SAAS,sBAAsB;AACrC,SAAO,WAAY,OAAQ;AAC5B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -28,7 +28,9 @@ import { useBlockProps } from "./use-block-props/index.mjs";
|
|
|
28
28
|
import { store as blockEditorStore } from "../../store/index.mjs";
|
|
29
29
|
import { useLayout } from "./layout.mjs";
|
|
30
30
|
import { PrivateBlockContext } from "./private-block-context.mjs";
|
|
31
|
+
import { useBlockVisibility } from "../block-visibility/index.mjs";
|
|
31
32
|
import { unlock } from "../../lock-unlock.mjs";
|
|
33
|
+
import { deviceTypeKey } from "../../store/private-keys.mjs";
|
|
32
34
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
33
35
|
function mergeWrapperProps(propsA, propsB) {
|
|
34
36
|
const newProps = {
|
|
@@ -418,15 +420,15 @@ function BlockListBlockProvider(props) {
|
|
|
418
420
|
const attributes2 = getBlockAttributes(clientId);
|
|
419
421
|
const { name: blockName, isValid: isValid2 } = blockWithoutAttributes2;
|
|
420
422
|
const blockType2 = getBlockType(blockName);
|
|
423
|
+
const settings = getSettings();
|
|
421
424
|
const {
|
|
422
425
|
supportsLayout,
|
|
423
426
|
isPreviewMode: isPreviewMode2,
|
|
424
427
|
__experimentalBlockBindingsSupportedAttributes
|
|
425
|
-
} =
|
|
426
|
-
const { isBlockHidden: _isBlockHidden } = unlock(
|
|
427
|
-
select(blockEditorStore)
|
|
428
|
-
);
|
|
428
|
+
} = settings;
|
|
429
429
|
const bindableAttributes2 = __experimentalBlockBindingsSupportedAttributes?.[blockName];
|
|
430
|
+
const blockVisibility2 = attributes2?.metadata?.blockVisibility;
|
|
431
|
+
const deviceType2 = settings?.[deviceTypeKey]?.toLowerCase() || "desktop";
|
|
430
432
|
const hasLightBlockWrapper = blockType2?.apiVersion > 1;
|
|
431
433
|
const previewContext = {
|
|
432
434
|
isPreviewMode: isPreviewMode2,
|
|
@@ -440,8 +442,9 @@ function BlockListBlockProvider(props) {
|
|
|
440
442
|
className: hasLightBlockWrapper ? attributes2.className : void 0,
|
|
441
443
|
defaultClassName: hasLightBlockWrapper ? getBlockDefaultClassName(blockName) : void 0,
|
|
442
444
|
blockTitle: blockType2?.title,
|
|
443
|
-
|
|
444
|
-
|
|
445
|
+
bindableAttributes: bindableAttributes2,
|
|
446
|
+
blockVisibility: blockVisibility2,
|
|
447
|
+
deviceType: deviceType2
|
|
445
448
|
};
|
|
446
449
|
if (isPreviewMode2) {
|
|
447
450
|
return previewContext;
|
|
@@ -495,7 +498,9 @@ function BlockListBlockProvider(props) {
|
|
|
495
498
|
hasChildSelected: isAncestorOfSelectedBlock,
|
|
496
499
|
isEditingDisabled: blockEditingMode2 === "disabled",
|
|
497
500
|
hasEditableOutline: blockEditingMode2 !== "disabled" && getBlockEditingMode(rootClientId) === "disabled",
|
|
498
|
-
originalBlockClientId: isInvalid ? blocksWithSameName[0] : false
|
|
501
|
+
originalBlockClientId: isInvalid ? blocksWithSameName[0] : false,
|
|
502
|
+
blockVisibility: blockVisibility2,
|
|
503
|
+
deviceType: deviceType2
|
|
499
504
|
};
|
|
500
505
|
},
|
|
501
506
|
[clientId, rootClientId]
|
|
@@ -540,9 +545,14 @@ function BlockListBlockProvider(props) {
|
|
|
540
545
|
className,
|
|
541
546
|
defaultClassName,
|
|
542
547
|
originalBlockClientId,
|
|
543
|
-
|
|
544
|
-
|
|
548
|
+
bindableAttributes,
|
|
549
|
+
blockVisibility,
|
|
550
|
+
deviceType
|
|
545
551
|
} = selectedProps;
|
|
552
|
+
const { isBlockCurrentlyHidden } = useBlockVisibility({
|
|
553
|
+
blockVisibility,
|
|
554
|
+
deviceType
|
|
555
|
+
});
|
|
546
556
|
const block = useMemo(
|
|
547
557
|
() => ({ ...blockWithoutAttributes, attributes }),
|
|
548
558
|
[blockWithoutAttributes, attributes]
|
|
@@ -583,10 +593,12 @@ function BlockListBlockProvider(props) {
|
|
|
583
593
|
originalBlockClientId,
|
|
584
594
|
themeSupportsLayout,
|
|
585
595
|
canMove,
|
|
586
|
-
|
|
587
|
-
bindableAttributes
|
|
596
|
+
isBlockCurrentlyHidden,
|
|
597
|
+
bindableAttributes,
|
|
598
|
+
blockVisibility,
|
|
599
|
+
deviceType
|
|
588
600
|
};
|
|
589
|
-
if (
|
|
601
|
+
if (isBlockCurrentlyHidden && !isSelected && !isMultiSelected && !hasChildSelected) {
|
|
590
602
|
return null;
|
|
591
603
|
}
|
|
592
604
|
return /* @__PURE__ */ jsx(PrivateBlockContext.Provider, { value: privateContext, children: /* @__PURE__ */ jsx(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-list/block.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { memo, RawHTML, useContext, useMemo } from '@wordpress/element';\nimport {\n\tgetBlockType,\n\tgetSaveContent,\n\tisUnmodifiedDefaultBlock,\n\tserializeRawBlock,\n\tswitchToBlockType,\n\tgetDefaultBlockName,\n\tisUnmodifiedBlock,\n\tisReusableBlock,\n\tgetBlockDefaultClassName,\n\thasBlockSupport,\n\tcreateBlock,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { withFilters } from '@wordpress/components';\nimport { withDispatch, useSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { safeHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport BlockEdit from '../block-edit';\nimport BlockInvalidWarning from './block-invalid-warning';\nimport BlockCrashWarning from './block-crash-warning';\nimport BlockCrashBoundary from './block-crash-boundary';\nimport BlockHtml from './block-html';\nimport { useBlockProps } from './use-block-props';\nimport { store as blockEditorStore } from '../../store';\nimport { useLayout } from './layout';\nimport { PrivateBlockContext } from './private-block-context';\n\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Merges wrapper props with special handling for classNames and styles.\n *\n * @param {Object} propsA\n * @param {Object} propsB\n *\n * @return {Object} Merged props.\n */\nfunction mergeWrapperProps( propsA, propsB ) {\n\tconst newProps = {\n\t\t...propsA,\n\t\t...propsB,\n\t};\n\n\t// May be set to undefined, so check if the property is set!\n\tif (\n\t\tpropsA?.hasOwnProperty( 'className' ) &&\n\t\tpropsB?.hasOwnProperty( 'className' )\n\t) {\n\t\tnewProps.className = clsx( propsA.className, propsB.className );\n\t}\n\n\tif (\n\t\tpropsA?.hasOwnProperty( 'style' ) &&\n\t\tpropsB?.hasOwnProperty( 'style' )\n\t) {\n\t\tnewProps.style = { ...propsA.style, ...propsB.style };\n\t}\n\n\treturn newProps;\n}\n\nfunction Block( { children, isHtml, ...props } ) {\n\treturn (\n\t\t<div { ...useBlockProps( props, { __unstableIsHtml: isHtml } ) }>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nfunction BlockListBlock( {\n\tblock: { __unstableBlockSource },\n\tmode,\n\tisLocked,\n\tcanRemove,\n\tclientId,\n\tisSelected,\n\tisSelectionEnabled,\n\tclassName,\n\t__unstableLayoutClassNames: layoutClassNames,\n\tname,\n\tisValid,\n\tattributes,\n\twrapperProps,\n\tsetAttributes,\n\tonReplace,\n\tonRemove,\n\tonInsertBlocksAfter,\n\tonMerge,\n\ttoggleSelection,\n} ) {\n\tconst {\n\t\tmayDisplayControls,\n\t\tmayDisplayParentControls,\n\t\tthemeSupportsLayout,\n\t\t...context\n\t} = useContext( PrivateBlockContext );\n\n\tconst parentLayout = useLayout() || {};\n\n\t// We wrap the BlockEdit component in a div that hides it when editing in\n\t// HTML mode. This allows us to render all of the ancillary pieces\n\t// (InspectorControls, etc.) which are inside `BlockEdit` but not\n\t// `BlockHTML`, even in HTML mode.\n\tlet blockEdit = (\n\t\t<BlockEdit\n\t\t\tname={ name }\n\t\t\tisSelected={ isSelected }\n\t\t\tattributes={ attributes }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tinsertBlocksAfter={ isLocked ? undefined : onInsertBlocksAfter }\n\t\t\tonReplace={ canRemove ? onReplace : undefined }\n\t\t\tonRemove={ canRemove ? onRemove : undefined }\n\t\t\tmergeBlocks={ canRemove ? onMerge : undefined }\n\t\t\tclientId={ clientId }\n\t\t\tisSelectionEnabled={ isSelectionEnabled }\n\t\t\ttoggleSelection={ toggleSelection }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t\t__unstableParentLayout={\n\t\t\t\tObject.keys( parentLayout ).length ? parentLayout : undefined\n\t\t\t}\n\t\t\tmayDisplayControls={ mayDisplayControls }\n\t\t\tmayDisplayParentControls={ mayDisplayParentControls }\n\t\t\tblockEditingMode={ context.blockEditingMode }\n\t\t\tisPreviewMode={ context.isPreviewMode }\n\t\t/>\n\t);\n\n\tconst blockType = getBlockType( name );\n\n\t// Determine whether the block has props to apply to the wrapper.\n\tif ( blockType?.getEditWrapperProps ) {\n\t\twrapperProps = mergeWrapperProps(\n\t\t\twrapperProps,\n\t\t\tblockType.getEditWrapperProps( attributes )\n\t\t);\n\t}\n\n\tconst isAligned =\n\t\twrapperProps &&\n\t\t!! wrapperProps[ 'data-align' ] &&\n\t\t! themeSupportsLayout;\n\n\t// Support for sticky position in classic themes with alignment wrappers.\n\n\tconst isSticky = className?.includes( 'is-position-sticky' );\n\n\t// For aligned blocks, provide a wrapper element so the block can be\n\t// positioned relative to the block column.\n\t// This is only kept for classic themes that don't support layout\n\t// Historically we used to rely on extra divs and data-align to\n\t// provide the alignments styles in the editor.\n\t// Due to the differences between frontend and backend, we migrated\n\t// to the layout feature, and we're now aligning the markup of frontend\n\t// and backend.\n\tif ( isAligned ) {\n\t\tblockEdit = (\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'wp-block', isSticky && className ) }\n\t\t\t\tdata-align={ wrapperProps[ 'data-align' ] }\n\t\t\t>\n\t\t\t\t{ blockEdit }\n\t\t\t</div>\n\t\t);\n\t}\n\n\tlet block;\n\n\tif ( ! isValid ) {\n\t\tconst saveContent = __unstableBlockSource\n\t\t\t? serializeRawBlock( __unstableBlockSource )\n\t\t\t: getSaveContent( blockType, attributes );\n\n\t\tblock = (\n\t\t\t<Block className=\"has-warning\">\n\t\t\t\t<BlockInvalidWarning clientId={ clientId } />\n\t\t\t\t<RawHTML>{ safeHTML( saveContent ) }</RawHTML>\n\t\t\t</Block>\n\t\t);\n\t} else if ( mode === 'html' ) {\n\t\t// Render blockEdit so the inspector controls don't disappear.\n\t\t// See #8969.\n\t\tblock = (\n\t\t\t<>\n\t\t\t\t<div style={ { display: 'none' } }>{ blockEdit }</div>\n\t\t\t\t<Block isHtml>\n\t\t\t\t\t<BlockHtml clientId={ clientId } />\n\t\t\t\t</Block>\n\t\t\t</>\n\t\t);\n\t} else if ( blockType?.apiVersion > 1 ) {\n\t\tblock = blockEdit;\n\t} else {\n\t\tblock = <Block>{ blockEdit }</Block>;\n\t}\n\n\tconst { 'data-align': dataAlign, ...restWrapperProps } = wrapperProps ?? {};\n\tconst updatedWrapperProps = {\n\t\t...restWrapperProps,\n\t\tclassName: clsx(\n\t\t\trestWrapperProps.className,\n\t\t\tdataAlign && themeSupportsLayout && `align${ dataAlign }`,\n\t\t\t! ( dataAlign && isSticky ) && className\n\t\t),\n\t};\n\n\t// We set a new context with the adjusted and filtered wrapperProps (through\n\t// `editor.BlockListBlock`), which the `BlockListBlockProvider` did not have\n\t// access to.\n\t// Note that the context value doesn't have to be memoized in this case\n\t// because when it changes, this component will be re-rendered anyway, and\n\t// none of the consumers (BlockListBlock and useBlockProps) are memoized or\n\t// \"pure\". This is different from the public BlockEditContext, where\n\t// consumers might be memoized or \"pure\".\n\treturn (\n\t\t<PrivateBlockContext.Provider\n\t\t\tvalue={ {\n\t\t\t\twrapperProps: updatedWrapperProps,\n\t\t\t\tisAligned,\n\t\t\t\t...context,\n\t\t\t} }\n\t\t>\n\t\t\t<BlockCrashBoundary\n\t\t\t\tfallback={\n\t\t\t\t\t<Block className=\"has-warning\">\n\t\t\t\t\t\t<BlockCrashWarning />\n\t\t\t\t\t</Block>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ block }\n\t\t\t</BlockCrashBoundary>\n\t\t</PrivateBlockContext.Provider>\n\t);\n}\n\nconst applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => {\n\tconst {\n\t\tupdateBlockAttributes,\n\t\tinsertBlocks,\n\t\tmergeBlocks,\n\t\treplaceBlocks,\n\t\ttoggleSelection,\n\t\t__unstableMarkLastChangeAsPersistent,\n\t\tmoveBlocksToPosition,\n\t\tremoveBlock,\n\t\tselectBlock,\n\t} = dispatch( blockEditorStore );\n\n\t// Do not add new properties here, use `useDispatch` instead to avoid\n\t// leaking new props to the public API (editor.BlockListBlock filter).\n\treturn {\n\t\tsetAttributes( nextAttributes ) {\n\t\t\tconst { getMultiSelectedBlockClientIds } =\n\t\t\t\tregistry.select( blockEditorStore );\n\t\t\tconst multiSelectedBlockClientIds =\n\t\t\t\tgetMultiSelectedBlockClientIds();\n\t\t\tconst { clientId, attributes } = ownProps;\n\t\t\tconst clientIds = multiSelectedBlockClientIds.length\n\t\t\t\t? multiSelectedBlockClientIds\n\t\t\t\t: [ clientId ];\n\t\t\tconst newAttributes =\n\t\t\t\ttypeof nextAttributes === 'function'\n\t\t\t\t\t? nextAttributes( attributes )\n\t\t\t\t\t: nextAttributes;\n\n\t\t\tupdateBlockAttributes( clientIds, newAttributes );\n\t\t},\n\t\tonInsertBlocks( blocks, index ) {\n\t\t\tconst { rootClientId } = ownProps;\n\t\t\tinsertBlocks( blocks, index, rootClientId );\n\t\t},\n\t\tonInsertBlocksAfter( blocks ) {\n\t\t\tconst { clientId, rootClientId } = ownProps;\n\t\t\tconst { getBlockIndex } = registry.select( blockEditorStore );\n\t\t\tconst index = getBlockIndex( clientId );\n\t\t\tinsertBlocks( blocks, index + 1, rootClientId );\n\t\t},\n\t\tonMerge( forward ) {\n\t\t\tconst { clientId, rootClientId } = ownProps;\n\t\t\tconst {\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t} = registry.select( blockEditorStore );\n\n\t\t\tfunction switchToDefaultOrRemove() {\n\t\t\t\tconst block = getBlock( clientId );\n\t\t\t\tconst defaultBlockName = getDefaultBlockName();\n\t\t\t\tconst defaultBlockType = getBlockType( defaultBlockName );\n\t\t\t\tif ( getBlockName( clientId ) !== defaultBlockName ) {\n\t\t\t\t\tconst replacement = switchToBlockType(\n\t\t\t\t\t\tblock,\n\t\t\t\t\t\tdefaultBlockName\n\t\t\t\t\t);\n\t\t\t\t\tif ( replacement && replacement.length ) {\n\t\t\t\t\t\treplaceBlocks( clientId, replacement );\n\t\t\t\t\t}\n\t\t\t\t} else if ( isUnmodifiedDefaultBlock( block ) ) {\n\t\t\t\t\tconst nextBlockClientId = getNextBlockClientId( clientId );\n\t\t\t\t\tif ( nextBlockClientId ) {\n\t\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t\t\t\tselectBlock( nextBlockClientId );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( defaultBlockType.merge ) {\n\t\t\t\t\tconst attributes = defaultBlockType.merge(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\tblock.attributes\n\t\t\t\t\t);\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t[ clientId ],\n\t\t\t\t\t\t[ createBlock( defaultBlockName, attributes ) ]\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Moves the block with clientId up one level. If the block type\n\t\t\t * cannot be inserted at the new location, it will be attempted to\n\t\t\t * convert to the default block type.\n\t\t\t *\n\t\t\t * @param {string} _clientId The block to move.\n\t\t\t * @param {boolean} changeSelection Whether to change the selection\n\t\t\t * to the moved block.\n\t\t\t */\n\t\t\tfunction moveFirstItemUp( _clientId, changeSelection = true ) {\n\t\t\t\tconst wrapperBlockName = getBlockName( _clientId );\n\t\t\t\tconst wrapperBlockType = getBlockType( wrapperBlockName );\n\t\t\t\tconst isTextualWrapper = wrapperBlockType.category === 'text';\n\t\t\t\tconst targetRootClientId = getBlockRootClientId( _clientId );\n\t\t\t\tconst blockOrder = getBlockOrder( _clientId );\n\t\t\t\tconst [ firstClientId ] = blockOrder;\n\n\t\t\t\tif (\n\t\t\t\t\tblockOrder.length === 1 &&\n\t\t\t\t\tisUnmodifiedBlock( getBlock( firstClientId ) )\n\t\t\t\t) {\n\t\t\t\t\tremoveBlock( _clientId );\n\t\t\t\t} else if ( isTextualWrapper ) {\n\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tgetBlockName( firstClientId ),\n\t\t\t\t\t\t\t\ttargetRootClientId\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ firstClientId ],\n\t\t\t\t\t\t\t\t_clientId,\n\t\t\t\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\t\t\t\tgetBlockIndex( _clientId )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst replacement = switchToBlockType(\n\t\t\t\t\t\t\t\tgetBlock( firstClientId ),\n\t\t\t\t\t\t\t\tgetDefaultBlockName()\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\treplacement &&\n\t\t\t\t\t\t\t\treplacement.length &&\n\t\t\t\t\t\t\t\treplacement.every( ( block ) =>\n\t\t\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\t\t\ttargetRootClientId\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tinsertBlocks(\n\t\t\t\t\t\t\t\t\treplacement,\n\t\t\t\t\t\t\t\t\tgetBlockIndex( _clientId ),\n\t\t\t\t\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\t\t\t\t\tchangeSelection\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tremoveBlock( firstClientId, false );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tswitchToDefaultOrRemove();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! getBlockOrder( _clientId ).length &&\n\t\t\t\t\t\t\tisUnmodifiedBlock( getBlock( _clientId ) )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tremoveBlock( _clientId, false );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tswitchToDefaultOrRemove();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For `Delete` or forward merge, we should do the exact same thing\n\t\t\t// as `Backspace`, but from the other block.\n\t\t\tif ( forward ) {\n\t\t\t\tif ( rootClientId ) {\n\t\t\t\t\tconst nextRootClientId =\n\t\t\t\t\t\tgetNextBlockClientId( rootClientId );\n\n\t\t\t\t\tif ( nextRootClientId ) {\n\t\t\t\t\t\t// If there is a block that follows with the same parent\n\t\t\t\t\t\t// block name and the same attributes, merge the inner\n\t\t\t\t\t\t// blocks.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tgetBlockName( rootClientId ) ===\n\t\t\t\t\t\t\tgetBlockName( nextRootClientId )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst rootAttributes =\n\t\t\t\t\t\t\t\tgetBlockAttributes( rootClientId );\n\t\t\t\t\t\t\tconst previousRootAttributes =\n\t\t\t\t\t\t\t\tgetBlockAttributes( nextRootClientId );\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tObject.keys( rootAttributes ).every(\n\t\t\t\t\t\t\t\t\t( key ) =>\n\t\t\t\t\t\t\t\t\t\trootAttributes[ key ] ===\n\t\t\t\t\t\t\t\t\t\tpreviousRootAttributes[ key ]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\t\tgetBlockOrder( nextRootClientId ),\n\t\t\t\t\t\t\t\t\t\tnextRootClientId,\n\t\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tremoveBlock( nextRootClientId, false );\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmergeBlocks( rootClientId, nextRootClientId );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst nextBlockClientId = getNextBlockClientId( clientId );\n\n\t\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( getBlockOrder( nextBlockClientId ).length ) {\n\t\t\t\t\tmoveFirstItemUp( nextBlockClientId, false );\n\t\t\t\t} else {\n\t\t\t\t\tmergeBlocks( clientId, nextBlockClientId );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst previousBlockClientId =\n\t\t\t\t\tgetPreviousBlockClientId( clientId );\n\n\t\t\t\tif ( previousBlockClientId ) {\n\t\t\t\t\tmergeBlocks( previousBlockClientId, clientId );\n\t\t\t\t} else if ( rootClientId ) {\n\t\t\t\t\tconst previousRootClientId =\n\t\t\t\t\t\tgetPreviousBlockClientId( rootClientId );\n\n\t\t\t\t\t// If there is a preceding block with the same parent block\n\t\t\t\t\t// name and the same attributes, merge the inner blocks.\n\t\t\t\t\tif (\n\t\t\t\t\t\tpreviousRootClientId &&\n\t\t\t\t\t\tgetBlockName( rootClientId ) ===\n\t\t\t\t\t\t\tgetBlockName( previousRootClientId )\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst rootAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( rootClientId );\n\t\t\t\t\t\tconst previousRootAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( previousRootClientId );\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tObject.keys( rootAttributes ).every(\n\t\t\t\t\t\t\t\t( key ) =>\n\t\t\t\t\t\t\t\t\trootAttributes[ key ] ===\n\t\t\t\t\t\t\t\t\tpreviousRootAttributes[ key ]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\tgetBlockOrder( rootClientId ),\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\tpreviousRootClientId\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tremoveBlock( rootClientId, false );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tmoveFirstItemUp( rootClientId );\n\t\t\t\t} else {\n\t\t\t\t\tswitchToDefaultOrRemove();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonReplace( blocks, indexToSelect, initialPosition ) {\n\t\t\tif (\n\t\t\t\tblocks.length &&\n\t\t\t\t! isUnmodifiedDefaultBlock( blocks[ blocks.length - 1 ] )\n\t\t\t) {\n\t\t\t\t__unstableMarkLastChangeAsPersistent();\n\t\t\t}\n\t\t\t//Unsynced patterns are nested in an array so we need to flatten them.\n\t\t\tconst replacementBlocks =\n\t\t\t\tblocks?.length === 1 && Array.isArray( blocks[ 0 ] )\n\t\t\t\t\t? blocks[ 0 ]\n\t\t\t\t\t: blocks;\n\t\t\treplaceBlocks(\n\t\t\t\t[ ownProps.clientId ],\n\t\t\t\treplacementBlocks,\n\t\t\t\tindexToSelect,\n\t\t\t\tinitialPosition\n\t\t\t);\n\t\t},\n\t\tonRemove() {\n\t\t\tremoveBlock( ownProps.clientId );\n\t\t},\n\t\ttoggleSelection( selectionEnabled ) {\n\t\t\ttoggleSelection( selectionEnabled );\n\t\t},\n\t};\n} );\n\n// This component is used by the BlockListBlockProvider component below. It will\n// add the props necessary for the `editor.BlockListBlock` filters.\nBlockListBlock = compose(\n\tapplyWithDispatch,\n\twithFilters( 'editor.BlockListBlock' )\n)( BlockListBlock );\n\n// This component provides all the information we need through a single store\n// subscription (useSelect mapping). Only the necessary props are passed down\n// to the BlockListBlock component, which is a filtered component, so these\n// props are public API. To avoid adding to the public API, we use a private\n// context to pass the rest of the information to the filtered BlockListBlock\n// component, and useBlockProps.\nfunction BlockListBlockProvider( props ) {\n\tconst { clientId, rootClientId } = props;\n\tconst selectedProps = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockSelected,\n\t\t\t\tgetBlockMode,\n\t\t\t\tisSelectionEnabled,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tisSectionBlock: _isSectionBlock,\n\t\t\t\tgetParentSectionBlock,\n\t\t\t\tgetBlockWithoutAttributes,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tcanRemoveBlock,\n\t\t\t\tcanMoveBlock,\n\n\t\t\t\tgetSettings,\n\t\t\t\tgetEditedContentOnlySection,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetBlockName,\n\t\t\t\tisFirstMultiSelectedBlock,\n\t\t\t\tgetMultiSelectedBlockClientIds,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetBlocksByName,\n\n\t\t\t\tgetBlockIndex,\n\t\t\t\tisBlockMultiSelected,\n\t\t\t\tisBlockSubtreeDisabled,\n\t\t\t\tisBlockHighlighted,\n\t\t\t\t__unstableIsFullySelected,\n\t\t\t\t__unstableSelectionHasUnmergeableBlock,\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\tisDragging,\n\t\t\t\t__unstableHasActiveBlockOverlayActive,\n\t\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tconst blockWithoutAttributes =\n\t\t\t\tgetBlockWithoutAttributes( clientId );\n\n\t\t\t// This is a temporary fix.\n\t\t\t// This function should never be called when a block is not\n\t\t\t// present in the state. It happens now because the order in\n\t\t\t// withSelect rendering is not correct.\n\t\t\tif ( ! blockWithoutAttributes ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\thasBlockSupport: _hasBlockSupport,\n\t\t\t\tgetActiveBlockVariation,\n\t\t\t} = select( blocksStore );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst { name: blockName, isValid } = blockWithoutAttributes;\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst {\n\t\t\t\tsupportsLayout,\n\t\t\t\tisPreviewMode,\n\t\t\t\t__experimentalBlockBindingsSupportedAttributes,\n\t\t\t} = getSettings();\n\t\t\tconst { isBlockHidden: _isBlockHidden } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\tconst bindableAttributes =\n\t\t\t\t__experimentalBlockBindingsSupportedAttributes?.[ blockName ];\n\n\t\t\tconst hasLightBlockWrapper = blockType?.apiVersion > 1;\n\t\t\tconst previewContext = {\n\t\t\t\tisPreviewMode,\n\t\t\t\tblockWithoutAttributes,\n\t\t\t\tname: blockName,\n\t\t\t\tattributes,\n\t\t\t\tisValid,\n\t\t\t\tthemeSupportsLayout: supportsLayout,\n\t\t\t\tindex: getBlockIndex( clientId ),\n\t\t\t\tisReusable: isReusableBlock( blockType ),\n\t\t\t\tclassName: hasLightBlockWrapper\n\t\t\t\t\t? attributes.className\n\t\t\t\t\t: undefined,\n\t\t\t\tdefaultClassName: hasLightBlockWrapper\n\t\t\t\t\t? getBlockDefaultClassName( blockName )\n\t\t\t\t\t: undefined,\n\t\t\t\tblockTitle: blockType?.title,\n\t\t\t\tisBlockHidden: _isBlockHidden( clientId ),\n\t\t\t\tbindableAttributes,\n\t\t\t};\n\n\t\t\t// When in preview mode, we can avoid a lot of selection and\n\t\t\t// editing related selectors.\n\t\t\tif ( isPreviewMode ) {\n\t\t\t\treturn previewContext;\n\t\t\t}\n\t\t\tconst _isSelected = isBlockSelected( clientId );\n\t\t\tconst canRemove = canRemoveBlock( clientId );\n\t\t\tconst canMove = canMoveBlock( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\t\t\tconst isMultiSelected = isBlockMultiSelected( clientId );\n\t\t\tconst checkDeep = true;\n\t\t\tconst isAncestorOfSelectedBlock = hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\tcheckDeep\n\t\t\t);\n\t\t\tconst blockEditingMode = getBlockEditingMode( clientId );\n\t\t\tconst sectionBlockClientId = _isSectionBlock( clientId )\n\t\t\t\t? clientId\n\t\t\t\t: getParentSectionBlock( clientId );\n\n\t\t\tconst multiple = hasBlockSupport( blockName, 'multiple', true );\n\n\t\t\t// For block types with `multiple` support, there is no \"original\n\t\t\t// block\" to be found in the content, as the block itself is valid.\n\t\t\tconst blocksWithSameName = multiple\n\t\t\t\t? []\n\t\t\t\t: getBlocksByName( blockName );\n\t\t\tconst isInvalid =\n\t\t\t\tblocksWithSameName.length &&\n\t\t\t\tblocksWithSameName[ 0 ] !== clientId;\n\n\t\t\treturn {\n\t\t\t\t...previewContext,\n\t\t\t\tmode: getBlockMode( clientId ),\n\t\t\t\tisSelectionEnabled: isSelectionEnabled(),\n\t\t\t\tisLocked: !! getTemplateLock( rootClientId ),\n\t\t\t\tisSectionBlock: _isSectionBlock( clientId ),\n\t\t\t\tisWithinSectionBlock: !! sectionBlockClientId,\n\t\t\t\tisSelectionWithinCurrentSection:\n\t\t\t\t\tisBlockSelected( sectionBlockClientId ) ||\n\t\t\t\t\thasSelectedInnerBlock( sectionBlockClientId, checkDeep ),\n\t\t\t\tblockType,\n\t\t\t\tcanRemove,\n\t\t\t\tcanMove,\n\t\t\t\tisSelected: _isSelected,\n\t\t\t\tisEditingContentOnlySection:\n\t\t\t\t\tgetEditedContentOnlySection() === clientId,\n\t\t\t\tblockEditingMode,\n\t\t\t\tmayDisplayControls:\n\t\t\t\t\t_isSelected ||\n\t\t\t\t\t( isFirstMultiSelectedBlock( clientId ) &&\n\t\t\t\t\t\tgetMultiSelectedBlockClientIds().every(\n\t\t\t\t\t\t\t( id ) => getBlockName( id ) === blockName\n\t\t\t\t\t\t) ),\n\t\t\t\tmayDisplayParentControls:\n\t\t\t\t\t_hasBlockSupport(\n\t\t\t\t\t\tgetBlockName( clientId ),\n\t\t\t\t\t\t'__experimentalExposeControlsToChildren',\n\t\t\t\t\t\tfalse\n\t\t\t\t\t) && hasSelectedInnerBlock( clientId ),\n\t\t\t\tblockApiVersion: blockType?.apiVersion || 1,\n\t\t\t\tblockTitle: match?.title || blockType?.title,\n\t\t\t\tisSubtreeDisabled:\n\t\t\t\t\tblockEditingMode === 'disabled' &&\n\t\t\t\t\tisBlockSubtreeDisabled( clientId ),\n\t\t\t\thasOverlay:\n\t\t\t\t\t__unstableHasActiveBlockOverlayActive( clientId ) &&\n\t\t\t\t\t! isDragging(),\n\t\t\t\tinitialPosition: _isSelected\n\t\t\t\t\t? getSelectedBlocksInitialCaretPosition()\n\t\t\t\t\t: undefined,\n\t\t\t\tisHighlighted: isBlockHighlighted( clientId ),\n\t\t\t\tisMultiSelected,\n\t\t\t\tisPartiallySelected:\n\t\t\t\t\tisMultiSelected &&\n\t\t\t\t\t! __unstableIsFullySelected() &&\n\t\t\t\t\t! __unstableSelectionHasUnmergeableBlock(),\n\t\t\t\tisDragging: isBlockBeingDragged( clientId ),\n\t\t\t\thasChildSelected: isAncestorOfSelectedBlock,\n\t\t\t\tisEditingDisabled: blockEditingMode === 'disabled',\n\t\t\t\thasEditableOutline:\n\t\t\t\t\tblockEditingMode !== 'disabled' &&\n\t\t\t\t\tgetBlockEditingMode( rootClientId ) === 'disabled',\n\t\t\t\toriginalBlockClientId: isInvalid\n\t\t\t\t\t? blocksWithSameName[ 0 ]\n\t\t\t\t\t: false,\n\t\t\t};\n\t\t},\n\t\t[ clientId, rootClientId ]\n\t);\n\n\tconst {\n\t\tisPreviewMode,\n\t\t// Fill values that end up as a public API and may not be defined in\n\t\t// preview mode.\n\t\tmode = 'visual',\n\t\tisSelectionEnabled = false,\n\t\tisLocked = false,\n\t\tcanRemove = false,\n\t\tcanMove = false,\n\t\tblockWithoutAttributes,\n\t\tname,\n\t\tattributes,\n\t\tisValid,\n\t\tisSelected = false,\n\t\tthemeSupportsLayout,\n\t\tisEditingContentOnlySection,\n\t\tblockEditingMode,\n\t\tmayDisplayControls,\n\t\tmayDisplayParentControls,\n\t\tindex,\n\t\tblockApiVersion,\n\t\tblockType,\n\t\tblockTitle,\n\t\tisSubtreeDisabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tisHighlighted,\n\t\tisMultiSelected,\n\t\tisPartiallySelected,\n\t\tisReusable,\n\t\tisDragging,\n\t\thasChildSelected,\n\t\tisSectionBlock,\n\t\tisWithinSectionBlock,\n\t\tisSelectionWithinCurrentSection,\n\t\tisEditingDisabled,\n\t\thasEditableOutline,\n\t\tclassName,\n\t\tdefaultClassName,\n\t\toriginalBlockClientId,\n\t\tisBlockHidden,\n\t\tbindableAttributes,\n\t} = selectedProps;\n\n\t// Users of the editor.BlockListBlock filter used to be able to\n\t// access the block prop.\n\t// Ideally these blocks would rely on the clientId prop only.\n\t// This is kept for backward compatibility reasons.\n\tconst block = useMemo(\n\t\t() => ( { ...blockWithoutAttributes, attributes } ),\n\t\t[ blockWithoutAttributes, attributes ]\n\t);\n\n\t// Block is sometimes not mounted at the right time, causing it be\n\t// undefined see issue for more info\n\t// https://github.com/WordPress/gutenberg/issues/17013\n\tif ( ! selectedProps ) {\n\t\treturn null;\n\t}\n\n\tconst privateContext = {\n\t\tisPreviewMode,\n\t\tclientId,\n\t\tclassName,\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockType,\n\t\tblockTitle,\n\t\tisSelected,\n\t\tisSubtreeDisabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tblockEditingMode,\n\t\tisHighlighted,\n\t\tisMultiSelected,\n\t\tisPartiallySelected,\n\t\tisReusable,\n\t\tisDragging,\n\t\thasChildSelected,\n\t\tisSectionBlock,\n\t\tisWithinSectionBlock,\n\t\tisSelectionWithinCurrentSection,\n\t\tisEditingDisabled,\n\t\thasEditableOutline,\n\t\tisEditingContentOnlySection,\n\t\tdefaultClassName,\n\t\tmayDisplayControls,\n\t\tmayDisplayParentControls,\n\t\toriginalBlockClientId,\n\t\tthemeSupportsLayout,\n\t\tcanMove,\n\t\tisBlockHidden,\n\t\tbindableAttributes,\n\t};\n\n\tif (\n\t\tisBlockHidden &&\n\t\t! isSelected &&\n\t\t! isMultiSelected &&\n\t\t! hasChildSelected\n\t) {\n\t\treturn null;\n\t}\n\n\t// Here we separate between the props passed to BlockListBlock and any other\n\t// information we selected for internal use. BlockListBlock is a filtered\n\t// component and thus ALL the props are PUBLIC API.\n\n\t// Note that the context value doesn't have to be memoized in this case\n\t// because when it changes, this component will be re-rendered anyway, and\n\t// none of the consumers (BlockListBlock and useBlockProps) are memoized or\n\t// \"pure\". This is different from the public BlockEditContext, where\n\t// consumers might be memoized or \"pure\".\n\treturn (\n\t\t<PrivateBlockContext.Provider value={ privateContext }>\n\t\t\t<BlockListBlock\n\t\t\t\t{ ...props }\n\t\t\t\t// WARNING: all the following props are public API (through the\n\t\t\t\t// editor.BlockListBlock filter) and normally nothing new should\n\t\t\t\t// be added to it.\n\t\t\t\t{ ...{\n\t\t\t\t\tmode,\n\t\t\t\t\tisSelectionEnabled,\n\t\t\t\t\tisLocked,\n\t\t\t\t\tcanRemove,\n\t\t\t\t\tcanMove,\n\t\t\t\t\t// Users of the editor.BlockListBlock filter used to be able\n\t\t\t\t\t// to access the block prop. Ideally these blocks would rely\n\t\t\t\t\t// on the clientId prop only. This is kept for backward\n\t\t\t\t\t// compatibility reasons.\n\t\t\t\t\tblock,\n\t\t\t\t\tname,\n\t\t\t\t\tattributes,\n\t\t\t\t\tisValid,\n\t\t\t\t\tisSelected,\n\t\t\t\t} }\n\t\t\t/>\n\t\t</PrivateBlockContext.Provider>\n\t);\n}\n\nexport default memo( BlockListBlockProvider );\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,MAAM,SAAS,YAAY,eAAe;AACnD;AAAA,EACC;AAAA,EACA;AAAA,EACA;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ACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA;AAAA,EACD,GACD;AAEF;AAEA,IAAO,gBAAQ,KAAM,sBAAuB;",
|
|
6
|
-
"names": ["isSelectionEnabled", "isDragging", "blockWithoutAttributes", "attributes", "isValid", "blockType", "isPreviewMode", "bindableAttributes", "canRemove", "canMove", "isMultiSelected", "blockEditingMode"]
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { memo, RawHTML, useContext, useMemo } from '@wordpress/element';\nimport {\n\tgetBlockType,\n\tgetSaveContent,\n\tisUnmodifiedDefaultBlock,\n\tserializeRawBlock,\n\tswitchToBlockType,\n\tgetDefaultBlockName,\n\tisUnmodifiedBlock,\n\tisReusableBlock,\n\tgetBlockDefaultClassName,\n\thasBlockSupport,\n\tcreateBlock,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { withFilters } from '@wordpress/components';\nimport { withDispatch, useSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { safeHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport BlockEdit from '../block-edit';\nimport BlockInvalidWarning from './block-invalid-warning';\nimport BlockCrashWarning from './block-crash-warning';\nimport BlockCrashBoundary from './block-crash-boundary';\nimport BlockHtml from './block-html';\nimport { useBlockProps } from './use-block-props';\nimport { store as blockEditorStore } from '../../store';\nimport { useLayout } from './layout';\nimport { PrivateBlockContext } from './private-block-context';\nimport { useBlockVisibility } from '../block-visibility/';\nimport { unlock } from '../../lock-unlock';\nimport { deviceTypeKey } from '../../store/private-keys';\n\n/**\n * Merges wrapper props with special handling for classNames and styles.\n *\n * @param {Object} propsA\n * @param {Object} propsB\n *\n * @return {Object} Merged props.\n */\nfunction mergeWrapperProps( propsA, propsB ) {\n\tconst newProps = {\n\t\t...propsA,\n\t\t...propsB,\n\t};\n\n\t// May be set to undefined, so check if the property is set!\n\tif (\n\t\tpropsA?.hasOwnProperty( 'className' ) &&\n\t\tpropsB?.hasOwnProperty( 'className' )\n\t) {\n\t\tnewProps.className = clsx( propsA.className, propsB.className );\n\t}\n\n\tif (\n\t\tpropsA?.hasOwnProperty( 'style' ) &&\n\t\tpropsB?.hasOwnProperty( 'style' )\n\t) {\n\t\tnewProps.style = { ...propsA.style, ...propsB.style };\n\t}\n\n\treturn newProps;\n}\n\nfunction Block( { children, isHtml, ...props } ) {\n\treturn (\n\t\t<div { ...useBlockProps( props, { __unstableIsHtml: isHtml } ) }>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nfunction BlockListBlock( {\n\tblock: { __unstableBlockSource },\n\tmode,\n\tisLocked,\n\tcanRemove,\n\tclientId,\n\tisSelected,\n\tisSelectionEnabled,\n\tclassName,\n\t__unstableLayoutClassNames: layoutClassNames,\n\tname,\n\tisValid,\n\tattributes,\n\twrapperProps,\n\tsetAttributes,\n\tonReplace,\n\tonRemove,\n\tonInsertBlocksAfter,\n\tonMerge,\n\ttoggleSelection,\n} ) {\n\tconst {\n\t\tmayDisplayControls,\n\t\tmayDisplayParentControls,\n\t\tthemeSupportsLayout,\n\t\t...context\n\t} = useContext( PrivateBlockContext );\n\n\tconst parentLayout = useLayout() || {};\n\n\t// We wrap the BlockEdit component in a div that hides it when editing in\n\t// HTML mode. This allows us to render all of the ancillary pieces\n\t// (InspectorControls, etc.) which are inside `BlockEdit` but not\n\t// `BlockHTML`, even in HTML mode.\n\tlet blockEdit = (\n\t\t<BlockEdit\n\t\t\tname={ name }\n\t\t\tisSelected={ isSelected }\n\t\t\tattributes={ attributes }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tinsertBlocksAfter={ isLocked ? undefined : onInsertBlocksAfter }\n\t\t\tonReplace={ canRemove ? onReplace : undefined }\n\t\t\tonRemove={ canRemove ? onRemove : undefined }\n\t\t\tmergeBlocks={ canRemove ? onMerge : undefined }\n\t\t\tclientId={ clientId }\n\t\t\tisSelectionEnabled={ isSelectionEnabled }\n\t\t\ttoggleSelection={ toggleSelection }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t\t__unstableParentLayout={\n\t\t\t\tObject.keys( parentLayout ).length ? parentLayout : undefined\n\t\t\t}\n\t\t\tmayDisplayControls={ mayDisplayControls }\n\t\t\tmayDisplayParentControls={ mayDisplayParentControls }\n\t\t\tblockEditingMode={ context.blockEditingMode }\n\t\t\tisPreviewMode={ context.isPreviewMode }\n\t\t/>\n\t);\n\n\tconst blockType = getBlockType( name );\n\n\t// Determine whether the block has props to apply to the wrapper.\n\tif ( blockType?.getEditWrapperProps ) {\n\t\twrapperProps = mergeWrapperProps(\n\t\t\twrapperProps,\n\t\t\tblockType.getEditWrapperProps( attributes )\n\t\t);\n\t}\n\n\tconst isAligned =\n\t\twrapperProps &&\n\t\t!! wrapperProps[ 'data-align' ] &&\n\t\t! themeSupportsLayout;\n\n\t// Support for sticky position in classic themes with alignment wrappers.\n\n\tconst isSticky = className?.includes( 'is-position-sticky' );\n\n\t// For aligned blocks, provide a wrapper element so the block can be\n\t// positioned relative to the block column.\n\t// This is only kept for classic themes that don't support layout\n\t// Historically we used to rely on extra divs and data-align to\n\t// provide the alignments styles in the editor.\n\t// Due to the differences between frontend and backend, we migrated\n\t// to the layout feature, and we're now aligning the markup of frontend\n\t// and backend.\n\tif ( isAligned ) {\n\t\tblockEdit = (\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'wp-block', isSticky && className ) }\n\t\t\t\tdata-align={ wrapperProps[ 'data-align' ] }\n\t\t\t>\n\t\t\t\t{ blockEdit }\n\t\t\t</div>\n\t\t);\n\t}\n\n\tlet block;\n\n\tif ( ! isValid ) {\n\t\tconst saveContent = __unstableBlockSource\n\t\t\t? serializeRawBlock( __unstableBlockSource )\n\t\t\t: getSaveContent( blockType, attributes );\n\n\t\tblock = (\n\t\t\t<Block className=\"has-warning\">\n\t\t\t\t<BlockInvalidWarning clientId={ clientId } />\n\t\t\t\t<RawHTML>{ safeHTML( saveContent ) }</RawHTML>\n\t\t\t</Block>\n\t\t);\n\t} else if ( mode === 'html' ) {\n\t\t// Render blockEdit so the inspector controls don't disappear.\n\t\t// See #8969.\n\t\tblock = (\n\t\t\t<>\n\t\t\t\t<div style={ { display: 'none' } }>{ blockEdit }</div>\n\t\t\t\t<Block isHtml>\n\t\t\t\t\t<BlockHtml clientId={ clientId } />\n\t\t\t\t</Block>\n\t\t\t</>\n\t\t);\n\t} else if ( blockType?.apiVersion > 1 ) {\n\t\tblock = blockEdit;\n\t} else {\n\t\tblock = <Block>{ blockEdit }</Block>;\n\t}\n\n\tconst { 'data-align': dataAlign, ...restWrapperProps } = wrapperProps ?? {};\n\tconst updatedWrapperProps = {\n\t\t...restWrapperProps,\n\t\tclassName: clsx(\n\t\t\trestWrapperProps.className,\n\t\t\tdataAlign && themeSupportsLayout && `align${ dataAlign }`,\n\t\t\t! ( dataAlign && isSticky ) && className\n\t\t),\n\t};\n\n\t// We set a new context with the adjusted and filtered wrapperProps (through\n\t// `editor.BlockListBlock`), which the `BlockListBlockProvider` did not have\n\t// access to.\n\t// Note that the context value doesn't have to be memoized in this case\n\t// because when it changes, this component will be re-rendered anyway, and\n\t// none of the consumers (BlockListBlock and useBlockProps) are memoized or\n\t// \"pure\". This is different from the public BlockEditContext, where\n\t// consumers might be memoized or \"pure\".\n\treturn (\n\t\t<PrivateBlockContext.Provider\n\t\t\tvalue={ {\n\t\t\t\twrapperProps: updatedWrapperProps,\n\t\t\t\tisAligned,\n\t\t\t\t...context,\n\t\t\t} }\n\t\t>\n\t\t\t<BlockCrashBoundary\n\t\t\t\tfallback={\n\t\t\t\t\t<Block className=\"has-warning\">\n\t\t\t\t\t\t<BlockCrashWarning />\n\t\t\t\t\t</Block>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ block }\n\t\t\t</BlockCrashBoundary>\n\t\t</PrivateBlockContext.Provider>\n\t);\n}\n\nconst applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => {\n\tconst {\n\t\tupdateBlockAttributes,\n\t\tinsertBlocks,\n\t\tmergeBlocks,\n\t\treplaceBlocks,\n\t\ttoggleSelection,\n\t\t__unstableMarkLastChangeAsPersistent,\n\t\tmoveBlocksToPosition,\n\t\tremoveBlock,\n\t\tselectBlock,\n\t} = dispatch( blockEditorStore );\n\n\t// Do not add new properties here, use `useDispatch` instead to avoid\n\t// leaking new props to the public API (editor.BlockListBlock filter).\n\treturn {\n\t\tsetAttributes( nextAttributes ) {\n\t\t\tconst { getMultiSelectedBlockClientIds } =\n\t\t\t\tregistry.select( blockEditorStore );\n\t\t\tconst multiSelectedBlockClientIds =\n\t\t\t\tgetMultiSelectedBlockClientIds();\n\t\t\tconst { clientId, attributes } = ownProps;\n\t\t\tconst clientIds = multiSelectedBlockClientIds.length\n\t\t\t\t? multiSelectedBlockClientIds\n\t\t\t\t: [ clientId ];\n\t\t\tconst newAttributes =\n\t\t\t\ttypeof nextAttributes === 'function'\n\t\t\t\t\t? nextAttributes( attributes )\n\t\t\t\t\t: nextAttributes;\n\n\t\t\tupdateBlockAttributes( clientIds, newAttributes );\n\t\t},\n\t\tonInsertBlocks( blocks, index ) {\n\t\t\tconst { rootClientId } = ownProps;\n\t\t\tinsertBlocks( blocks, index, rootClientId );\n\t\t},\n\t\tonInsertBlocksAfter( blocks ) {\n\t\t\tconst { clientId, rootClientId } = ownProps;\n\t\t\tconst { getBlockIndex } = registry.select( blockEditorStore );\n\t\t\tconst index = getBlockIndex( clientId );\n\t\t\tinsertBlocks( blocks, index + 1, rootClientId );\n\t\t},\n\t\tonMerge( forward ) {\n\t\t\tconst { clientId, rootClientId } = ownProps;\n\t\t\tconst {\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t} = registry.select( blockEditorStore );\n\n\t\t\tfunction switchToDefaultOrRemove() {\n\t\t\t\tconst block = getBlock( clientId );\n\t\t\t\tconst defaultBlockName = getDefaultBlockName();\n\t\t\t\tconst defaultBlockType = getBlockType( defaultBlockName );\n\t\t\t\tif ( getBlockName( clientId ) !== defaultBlockName ) {\n\t\t\t\t\tconst replacement = switchToBlockType(\n\t\t\t\t\t\tblock,\n\t\t\t\t\t\tdefaultBlockName\n\t\t\t\t\t);\n\t\t\t\t\tif ( replacement && replacement.length ) {\n\t\t\t\t\t\treplaceBlocks( clientId, replacement );\n\t\t\t\t\t}\n\t\t\t\t} else if ( isUnmodifiedDefaultBlock( block ) ) {\n\t\t\t\t\tconst nextBlockClientId = getNextBlockClientId( clientId );\n\t\t\t\t\tif ( nextBlockClientId ) {\n\t\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t\t\t\tselectBlock( nextBlockClientId );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( defaultBlockType.merge ) {\n\t\t\t\t\tconst attributes = defaultBlockType.merge(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\tblock.attributes\n\t\t\t\t\t);\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t[ clientId ],\n\t\t\t\t\t\t[ createBlock( defaultBlockName, attributes ) ]\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Moves the block with clientId up one level. If the block type\n\t\t\t * cannot be inserted at the new location, it will be attempted to\n\t\t\t * convert to the default block type.\n\t\t\t *\n\t\t\t * @param {string} _clientId The block to move.\n\t\t\t * @param {boolean} changeSelection Whether to change the selection\n\t\t\t * to the moved block.\n\t\t\t */\n\t\t\tfunction moveFirstItemUp( _clientId, changeSelection = true ) {\n\t\t\t\tconst wrapperBlockName = getBlockName( _clientId );\n\t\t\t\tconst wrapperBlockType = getBlockType( wrapperBlockName );\n\t\t\t\tconst isTextualWrapper = wrapperBlockType.category === 'text';\n\t\t\t\tconst targetRootClientId = getBlockRootClientId( _clientId );\n\t\t\t\tconst blockOrder = getBlockOrder( _clientId );\n\t\t\t\tconst [ firstClientId ] = blockOrder;\n\n\t\t\t\tif (\n\t\t\t\t\tblockOrder.length === 1 &&\n\t\t\t\t\tisUnmodifiedBlock( getBlock( firstClientId ) )\n\t\t\t\t) {\n\t\t\t\t\tremoveBlock( _clientId );\n\t\t\t\t} else if ( isTextualWrapper ) {\n\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tgetBlockName( firstClientId ),\n\t\t\t\t\t\t\t\ttargetRootClientId\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ firstClientId ],\n\t\t\t\t\t\t\t\t_clientId,\n\t\t\t\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\t\t\t\tgetBlockIndex( _clientId )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst replacement = switchToBlockType(\n\t\t\t\t\t\t\t\tgetBlock( firstClientId ),\n\t\t\t\t\t\t\t\tgetDefaultBlockName()\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\treplacement &&\n\t\t\t\t\t\t\t\treplacement.length &&\n\t\t\t\t\t\t\t\treplacement.every( ( block ) =>\n\t\t\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\t\t\ttargetRootClientId\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tinsertBlocks(\n\t\t\t\t\t\t\t\t\treplacement,\n\t\t\t\t\t\t\t\t\tgetBlockIndex( _clientId ),\n\t\t\t\t\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\t\t\t\t\tchangeSelection\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tremoveBlock( firstClientId, false );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tswitchToDefaultOrRemove();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! getBlockOrder( _clientId ).length &&\n\t\t\t\t\t\t\tisUnmodifiedBlock( getBlock( _clientId ) )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tremoveBlock( _clientId, false );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tswitchToDefaultOrRemove();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For `Delete` or forward merge, we should do the exact same thing\n\t\t\t// as `Backspace`, but from the other block.\n\t\t\tif ( forward ) {\n\t\t\t\tif ( rootClientId ) {\n\t\t\t\t\tconst nextRootClientId =\n\t\t\t\t\t\tgetNextBlockClientId( rootClientId );\n\n\t\t\t\t\tif ( nextRootClientId ) {\n\t\t\t\t\t\t// If there is a block that follows with the same parent\n\t\t\t\t\t\t// block name and the same attributes, merge the inner\n\t\t\t\t\t\t// blocks.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tgetBlockName( rootClientId ) ===\n\t\t\t\t\t\t\tgetBlockName( nextRootClientId )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst rootAttributes =\n\t\t\t\t\t\t\t\tgetBlockAttributes( rootClientId );\n\t\t\t\t\t\t\tconst previousRootAttributes =\n\t\t\t\t\t\t\t\tgetBlockAttributes( nextRootClientId );\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tObject.keys( rootAttributes ).every(\n\t\t\t\t\t\t\t\t\t( key ) =>\n\t\t\t\t\t\t\t\t\t\trootAttributes[ key ] ===\n\t\t\t\t\t\t\t\t\t\tpreviousRootAttributes[ key ]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\t\tgetBlockOrder( nextRootClientId ),\n\t\t\t\t\t\t\t\t\t\tnextRootClientId,\n\t\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tremoveBlock( nextRootClientId, false );\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmergeBlocks( rootClientId, nextRootClientId );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst nextBlockClientId = getNextBlockClientId( clientId );\n\n\t\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( getBlockOrder( nextBlockClientId ).length ) {\n\t\t\t\t\tmoveFirstItemUp( nextBlockClientId, false );\n\t\t\t\t} else {\n\t\t\t\t\tmergeBlocks( clientId, nextBlockClientId );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst previousBlockClientId =\n\t\t\t\t\tgetPreviousBlockClientId( clientId );\n\n\t\t\t\tif ( previousBlockClientId ) {\n\t\t\t\t\tmergeBlocks( previousBlockClientId, clientId );\n\t\t\t\t} else if ( rootClientId ) {\n\t\t\t\t\tconst previousRootClientId =\n\t\t\t\t\t\tgetPreviousBlockClientId( rootClientId );\n\n\t\t\t\t\t// If there is a preceding block with the same parent block\n\t\t\t\t\t// name and the same attributes, merge the inner blocks.\n\t\t\t\t\tif (\n\t\t\t\t\t\tpreviousRootClientId &&\n\t\t\t\t\t\tgetBlockName( rootClientId ) ===\n\t\t\t\t\t\t\tgetBlockName( previousRootClientId )\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst rootAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( rootClientId );\n\t\t\t\t\t\tconst previousRootAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( previousRootClientId );\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tObject.keys( rootAttributes ).every(\n\t\t\t\t\t\t\t\t( key ) =>\n\t\t\t\t\t\t\t\t\trootAttributes[ key ] ===\n\t\t\t\t\t\t\t\t\tpreviousRootAttributes[ key ]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\tgetBlockOrder( rootClientId ),\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\tpreviousRootClientId\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tremoveBlock( rootClientId, false );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tmoveFirstItemUp( rootClientId );\n\t\t\t\t} else {\n\t\t\t\t\tswitchToDefaultOrRemove();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonReplace( blocks, indexToSelect, initialPosition ) {\n\t\t\tif (\n\t\t\t\tblocks.length &&\n\t\t\t\t! isUnmodifiedDefaultBlock( blocks[ blocks.length - 1 ] )\n\t\t\t) {\n\t\t\t\t__unstableMarkLastChangeAsPersistent();\n\t\t\t}\n\t\t\t//Unsynced patterns are nested in an array so we need to flatten them.\n\t\t\tconst replacementBlocks =\n\t\t\t\tblocks?.length === 1 && Array.isArray( blocks[ 0 ] )\n\t\t\t\t\t? blocks[ 0 ]\n\t\t\t\t\t: blocks;\n\t\t\treplaceBlocks(\n\t\t\t\t[ ownProps.clientId ],\n\t\t\t\treplacementBlocks,\n\t\t\t\tindexToSelect,\n\t\t\t\tinitialPosition\n\t\t\t);\n\t\t},\n\t\tonRemove() {\n\t\t\tremoveBlock( ownProps.clientId );\n\t\t},\n\t\ttoggleSelection( selectionEnabled ) {\n\t\t\ttoggleSelection( selectionEnabled );\n\t\t},\n\t};\n} );\n\n// This component is used by the BlockListBlockProvider component below. It will\n// add the props necessary for the `editor.BlockListBlock` filters.\nBlockListBlock = compose(\n\tapplyWithDispatch,\n\twithFilters( 'editor.BlockListBlock' )\n)( BlockListBlock );\n\n// This component provides all the information we need through a single store\n// subscription (useSelect mapping). Only the necessary props are passed down\n// to the BlockListBlock component, which is a filtered component, so these\n// props are public API. To avoid adding to the public API, we use a private\n// context to pass the rest of the information to the filtered BlockListBlock\n// component, and useBlockProps.\nfunction BlockListBlockProvider( props ) {\n\tconst { clientId, rootClientId } = props;\n\tconst selectedProps = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockSelected,\n\t\t\t\tgetBlockMode,\n\t\t\t\tisSelectionEnabled,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tisSectionBlock: _isSectionBlock,\n\t\t\t\tgetParentSectionBlock,\n\t\t\t\tgetBlockWithoutAttributes,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tcanRemoveBlock,\n\t\t\t\tcanMoveBlock,\n\n\t\t\t\tgetSettings,\n\t\t\t\tgetEditedContentOnlySection,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetBlockName,\n\t\t\t\tisFirstMultiSelectedBlock,\n\t\t\t\tgetMultiSelectedBlockClientIds,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetBlocksByName,\n\n\t\t\t\tgetBlockIndex,\n\t\t\t\tisBlockMultiSelected,\n\t\t\t\tisBlockSubtreeDisabled,\n\t\t\t\tisBlockHighlighted,\n\t\t\t\t__unstableIsFullySelected,\n\t\t\t\t__unstableSelectionHasUnmergeableBlock,\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\tisDragging,\n\t\t\t\t__unstableHasActiveBlockOverlayActive,\n\t\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tconst blockWithoutAttributes =\n\t\t\t\tgetBlockWithoutAttributes( clientId );\n\n\t\t\t// This is a temporary fix.\n\t\t\t// This function should never be called when a block is not\n\t\t\t// present in the state. It happens now because the order in\n\t\t\t// withSelect rendering is not correct.\n\t\t\tif ( ! blockWithoutAttributes ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\thasBlockSupport: _hasBlockSupport,\n\t\t\t\tgetActiveBlockVariation,\n\t\t\t} = select( blocksStore );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst { name: blockName, isValid } = blockWithoutAttributes;\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst settings = getSettings();\n\t\t\tconst {\n\t\t\t\tsupportsLayout,\n\t\t\t\tisPreviewMode,\n\t\t\t\t__experimentalBlockBindingsSupportedAttributes,\n\t\t\t} = settings;\n\t\t\tconst bindableAttributes =\n\t\t\t\t__experimentalBlockBindingsSupportedAttributes?.[ blockName ];\n\t\t\tconst blockVisibility = attributes?.metadata?.blockVisibility;\n\t\t\tconst deviceType =\n\t\t\t\tsettings?.[ deviceTypeKey ]?.toLowerCase() || 'desktop';\n\n\t\t\tconst hasLightBlockWrapper = blockType?.apiVersion > 1;\n\t\t\tconst previewContext = {\n\t\t\t\tisPreviewMode,\n\t\t\t\tblockWithoutAttributes,\n\t\t\t\tname: blockName,\n\t\t\t\tattributes,\n\t\t\t\tisValid,\n\t\t\t\tthemeSupportsLayout: supportsLayout,\n\t\t\t\tindex: getBlockIndex( clientId ),\n\t\t\t\tisReusable: isReusableBlock( blockType ),\n\t\t\t\tclassName: hasLightBlockWrapper\n\t\t\t\t\t? attributes.className\n\t\t\t\t\t: undefined,\n\t\t\t\tdefaultClassName: hasLightBlockWrapper\n\t\t\t\t\t? getBlockDefaultClassName( blockName )\n\t\t\t\t\t: undefined,\n\t\t\t\tblockTitle: blockType?.title,\n\t\t\t\tbindableAttributes,\n\t\t\t\tblockVisibility,\n\t\t\t\tdeviceType,\n\t\t\t};\n\n\t\t\t// When in preview mode, we can avoid a lot of selection and\n\t\t\t// editing related selectors.\n\t\t\tif ( isPreviewMode ) {\n\t\t\t\treturn previewContext;\n\t\t\t}\n\t\t\tconst _isSelected = isBlockSelected( clientId );\n\t\t\tconst canRemove = canRemoveBlock( clientId );\n\t\t\tconst canMove = canMoveBlock( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\t\t\tconst isMultiSelected = isBlockMultiSelected( clientId );\n\t\t\tconst checkDeep = true;\n\t\t\tconst isAncestorOfSelectedBlock = hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\tcheckDeep\n\t\t\t);\n\t\t\tconst blockEditingMode = getBlockEditingMode( clientId );\n\t\t\tconst sectionBlockClientId = _isSectionBlock( clientId )\n\t\t\t\t? clientId\n\t\t\t\t: getParentSectionBlock( clientId );\n\n\t\t\tconst multiple = hasBlockSupport( blockName, 'multiple', true );\n\n\t\t\t// For block types with `multiple` support, there is no \"original\n\t\t\t// block\" to be found in the content, as the block itself is valid.\n\t\t\tconst blocksWithSameName = multiple\n\t\t\t\t? []\n\t\t\t\t: getBlocksByName( blockName );\n\t\t\tconst isInvalid =\n\t\t\t\tblocksWithSameName.length &&\n\t\t\t\tblocksWithSameName[ 0 ] !== clientId;\n\n\t\t\treturn {\n\t\t\t\t...previewContext,\n\t\t\t\tmode: getBlockMode( clientId ),\n\t\t\t\tisSelectionEnabled: isSelectionEnabled(),\n\t\t\t\tisLocked: !! getTemplateLock( rootClientId ),\n\t\t\t\tisSectionBlock: _isSectionBlock( clientId ),\n\t\t\t\tisWithinSectionBlock: !! sectionBlockClientId,\n\t\t\t\tisSelectionWithinCurrentSection:\n\t\t\t\t\tisBlockSelected( sectionBlockClientId ) ||\n\t\t\t\t\thasSelectedInnerBlock( sectionBlockClientId, checkDeep ),\n\t\t\t\tblockType,\n\t\t\t\tcanRemove,\n\t\t\t\tcanMove,\n\t\t\t\tisSelected: _isSelected,\n\t\t\t\tisEditingContentOnlySection:\n\t\t\t\t\tgetEditedContentOnlySection() === clientId,\n\t\t\t\tblockEditingMode,\n\t\t\t\tmayDisplayControls:\n\t\t\t\t\t_isSelected ||\n\t\t\t\t\t( isFirstMultiSelectedBlock( clientId ) &&\n\t\t\t\t\t\tgetMultiSelectedBlockClientIds().every(\n\t\t\t\t\t\t\t( id ) => getBlockName( id ) === blockName\n\t\t\t\t\t\t) ),\n\t\t\t\tmayDisplayParentControls:\n\t\t\t\t\t_hasBlockSupport(\n\t\t\t\t\t\tgetBlockName( clientId ),\n\t\t\t\t\t\t'__experimentalExposeControlsToChildren',\n\t\t\t\t\t\tfalse\n\t\t\t\t\t) && hasSelectedInnerBlock( clientId ),\n\t\t\t\tblockApiVersion: blockType?.apiVersion || 1,\n\t\t\t\tblockTitle: match?.title || blockType?.title,\n\t\t\t\tisSubtreeDisabled:\n\t\t\t\t\tblockEditingMode === 'disabled' &&\n\t\t\t\t\tisBlockSubtreeDisabled( clientId ),\n\t\t\t\thasOverlay:\n\t\t\t\t\t__unstableHasActiveBlockOverlayActive( clientId ) &&\n\t\t\t\t\t! isDragging(),\n\t\t\t\tinitialPosition: _isSelected\n\t\t\t\t\t? getSelectedBlocksInitialCaretPosition()\n\t\t\t\t\t: undefined,\n\t\t\t\tisHighlighted: isBlockHighlighted( clientId ),\n\t\t\t\tisMultiSelected,\n\t\t\t\tisPartiallySelected:\n\t\t\t\t\tisMultiSelected &&\n\t\t\t\t\t! __unstableIsFullySelected() &&\n\t\t\t\t\t! __unstableSelectionHasUnmergeableBlock(),\n\t\t\t\tisDragging: isBlockBeingDragged( clientId ),\n\t\t\t\thasChildSelected: isAncestorOfSelectedBlock,\n\t\t\t\tisEditingDisabled: blockEditingMode === 'disabled',\n\t\t\t\thasEditableOutline:\n\t\t\t\t\tblockEditingMode !== 'disabled' &&\n\t\t\t\t\tgetBlockEditingMode( rootClientId ) === 'disabled',\n\t\t\t\toriginalBlockClientId: isInvalid\n\t\t\t\t\t? blocksWithSameName[ 0 ]\n\t\t\t\t\t: false,\n\t\t\t\tblockVisibility,\n\t\t\t\tdeviceType,\n\t\t\t};\n\t\t},\n\t\t[ clientId, rootClientId ]\n\t);\n\n\tconst {\n\t\tisPreviewMode,\n\t\t// Fill values that end up as a public API and may not be defined in\n\t\t// preview mode.\n\t\tmode = 'visual',\n\t\tisSelectionEnabled = false,\n\t\tisLocked = false,\n\t\tcanRemove = false,\n\t\tcanMove = false,\n\t\tblockWithoutAttributes,\n\t\tname,\n\t\tattributes,\n\t\tisValid,\n\t\tisSelected = false,\n\t\tthemeSupportsLayout,\n\t\tisEditingContentOnlySection,\n\t\tblockEditingMode,\n\t\tmayDisplayControls,\n\t\tmayDisplayParentControls,\n\t\tindex,\n\t\tblockApiVersion,\n\t\tblockType,\n\t\tblockTitle,\n\t\tisSubtreeDisabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tisHighlighted,\n\t\tisMultiSelected,\n\t\tisPartiallySelected,\n\t\tisReusable,\n\t\tisDragging,\n\t\thasChildSelected,\n\t\tisSectionBlock,\n\t\tisWithinSectionBlock,\n\t\tisSelectionWithinCurrentSection,\n\t\tisEditingDisabled,\n\t\thasEditableOutline,\n\t\tclassName,\n\t\tdefaultClassName,\n\t\toriginalBlockClientId,\n\t\tbindableAttributes,\n\t\tblockVisibility,\n\t\tdeviceType,\n\t} = selectedProps;\n\n\t// Use block visibility hook with data from existing useSelect to avoid extra subscription\n\tconst { isBlockCurrentlyHidden } = useBlockVisibility( {\n\t\tblockVisibility,\n\t\tdeviceType,\n\t} );\n\n\t// Users of the editor.BlockListBlock filter used to be able to\n\t// access the block prop.\n\t// Ideally these blocks would rely on the clientId prop only.\n\t// This is kept for backward compatibility reasons.\n\tconst block = useMemo(\n\t\t() => ( { ...blockWithoutAttributes, attributes } ),\n\t\t[ blockWithoutAttributes, attributes ]\n\t);\n\n\t// Block is sometimes not mounted at the right time, causing it be\n\t// undefined see issue for more info\n\t// https://github.com/WordPress/gutenberg/issues/17013\n\tif ( ! selectedProps ) {\n\t\treturn null;\n\t}\n\n\tconst privateContext = {\n\t\tisPreviewMode,\n\t\tclientId,\n\t\tclassName,\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockType,\n\t\tblockTitle,\n\t\tisSelected,\n\t\tisSubtreeDisabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tblockEditingMode,\n\t\tisHighlighted,\n\t\tisMultiSelected,\n\t\tisPartiallySelected,\n\t\tisReusable,\n\t\tisDragging,\n\t\thasChildSelected,\n\t\tisSectionBlock,\n\t\tisWithinSectionBlock,\n\t\tisSelectionWithinCurrentSection,\n\t\tisEditingDisabled,\n\t\thasEditableOutline,\n\t\tisEditingContentOnlySection,\n\t\tdefaultClassName,\n\t\tmayDisplayControls,\n\t\tmayDisplayParentControls,\n\t\toriginalBlockClientId,\n\t\tthemeSupportsLayout,\n\t\tcanMove,\n\t\tisBlockCurrentlyHidden,\n\t\tbindableAttributes,\n\t\tblockVisibility,\n\t\tdeviceType,\n\t};\n\n\tif (\n\t\tisBlockCurrentlyHidden &&\n\t\t! isSelected &&\n\t\t! isMultiSelected &&\n\t\t! hasChildSelected\n\t) {\n\t\treturn null;\n\t}\n\n\t// Here we separate between the props passed to BlockListBlock and any other\n\t// information we selected for internal use. BlockListBlock is a filtered\n\t// component and thus ALL the props are PUBLIC API.\n\n\t// Note that the context value doesn't have to be memoized in this case\n\t// because when it changes, this component will be re-rendered anyway, and\n\t// none of the consumers (BlockListBlock and useBlockProps) are memoized or\n\t// \"pure\". This is different from the public BlockEditContext, where\n\t// consumers might be memoized or \"pure\".\n\treturn (\n\t\t<PrivateBlockContext.Provider value={ privateContext }>\n\t\t\t<BlockListBlock\n\t\t\t\t{ ...props }\n\t\t\t\t// WARNING: all the following props are public API (through the\n\t\t\t\t// editor.BlockListBlock filter) and normally nothing new should\n\t\t\t\t// be added to it.\n\t\t\t\t{ ...{\n\t\t\t\t\tmode,\n\t\t\t\t\tisSelectionEnabled,\n\t\t\t\t\tisLocked,\n\t\t\t\t\tcanRemove,\n\t\t\t\t\tcanMove,\n\t\t\t\t\t// Users of the editor.BlockListBlock filter used to be able\n\t\t\t\t\t// to access the block prop. Ideally these blocks would rely\n\t\t\t\t\t// on the clientId prop only. This is kept for backward\n\t\t\t\t\t// compatibility reasons.\n\t\t\t\t\tblock,\n\t\t\t\t\tname,\n\t\t\t\t\tattributes,\n\t\t\t\t\tisValid,\n\t\t\t\t\tisSelected,\n\t\t\t\t} }\n\t\t\t/>\n\t\t</PrivateBlockContext.Provider>\n\t);\n}\n\nexport default memo( BlockListBlockProvider );\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,MAAM,SAAS,YAAY,eAAe;AACnD;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,mBAAmB;AAC5B,SAAS,cAAc,iBAAiB;AACxC,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAKzB,OAAO,eAAe;AACtB,OAAO,yBAAyB;AAChC,OAAO,uBAAuB;AAC9B,OAAO,wBAAwB;AAC/B,OAAO,eAAe;AACtB,SAAS,qBAAqB;AAC9B,SAAS,SAAS,wBAAwB;AAC1C,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAoC5B,SAuHC,UAvHD,KA8GC,YA9GD;AA1BF,SAAS,kBAAmB,QAAQ,QAAS;AAC5C,QAAM,WAAW;AAAA,IAChB,GAAG;AAAA,IACH,GAAG;AAAA,EACJ;AAGA,MACC,QAAQ,eAAgB,WAAY,KACpC,QAAQ,eAAgB,WAAY,GACnC;AAC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AwB,WAAW;AAAA,IAChD,CAAE,wBAAwB,UAAW;AAAA,EACtC;AAKA,MAAK,CAAE,eAAgB;AACtB,WAAO;AAAA,EACR;AAEA,QAAM,iBAAiB;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,MACC,0BACA,CAAE,cACF,CAAE,mBACF,CAAE,kBACD;AACD,WAAO;AAAA,EACR;AAWA,SACC,oBAAC,oBAAoB,UAApB,EAA6B,OAAQ,gBACrC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MAIH,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA;AAAA;AAAA;AAAA,QAKA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA;AAAA,EACD,GACD;AAEF;AAEA,IAAO,gBAAQ,KAAM,sBAAuB;",
|
|
6
|
+
"names": ["isSelectionEnabled", "isDragging", "blockWithoutAttributes", "attributes", "isValid", "blockType", "isPreviewMode", "bindableAttributes", "blockVisibility", "deviceType", "canRemove", "canMove", "isMultiSelected", "blockEditingMode"]
|
|
7
7
|
}
|