@wordpress/block-library 9.45.1-next.v.202605131032.0 → 9.47.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/CHANGELOG.md +8 -0
- package/build/button/edit.cjs +7 -4
- package/build/button/edit.cjs.map +3 -3
- package/build/columns/edit.cjs +4 -10
- package/build/columns/edit.cjs.map +2 -2
- package/build/comments/edit/placeholder.cjs +1 -1
- package/build/comments/edit/placeholder.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +4 -2
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/freeform/migration-notice.cjs +1 -1
- package/build/freeform/migration-notice.cjs.map +1 -1
- package/build/home-link/block.json +7 -0
- package/build/home-link/edit.cjs +167 -24
- package/build/home-link/edit.cjs.map +3 -3
- package/build/html/edit.cjs +2 -4
- package/build/html/edit.cjs.map +2 -2
- package/build/html/modal.cjs +0 -4
- package/build/html/modal.cjs.map +2 -2
- package/build/image/block.json +4 -0
- package/build/image/deprecated.cjs +202 -4
- package/build/image/deprecated.cjs.map +3 -3
- package/build/image/image.cjs +80 -27
- package/build/image/image.cjs.map +2 -2
- package/build/image/index.cjs +23 -4
- package/build/image/index.cjs.map +2 -2
- package/build/image/save.cjs +25 -10
- package/build/image/save.cjs.map +2 -2
- package/build/image/transforms.cjs +15 -3
- package/build/image/transforms.cjs.map +2 -2
- package/build/image/use-open-image-media-editor-modal.cjs +29 -12
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/list-item/hooks/use-enter.cjs +8 -4
- package/build/list-item/hooks/use-enter.cjs.map +3 -3
- package/build/list-item/hooks/use-space.cjs +8 -4
- package/build/list-item/hooks/use-space.cjs.map +3 -3
- package/build/navigation-link/edit.cjs +2 -1
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-link/shared/use-handle-link-change.cjs +19 -3
- package/build/navigation-link/shared/use-handle-link-change.cjs.map +3 -3
- package/build/navigation-submenu/edit.cjs +8 -22
- package/build/navigation-submenu/edit.cjs.map +2 -2
- package/build/paragraph/use-enter.cjs +8 -4
- package/build/paragraph/use-enter.cjs.map +3 -3
- package/build/post-date/edit.cjs +9 -1
- package/build/post-date/edit.cjs.map +2 -2
- package/build/post-featured-image/edit.cjs +0 -1
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/site-logo/edit.cjs +1 -1
- package/build/site-logo/edit.cjs.map +2 -2
- package/build/social-link/edit.cjs.map +3 -3
- package/build/tab-list/edit.cjs +2 -0
- package/build/tab-list/edit.cjs.map +2 -2
- package/build/tab-panels/edit.cjs +5 -1
- package/build/tab-panels/edit.cjs.map +2 -2
- package/build/table/edit.cjs +1 -0
- package/build/table/edit.cjs.map +2 -2
- package/build/tabs/edit.cjs +1 -36
- package/build/tabs/edit.cjs.map +2 -2
- package/build-module/button/edit.mjs +12 -5
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/columns/edit.mjs +4 -10
- package/build-module/columns/edit.mjs.map +2 -2
- package/build-module/comments/edit/placeholder.mjs +1 -1
- package/build-module/comments/edit/placeholder.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +4 -3
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/freeform/migration-notice.mjs +1 -1
- package/build-module/freeform/migration-notice.mjs.map +1 -1
- package/build-module/home-link/block.json +7 -0
- package/build-module/home-link/edit.mjs +181 -26
- package/build-module/home-link/edit.mjs.map +2 -2
- package/build-module/html/edit.mjs +2 -4
- package/build-module/html/edit.mjs.map +2 -2
- package/build-module/html/modal.mjs +0 -4
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/image/block.json +4 -0
- package/build-module/image/deprecated.mjs +204 -5
- package/build-module/image/deprecated.mjs.map +2 -2
- package/build-module/image/image.mjs +81 -27
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/index.mjs +23 -4
- package/build-module/image/index.mjs.map +2 -2
- package/build-module/image/save.mjs +25 -10
- package/build-module/image/save.mjs.map +2 -2
- package/build-module/image/transforms.mjs +15 -3
- package/build-module/image/transforms.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +29 -12
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/list-item/hooks/use-enter.mjs +12 -5
- package/build-module/list-item/hooks/use-enter.mjs.map +2 -2
- package/build-module/list-item/hooks/use-space.mjs +12 -5
- package/build-module/list-item/hooks/use-space.mjs.map +2 -2
- package/build-module/navigation-link/edit.mjs +2 -1
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-handle-link-change.mjs +19 -3
- package/build-module/navigation-link/shared/use-handle-link-change.mjs.map +2 -2
- package/build-module/navigation-submenu/edit.mjs +9 -23
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/paragraph/use-enter.mjs +12 -5
- package/build-module/paragraph/use-enter.mjs.map +2 -2
- package/build-module/post-date/edit.mjs +9 -1
- package/build-module/post-date/edit.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +0 -1
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +1 -1
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/social-link/edit.mjs +2 -2
- package/build-module/social-link/edit.mjs.map +2 -2
- package/build-module/tab-list/edit.mjs +2 -0
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-panels/edit.mjs +5 -1
- package/build-module/tab-panels/edit.mjs.map +2 -2
- package/build-module/table/edit.mjs +1 -0
- package/build-module/table/edit.mjs.map +2 -2
- package/build-module/tabs/edit.mjs +2 -37
- package/build-module/tabs/edit.mjs.map +2 -2
- package/build-style/breadcrumbs/style-rtl.css +1 -1
- package/build-style/breadcrumbs/style.css +1 -1
- package/build-style/editor-rtl.css +0 -11
- package/build-style/editor.css +0 -11
- package/build-style/gallery/editor-rtl.css +0 -11
- package/build-style/gallery/editor.css +0 -11
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +42 -42
- package/src/block/edit-title.native.js +3 -3
- package/src/block/edit.native.js +2 -2
- package/src/breadcrumbs/style.scss +1 -1
- package/src/button/edit.js +14 -5
- package/src/columns/edit.js +3 -9
- package/src/comments/edit/placeholder.js +1 -1
- package/src/cover/controls.native.js +2 -2
- package/src/cover/edit/inspector-controls.js +8 -7
- package/src/cover/edit.native.js +6 -4
- package/src/cover/focal-point-settings-button.native.js +2 -2
- package/src/cover/test/edit.js +32 -31
- package/src/embed/embed-no-preview.native.js +7 -3
- package/src/embed/embed-placeholder.native.js +2 -2
- package/src/file/edit.native.js +2 -2
- package/src/freeform/migration-notice.js +1 -1
- package/src/gallery/editor.scss +0 -14
- package/src/home-link/block.json +7 -0
- package/src/home-link/edit.js +185 -22
- package/src/home-link/index.php +14 -2
- package/src/html/edit.js +14 -12
- package/src/html/modal.js +0 -5
- package/src/image/block.json +4 -0
- package/src/image/deprecated.js +236 -4
- package/src/image/edit.native.js +2 -2
- package/src/image/image.js +116 -41
- package/src/image/index.js +20 -1
- package/src/image/index.php +1 -1
- package/src/image/save.js +39 -12
- package/src/image/test/use-open-image-media-editor-modal.js +60 -0
- package/src/image/transforms.js +21 -5
- package/src/image/use-open-image-media-editor-modal.js +34 -16
- package/src/latest-posts/edit.native.js +2 -2
- package/src/list-item/hooks/use-enter.js +15 -5
- package/src/list-item/hooks/use-space.js +15 -5
- package/src/list-item/list-style-type.native.js +2 -2
- package/src/media-text/media-container.native.js +7 -3
- package/src/missing/edit.native.js +4 -4
- package/src/missing/test/edit.native.js +3 -3
- package/src/navigation/test/use-navigation-menu.js +8 -2
- package/src/navigation-link/edit.js +1 -0
- package/src/navigation-link/shared/test/use-handle-link-change.test.js +212 -0
- package/src/navigation-link/shared/use-handle-link-change.js +36 -9
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +134 -45
- package/src/navigation-submenu/edit.js +11 -28
- package/src/navigation-submenu/index.php +13 -0
- package/src/paragraph/use-enter.js +19 -5
- package/src/post-date/edit.js +7 -3
- package/src/post-featured-image/edit.js +0 -1
- package/src/search/edit.native.js +2 -2
- package/src/search/test/edit.native.js +2 -2
- package/src/site-logo/edit.js +2 -1
- package/src/social-link/edit.js +2 -2
- package/src/tab-list/edit.js +3 -0
- package/src/tab-panels/edit.js +10 -1
- package/src/table/edit.js +1 -0
- package/src/tabs/edit.js +14 -42
- package/src/video/edit.native.js +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/columns/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tNotice,\n\tRangeControl,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\nimport {\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\t__experimentalBlockVariationPicker,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\thasExplicitPercentColumnWidths,\n\tgetMappedColumnWidths,\n\tgetRedistributedColumnWidths,\n\ttoWidthPrecision,\n} from './utils';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/column',\n};\n\nfunction ColumnInspectorControls( {\n\tclientId,\n\tsetAttributes,\n\tisStackedOnMobile,\n} ) {\n\tconst { count, canInsertColumnBlock, minCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, canRemoveBlock, getBlockOrder } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blockOrder = getBlockOrder( clientId );\n\n\t\t\t// Get the indexes of columns for which removal is prevented.\n\t\t\t// The highest index will be used to determine the minimum column count.\n\t\t\tconst preventRemovalBlockIndexes = blockOrder.reduce(\n\t\t\t\t( acc, blockId, index ) => {\n\t\t\t\t\tif ( ! canRemoveBlock( blockId ) ) {\n\t\t\t\t\t\tacc.push( index );\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcount: blockOrder.length,\n\t\t\t\tcanInsertColumnBlock: canInsertBlockType(\n\t\t\t\t\t'core/column',\n\t\t\t\t\tclientId\n\t\t\t\t),\n\t\t\t\tminCount: Math.max( ...preventRemovalBlockIndexes ) + 1,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\n\t/**\n\t * Updates the column count, including necessary revisions to child Column\n\t * blocks to grant required or redistribute available space.\n\t *\n\t * @param {number} previousColumns Previous column count.\n\t * @param {number} newColumns New column count.\n\t */\n\tfunction updateColumns( previousColumns, newColumns ) {\n\t\tlet innerBlocks = getBlocks( clientId );\n\t\tconst hasExplicitWidths = hasExplicitPercentColumnWidths( innerBlocks );\n\n\t\t// Redistribute available width for existing inner blocks.\n\t\tconst isAddingColumn = newColumns > previousColumns;\n\n\t\tif ( isAddingColumn && hasExplicitWidths ) {\n\t\t\t// If adding a new column, assign width to the new column equal to\n\t\t\t// as if it were `1 / columns` of the total available space.\n\t\t\tconst newColumnWidth = toWidthPrecision( 100 / newColumns );\n\t\t\tconst newlyAddedColumns = newColumns - previousColumns;\n\n\t\t\t// Redistribute in consideration of pending block insertion as\n\t\t\t// constraining the available working width.\n\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\tinnerBlocks,\n\t\t\t\t100 - newColumnWidth * newlyAddedColumns\n\t\t\t);\n\n\t\t\tinnerBlocks = [\n\t\t\t\t...getMappedColumnWidths( innerBlocks, widths ),\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newlyAddedColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\twidth: `${ newColumnWidth }%`,\n\t\t\t\t\t} );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( isAddingColumn ) {\n\t\t\tinnerBlocks = [\n\t\t\t\t...innerBlocks,\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column' );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( newColumns < previousColumns ) {\n\t\t\t// The removed column will be the last of the inner blocks.\n\t\t\tinnerBlocks = innerBlocks.slice(\n\t\t\t\t0,\n\t\t\t\t-( previousColumns - newColumns )\n\t\t\t);\n\t\t\tif ( hasExplicitWidths ) {\n\t\t\t\t// Redistribute as if block is already removed.\n\t\t\t\tconst widths = getRedistributedColumnWidths( innerBlocks, 100 );\n\n\t\t\t\tinnerBlocks = getMappedColumnWidths( innerBlocks, widths );\n\t\t\t}\n\t\t}\n\n\t\treplaceInnerBlocks( clientId, innerBlocks );\n\t}\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tisStackedOnMobile: true,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t{ canInsertColumnBlock && (\n\t\t\t\t<VStack spacing={ 4 } style={ { gridColumn: '1 / -1' } }>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\tvalue={ count }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tupdateColumns( count, Math.max( minCount, value ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ Math.max( 1, minCount ) }\n\t\t\t\t\t\tmax={ Math.max( 6, count ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ count > 6 && (\n\t\t\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => isStackedOnMobile !== true }\n\t\t\t\tonDeselect={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tisStackedOnMobile: true,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\t\tchecked={ isStackedOnMobile }\n\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tisStackedOnMobile: ! isStackedOnMobile,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n\nfunction ColumnsEditContainer( { attributes, setAttributes, clientId } ) {\n\tconst { isStackedOnMobile, verticalAlignment, templateLock } = attributes;\n\tconst registry = useRegistry();\n\tconst { getBlockOrder } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst classes = clsx( {\n\t\t[ `are-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t\t[ `is-not-stacked-on-mobile` ]: ! isStackedOnMobile,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t\ttemplateLock,\n\t} );\n\n\t/**\n\t * Update all child Column blocks with a new vertical alignment setting\n\t * based on whatever alignment is passed in. This allows change to parent\n\t * to override anything set on a individual column basis.\n\t *\n\t * @param {string} newVerticalAlignment The vertical alignment setting.\n\t */\n\tfunction updateAlignment( newVerticalAlignment ) {\n\t\tconst innerBlockClientIds = getBlockOrder( clientId );\n\n\t\t// Update own and child Column block vertical alignments.\n\t\t// This is a single action; the batching prevents creating multiple history records.\n\t\tregistry.batch( () => {\n\t\t\tsetAttributes( { verticalAlignment: newVerticalAlignment } );\n\t\t\tupdateBlockAttributes( innerBlockClientIds, {\n\t\t\t\tverticalAlignment: newVerticalAlignment,\n\t\t\t} );\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<ColumnInspectorControls\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisStackedOnMobile={ isStackedOnMobile }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nfunction Placeholder( { clientId, name, setAttributes } ) {\n\tconst { blockType,
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC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AAS;AAIpD,aAAS,MAAO,MAAM;AACrB,oBAAe,EAAE,mBAAmB,qBAAqB,CAAE;AAC3D,4BAAuB,qBAAqB;AAAA,QAC3C,mBAAmB;AAAA,MACpB,CAAE;AAAA,IACH,CAAE;AAAA,EACH;AAEA,SACC,iCACC;AAAA,wBAAC,iBACA;AAAA,MAAC;AAAA;AAAA,QACA,UAAW;AAAA,QACX,OAAQ;AAAA;AAAA,IACT,GACD;AAAA,IACA,oBAAC,qBACA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD,GACD;AAAA,IACA,oBAAC,SAAM,GAAG,kBAAmB;AAAA,KAC9B;AAEF;AAEA,SAAS,YAAa,EAAE,UAAU,MAAM,cAAc,GAAI;AACzD,QAAM,EAAE,WAAW,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tNotice,\n\tRangeControl,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\nimport {\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\t__experimentalBlockVariationPicker,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\thasExplicitPercentColumnWidths,\n\tgetMappedColumnWidths,\n\tgetRedistributedColumnWidths,\n\ttoWidthPrecision,\n} from './utils';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/column',\n};\n\nfunction ColumnInspectorControls( {\n\tclientId,\n\tsetAttributes,\n\tisStackedOnMobile,\n} ) {\n\tconst { count, canInsertColumnBlock, minCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, canRemoveBlock, getBlockOrder } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blockOrder = getBlockOrder( clientId );\n\n\t\t\t// Get the indexes of columns for which removal is prevented.\n\t\t\t// The highest index will be used to determine the minimum column count.\n\t\t\tconst preventRemovalBlockIndexes = blockOrder.reduce(\n\t\t\t\t( acc, blockId, index ) => {\n\t\t\t\t\tif ( ! canRemoveBlock( blockId ) ) {\n\t\t\t\t\t\tacc.push( index );\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcount: blockOrder.length,\n\t\t\t\tcanInsertColumnBlock: canInsertBlockType(\n\t\t\t\t\t'core/column',\n\t\t\t\t\tclientId\n\t\t\t\t),\n\t\t\t\tminCount: Math.max( ...preventRemovalBlockIndexes ) + 1,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\n\t/**\n\t * Updates the column count, including necessary revisions to child Column\n\t * blocks to grant required or redistribute available space.\n\t *\n\t * @param {number} previousColumns Previous column count.\n\t * @param {number} newColumns New column count.\n\t */\n\tfunction updateColumns( previousColumns, newColumns ) {\n\t\tlet innerBlocks = getBlocks( clientId );\n\t\tconst hasExplicitWidths = hasExplicitPercentColumnWidths( innerBlocks );\n\n\t\t// Redistribute available width for existing inner blocks.\n\t\tconst isAddingColumn = newColumns > previousColumns;\n\n\t\tif ( isAddingColumn && hasExplicitWidths ) {\n\t\t\t// If adding a new column, assign width to the new column equal to\n\t\t\t// as if it were `1 / columns` of the total available space.\n\t\t\tconst newColumnWidth = toWidthPrecision( 100 / newColumns );\n\t\t\tconst newlyAddedColumns = newColumns - previousColumns;\n\n\t\t\t// Redistribute in consideration of pending block insertion as\n\t\t\t// constraining the available working width.\n\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\tinnerBlocks,\n\t\t\t\t100 - newColumnWidth * newlyAddedColumns\n\t\t\t);\n\n\t\t\tinnerBlocks = [\n\t\t\t\t...getMappedColumnWidths( innerBlocks, widths ),\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newlyAddedColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\twidth: `${ newColumnWidth }%`,\n\t\t\t\t\t} );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( isAddingColumn ) {\n\t\t\tinnerBlocks = [\n\t\t\t\t...innerBlocks,\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column' );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( newColumns < previousColumns ) {\n\t\t\t// The removed column will be the last of the inner blocks.\n\t\t\tinnerBlocks = innerBlocks.slice(\n\t\t\t\t0,\n\t\t\t\t-( previousColumns - newColumns )\n\t\t\t);\n\t\t\tif ( hasExplicitWidths ) {\n\t\t\t\t// Redistribute as if block is already removed.\n\t\t\t\tconst widths = getRedistributedColumnWidths( innerBlocks, 100 );\n\n\t\t\t\tinnerBlocks = getMappedColumnWidths( innerBlocks, widths );\n\t\t\t}\n\t\t}\n\n\t\treplaceInnerBlocks( clientId, innerBlocks );\n\t}\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tisStackedOnMobile: true,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t{ canInsertColumnBlock && (\n\t\t\t\t<VStack spacing={ 4 } style={ { gridColumn: '1 / -1' } }>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\tvalue={ count }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tupdateColumns( count, Math.max( minCount, value ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ Math.max( 1, minCount ) }\n\t\t\t\t\t\tmax={ Math.max( 6, count ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ count > 6 && (\n\t\t\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => isStackedOnMobile !== true }\n\t\t\t\tonDeselect={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tisStackedOnMobile: true,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\t\tchecked={ isStackedOnMobile }\n\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tisStackedOnMobile: ! isStackedOnMobile,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n\nfunction ColumnsEditContainer( { attributes, setAttributes, clientId } ) {\n\tconst { isStackedOnMobile, verticalAlignment, templateLock } = attributes;\n\tconst registry = useRegistry();\n\tconst { getBlockOrder } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst classes = clsx( {\n\t\t[ `are-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t\t[ `is-not-stacked-on-mobile` ]: ! isStackedOnMobile,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t\ttemplateLock,\n\t} );\n\n\t/**\n\t * Update all child Column blocks with a new vertical alignment setting\n\t * based on whatever alignment is passed in. This allows change to parent\n\t * to override anything set on a individual column basis.\n\t *\n\t * @param {string} newVerticalAlignment The vertical alignment setting.\n\t */\n\tfunction updateAlignment( newVerticalAlignment ) {\n\t\tconst innerBlockClientIds = getBlockOrder( clientId );\n\n\t\t// Update own and child Column block vertical alignments.\n\t\t// This is a single action; the batching prevents creating multiple history records.\n\t\tregistry.batch( () => {\n\t\t\tsetAttributes( { verticalAlignment: newVerticalAlignment } );\n\t\t\tupdateBlockAttributes( innerBlockClientIds, {\n\t\t\t\tverticalAlignment: newVerticalAlignment,\n\t\t\t} );\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<ColumnInspectorControls\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisStackedOnMobile={ isStackedOnMobile }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nfunction Placeholder( { clientId, name, setAttributes } ) {\n\tconst { blockType, variations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockVariations, getBlockType } = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tvariations: getBlockVariations( name, 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ blockType?.icon?.src }\n\t\t\t\tlabel={ blockType?.title }\n\t\t\t\tvariations={ variations }\n\t\t\t\tinstructions={ __( 'Divide into columns. Select a layout:' ) }\n\t\t\t\tonSelect={ ( nextVariation ) => {\n\t\t\t\t\tif ( nextVariation.attributes ) {\n\t\t\t\t\t\tsetAttributes( nextVariation.attributes );\n\t\t\t\t\t}\n\t\t\t\t\tif ( nextVariation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tnextVariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nconst ColumnsEdit = ( props ) => {\n\tconst { clientId } = props;\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocks( clientId ).length > 0,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks ? ColumnsEditContainer : Placeholder;\n\n\treturn <Component { ...props } />;\n};\n\nexport default ColumnsEdit;\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAA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M,EAAE,SAAS,IAAI;AACrB,QAAM,iBAAiB;AAAA,IACtB,CAAE,WACD,OAAQ,gBAAiB,EAAE,UAAW,QAAS,EAAE,SAAS;AAAA,IAC3D,CAAE,QAAS;AAAA,EACZ;AACA,QAAM,YAAY,iBAAiB,uBAAuB;AAE1D,SAAO,oBAAC,aAAY,GAAG,OAAQ;AAChC;AAEA,IAAO,eAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -13,7 +13,7 @@ function PostCommentsPlaceholder({ postType, postId }) {
|
|
|
13
13
|
(select) => select(blockEditorStore).getSettings().__experimentalDiscussionSettings?.avatarURL,
|
|
14
14
|
[]
|
|
15
15
|
);
|
|
16
|
-
return /* @__PURE__ */ jsxs("div", { className: "wp-block-comments__legacy-placeholder", inert:
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", { className: "wp-block-comments__legacy-placeholder", inert: true, children: [
|
|
17
17
|
/* @__PURE__ */ jsx("h3", {
|
|
18
18
|
/* translators: %s: Post title. */
|
|
19
19
|
children: sprintf(__("One response to %s"), postTitle)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/comments/edit/placeholder.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CommentsForm from '../../post-comments-form/form';\n\nexport default function PostCommentsPlaceholder( { postType, postId } ) {\n\tlet [ postTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tpostTitle = postTitle || __( 'Post Title' );\n\n\tconst avatarURL = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings?.avatarURL,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<div className=\"wp-block-comments__legacy-placeholder\" inert
|
|
5
|
-
"mappings": ";AAGA,SAAS,SAAS,wBAAwB;AAC1C,SAAS,IAAI,IAAI,eAAe;AAChC,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,gCAAgC;AAKzC,OAAO,kBAAkB;AAetB,cASE,YATF;AAbY,SAAR,wBAA0C,EAAE,UAAU,OAAO,GAAI;AACvE,MAAI,CAAE,SAAU,IAAI,cAAe,YAAY,UAAU,SAAS,MAAO;AACzE,cAAY,aAAa,GAAI,YAAa;AAE1C,QAAM,YAAY;AAAA,IACjB,CAAE,WACD,OAAQ,gBAAiB,EAAE,YAAY,EACrC,kCAAkC;AAAA,IACrC,CAAC;AAAA,EACF;AAEA,SACC,qBAAC,SAAI,WAAU,yCAAwC,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CommentsForm from '../../post-comments-form/form';\n\nexport default function PostCommentsPlaceholder( { postType, postId } ) {\n\tlet [ postTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tpostTitle = postTitle || __( 'Post Title' );\n\n\tconst avatarURL = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings?.avatarURL,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<div className=\"wp-block-comments__legacy-placeholder\" inert>\n\t\t\t<h3>\n\t\t\t\t{\n\t\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\t\tsprintf( __( 'One response to %s' ), postTitle )\n\t\t\t\t}\n\t\t\t</h3>\n\n\t\t\t<div className=\"navigation\">\n\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t<a href=\"#top\">\u00AB { __( 'Older Comments' ) }</a>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } \u00BB</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<ol className=\"commentlist\">\n\t\t\t\t<li className=\"comment even thread-even depth-1\">\n\t\t\t\t\t<article className=\"comment-body\">\n\t\t\t\t\t\t<footer className=\"comment-meta\">\n\t\t\t\t\t\t\t<div className=\"comment-author vcard\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt={ __( 'Commenter Avatar' ) }\n\t\t\t\t\t\t\t\t\tsrc={ avatarURL }\n\t\t\t\t\t\t\t\t\tclassName=\"avatar avatar-32 photo\"\n\t\t\t\t\t\t\t\t\theight=\"32\"\n\t\t\t\t\t\t\t\t\twidth=\"32\"\n\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<b className=\"fn\">\n\t\t\t\t\t\t\t\t\t<a href=\"#top\" className=\"url\">\n\t\t\t\t\t\t\t\t\t\t{ __( 'A WordPress Commenter' ) }\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</b>{ ' ' }\n\t\t\t\t\t\t\t\t<span className=\"says\">{ __( 'says' ) }:</span>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div className=\"comment-metadata\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">\n\t\t\t\t\t\t\t\t\t<time dateTime=\"2000-01-01T00:00:00+00:00\">\n\t\t\t\t\t\t\t\t\t\t{ __( 'January 1, 2000 at 00:00 am' ) }\n\t\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t\t\t\t<span className=\"edit-link\">\n\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\tclassName=\"comment-edit-link\"\n\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</footer>\n\n\t\t\t\t\t\t<div className=\"comment-content\">\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __( 'Hi, this is a comment.' ) }\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Commenter avatars come from <a>Gravatar</a>.'\n\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\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"https://gravatar.com/\" />\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</p>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div className=\"reply\">\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tclassName=\"comment-reply-link\"\n\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t'Reply to A WordPress Commenter'\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\t{\n\t\t\t\t\t\t\t\t\t/* translators: Comment reply button text. */\n\t\t\t\t\t\t\t\t\t_x( 'Reply', 'verb' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</article>\n\t\t\t\t</li>\n\t\t\t</ol>\n\n\t\t\t<div className=\"navigation\">\n\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t<a href=\"#top\">\u00AB { __( 'Older Comments' ) }</a>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } \u00BB</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<CommentsForm postId={ postId } postType={ postType } />\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,SAAS,wBAAwB;AAC1C,SAAS,IAAI,IAAI,eAAe;AAChC,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,gCAAgC;AAKzC,OAAO,kBAAkB;AAetB,cASE,YATF;AAbY,SAAR,wBAA0C,EAAE,UAAU,OAAO,GAAI;AACvE,MAAI,CAAE,SAAU,IAAI,cAAe,YAAY,UAAU,SAAS,MAAO;AACzE,cAAY,aAAa,GAAI,YAAa;AAE1C,QAAM,YAAY;AAAA,IACjB,CAAE,WACD,OAAQ,gBAAiB,EAAE,YAAY,EACrC,kCAAkC;AAAA,IACrC,CAAC;AAAA,EACF;AAEA,SACC,qBAAC,SAAI,WAAU,yCAAwC,OAAK,MAC3D;AAAA,wBAAC;AAAA;AAAA,MAGC,kBAAS,GAAI,oBAAqB,GAAG,SAAU;AAAA,KAEjD;AAAA,IAEA,qBAAC,SAAI,WAAU,cACd;AAAA,0BAAC,SAAI,WAAU,aACd,+BAAC,OAAE,MAAK,QAAO;AAAA;AAAA,QAAI,GAAI,gBAAiB;AAAA,SAAG,GAC5C;AAAA,MACA,oBAAC,SAAI,WAAU,cACd,+BAAC,OAAE,MAAK,QAAS;AAAA,WAAI,gBAAiB;AAAA,QAAG;AAAA,S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Aa;AAAA,YACZ;AAAA,UACD;AAAA;AAAA,UAIC,aAAI,SAAS,MAAO;AAAA;AAAA,MAEtB,GACD;AAAA,OACD,GACD,GACD;AAAA,IAEA,qBAAC,SAAI,WAAU,cACd;AAAA,0BAAC,SAAI,WAAU,aACd,+BAAC,OAAE,MAAK,QAAO;AAAA;AAAA,QAAI,GAAI,gBAAiB;AAAA,SAAG,GAC5C;AAAA,MACA,oBAAC,SAAI,WAAU,cACd,+BAAC,OAAE,MAAK,QAAS;AAAA,WAAI,gBAAiB;AAAA,QAAG;AAAA,SAAE,GAC5C;AAAA,OACD;AAAA,IAEA,oBAAC,gBAAa,QAAkB,UAAsB;AAAA,KACvD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// packages/block-library/src/cover/edit/inspector-controls.js
|
|
2
2
|
import { useMemo } from "@wordpress/element";
|
|
3
3
|
import {
|
|
4
|
-
ExternalLink,
|
|
5
4
|
FocalPointPicker,
|
|
6
5
|
RangeControl,
|
|
7
6
|
TextareaControl,
|
|
@@ -25,6 +24,7 @@ import {
|
|
|
25
24
|
import { __ } from "@wordpress/i18n";
|
|
26
25
|
import { useSelect } from "@wordpress/data";
|
|
27
26
|
import { store as coreStore } from "@wordpress/core-data";
|
|
27
|
+
import { Link } from "@wordpress/ui";
|
|
28
28
|
import { COVER_MIN_HEIGHT, mediaPosition } from "../shared.mjs";
|
|
29
29
|
import { unlock } from "../../lock-unlock.mjs";
|
|
30
30
|
import { useToolsPanelDropdownMenuProps } from "../../utils/hooks.mjs";
|
|
@@ -151,7 +151,7 @@ function CoverInspectorControls({
|
|
|
151
151
|
const colorGradientSettings = useMultipleOriginColorsAndGradients();
|
|
152
152
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
153
153
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
154
|
-
/* @__PURE__ */ jsx(InspectorControls, { children:
|
|
154
|
+
(!!url || useFeaturedImage) && /* @__PURE__ */ jsx(InspectorControls, { children: /* @__PURE__ */ jsxs(
|
|
155
155
|
ToolsPanel,
|
|
156
156
|
{
|
|
157
157
|
label: __("Settings"),
|
|
@@ -256,8 +256,9 @@ function CoverInspectorControls({
|
|
|
256
256
|
onChange: (newAlt) => setAttributes({ alt: newAlt }),
|
|
257
257
|
help: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
258
258
|
/* @__PURE__ */ jsx(
|
|
259
|
-
|
|
259
|
+
Link,
|
|
260
260
|
{
|
|
261
|
+
openInNewTab: true,
|
|
261
262
|
href: (
|
|
262
263
|
// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
|
|
263
264
|
__(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cover/edit/inspector-controls.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tExternalLink,\n\tFocalPointPicker,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\tstore as blockEditorStore,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\nimport { unlock } from '../../lock-unlock';\nimport { useToolsPanelDropdownMenuProps } from '../../utils/hooks';\nimport { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';\nimport PosterImage from '../../utils/poster-image';\n\nconst { cleanEmptyObject, ResolutionTool, HTMLElementControl } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n\tupdateDimRatio,\n\tfeaturedImage,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tid,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t\tposter,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst sizeSlug = attributes.sizeSlug || DEFAULT_MEDIA_SIZE_SLUG;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\tconst { getSettings } = useSelect( blockEditorStore );\n\n\tconst imageSizes = getSettings()?.imageSizes;\n\n\tconst image = useSelect(\n\t\t( select ) =>\n\t\t\tid && isImageBackground\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\tid,\n\t\t\t\t\t\t{ context: 'view' }\n\t\t\t\t )\n\t\t\t\t: null,\n\t\t[ id, isImageBackground ]\n\t);\n\n\tconst currentBackgroundImage = useFeaturedImage ? featuredImage : image;\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl =\n\t\t\tcurrentBackgroundImage?.media_details?.sizes?.[ newSizeSlug ]\n\t\t\t\t?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tconst imageSizeOptions = imageSizes\n\t\t?.filter(\n\t\t\t( { slug } ) =>\n\t\t\t\tcurrentBackgroundImage?.media_details?.sizes?.[ slug ]\n\t\t\t\t\t?.source_url\n\t\t)\n\t\t?.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker = isVideoBackground || isImageBackground;\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ ( !! url || useFeaturedImage ) && (\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\thasParallax: false,\n\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\tisRepeated: false,\n\t\t\t\t\t\t\t\talt: '',\n\t\t\t\t\t\t\t\tposter: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tupdateImage( DEFAULT_MEDIA_SIZE_SLUG );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\thasValue={ () => !! hasParallax }\n\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\thasParallax: false,\n\t\t\t\t\t\t\t\t\t\t\tfocalPoint: undefined,\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\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ !! hasParallax }\n\t\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\thasValue={ () => isRepeated }\n\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tisRepeated: false,\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\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! focalPoint }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: 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\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\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</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isVideoBackground && (\n\t\t\t\t\t\t\t<PosterImage\n\t\t\t\t\t\t\t\tposter={ poster }\n\t\t\t\t\t\t\t\tonChange={ ( posterImage ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tposter: posterImage?.url,\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\t{ ! useFeaturedImage && url && ! isVideoBackground && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! alt }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: '' } )\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\t<TextareaControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t\t\t\t\t\t\t// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.\n\t\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'https://www.w3.org/WAI/tutorials/images/decision-tree/'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Leave empty if decorative.'\n\t\t\t\t\t\t\t\t\t\t\t) }\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</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ !! imageSizeOptions?.length && (\n\t\t\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\t\t\tdefaultValue={ DEFAULT_MEDIA_SIZE_SLUG }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t\tclearable: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () => updateDimRatio( url ? 50 : 100 ) }\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\t\t\tupdateDimRatio( newDimRatio )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tattributes?.style?.dimensions?.aspectRatio\n\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t: minHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeight: newMinHeight,\n\t\t\t\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\t\t\t\tdimensions: {\n\t\t\t\t\t\t\t\t\t\t...attributes?.style?.dimensions,\n\t\t\t\t\t\t\t\t\t\taspectRatio: undefined, // Reset aspect ratio when minHeight is set.\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\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,eAAe;AACxB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tFocalPointPicker,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\tstore as blockEditorStore,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Link } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\nimport { unlock } from '../../lock-unlock';\nimport { useToolsPanelDropdownMenuProps } from '../../utils/hooks';\nimport { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';\nimport PosterImage from '../../utils/poster-image';\n\nconst { cleanEmptyObject, ResolutionTool, HTMLElementControl } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n\tupdateDimRatio,\n\tfeaturedImage,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tid,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t\tposter,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst sizeSlug = attributes.sizeSlug || DEFAULT_MEDIA_SIZE_SLUG;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\tconst { getSettings } = useSelect( blockEditorStore );\n\n\tconst imageSizes = getSettings()?.imageSizes;\n\n\tconst image = useSelect(\n\t\t( select ) =>\n\t\t\tid && isImageBackground\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\tid,\n\t\t\t\t\t\t{ context: 'view' }\n\t\t\t\t )\n\t\t\t\t: null,\n\t\t[ id, isImageBackground ]\n\t);\n\n\tconst currentBackgroundImage = useFeaturedImage ? featuredImage : image;\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl =\n\t\t\tcurrentBackgroundImage?.media_details?.sizes?.[ newSizeSlug ]\n\t\t\t\t?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tconst imageSizeOptions = imageSizes\n\t\t?.filter(\n\t\t\t( { slug } ) =>\n\t\t\t\tcurrentBackgroundImage?.media_details?.sizes?.[ slug ]\n\t\t\t\t\t?.source_url\n\t\t)\n\t\t?.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker = isVideoBackground || isImageBackground;\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t{ ( !! url || useFeaturedImage ) && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\thasParallax: false,\n\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\tisRepeated: false,\n\t\t\t\t\t\t\t\talt: '',\n\t\t\t\t\t\t\t\tposter: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tupdateImage( DEFAULT_MEDIA_SIZE_SLUG );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\thasValue={ () => !! hasParallax }\n\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\thasParallax: false,\n\t\t\t\t\t\t\t\t\t\t\tfocalPoint: undefined,\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\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ !! hasParallax }\n\t\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\thasValue={ () => isRepeated }\n\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tisRepeated: false,\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\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! focalPoint }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: 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\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\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</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isVideoBackground && (\n\t\t\t\t\t\t\t<PosterImage\n\t\t\t\t\t\t\t\tposter={ poster }\n\t\t\t\t\t\t\t\tonChange={ ( posterImage ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tposter: posterImage?.url,\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\t{ ! useFeaturedImage && url && ! isVideoBackground && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! alt }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: '' } )\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\t<TextareaControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\t\t\t\topenInNewTab\n\t\t\t\t\t\t\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t\t\t\t\t\t\t// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.\n\t\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'https://www.w3.org/WAI/tutorials/images/decision-tree/'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Leave empty if decorative.'\n\t\t\t\t\t\t\t\t\t\t\t) }\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</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ !! imageSizeOptions?.length && (\n\t\t\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\t\t\tdefaultValue={ DEFAULT_MEDIA_SIZE_SLUG }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t\tclearable: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () => updateDimRatio( url ? 50 : 100 ) }\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\t\t\tupdateDimRatio( newDimRatio )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tattributes?.style?.dimensions?.aspectRatio\n\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t: minHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeight: newMinHeight,\n\t\t\t\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\t\t\t\tdimensions: {\n\t\t\t\t\t\t\t\t\t\t...attributes?.style?.dimensions,\n\t\t\t\t\t\t\t\t\t\taspectRatio: undefined, // Reset aspect ratio when minHeight is set.\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\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,eAAe;AACxB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,kDAAkD;AAAA,OAC5C;AACP,SAAS,qBAAqB;AAC9B;AAAA,EACC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,+CAA+C;AAAA,EAC/C;AAAA,EACA,qDAAqD;AAAA,EACrD,eAAe;AAAA,OACT;AACP,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,YAAY;AAKrB,SAAS,kB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,OAAO,UAAU;AAAA,UACvC,EAAE,OAAO,aAAa,OAAO,UAAU;AAAA,UACvC,EAAE,OAAO,WAAW,OAAO,QAAQ;AAAA,UACnC,EAAE,OAAO,YAAY,OAAO,SAAS;AAAA,QACtC;AAAA;AAAA,IACD,GACD;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -28,7 +28,7 @@ function MigrationNotice({ content, onReplace }) {
|
|
|
28
28
|
)
|
|
29
29
|
];
|
|
30
30
|
return /* @__PURE__ */ jsx(Warning, { actions, children: __(
|
|
31
|
-
"The Classic block is being phased out. Convert this content to blocks for the best editing experience, or move it to a Custom HTML block to preserve the markup
|
|
31
|
+
"The Classic block is being phased out. Convert this content to blocks for the best editing experience, or move it to a Custom HTML block to preserve the original markup."
|
|
32
32
|
) });
|
|
33
33
|
}
|
|
34
34
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/freeform/migration-notice.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Warning } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { createBlock, rawHandler } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Block-level deprecation warning rendered when the\n * `gutenberg-classic-block-deprecation` experiment is enabled.\n *\n * Uses the same `Warning` primitive as `core/missing` so the experience is\n * visually consistent with how the editor already surfaces deprecated blocks,\n * and offers two migration actions - a primary \"Convert to blocks\", and a\n * secondary \"Convert to Custom HTML\".\n *\n * @param {Object} props\n * @param {string} props.content Raw HTML content of the Classic block.\n * @param {Function} props.onReplace Replace the current block with the given blocks.\n */\nexport default function MigrationNotice( { content, onReplace } ) {\n\tconst actions = [\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tkey=\"convert-to-blocks\"\n\t\t\tvariant=\"primary\"\n\t\t\tonClick={ () => onReplace( rawHandler( { HTML: content } ) ) }\n\t\t>\n\t\t\t{ __( 'Convert to blocks' ) }\n\t\t</Button>,\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tkey=\"convert-to-html\"\n\t\t\tvariant=\"secondary\"\n\t\t\tonClick={ () =>\n\t\t\t\tonReplace( createBlock( 'core/html', { content } ) )\n\t\t\t}\n\t\t>\n\t\t\t{ __( 'Convert to HTML' ) }\n\t\t</Button>,\n\t];\n\n\treturn (\n\t\t<Warning actions={ actions }>\n\t\t\t{ __(\n\t\t\t\t'The Classic block is being phased out. Convert this content to blocks for the best editing experience, or move it to a Custom HTML block to preserve the markup
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Warning } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { createBlock, rawHandler } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Block-level deprecation warning rendered when the\n * `gutenberg-classic-block-deprecation` experiment is enabled.\n *\n * Uses the same `Warning` primitive as `core/missing` so the experience is\n * visually consistent with how the editor already surfaces deprecated blocks,\n * and offers two migration actions - a primary \"Convert to blocks\", and a\n * secondary \"Convert to Custom HTML\".\n *\n * @param {Object} props\n * @param {string} props.content Raw HTML content of the Classic block.\n * @param {Function} props.onReplace Replace the current block with the given blocks.\n */\nexport default function MigrationNotice( { content, onReplace } ) {\n\tconst actions = [\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tkey=\"convert-to-blocks\"\n\t\t\tvariant=\"primary\"\n\t\t\tonClick={ () => onReplace( rawHandler( { HTML: content } ) ) }\n\t\t>\n\t\t\t{ __( 'Convert to blocks' ) }\n\t\t</Button>,\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tkey=\"convert-to-html\"\n\t\t\tvariant=\"secondary\"\n\t\t\tonClick={ () =>\n\t\t\t\tonReplace( createBlock( 'core/html', { content } ) )\n\t\t\t}\n\t\t>\n\t\t\t{ __( 'Convert to HTML' ) }\n\t\t</Button>,\n\t];\n\n\treturn (\n\t\t<Warning actions={ actions }>\n\t\t\t{ __(\n\t\t\t\t'The Classic block is being phased out. Convert this content to blocks for the best editing experience, or move it to a Custom HTML block to preserve the original markup.'\n\t\t\t) }\n\t\t</Warning>\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";AAGA,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,aAAa,kBAAkB;AACxC,SAAS,UAAU;AAiBjB;AAFa,SAAR,gBAAkC,EAAE,SAAS,UAAU,GAAI;AACjE,QAAM,UAAU;AAAA,IACf;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QAErB,SAAQ;AAAA,QACR,SAAU,MAAM,UAAW,WAAY,EAAE,MAAM,QAAQ,CAAE,CAAE;AAAA,QAEzD,aAAI,mBAAoB;AAAA;AAAA,MAJtB;AAAA,IAKL;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QAErB,SAAQ;AAAA,QACR,SAAU,MACT,UAAW,YAAa,aAAa,EAAE,QAAQ,CAAE,CAAE;AAAA,QAGlD,aAAI,iBAAkB;AAAA;AAAA,MANpB;AAAA,IAOL;AAAA,EACD;AAEA,SACC,oBAAC,WAAQ,SACN;AAAA,IACD;AAAA,EACD,GACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,16 +1,53 @@
|
|
|
1
1
|
// packages/block-library/src/home-link/edit.js
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
InspectorControls,
|
|
5
|
+
RichText,
|
|
6
|
+
useBlockProps,
|
|
7
|
+
store as blockEditorStore
|
|
8
|
+
} from "@wordpress/block-editor";
|
|
9
|
+
import {
|
|
10
|
+
Button,
|
|
11
|
+
CheckboxControl,
|
|
12
|
+
TextControl,
|
|
13
|
+
TextareaControl,
|
|
14
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
15
|
+
__experimentalToolsPanelItem as ToolsPanelItem
|
|
16
|
+
} from "@wordpress/components";
|
|
4
17
|
import { __ } from "@wordpress/i18n";
|
|
5
18
|
import { useSelect } from "@wordpress/data";
|
|
6
19
|
import { store as coreStore } from "@wordpress/core-data";
|
|
7
|
-
import {
|
|
20
|
+
import { external } from "@wordpress/icons";
|
|
21
|
+
import { __unstableStripHTML as stripHTML } from "@wordpress/dom";
|
|
22
|
+
import { useToolsPanelDropdownMenuProps } from "../utils/hooks.mjs";
|
|
23
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
24
|
var preventDefault = (event) => event.preventDefault();
|
|
9
25
|
function HomeEdit({ attributes, setAttributes, context }) {
|
|
10
|
-
const
|
|
11
|
-
|
|
26
|
+
const {
|
|
27
|
+
homeUrl,
|
|
28
|
+
onNavigateToEntityRecord,
|
|
29
|
+
frontPageId,
|
|
30
|
+
frontPageTemplateId
|
|
31
|
+
} = useSelect((select) => {
|
|
32
|
+
const { getEntityRecord, getDefaultTemplateId, canUser } = select(coreStore);
|
|
33
|
+
const baseUrl = getEntityRecord("root", "__unstableBase")?.home;
|
|
34
|
+
const canReadSettings = canUser("read", {
|
|
35
|
+
kind: "root",
|
|
36
|
+
name: "site"
|
|
37
|
+
});
|
|
38
|
+
const site = canReadSettings ? getEntityRecord("root", "site") : null;
|
|
39
|
+
const resolvedFrontPageId = site?.show_on_front === "page" ? site?.page_on_front : null;
|
|
40
|
+
const resolvedFrontPageTemplateId = !resolvedFrontPageId ? getDefaultTemplateId({ slug: "front-page" }) : null;
|
|
41
|
+
return {
|
|
42
|
+
homeUrl: baseUrl,
|
|
43
|
+
onNavigateToEntityRecord: select(blockEditorStore).getSettings().onNavigateToEntityRecord,
|
|
44
|
+
frontPageId: resolvedFrontPageId,
|
|
45
|
+
frontPageTemplateId: resolvedFrontPageTemplateId
|
|
46
|
+
};
|
|
12
47
|
}, []);
|
|
13
48
|
const { textColor, backgroundColor, style } = context;
|
|
49
|
+
const { label, opensInNewTab, description } = attributes;
|
|
50
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
14
51
|
const blockProps = useBlockProps({
|
|
15
52
|
className: clsx("wp-block-navigation-item", {
|
|
16
53
|
"has-text-color": !!textColor || !!style?.color?.text,
|
|
@@ -23,28 +60,146 @@ function HomeEdit({ attributes, setAttributes, context }) {
|
|
|
23
60
|
backgroundColor: style?.color?.background
|
|
24
61
|
}
|
|
25
62
|
});
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
63
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
64
|
+
/* @__PURE__ */ jsx(InspectorControls, { group: "content", children: /* @__PURE__ */ jsxs(
|
|
65
|
+
ToolsPanel,
|
|
66
|
+
{
|
|
67
|
+
label: __("Settings"),
|
|
68
|
+
resetAll: () => {
|
|
69
|
+
setAttributes({
|
|
70
|
+
label: "",
|
|
71
|
+
opensInNewTab: false,
|
|
72
|
+
description: ""
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
dropdownMenuProps,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
ToolsPanelItem,
|
|
79
|
+
{
|
|
80
|
+
hasValue: () => !!label,
|
|
81
|
+
label: __("Text"),
|
|
82
|
+
onDeselect: () => setAttributes({ label: "" }),
|
|
83
|
+
isShownByDefault: true,
|
|
84
|
+
children: /* @__PURE__ */ jsx(
|
|
85
|
+
TextControl,
|
|
86
|
+
{
|
|
87
|
+
__next40pxDefaultSize: true,
|
|
88
|
+
label: __("Text"),
|
|
89
|
+
value: label ? stripHTML(label) : "",
|
|
90
|
+
onChange: (labelValue) => {
|
|
91
|
+
setAttributes({ label: labelValue });
|
|
92
|
+
},
|
|
93
|
+
autoComplete: "off"
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
ToolsPanelItem,
|
|
100
|
+
{
|
|
101
|
+
hasValue: () => !!opensInNewTab,
|
|
102
|
+
label: __("Open in new tab"),
|
|
103
|
+
onDeselect: () => setAttributes({ opensInNewTab: false }),
|
|
104
|
+
isShownByDefault: true,
|
|
105
|
+
children: /* @__PURE__ */ jsx(
|
|
106
|
+
CheckboxControl,
|
|
107
|
+
{
|
|
108
|
+
label: __("Open in new tab"),
|
|
109
|
+
checked: opensInNewTab,
|
|
110
|
+
onChange: (value) => setAttributes({ opensInNewTab: value })
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
onNavigateToEntityRecord && (frontPageId || frontPageTemplateId) && /* @__PURE__ */ jsx(
|
|
116
|
+
Button,
|
|
117
|
+
{
|
|
118
|
+
variant: "secondary",
|
|
119
|
+
onClick: () => {
|
|
120
|
+
if (frontPageId) {
|
|
121
|
+
onNavigateToEntityRecord({
|
|
122
|
+
postId: frontPageId,
|
|
123
|
+
postType: "page"
|
|
124
|
+
});
|
|
125
|
+
} else {
|
|
126
|
+
onNavigateToEntityRecord({
|
|
127
|
+
postId: frontPageTemplateId,
|
|
128
|
+
postType: "wp_template"
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
__next40pxDefaultSize: true,
|
|
133
|
+
className: "navigation-link-to__action-button",
|
|
134
|
+
children: __("Edit")
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
homeUrl && /* @__PURE__ */ jsx(
|
|
138
|
+
Button,
|
|
139
|
+
{
|
|
140
|
+
variant: "secondary",
|
|
141
|
+
href: homeUrl,
|
|
142
|
+
target: "_blank",
|
|
143
|
+
icon: external,
|
|
144
|
+
iconPosition: "right",
|
|
145
|
+
__next40pxDefaultSize: true,
|
|
146
|
+
className: "navigation-link-to__action-button",
|
|
147
|
+
children: __("View")
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
ToolsPanelItem,
|
|
152
|
+
{
|
|
153
|
+
hasValue: () => !!description,
|
|
154
|
+
label: __("Description"),
|
|
155
|
+
onDeselect: () => setAttributes({ description: "" }),
|
|
156
|
+
isShownByDefault: true,
|
|
157
|
+
children: /* @__PURE__ */ jsx(
|
|
158
|
+
TextareaControl,
|
|
159
|
+
{
|
|
160
|
+
label: __("Description"),
|
|
161
|
+
value: description || "",
|
|
162
|
+
onChange: (descriptionValue) => {
|
|
163
|
+
setAttributes({
|
|
164
|
+
description: descriptionValue
|
|
165
|
+
});
|
|
166
|
+
},
|
|
167
|
+
help: __(
|
|
168
|
+
"The description will be displayed in the menu if the current theme supports it."
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
) }),
|
|
177
|
+
/* @__PURE__ */ jsx("div", { ...blockProps, children: /* @__PURE__ */ jsxs(
|
|
178
|
+
"a",
|
|
179
|
+
{
|
|
180
|
+
className: "wp-block-home-link__content wp-block-navigation-item__content",
|
|
181
|
+
href: homeUrl,
|
|
182
|
+
onClick: preventDefault,
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ jsx(
|
|
185
|
+
RichText,
|
|
186
|
+
{
|
|
187
|
+
identifier: "label",
|
|
188
|
+
className: "wp-block-home-link__label",
|
|
189
|
+
value: label ?? __("Home"),
|
|
190
|
+
onChange: (labelValue) => {
|
|
191
|
+
setAttributes({ label: labelValue });
|
|
192
|
+
},
|
|
193
|
+
"aria-label": __("Home link text"),
|
|
194
|
+
placeholder: __("Add label\u2026"),
|
|
195
|
+
withoutInteractiveFormatting: true
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
description && /* @__PURE__ */ jsx("span", { className: "wp-block-navigation-item__description", children: description })
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
) })
|
|
202
|
+
] });
|
|
48
203
|
}
|
|
49
204
|
export {
|
|
50
205
|
HomeEdit as default
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/home-link/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\tCheckboxControl,\n\tTextControl,\n\tTextareaControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { external } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst preventDefault = ( event ) => event.preventDefault();\n\nexport default function HomeEdit( { attributes, setAttributes, context } ) {\n\tconst {\n\t\thomeUrl,\n\t\tonNavigateToEntityRecord,\n\t\tfrontPageId,\n\t\tfrontPageTemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, getDefaultTemplateId, canUser } =\n\t\t\tselect( coreStore );\n\n\t\t// Site index.\n\t\tconst baseUrl = getEntityRecord( 'root', '__unstableBase' )?.home;\n\n\t\t// Front-page data (only available if the user can read site settings).\n\t\tconst canReadSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} );\n\t\tconst site = canReadSettings ? getEntityRecord( 'root', 'site' ) : null;\n\t\tconst resolvedFrontPageId =\n\t\t\tsite?.show_on_front === 'page' ? site?.page_on_front : null;\n\n\t\t// When no specific front page is set, fall back to the front-page template.\n\t\tconst resolvedFrontPageTemplateId = ! resolvedFrontPageId\n\t\t\t? getDefaultTemplateId( { slug: 'front-page' } )\n\t\t\t: null;\n\n\t\treturn {\n\t\t\thomeUrl: baseUrl,\n\t\t\tonNavigateToEntityRecord:\n\t\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t\t.onNavigateToEntityRecord,\n\t\t\tfrontPageId: resolvedFrontPageId,\n\t\t\tfrontPageTemplateId: resolvedFrontPageTemplateId,\n\t\t};\n\t}, [] );\n\n\tconst { textColor, backgroundColor, style } = context;\n\tconst { label, opensInNewTab, description } = attributes;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wp-block-navigation-item', {\n\t\t\t'has-text-color': !! textColor || !! style?.color?.text,\n\t\t\t[ `has-${ textColor }-color` ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || !! style?.color?.background,\n\t\t\t[ `has-${ backgroundColor }-background-color` ]: !! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: style?.color?.text,\n\t\t\tbackgroundColor: style?.color?.background,\n\t\t},\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"content\">\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tlabel: '',\n\t\t\t\t\t\t\topensInNewTab: false,\n\t\t\t\t\t\t\tdescription: '',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! label }\n\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { label: '' } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! opensInNewTab }\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { opensInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tchecked={ opensInNewTab }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { opensInNewTab: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ onNavigateToEntityRecord &&\n\t\t\t\t\t\t( frontPageId || frontPageTemplateId ) && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tif ( frontPageId ) {\n\t\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\t\tpostId: frontPageId,\n\t\t\t\t\t\t\t\t\t\t\tpostType: 'page',\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\t\tpostId: frontPageTemplateId,\n\t\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\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\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tclassName=\"navigation-link-to__action-button\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t{ homeUrl && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\ticonPosition=\"right\"\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"navigation-link-to__action-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'View' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! description }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { description: '' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<a\n\t\t\t\t\tclassName=\"wp-block-home-link__content wp-block-navigation-item__content\"\n\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\tonClick={ preventDefault }\n\t\t\t\t>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName=\"wp-block-home-link__label\"\n\t\t\t\t\t\tvalue={ label ?? __( 'Home' ) }\n\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\taria-label={ __( 'Home link text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add label\u2026' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t/>\n\t\t\t\t\t{ description && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;A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AAI,MAAO;AAAA,cAC5B,UAAW,CAAE,eAAgB;AAC5B,8BAAe,EAAE,OAAO,WAAW,CAAE;AAAA,cACtC;AAAA,cACA,cAAa,GAAI,gBAAiB;AAAA,cAClC,aAAc,GAAI,iBAAa;AAAA,cAC/B,8BAA4B;AAAA;AAAA,UAC7B;AAAA,UACE,eACD,oBAAC,UAAK,WAAU,yCACb,uBACH;AAAA;AAAA;AAAA,IAEF,GACD;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -44,10 +44,9 @@ function HTMLEdit({ attributes, setAttributes, isSelected }) {
|
|
|
44
44
|
)
|
|
45
45
|
}
|
|
46
46
|
),
|
|
47
|
-
/* @__PURE__ */ jsx(
|
|
47
|
+
isModalOpen && /* @__PURE__ */ jsx(
|
|
48
48
|
HTMLEditModal,
|
|
49
49
|
{
|
|
50
|
-
isOpen: isModalOpen,
|
|
51
50
|
onRequestClose: () => setIsModalOpen(false),
|
|
52
51
|
content: attributes.content,
|
|
53
52
|
setAttributes
|
|
@@ -75,10 +74,9 @@ function HTMLEdit({ attributes, setAttributes, isSelected }) {
|
|
|
75
74
|
}
|
|
76
75
|
) }),
|
|
77
76
|
/* @__PURE__ */ jsx(Preview, { content: attributes.content, isSelected }),
|
|
78
|
-
/* @__PURE__ */ jsx(
|
|
77
|
+
isModalOpen && /* @__PURE__ */ jsx(
|
|
79
78
|
HTMLEditModal,
|
|
80
79
|
{
|
|
81
|
-
isOpen: isModalOpen,
|
|
82
80
|
onRequestClose: () => setIsModalOpen(false),
|
|
83
81
|
content: attributes.content,
|
|
84
82
|
setAttributes
|