@wordpress/block-editor 15.21.1 → 15.22.1-next.v.202606191442.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 +6 -0
- package/build/components/block-card/index.cjs +4 -5
- package/build/components/block-card/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +3 -4
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-mover/mover-description.cjs +6 -6
- package/build/components/block-mover/mover-description.cjs.map +1 -1
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-patterns-paging/index.cjs +4 -4
- package/build/components/block-patterns-paging/index.cjs.map +2 -2
- package/build/components/block-popover/use-popover-scroll.cjs.map +1 -1
- package/build/components/block-quick-navigation/index.cjs +7 -5
- package/build/components/block-quick-navigation/index.cjs.map +2 -2
- package/build/components/block-toolbar/edit-section-button.cjs.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs +10 -4
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs +51 -19
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/dimensions-tool/index.cjs +4 -5
- package/build/components/dimensions-tool/index.cjs.map +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs +1 -1
- package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +1 -1
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/grid/grid-item-resizer.cjs.map +1 -1
- package/build/components/grid/grid-visualizer.cjs.map +1 -1
- package/build/components/iframe/index.cjs +6 -3
- package/build/components/iframe/index.cjs.map +3 -3
- package/build/components/image-editor/use-transform-image.cjs.map +1 -1
- package/build/components/inserter/get-appender-label.cjs.map +1 -1
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/search-items.cjs.map +1 -1
- package/build/components/inspector-controls/fill.cjs +1 -3
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
- package/build/components/line-height-control/index.cjs.map +1 -1
- package/build/components/link-control/index.cjs +1 -1
- package/build/components/link-control/index.cjs.map +1 -1
- package/build/components/link-control/normalize-url.cjs.map +1 -1
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/utils.cjs.map +1 -1
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/provider/index.cjs.map +1 -1
- package/build/components/provider/use-block-sync.cjs.map +1 -1
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +1 -1
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs.map +1 -1
- package/build/components/writing-flow/use-tab-nav.cjs.map +1 -1
- package/build/hooks/anchor.cjs +1 -1
- package/build/hooks/anchor.cjs.map +1 -1
- package/build/hooks/background.cjs.map +1 -1
- package/build/hooks/block-fields/index.cjs +13 -2
- package/build/hooks/block-fields/index.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +13 -2
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +27 -2
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/list-view.cjs +10 -7
- package/build/hooks/list-view.cjs.map +2 -2
- package/build/hooks/spacing-visualizer.cjs.map +1 -1
- package/build/hooks/state-utils.cjs.map +1 -1
- package/build/hooks/style.cjs +42 -2
- package/build/hooks/style.cjs.map +2 -2
- package/build/private-apis.cjs +4 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs.map +1 -1
- package/build/store/private-selectors.cjs +19 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs.map +1 -1
- package/build/store/selectors.cjs.map +1 -1
- package/build/utils/dom.cjs.map +1 -1
- package/build/utils/selection.cjs +1 -1
- package/build-module/components/block-card/index.mjs +5 -6
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +3 -5
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-mover/mover-description.mjs +6 -6
- package/build-module/components/block-mover/mover-description.mjs.map +1 -1
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-patterns-paging/index.mjs +4 -4
- package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
- package/build-module/components/block-popover/use-popover-scroll.mjs.map +1 -1
- package/build-module/components/block-quick-navigation/index.mjs +8 -6
- package/build-module/components/block-quick-navigation/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/edit-section-button.mjs.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs +10 -4
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +51 -19
- package/build-module/components/child-layout-control/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/index.mjs +4 -5
- package/build-module/components/dimensions-tool/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs +1 -1
- package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +1 -2
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/grid/grid-item-resizer.mjs.map +1 -1
- package/build-module/components/grid/grid-visualizer.mjs.map +1 -1
- package/build-module/components/iframe/index.mjs +6 -3
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/image-editor/use-transform-image.mjs.map +1 -1
- package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/search-items.mjs.map +1 -1
- package/build-module/components/inspector-controls/fill.mjs +1 -3
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -1
- package/build-module/components/line-height-control/index.mjs.map +1 -1
- package/build-module/components/link-control/index.mjs +1 -1
- package/build-module/components/link-control/index.mjs.map +1 -1
- package/build-module/components/link-control/normalize-url.mjs.map +1 -1
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs.map +1 -1
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/provider/index.mjs.map +1 -1
- package/build-module/components/provider/use-block-sync.mjs.map +1 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +1 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.mjs.map +1 -1
- package/build-module/hooks/anchor.mjs +1 -1
- package/build-module/hooks/anchor.mjs.map +1 -1
- package/build-module/hooks/background.mjs.map +1 -1
- package/build-module/hooks/block-fields/index.mjs +13 -2
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +12 -2
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +27 -2
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +10 -7
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/spacing-visualizer.mjs.map +1 -1
- package/build-module/hooks/state-utils.mjs.map +1 -1
- package/build-module/hooks/style.mjs +44 -3
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/private-apis.mjs +8 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs.map +1 -1
- package/build-module/store/private-selectors.mjs +18 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs.map +1 -1
- package/build-module/store/selectors.mjs.map +1 -1
- package/build-module/utils/dom.mjs.map +1 -1
- package/build-module/utils/selection.mjs +1 -1
- package/package.json +45 -40
- package/src/components/block-card/index.js +7 -13
- package/src/components/block-inspector/index.js +2 -10
- package/src/components/block-patterns-list/index.js +0 -1
- package/src/components/block-quick-navigation/index.js +7 -7
- package/src/components/block-tools/use-block-toolbar-popover-props.js +10 -4
- package/src/components/child-layout-control/index.js +65 -20
- package/src/components/child-layout-control/test/index.js +64 -0
- package/src/components/dimensions-tool/index.js +4 -9
- package/src/components/dimensions-tool/scale-tool.js +1 -2
- package/src/components/dimensions-tool/test/index.js +89 -11
- package/src/components/global-styles/dimensions-panel.js +1 -2
- package/src/components/global-styles/shadow-panel-components.js +0 -1
- package/src/components/iframe/index.js +8 -3
- package/src/components/inserter/media-tab/media-preview.js +0 -1
- package/src/components/inspector-controls/fill.js +6 -8
- package/src/components/inspector-controls-tabs/index.js +0 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +5 -1
- package/src/components/list-view/block-select-button.js +0 -1
- package/src/components/preset-input-control/custom-value-controls.js +0 -1
- package/src/hooks/block-fields/index.js +27 -2
- package/src/hooks/dimensions.js +14 -3
- package/src/hooks/layout-child.js +41 -2
- package/src/hooks/list-view.js +10 -11
- package/src/hooks/style.js +80 -2
- package/src/hooks/test/dimensions.js +71 -0
- package/src/hooks/test/layout-child.js +165 -0
- package/src/hooks/test/style.js +126 -4
- package/src/private-apis.js +8 -0
- package/src/store/private-selectors.js +47 -0
- package/src/store/test/private-selectors.js +138 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 15.22.0-next.0 (2026-06-19)
|
|
6
|
+
|
|
7
|
+
### Enhancements
|
|
8
|
+
|
|
9
|
+
- List View: a block that supports `listView` is now excluded from the List View when it has no inner blocks and disallows insertion (`allowedBlocks` is `[]` or `false`), since there is nothing to show, rearrange, or add. ([#78932](https://github.com/WordPress/gutenberg/pull/78932))
|
|
10
|
+
|
|
5
11
|
## 15.21.1 (2026-06-16)
|
|
6
12
|
|
|
7
13
|
## 15.21.0 (2026-06-10)
|
|
@@ -86,12 +86,11 @@ function BlockCard({
|
|
|
86
86
|
if (parentClientId || isChild || !allowParentNavigation) {
|
|
87
87
|
return {};
|
|
88
88
|
}
|
|
89
|
-
const { getBlockParents, getBlockName } = select(import_store.store);
|
|
89
|
+
const { getBlockParents, getBlockName, shouldRenderBlockListView } = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
90
90
|
const parents = getBlockParents(clientId, false);
|
|
91
|
-
const foundParentId = parents.find(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
});
|
|
91
|
+
const foundParentId = parents.find(
|
|
92
|
+
(parentId) => shouldRenderBlockListView(parentId)
|
|
93
|
+
);
|
|
95
94
|
return {
|
|
96
95
|
parentBlockClientId: foundParentId,
|
|
97
96
|
parentBlockName: foundParentId ? getBlockName(foundParentId) : null
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-card/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon as WCIcon,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { Text, Stack } from '@wordpress/ui';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tchevronLeft,\n\tchevronRight,\n\tarrowRight,\n\tarrowLeft,\n} from '@wordpress/icons';\nimport { getBlockType
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAIO;AACP,gBAA4B;AAC5B,kBAAuC;AACvC,wBAAuB;AACvB,kBAAmC;AACnC,mBAKO;AACP,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon as WCIcon,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { Text, Stack } from '@wordpress/ui';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tchevronLeft,\n\tchevronRight,\n\tarrowRight,\n\tarrowLeft,\n} from '@wordpress/icons';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as blockEditorStore } from '../../store';\nimport BlockIcon from '../block-icon';\n\nconst { Badge: WCBadge } = unlock( componentsPrivateApis );\n\nfunction OptionalParentSelectButton( { children, onClick } ) {\n\tif ( ! onClick ) {\n\t\treturn children;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"block-editor-block-card__parent-select-button\"\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\n/**\n * A card component that displays block information including title, icon, and description.\n * Can be used to show block metadata and navigation controls for parent blocks.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-card/README.md\n *\n * @example\n * ```jsx\n * function Example() {\n * return (\n * <BlockCard\n * title=\"My Block\"\n * icon=\"smiley\"\n * description=\"A simple block example\"\n * name=\"Custom Block\"\n * />\n * );\n * }\n * ```\n *\n * @param {Object} props Component props.\n * @param {string} props.title The title of the block.\n * @param {string|Object} props.icon The icon of the block. This can be any of [WordPress' Dashicons](https://developer.wordpress.org/resource/dashicons/), or a custom `svg` element.\n * @param {string} props.description The description of the block.\n * @param {Object} [props.blockType] Deprecated: Object containing block type data.\n * @param {string} [props.className] Additional classes to apply to the card.\n * @param {string} [props.name] Custom block name to display before the title.\n * @param {string} [props.allowParentNavigation] Show a back arrow to the parent block in some situations.\n * @param {string} [props.parentClientId] The parent clientId, if this card is for a parent block.\n * @param {string} [props.isChild] Whether the block card is for a child block, in which case, indent the block using an arrow.\n * @param {string} [props.clientId] Whether the block card is for a child block, in which case, indent the block using an arrow.\n * @param {Element} [props.controls] Controls rendered beside the block title.\n * @param {Element} [props.children] Children.\n * @return {Element} Block card component.\n */\nfunction BlockCard( {\n\ttitle,\n\ticon,\n\tdescription,\n\tblockType,\n\tclassName,\n\tname,\n\tallowParentNavigation,\n\tparentClientId,\n\tisChild,\n\tchildren,\n\tclientId,\n\tcontrols,\n} ) {\n\tif ( blockType ) {\n\t\tdeprecated( '`blockType` property in `BlockCard component`', {\n\t\t\tsince: '5.7',\n\t\t\talternative: '`title, icon and description` properties',\n\t\t} );\n\t\t( { title, icon, description } = blockType );\n\t}\n\n\tconst { parentBlockClientId, parentBlockName } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( parentClientId || isChild || ! allowParentNavigation ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst { getBlockParents, getBlockName, shouldRenderBlockListView } =\n\t\t\t\tunlock( select( blockEditorStore ) );\n\n\t\t\t// Find the top-most parent block that participates in List View.\n\t\t\tconst parents = getBlockParents( clientId, false );\n\t\t\tconst foundParentId = parents.find( ( parentId ) =>\n\t\t\t\tshouldRenderBlockListView( parentId )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tparentBlockClientId: foundParentId,\n\t\t\t\tparentBlockName: foundParentId\n\t\t\t\t\t? getBlockName( foundParentId )\n\t\t\t\t\t: null,\n\t\t\t};\n\t\t},\n\t\t[ clientId, allowParentNavigation, isChild, parentClientId ]\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst TitleElement = parentClientId ? 'div' : 'h2';\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-block-card',\n\t\t\t\t{\n\t\t\t\t\t'is-parent': parentClientId,\n\t\t\t\t\t'is-child': isChild,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<Stack direction=\"column\" gap=\"sm\">\n\t\t\t\t<Stack direction=\"row\" align=\"center\" justify=\"space-between\">\n\t\t\t\t\t<Stack direction=\"row\" align=\"center\" justify=\"flex-start\">\n\t\t\t\t\t\t{ parentBlockClientId && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tselectBlock( parentBlockClientId )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tparentBlockName\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: The name of the parent block. */\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'Go to \"%s\" block' ),\n\t\t\t\t\t\t\t\t\t\t\t\tgetBlockType( parentBlockName )\n\t\t\t\t\t\t\t\t\t\t\t\t\t?.title\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __( 'Go to parent block' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t// TODO: This style override is also used in ToolsPanelHeader.\n\t\t\t\t\t\t\t\t\t// It should be supported out-of-the-box by Button.\n\t\t\t\t\t\t\t\t\t{ minWidth: 24, padding: 0 }\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isChild && (\n\t\t\t\t\t\t\t<span className=\"block-editor-block-card__child-indicator-icon\">\n\t\t\t\t\t\t\t\t<WCIcon\n\t\t\t\t\t\t\t\t\ticon={ isRTL() ? arrowLeft : arrowRight }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<OptionalParentSelectButton\n\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\tparentClientId\n\t\t\t\t\t\t\t\t\t? () => {\n\t\t\t\t\t\t\t\t\t\t\tselectBlock( parentClientId );\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockIcon icon={ icon } showColors />\n\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t\t\t<TitleElement className=\"block-editor-block-card__title\">\n\t\t\t\t\t\t\t\t\t<span className=\"block-editor-block-card__name\">\n\t\t\t\t\t\t\t\t\t\t{ !! name?.length ? name : title }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{ ! parentClientId &&\n\t\t\t\t\t\t\t\t\t\t! isChild &&\n\t\t\t\t\t\t\t\t\t\t!! name?.length && (\n\t\t\t\t\t\t\t\t\t\t\t<WCBadge>{ title }</WCBadge>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TitleElement>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t</OptionalParentSelectButton>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t{ controls }\n\t\t\t\t</Stack>\n\t\t\t\t{ ! parentClientId && ! isChild && description && (\n\t\t\t\t\t<Text className=\"block-editor-block-card__description\">\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</Stack>\n\t\t</div>\n\t);\n}\n\nexport default BlockCard;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAIO;AACP,gBAA4B;AAC5B,kBAAuC;AACvC,wBAAuB;AACvB,kBAAmC;AACnC,mBAKO;AACP,oBAA6B;AAK7B,yBAAuB;AACvB,mBAA0C;AAC1C,wBAAsB;AAUpB;AARF,IAAM,EAAE,OAAO,QAAQ,QAAI,2BAAQ,kBAAAA,WAAsB;AAEzD,SAAS,2BAA4B,EAAE,UAAU,QAAQ,GAAI;AAC5D,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,WAAU;AAAA,MACV;AAAA,MAEE;AAAA;AAAA,EACH;AAEF;AAqCA,SAAS,UAAW;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,MAAK,WAAY;AAChB,0BAAAC,SAAY,iDAAiD;AAAA,MAC5D,OAAO;AAAA,MACP,aAAa;AAAA,IACd,CAAE;AACF,KAAE,EAAE,OAAO,MAAM,YAAY,IAAI;AAAA,EAClC;AAEA,QAAM,EAAE,qBAAqB,gBAAgB,QAAI;AAAA,IAChD,CAAE,WAAY;AACb,UAAK,kBAAkB,WAAW,CAAE,uBAAwB;AAC3D,eAAO,CAAC;AAAA,MACT;AACA,YAAM,EAAE,iBAAiB,cAAc,0BAA0B,QAChE,2BA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ACC,iBACG,MAAM;AACN,8BAAa,cAAe;AAAA,gBAC5B,IACA;AAAA,gBAGJ;AAAA,8DAAC,kBAAAC,SAAA,EAAU,MAAc,YAAU,MAAC;AAAA,kBACpC,6CAAC,mBAAM,WAAU,UAAS,KAAI,MAC7B;AAAA,iEAAC,gBAAa,WAAU,kCACvB;AAAA,kEAAC,UAAK,WAAU,iCACb,WAAC,CAAE,MAAM,SAAS,OAAO,OAC5B;AAAA,sBACE,CAAE,kBACH,CAAE,WACF,CAAC,CAAE,MAAM,UACR,4CAAC,WAAU,iBAAO;AAAA,uBAErB;AAAA,oBACE;AAAA,qBACH;AAAA;AAAA;AAAA,YACD;AAAA,aACD;AAAA,UACE;AAAA,WACH;AAAA,QACE,CAAE,kBAAkB,CAAE,WAAW,eAClC,4CAAC,kBAAK,WAAU,wCACb,uBACH;AAAA,SAEF;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": ["componentsPrivateApis", "deprecated", "blockEditorStore", "clsx", "WCIcon", "BlockIcon"]
|
|
7
7
|
}
|
|
@@ -223,16 +223,15 @@ function BlockInspector() {
|
|
|
223
223
|
}
|
|
224
224
|
const {
|
|
225
225
|
getClientIdsOfDescendants,
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
getBlockEditingMode,
|
|
227
|
+
shouldRenderBlockListView
|
|
228
228
|
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
229
229
|
const descendants = getClientIdsOfDescendants(
|
|
230
230
|
renderedBlockClientId
|
|
231
231
|
);
|
|
232
232
|
const listViewDescendants = /* @__PURE__ */ new Set();
|
|
233
233
|
descendants.forEach((clientId) => {
|
|
234
|
-
|
|
235
|
-
if (blockName === "core/navigation" || (0, import_blocks.hasBlockSupport)(blockName, "listView")) {
|
|
234
|
+
if (shouldRenderBlockListView(clientId)) {
|
|
236
235
|
const listViewChildren = getClientIdsOfDescendants(clientId);
|
|
237
236
|
listViewChildren.forEach(
|
|
238
237
|
(childId) => listViewDescendants.add(childId)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-inspector/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetBlockType,\n\tgetUnregisteredTypeHandlerName,\n\thasBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport {\n\tToggleControl,\n\t__experimentalSpacer as Spacer,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EditContents from './edit-contents';\nimport SkipToSelectedBlock from '../skip-to-selected-block';\nimport BlockCard from '../block-card';\nimport MultiSelectionInspector from '../multi-selection-inspector';\nimport BlockVariationTransforms from '../block-variation-transforms';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { store as blockEditorStore } from '../../store';\nimport BlockStyles from '../block-styles';\nimport { ListViewContentPopover } from '../inspector-controls/list-view-content-popover';\nimport InspectorControls from '../inspector-controls';\nimport { BlockInspectorPreTabsSlot } from './inspector-pre-tabs-slot-fill';\nimport { default as InspectorControlsTabs } from '../inspector-controls-tabs';\nimport useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-controls-tabs';\nimport InspectorControlsLastItem from '../inspector-controls/last-item';\nimport AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';\nimport PositionControls from '../inspector-controls-tabs/position-controls-panel';\nimport useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';\nimport { useBorderPanelLabel } from '../../hooks/border';\nimport { BlockStateBadges, BlockStatesControl } from '../../hooks/states';\nimport ContentTab from '../inspector-controls-tabs/content-tab';\nimport ViewportVisibilityInfo from '../block-visibility/viewport-visibility-info';\nimport { unlock } from '../../lock-unlock';\nimport {\n\thasPseudoBlockStyleState,\n\thasViewportBlockStyleState,\n\tisDefaultBlockStyleState,\n} from '../../hooks/block-style-state';\nimport { onViewportStateChangeKey } from '../../store/private-keys';\n\nfunction StyleInspectorSlots( {\n\tblockName,\n\tshowAdvancedControls = true,\n\tshowPositionControls = true,\n\tshowBindingsControls = true,\n} ) {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls.Slot />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"color\"\n\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"background\"\n\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\tclassName=\"background-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"typography\"\n\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"layout\" label={ __( 'Layout' ) } />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"border\" label={ borderPanelLabel } />\n\t\t\t{ showPositionControls && <PositionControls /> }\n\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t\t{ showBindingsControls && (\n\t\t\t\t<InspectorControls.Slot group=\"bindings\" />\n\t\t\t) }\n\t\t\t{ showAdvancedControls && (\n\t\t\t\t<div>\n\t\t\t\t\t<AdvancedControls />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction StyleStateInspectorSlots( { blockName, selectedBlockStyleState } ) {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\tconst showLayoutControls =\n\t\thasViewportBlockStyleState( selectedBlockStyleState ) &&\n\t\t! hasPseudoBlockStyleState( selectedBlockStyleState );\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"color\"\n\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"background\"\n\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\tclassName=\"background-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"typography\"\n\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t/>\n\t\t\t{ showLayoutControls && (\n\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\tgroup=\"layout\"\n\t\t\t\t\tlabel={ __( 'Layout' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"border\" label={ borderPanelLabel } />\n\t\t</>\n\t);\n}\n\nfunction BlockInspector() {\n\tconst {\n\t\tselectedBlockCount,\n\t\trenderedBlockName,\n\t\trenderedBlockClientId,\n\t\tblockType,\n\t\tisSectionBlock,\n\t\tisSectionBlockInSelection,\n\t\thasBlockStyles,\n\t\teditedContentOnlySection,\n\t\tblockEditingMode,\n\t\tselectedBlockStyleState,\n\t\tshowStateOnCanvas,\n\t\tonViewportStateChange,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tgetSelectedBlockCount,\n\t\t\tgetBlockName,\n\t\t\tgetParentSectionBlock,\n\t\t\tisSectionBlock: _isSectionBlock,\n\t\t\tgetEditedContentOnlySection,\n\t\t\tisWithinEditedContentOnlySection,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetSelectedBlockStyleState,\n\t\t\tisSelectedBlockStyleStateShownOnCanvas,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst blockEditorSettings = select( blockEditorStore ).getSettings();\n\t\tconst { getBlockStyles } = select( blocksStore );\n\t\tconst _selectedBlockClientId = getSelectedBlockClientId();\n\t\tconst isWithinEditedSection = isWithinEditedContentOnlySection(\n\t\t\t_selectedBlockClientId\n\t\t);\n\t\tconst _renderedBlockClientId = isWithinEditedSection\n\t\t\t? _selectedBlockClientId\n\t\t\t: getParentSectionBlock( _selectedBlockClientId ) ||\n\t\t\t _selectedBlockClientId;\n\t\tconst _renderedBlockName =\n\t\t\t_renderedBlockClientId && getBlockName( _renderedBlockClientId );\n\t\tconst _blockType =\n\t\t\t_renderedBlockName && getBlockType( _renderedBlockName );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst _isSectionBlockInSelection = selectedBlockClientIds.some(\n\t\t\t( id ) => _isSectionBlock( id )\n\t\t);\n\t\tconst blockStyles =\n\t\t\t_renderedBlockName && getBlockStyles( _renderedBlockName );\n\t\tconst _hasBlockStyles = blockStyles && blockStyles.length > 0;\n\n\t\treturn {\n\t\t\tselectedBlockCount: getSelectedBlockCount(),\n\t\t\trenderedBlockClientId: _renderedBlockClientId,\n\t\t\trenderedBlockName: _renderedBlockName,\n\t\t\tblockType: _blockType,\n\t\t\tisSectionBlockInSelection: _isSectionBlockInSelection,\n\t\t\tisSectionBlock: _isSectionBlock( _renderedBlockClientId ),\n\t\t\thasBlockStyles: _hasBlockStyles,\n\t\t\teditedContentOnlySection: getEditedContentOnlySection(),\n\t\t\tblockEditingMode: getBlockEditingMode( _renderedBlockClientId ),\n\t\t\tselectedBlockStyleState: getSelectedBlockStyleState(\n\t\t\t\t_renderedBlockClientId\n\t\t\t),\n\t\t\tshowStateOnCanvas: isSelectedBlockStyleStateShownOnCanvas(\n\t\t\t\t_renderedBlockClientId\n\t\t\t),\n\t\t\tonViewportStateChange:\n\t\t\t\tblockEditorSettings?.[ onViewportStateChangeKey ],\n\t\t};\n\t}, [] );\n\n\t// Separate useSelect for contentClientIds with proper dependencies\n\tconst contentClientIds = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSectionBlock || ! renderedBlockClientId ) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst descendants = getClientIdsOfDescendants(\n\t\t\t\trenderedBlockClientId\n\t\t\t);\n\n\t\t\t// Exclude items from the content tab that are already present in the\n\t\t\t// List View tab.\n\t\t\tconst listViewDescendants = new Set();\n\t\t\tdescendants.forEach( ( clientId ) => {\n\t\t\t\tconst blockName = getBlockName( clientId );\n\t\t\t\t// Navigation block doesn't have List View block support, but\n\t\t\t\t// it does have a custom implementation that is shown within\n\t\t\t\t// patterns, so it's included in this condition.\n\t\t\t\tif (\n\t\t\t\t\tblockName === 'core/navigation' ||\n\t\t\t\t\thasBlockSupport( blockName, 'listView' )\n\t\t\t\t) {\n\t\t\t\t\tconst listViewChildren =\n\t\t\t\t\t\tgetClientIdsOfDescendants( clientId );\n\t\t\t\t\tlistViewChildren.forEach( ( childId ) =>\n\t\t\t\t\t\tlistViewDescendants.add( childId )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn descendants.filter( ( current ) => {\n\t\t\t\treturn (\n\t\t\t\t\t! listViewDescendants.has( current ) &&\n\t\t\t\t\tgetBlockEditingMode( current ) === 'contentOnly'\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ isSectionBlock, renderedBlockClientId ]\n\t);\n\n\tconst availableTabs = useInspectorControlsTabs(\n\t\tblockType?.name,\n\t\tcontentClientIds,\n\t\tisSectionBlock,\n\t\thasBlockStyles\n\t);\n\tconst hasMultipleTabs = availableTabs?.length > 1;\n\n\t// The block inspector animation settings will be completely\n\t// removed in the future to create an API which allows the block\n\t// inspector to transition between what it\n\t// displays based on the relationship between the selected block\n\t// and its parent, and only enable it if the parent is controlling\n\t// its children blocks.\n\tconst blockInspectorAnimationSettings =\n\t\tuseBlockInspectorAnimationSettings( blockType );\n\n\tconst hasSelectedBlocks = selectedBlockCount > 1;\n\tconst isBlockStyleStateSelected = ! isDefaultBlockStyleState(\n\t\tselectedBlockStyleState\n\t);\n\n\tif ( hasSelectedBlocks && ! isSectionBlockInSelection ) {\n\t\treturn (\n\t\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t\t<MultiSelectionInspector />\n\t\t\t\t{ hasMultipleTabs ? (\n\t\t\t\t\t<InspectorControlsTabs tabs={ availableTabs } />\n\t\t\t\t) : (\n\t\t\t\t\t<StyleInspectorSlots\n\t\t\t\t\t\tblockName={ renderedBlockName }\n\t\t\t\t\t\tshowAdvancedControls={ false }\n\t\t\t\t\t\tshowPositionControls={ false }\n\t\t\t\t\t\tshowBindingsControls={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( hasSelectedBlocks && isSectionBlockInSelection ) {\n\t\treturn (\n\t\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t\t<MultiSelectionInspector />\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst isRenderedBlockUnregistered =\n\t\trenderedBlockName === getUnregisteredTypeHandlerName();\n\n\t/*\n\t * If the rendered block is of an unregistered type, avoid showing it as an actual selection\n\t * because we want the user to focus on the unregistered block warning, not block settings.\n\t */\n\tconst shouldShowWarning =\n\t\t! blockType || ! renderedBlockClientId || isRenderedBlockUnregistered;\n\n\tif ( shouldShowWarning ) {\n\t\treturn (\n\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockInspectorSingleBlockWrapper\n\t\t\tanimate={ blockInspectorAnimationSettings }\n\t\t\twrapper={ ( children ) => (\n\t\t\t\t<AnimatedContainer\n\t\t\t\t\tblockInspectorAnimationSettings={\n\t\t\t\t\t\tblockInspectorAnimationSettings\n\t\t\t\t\t}\n\t\t\t\t\trenderedBlockClientId={ renderedBlockClientId }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</AnimatedContainer>\n\t\t\t) }\n\t\t>\n\t\t\t<BlockInspectorSingleBlock\n\t\t\t\trenderedBlockClientId={ renderedBlockClientId }\n\t\t\t\tblockName={ blockType.name }\n\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t\tavailableTabs={ availableTabs }\n\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\teditedContentOnlySection={ editedContentOnlySection }\n\t\t\t\tblockEditingMode={ blockEditingMode }\n\t\t\t\tselectedBlockStyleState={ selectedBlockStyleState }\n\t\t\t\tshowStateOnCanvas={ showStateOnCanvas }\n\t\t\t\tonViewportStateChange={ onViewportStateChange }\n\t\t\t\tisBlockStyleStateSelected={ isBlockStyleStateSelected }\n\t\t\t/>\n\t\t</BlockInspectorSingleBlockWrapper>\n\t);\n}\n\nconst BlockInspectorSingleBlockWrapper = ( { animate, wrapper, children } ) => {\n\treturn animate ? wrapper( children ) : children;\n};\n\nconst AnimatedContainer = ( {\n\tblockInspectorAnimationSettings,\n\trenderedBlockClientId,\n\tchildren,\n} ) => {\n\tconst animationOrigin =\n\t\tblockInspectorAnimationSettings &&\n\t\tblockInspectorAnimationSettings.enterDirection === 'leftToRight'\n\t\t\t? -50\n\t\t\t: 50;\n\n\treturn (\n\t\t<motion.div\n\t\t\tanimate={ {\n\t\t\t\tx: 0,\n\t\t\t\topacity: 1,\n\t\t\t\ttransition: {\n\t\t\t\t\tease: 'easeInOut',\n\t\t\t\t\tduration: 0.14,\n\t\t\t\t},\n\t\t\t} }\n\t\t\tinitial={ {\n\t\t\t\tx: animationOrigin,\n\t\t\t\topacity: 0,\n\t\t\t} }\n\t\t\tkey={ renderedBlockClientId }\n\t\t>\n\t\t\t{ children }\n\t\t</motion.div>\n\t);\n};\n\nconst BlockInspectorSingleBlock = ( {\n\t// The block that is displayed in the inspector. This is the block whose\n\t// controls and information are shown to the user.\n\trenderedBlockClientId,\n\tblockName,\n\tisSectionBlock,\n\tavailableTabs,\n\tcontentClientIds,\n\thasBlockStyles,\n\teditedContentOnlySection,\n\tblockEditingMode,\n\tselectedBlockStyleState,\n\tshowStateOnCanvas,\n\tonViewportStateChange,\n\tisBlockStyleStateSelected,\n} ) => {\n\tconst listViewRef = useRef( null );\n\tconst hasMultipleTabs = availableTabs?.length > 1;\n\tconst hasParentChildBlockCards =\n\t\teditedContentOnlySection &&\n\t\teditedContentOnlySection !== renderedBlockClientId;\n\tconst parentBlockInformation = useBlockDisplayInformation(\n\t\teditedContentOnlySection\n\t);\n\tconst blockInformation = useBlockDisplayInformation(\n\t\trenderedBlockClientId\n\t);\n\tconst isBlockSynced = blockInformation.isSynced;\n\tconst {\n\t\tsetSelectedBlockStyleState,\n\t\tsetSelectedBlockStyleStateCanvasPreview,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\tconst onBlockStyleStateChange = ( value ) => {\n\t\tconst nextSelectedBlockStyleState = {\n\t\t\t...selectedBlockStyleState,\n\t\t\t...value,\n\t\t};\n\n\t\tsetSelectedBlockStyleState(\n\t\t\trenderedBlockClientId,\n\t\t\tnextSelectedBlockStyleState\n\t\t);\n\n\t\tif ( value.viewport ) {\n\t\t\tonViewportStateChange?.( {\n\t\t\t\tviewport: nextSelectedBlockStyleState.viewport,\n\t\t\t\tshowStateOnCanvas,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onShowStateOnCanvasChange = ( value ) => {\n\t\tsetSelectedBlockStyleStateCanvasPreview( renderedBlockClientId, value );\n\n\t\tif ( value ) {\n\t\t\tonViewportStateChange?.( {\n\t\t\t\tviewport: selectedBlockStyleState.viewport,\n\t\t\t\tshowStateOnCanvas: value,\n\t\t\t} );\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t{ hasParentChildBlockCards && (\n\t\t\t\t<BlockCard\n\t\t\t\t\t{ ...parentBlockInformation }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tparentBlockInformation?.isSynced && 'is-synced'\n\t\t\t\t\t}\n\t\t\t\t\tparentClientId={ editedContentOnlySection }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<BlockCard\n\t\t\t\t{ ...blockInformation }\n\t\t\t\tallowParentNavigation\n\t\t\t\tclassName={ isBlockSynced && 'is-synced' }\n\t\t\t\tisChild={ hasParentChildBlockCards }\n\t\t\t\tclientId={ renderedBlockClientId }\n\t\t\t\tcontrols={\n\t\t\t\t\tblockEditingMode === 'default' && (\n\t\t\t\t\t\t<BlockStatesControl\n\t\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\t\tvalue={ selectedBlockStyleState }\n\t\t\t\t\t\t\tonChange={ onBlockStyleStateChange }\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\t{ blockEditingMode === 'default' && isBlockStyleStateSelected && (\n\t\t\t\t<Spacer paddingX={ 4 } paddingY={ 2 }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show state on canvas' ) }\n\t\t\t\t\t\tchecked={ showStateOnCanvas }\n\t\t\t\t\t\tonChange={ onShowStateOnCanvasChange }\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockStateBadges\n\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\tvalue={ selectedBlockStyleState }\n\t\t\t\t\t/>\n\t\t\t\t</Spacer>\n\t\t\t) }\n\t\t\t<ViewportVisibilityInfo clientId={ renderedBlockClientId } />\n\t\t\t<EditContents clientId={ renderedBlockClientId } />\n\t\t\t{ ! isBlockStyleStateSelected && (\n\t\t\t\t<BlockVariationTransforms\n\t\t\t\t\tblockClientId={ renderedBlockClientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<BlockInspectorPreTabsSlot />\n\t\t\t{ isBlockStyleStateSelected && ! isSectionBlock && (\n\t\t\t\t<StyleStateInspectorSlots\n\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\tselectedBlockStyleState={ selectedBlockStyleState }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isBlockStyleStateSelected && hasMultipleTabs && (\n\t\t\t\t<>\n\t\t\t\t\t<InspectorControlsTabs\n\t\t\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\t\t\tclientId={ renderedBlockClientId }\n\t\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\t\ttabs={ availableTabs }\n\t\t\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isBlockStyleStateSelected && ! hasMultipleTabs && (\n\t\t\t\t<>\n\t\t\t\t\t{ hasBlockStyles && (\n\t\t\t\t\t\t<BlockStyles clientId={ renderedBlockClientId } />\n\t\t\t\t\t) }\n\t\t\t\t\t<ContentTab contentClientIds={ contentClientIds } />\n\t\t\t\t\t<InspectorControls.Slot group=\"content\" />\n\t\t\t\t\t<InspectorControls.Slot group=\"list\" ref={ listViewRef } />\n\t\t\t\t\t<ListViewContentPopover listViewRef={ listViewRef } />\n\t\t\t\t\t{ ! isSectionBlock && (\n\t\t\t\t\t\t<StyleInspectorSlots blockName={ blockName } />\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isBlockStyleStateSelected && (\n\t\t\t\t<InspectorControlsLastItem.Slot />\n\t\t\t) }\n\t\t\t<SkipToSelectedBlock key=\"back\" />\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-inspector/README.md\n */\nexport default BlockInspector;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetBlockType,\n\tgetUnregisteredTypeHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport {\n\tToggleControl,\n\t__experimentalSpacer as Spacer,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EditContents from './edit-contents';\nimport SkipToSelectedBlock from '../skip-to-selected-block';\nimport BlockCard from '../block-card';\nimport MultiSelectionInspector from '../multi-selection-inspector';\nimport BlockVariationTransforms from '../block-variation-transforms';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { store as blockEditorStore } from '../../store';\nimport BlockStyles from '../block-styles';\nimport { ListViewContentPopover } from '../inspector-controls/list-view-content-popover';\nimport InspectorControls from '../inspector-controls';\nimport { BlockInspectorPreTabsSlot } from './inspector-pre-tabs-slot-fill';\nimport { default as InspectorControlsTabs } from '../inspector-controls-tabs';\nimport useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-controls-tabs';\nimport InspectorControlsLastItem from '../inspector-controls/last-item';\nimport AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';\nimport PositionControls from '../inspector-controls-tabs/position-controls-panel';\nimport useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';\nimport { useBorderPanelLabel } from '../../hooks/border';\nimport { BlockStateBadges, BlockStatesControl } from '../../hooks/states';\nimport ContentTab from '../inspector-controls-tabs/content-tab';\nimport ViewportVisibilityInfo from '../block-visibility/viewport-visibility-info';\nimport { unlock } from '../../lock-unlock';\nimport {\n\thasPseudoBlockStyleState,\n\thasViewportBlockStyleState,\n\tisDefaultBlockStyleState,\n} from '../../hooks/block-style-state';\nimport { onViewportStateChangeKey } from '../../store/private-keys';\n\nfunction StyleInspectorSlots( {\n\tblockName,\n\tshowAdvancedControls = true,\n\tshowPositionControls = true,\n\tshowBindingsControls = true,\n} ) {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls.Slot />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"color\"\n\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"background\"\n\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\tclassName=\"background-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"typography\"\n\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"layout\" label={ __( 'Layout' ) } />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"border\" label={ borderPanelLabel } />\n\t\t\t{ showPositionControls && <PositionControls /> }\n\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t\t{ showBindingsControls && (\n\t\t\t\t<InspectorControls.Slot group=\"bindings\" />\n\t\t\t) }\n\t\t\t{ showAdvancedControls && (\n\t\t\t\t<div>\n\t\t\t\t\t<AdvancedControls />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction StyleStateInspectorSlots( { blockName, selectedBlockStyleState } ) {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\tconst showLayoutControls =\n\t\thasViewportBlockStyleState( selectedBlockStyleState ) &&\n\t\t! hasPseudoBlockStyleState( selectedBlockStyleState );\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"color\"\n\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"background\"\n\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\tclassName=\"background-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"typography\"\n\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t/>\n\t\t\t{ showLayoutControls && (\n\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\tgroup=\"layout\"\n\t\t\t\t\tlabel={ __( 'Layout' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"border\" label={ borderPanelLabel } />\n\t\t</>\n\t);\n}\n\nfunction BlockInspector() {\n\tconst {\n\t\tselectedBlockCount,\n\t\trenderedBlockName,\n\t\trenderedBlockClientId,\n\t\tblockType,\n\t\tisSectionBlock,\n\t\tisSectionBlockInSelection,\n\t\thasBlockStyles,\n\t\teditedContentOnlySection,\n\t\tblockEditingMode,\n\t\tselectedBlockStyleState,\n\t\tshowStateOnCanvas,\n\t\tonViewportStateChange,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tgetSelectedBlockCount,\n\t\t\tgetBlockName,\n\t\t\tgetParentSectionBlock,\n\t\t\tisSectionBlock: _isSectionBlock,\n\t\t\tgetEditedContentOnlySection,\n\t\t\tisWithinEditedContentOnlySection,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetSelectedBlockStyleState,\n\t\t\tisSelectedBlockStyleStateShownOnCanvas,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst blockEditorSettings = select( blockEditorStore ).getSettings();\n\t\tconst { getBlockStyles } = select( blocksStore );\n\t\tconst _selectedBlockClientId = getSelectedBlockClientId();\n\t\tconst isWithinEditedSection = isWithinEditedContentOnlySection(\n\t\t\t_selectedBlockClientId\n\t\t);\n\t\tconst _renderedBlockClientId = isWithinEditedSection\n\t\t\t? _selectedBlockClientId\n\t\t\t: getParentSectionBlock( _selectedBlockClientId ) ||\n\t\t\t _selectedBlockClientId;\n\t\tconst _renderedBlockName =\n\t\t\t_renderedBlockClientId && getBlockName( _renderedBlockClientId );\n\t\tconst _blockType =\n\t\t\t_renderedBlockName && getBlockType( _renderedBlockName );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst _isSectionBlockInSelection = selectedBlockClientIds.some(\n\t\t\t( id ) => _isSectionBlock( id )\n\t\t);\n\t\tconst blockStyles =\n\t\t\t_renderedBlockName && getBlockStyles( _renderedBlockName );\n\t\tconst _hasBlockStyles = blockStyles && blockStyles.length > 0;\n\n\t\treturn {\n\t\t\tselectedBlockCount: getSelectedBlockCount(),\n\t\t\trenderedBlockClientId: _renderedBlockClientId,\n\t\t\trenderedBlockName: _renderedBlockName,\n\t\t\tblockType: _blockType,\n\t\t\tisSectionBlockInSelection: _isSectionBlockInSelection,\n\t\t\tisSectionBlock: _isSectionBlock( _renderedBlockClientId ),\n\t\t\thasBlockStyles: _hasBlockStyles,\n\t\t\teditedContentOnlySection: getEditedContentOnlySection(),\n\t\t\tblockEditingMode: getBlockEditingMode( _renderedBlockClientId ),\n\t\t\tselectedBlockStyleState: getSelectedBlockStyleState(\n\t\t\t\t_renderedBlockClientId\n\t\t\t),\n\t\t\tshowStateOnCanvas: isSelectedBlockStyleStateShownOnCanvas(\n\t\t\t\t_renderedBlockClientId\n\t\t\t),\n\t\t\tonViewportStateChange:\n\t\t\t\tblockEditorSettings?.[ onViewportStateChangeKey ],\n\t\t};\n\t}, [] );\n\n\t// Separate useSelect for contentClientIds with proper dependencies\n\tconst contentClientIds = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSectionBlock || ! renderedBlockClientId ) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tshouldRenderBlockListView,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst descendants = getClientIdsOfDescendants(\n\t\t\t\trenderedBlockClientId\n\t\t\t);\n\n\t\t\t// Exclude items from the content tab that are already present in the\n\t\t\t// List View tab.\n\t\t\tconst listViewDescendants = new Set();\n\t\t\tdescendants.forEach( ( clientId ) => {\n\t\t\t\tif ( shouldRenderBlockListView( clientId ) ) {\n\t\t\t\t\tconst listViewChildren =\n\t\t\t\t\t\tgetClientIdsOfDescendants( clientId );\n\t\t\t\t\tlistViewChildren.forEach( ( childId ) =>\n\t\t\t\t\t\tlistViewDescendants.add( childId )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn descendants.filter( ( current ) => {\n\t\t\t\treturn (\n\t\t\t\t\t! listViewDescendants.has( current ) &&\n\t\t\t\t\tgetBlockEditingMode( current ) === 'contentOnly'\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ isSectionBlock, renderedBlockClientId ]\n\t);\n\n\tconst availableTabs = useInspectorControlsTabs(\n\t\tblockType?.name,\n\t\tcontentClientIds,\n\t\tisSectionBlock,\n\t\thasBlockStyles\n\t);\n\tconst hasMultipleTabs = availableTabs?.length > 1;\n\n\t// The block inspector animation settings will be completely\n\t// removed in the future to create an API which allows the block\n\t// inspector to transition between what it\n\t// displays based on the relationship between the selected block\n\t// and its parent, and only enable it if the parent is controlling\n\t// its children blocks.\n\tconst blockInspectorAnimationSettings =\n\t\tuseBlockInspectorAnimationSettings( blockType );\n\n\tconst hasSelectedBlocks = selectedBlockCount > 1;\n\tconst isBlockStyleStateSelected = ! isDefaultBlockStyleState(\n\t\tselectedBlockStyleState\n\t);\n\n\tif ( hasSelectedBlocks && ! isSectionBlockInSelection ) {\n\t\treturn (\n\t\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t\t<MultiSelectionInspector />\n\t\t\t\t{ hasMultipleTabs ? (\n\t\t\t\t\t<InspectorControlsTabs tabs={ availableTabs } />\n\t\t\t\t) : (\n\t\t\t\t\t<StyleInspectorSlots\n\t\t\t\t\t\tblockName={ renderedBlockName }\n\t\t\t\t\t\tshowAdvancedControls={ false }\n\t\t\t\t\t\tshowPositionControls={ false }\n\t\t\t\t\t\tshowBindingsControls={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( hasSelectedBlocks && isSectionBlockInSelection ) {\n\t\treturn (\n\t\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t\t<MultiSelectionInspector />\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst isRenderedBlockUnregistered =\n\t\trenderedBlockName === getUnregisteredTypeHandlerName();\n\n\t/*\n\t * If the rendered block is of an unregistered type, avoid showing it as an actual selection\n\t * because we want the user to focus on the unregistered block warning, not block settings.\n\t */\n\tconst shouldShowWarning =\n\t\t! blockType || ! renderedBlockClientId || isRenderedBlockUnregistered;\n\n\tif ( shouldShowWarning ) {\n\t\treturn (\n\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockInspectorSingleBlockWrapper\n\t\t\tanimate={ blockInspectorAnimationSettings }\n\t\t\twrapper={ ( children ) => (\n\t\t\t\t<AnimatedContainer\n\t\t\t\t\tblockInspectorAnimationSettings={\n\t\t\t\t\t\tblockInspectorAnimationSettings\n\t\t\t\t\t}\n\t\t\t\t\trenderedBlockClientId={ renderedBlockClientId }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</AnimatedContainer>\n\t\t\t) }\n\t\t>\n\t\t\t<BlockInspectorSingleBlock\n\t\t\t\trenderedBlockClientId={ renderedBlockClientId }\n\t\t\t\tblockName={ blockType.name }\n\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t\tavailableTabs={ availableTabs }\n\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\teditedContentOnlySection={ editedContentOnlySection }\n\t\t\t\tblockEditingMode={ blockEditingMode }\n\t\t\t\tselectedBlockStyleState={ selectedBlockStyleState }\n\t\t\t\tshowStateOnCanvas={ showStateOnCanvas }\n\t\t\t\tonViewportStateChange={ onViewportStateChange }\n\t\t\t\tisBlockStyleStateSelected={ isBlockStyleStateSelected }\n\t\t\t/>\n\t\t</BlockInspectorSingleBlockWrapper>\n\t);\n}\n\nconst BlockInspectorSingleBlockWrapper = ( { animate, wrapper, children } ) => {\n\treturn animate ? wrapper( children ) : children;\n};\n\nconst AnimatedContainer = ( {\n\tblockInspectorAnimationSettings,\n\trenderedBlockClientId,\n\tchildren,\n} ) => {\n\tconst animationOrigin =\n\t\tblockInspectorAnimationSettings &&\n\t\tblockInspectorAnimationSettings.enterDirection === 'leftToRight'\n\t\t\t? -50\n\t\t\t: 50;\n\n\treturn (\n\t\t<motion.div\n\t\t\tanimate={ {\n\t\t\t\tx: 0,\n\t\t\t\topacity: 1,\n\t\t\t\ttransition: {\n\t\t\t\t\tease: 'easeInOut',\n\t\t\t\t\tduration: 0.14,\n\t\t\t\t},\n\t\t\t} }\n\t\t\tinitial={ {\n\t\t\t\tx: animationOrigin,\n\t\t\t\topacity: 0,\n\t\t\t} }\n\t\t\tkey={ renderedBlockClientId }\n\t\t>\n\t\t\t{ children }\n\t\t</motion.div>\n\t);\n};\n\nconst BlockInspectorSingleBlock = ( {\n\t// The block that is displayed in the inspector. This is the block whose\n\t// controls and information are shown to the user.\n\trenderedBlockClientId,\n\tblockName,\n\tisSectionBlock,\n\tavailableTabs,\n\tcontentClientIds,\n\thasBlockStyles,\n\teditedContentOnlySection,\n\tblockEditingMode,\n\tselectedBlockStyleState,\n\tshowStateOnCanvas,\n\tonViewportStateChange,\n\tisBlockStyleStateSelected,\n} ) => {\n\tconst listViewRef = useRef( null );\n\tconst hasMultipleTabs = availableTabs?.length > 1;\n\tconst hasParentChildBlockCards =\n\t\teditedContentOnlySection &&\n\t\teditedContentOnlySection !== renderedBlockClientId;\n\tconst parentBlockInformation = useBlockDisplayInformation(\n\t\teditedContentOnlySection\n\t);\n\tconst blockInformation = useBlockDisplayInformation(\n\t\trenderedBlockClientId\n\t);\n\tconst isBlockSynced = blockInformation.isSynced;\n\tconst {\n\t\tsetSelectedBlockStyleState,\n\t\tsetSelectedBlockStyleStateCanvasPreview,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\tconst onBlockStyleStateChange = ( value ) => {\n\t\tconst nextSelectedBlockStyleState = {\n\t\t\t...selectedBlockStyleState,\n\t\t\t...value,\n\t\t};\n\n\t\tsetSelectedBlockStyleState(\n\t\t\trenderedBlockClientId,\n\t\t\tnextSelectedBlockStyleState\n\t\t);\n\n\t\tif ( value.viewport ) {\n\t\t\tonViewportStateChange?.( {\n\t\t\t\tviewport: nextSelectedBlockStyleState.viewport,\n\t\t\t\tshowStateOnCanvas,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onShowStateOnCanvasChange = ( value ) => {\n\t\tsetSelectedBlockStyleStateCanvasPreview( renderedBlockClientId, value );\n\n\t\tif ( value ) {\n\t\t\tonViewportStateChange?.( {\n\t\t\t\tviewport: selectedBlockStyleState.viewport,\n\t\t\t\tshowStateOnCanvas: value,\n\t\t\t} );\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t{ hasParentChildBlockCards && (\n\t\t\t\t<BlockCard\n\t\t\t\t\t{ ...parentBlockInformation }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tparentBlockInformation?.isSynced && 'is-synced'\n\t\t\t\t\t}\n\t\t\t\t\tparentClientId={ editedContentOnlySection }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<BlockCard\n\t\t\t\t{ ...blockInformation }\n\t\t\t\tallowParentNavigation\n\t\t\t\tclassName={ isBlockSynced && 'is-synced' }\n\t\t\t\tisChild={ hasParentChildBlockCards }\n\t\t\t\tclientId={ renderedBlockClientId }\n\t\t\t\tcontrols={\n\t\t\t\t\tblockEditingMode === 'default' && (\n\t\t\t\t\t\t<BlockStatesControl\n\t\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\t\tvalue={ selectedBlockStyleState }\n\t\t\t\t\t\t\tonChange={ onBlockStyleStateChange }\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\t{ blockEditingMode === 'default' && isBlockStyleStateSelected && (\n\t\t\t\t<Spacer paddingX={ 4 } paddingY={ 2 }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show state on canvas' ) }\n\t\t\t\t\t\tchecked={ showStateOnCanvas }\n\t\t\t\t\t\tonChange={ onShowStateOnCanvasChange }\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockStateBadges\n\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\tvalue={ selectedBlockStyleState }\n\t\t\t\t\t/>\n\t\t\t\t</Spacer>\n\t\t\t) }\n\t\t\t<ViewportVisibilityInfo clientId={ renderedBlockClientId } />\n\t\t\t<EditContents clientId={ renderedBlockClientId } />\n\t\t\t{ ! isBlockStyleStateSelected && (\n\t\t\t\t<BlockVariationTransforms\n\t\t\t\t\tblockClientId={ renderedBlockClientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<BlockInspectorPreTabsSlot />\n\t\t\t{ isBlockStyleStateSelected && ! isSectionBlock && (\n\t\t\t\t<StyleStateInspectorSlots\n\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\tselectedBlockStyleState={ selectedBlockStyleState }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isBlockStyleStateSelected && hasMultipleTabs && (\n\t\t\t\t<>\n\t\t\t\t\t<InspectorControlsTabs\n\t\t\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\t\t\tclientId={ renderedBlockClientId }\n\t\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\t\ttabs={ availableTabs }\n\t\t\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isBlockStyleStateSelected && ! hasMultipleTabs && (\n\t\t\t\t<>\n\t\t\t\t\t{ hasBlockStyles && (\n\t\t\t\t\t\t<BlockStyles clientId={ renderedBlockClientId } />\n\t\t\t\t\t) }\n\t\t\t\t\t<ContentTab contentClientIds={ contentClientIds } />\n\t\t\t\t\t<InspectorControls.Slot group=\"content\" />\n\t\t\t\t\t<InspectorControls.Slot group=\"list\" ref={ listViewRef } />\n\t\t\t\t\t<ListViewContentPopover listViewRef={ listViewRef } />\n\t\t\t\t\t{ ! isSectionBlock && (\n\t\t\t\t\t\t<StyleInspectorSlots blockName={ blockName } />\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isBlockStyleStateSelected && (\n\t\t\t\t<InspectorControlsLastItem.Slot />\n\t\t\t) }\n\t\t\t<SkipToSelectedBlock key=\"back\" />\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-inspector/README.md\n */\nexport default BlockInspector;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,oBAIO;AACP,wBAIO;AACP,kBAAuC;AACvC,qBAAuB;AAKvB,2BAAyB;AACzB,oCAAgC;AAChC,wBAAsB;AACtB,uCAAoC;AACpC,wCAAqC;AACrC,2CAAuC;AACvC,mBAA0C;AAC1C,0BAAwB;AACxB,uCAAuC;AACvC,gCAA8B;AAC9B,0CAA0C;AAC1C,qCAAiD;AACjD,yCAAqC;AACrC,uBAAsC;AACtC,qCAA6B;AAC7B,qCAA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nC,SAAU;AAAA,UACV,UAAW;AAAA;AAAA,MACZ;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,MAAO;AAAA,UACP,OAAQ;AAAA;AAAA,MACT;AAAA,OACD;AAAA,IAED,4CAAC,gCAAAC,SAAA,EAAuB,UAAW,uBAAwB;AAAA,IAC3D,4CAAC,qBAAAC,SAAA,EAAa,UAAW,uBAAwB;AAAA,IAC/C,CAAE,6BACH;AAAA,MAAC,kCAAAC;AAAA,MAAA;AAAA,QACA,eAAgB;AAAA;AAAA,IACjB;AAAA,IAED,4CAAC,iEAA0B;AAAA,IACzB,6BAA6B,CAAE,kBAChC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IAEC,CAAE,6BAA6B,mBAChC,2EACC;AAAA,MAAC,+BAAAP;AAAA,MAAA;AAAA,QACA;AAAA,QACA,UAAW;AAAA,QACX;AAAA,QACA,MAAO;AAAA,QACP;AAAA,QACA;AAAA;AAAA,IACD,GACD;AAAA,IAEC,CAAE,6BAA6B,CAAE,mBAClC,4EACG;AAAA,wBACD,4CAAC,oBAAAQ,SAAA,EAAY,UAAW,uBAAwB;AAAA,MAEjD,4CAAC,mBAAAC,SAAA,EAAW,kBAAsC;AAAA,MAClD,4CAAC,0BAAAjB,QAAkB,MAAlB,EAAuB,OAAM,WAAU;AAAA,MACxC,4CAAC,0BAAAA,QAAkB,MAAlB,EAAuB,OAAM,QAAO,KAAM,aAAc;AAAA,MACzD,4CAAC,2DAAuB,aAA4B;AAAA,MAClD,CAAE,kBACH,4CAAC,uBAAoB,WAAwB;AAAA,OAE/C;AAAA,IAEC,CAAE,6BACH,4CAAC,iBAAAkB,QAA0B,MAA1B,EAA+B;AAAA,IAEjC,4CAAC,8BAAAC,SAAA,IAAwB,MAAO;AAAA,KACjC;AAEF;AAKA,IAAO,0BAAQ;",
|
|
6
6
|
"names": ["InspectorControls", "PositionControls", "AdvancedControls", "blockEditorStore", "blocksStore", "useInspectorControlsTabs", "useBlockInspectorAnimationSettings", "MultiSelectionInspector", "InspectorControlsTabs", "motion", "useBlockDisplayInformation", "BlockCard", "Spacer", "ViewportVisibilityInfo", "EditContents", "BlockVariationTransforms", "BlockStyles", "ContentTab", "InspectorControlsLastItem", "SkipToSelectedBlock"]
|
|
7
7
|
}
|
|
@@ -100,7 +100,7 @@ function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLa
|
|
|
100
100
|
return (0, import_i18n.sprintf)(
|
|
101
101
|
// translators: 1: Type of block (i.e. Text, Image etc)
|
|
102
102
|
(0, import_i18n.__)(
|
|
103
|
-
"Block %1$s is at the end of the content and can
|
|
103
|
+
"Block %1$s is at the end of the content and can’t be moved down"
|
|
104
104
|
),
|
|
105
105
|
type
|
|
106
106
|
);
|
|
@@ -109,7 +109,7 @@ function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLa
|
|
|
109
109
|
return (0, import_i18n.sprintf)(
|
|
110
110
|
// translators: 1: Type of block (i.e. Text, Image etc)
|
|
111
111
|
(0, import_i18n.__)(
|
|
112
|
-
"Block %1$s is at the end of the content and can
|
|
112
|
+
"Block %1$s is at the end of the content and can’t be moved left"
|
|
113
113
|
),
|
|
114
114
|
type
|
|
115
115
|
);
|
|
@@ -118,7 +118,7 @@ function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLa
|
|
|
118
118
|
return (0, import_i18n.sprintf)(
|
|
119
119
|
// translators: 1: Type of block (i.e. Text, Image etc)
|
|
120
120
|
(0, import_i18n.__)(
|
|
121
|
-
"Block %1$s is at the end of the content and can
|
|
121
|
+
"Block %1$s is at the end of the content and can’t be moved right"
|
|
122
122
|
),
|
|
123
123
|
type
|
|
124
124
|
);
|
|
@@ -164,7 +164,7 @@ function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLa
|
|
|
164
164
|
return (0, import_i18n.sprintf)(
|
|
165
165
|
// translators: 1: Type of block (i.e. Text, Image etc)
|
|
166
166
|
(0, import_i18n.__)(
|
|
167
|
-
"Block %1$s is at the beginning of the content and can
|
|
167
|
+
"Block %1$s is at the beginning of the content and can’t be moved up"
|
|
168
168
|
),
|
|
169
169
|
type
|
|
170
170
|
);
|
|
@@ -173,7 +173,7 @@ function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLa
|
|
|
173
173
|
return (0, import_i18n.sprintf)(
|
|
174
174
|
// translators: 1: Type of block (i.e. Text, Image etc)
|
|
175
175
|
(0, import_i18n.__)(
|
|
176
|
-
"Block %1$s is at the beginning of the content and can
|
|
176
|
+
"Block %1$s is at the beginning of the content and can’t be moved left"
|
|
177
177
|
),
|
|
178
178
|
type
|
|
179
179
|
);
|
|
@@ -182,7 +182,7 @@ function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLa
|
|
|
182
182
|
return (0, import_i18n.sprintf)(
|
|
183
183
|
// translators: 1: Type of block (i.e. Text, Image etc)
|
|
184
184
|
(0, import_i18n.__)(
|
|
185
|
-
"Block %1$s is at the beginning of the content and can
|
|
185
|
+
"Block %1$s is at the beginning of the content and can’t be moved right"
|
|
186
186
|
),
|
|
187
187
|
type
|
|
188
188
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-mover/mover-description.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\n\nconst getMovementDirection = ( moveDirection, orientation ) => {\n\tif ( moveDirection === 'up' ) {\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\treturn isRTL() ? 'right' : 'left';\n\t\t}\n\t\treturn 'up';\n\t} else if ( moveDirection === 'down' ) {\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\treturn isRTL() ? 'left' : 'right';\n\t\t}\n\t\treturn 'down';\n\t}\n\treturn null;\n};\n\n/**\n * Return a label for the block movement controls depending on block position.\n *\n * @param {number} selectedCount Number of blocks selected.\n * @param {string} type Block type - in the case of a single block, should\n * define its 'type'. I.e. 'Text', 'Heading', 'Image' etc.\n * @param {number} firstIndex The index (position - 1) of the first block selected.\n * @param {boolean} isFirst This is the first block.\n * @param {boolean} isLast This is the last block.\n * @param {number} dir Direction of movement (> 0 is considered to be going\n * down, < 0 is up).\n * @param {string} orientation The orientation of the block movers, vertical or\n * horizontal.\n *\n * @return {string | undefined} Label for the block movement controls.\n */\nexport function getBlockMoverDescription(\n\tselectedCount,\n\ttype,\n\tfirstIndex,\n\tisFirst,\n\tisLast,\n\tdir,\n\torientation\n) {\n\tconst position = firstIndex + 1;\n\n\tif ( selectedCount > 1 ) {\n\t\treturn getMultiBlockMoverDescription(\n\t\t\tselectedCount,\n\t\t\tfirstIndex,\n\t\t\tisFirst,\n\t\t\tisLast,\n\t\t\tdir,\n\t\t\torientation\n\t\t);\n\t}\n\n\tif ( isFirst && isLast ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: Type of block (i.e. Text, Image etc)\n\t\t\t__( 'Block %s is the only block, and cannot be moved' ),\n\t\t\ttype\n\t\t);\n\t}\n\n\tif ( dir > 0 && ! isLast ) {\n\t\t// Moving down.\n\t\tconst movementDirection = getMovementDirection( 'down', orientation );\n\n\t\tif ( movementDirection === 'down' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position\n\t\t\t\t__(\n\t\t\t\t\t'Move %1$s block from position %2$d down to position %3$d'\n\t\t\t\t),\n\t\t\t\ttype,\n\t\t\t\tposition,\n\t\t\t\tposition + 1\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position\n\t\t\t\t__(\n\t\t\t\t\t'Move %1$s block from position %2$d left to position %3$d'\n\t\t\t\t),\n\t\t\t\ttype,\n\t\t\t\tposition,\n\t\t\t\tposition + 1\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position\n\t\t\t\t__(\n\t\t\t\t\t'Move %1$s block from position %2$d right to position %3$d'\n\t\t\t\t),\n\t\t\t\ttype,\n\t\t\t\tposition,\n\t\t\t\tposition + 1\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( dir > 0 && isLast ) {\n\t\t// Moving down, and is the last item.\n\t\tconst movementDirection = getMovementDirection( 'down', orientation );\n\n\t\tif ( movementDirection === 'down' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc)\n\t\t\t\t__(\n\t\t\t\t\t'Block %1$s is at the end of the content and can\u2019t be moved down'\n\t\t\t\t),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc)\n\t\t\t\t__(\n\t\t\t\t\t'Block %1$s is at the end of the content and can\u2019t be moved left'\n\t\t\t\t),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc)\n\t\t\t\t__(\n\t\t\t\t\t'Block %1$s is at the end of the content and can\u2019t be moved right'\n\t\t\t\t),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( dir < 0 && ! isFirst ) {\n\t\t// Moving up.\n\t\tconst movementDirection = getMovementDirection( 'up', orientation );\n\n\t\tif ( movementDirection === 'up' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position\n\t\t\t\t__( 'Move %1$s block from position %2$d up to position %3$d' ),\n\t\t\t\ttype,\n\t\t\t\tposition,\n\t\t\t\tposition - 1\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position\n\t\t\t\t__(\n\t\t\t\t\t'Move %1$s block from position %2$d left to position %3$d'\n\t\t\t\t),\n\t\t\t\ttype,\n\t\t\t\tposition,\n\t\t\t\tposition - 1\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position\n\t\t\t\t__(\n\t\t\t\t\t'Move %1$s block from position %2$d right to position %3$d'\n\t\t\t\t),\n\t\t\t\ttype,\n\t\t\t\tposition,\n\t\t\t\tposition - 1\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( dir < 0 && isFirst ) {\n\t\t// Moving up, and is the first item.\n\t\tconst movementDirection = getMovementDirection( 'up', orientation );\n\n\t\tif ( movementDirection === 'up' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc)\n\t\t\t\t__(\n\t\t\t\t\t'Block %1$s is at the beginning of the content and can\u2019t be moved up'\n\t\t\t\t),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc)\n\t\t\t\t__(\n\t\t\t\t\t'Block %1$s is at the beginning of the content and can\u2019t be moved left'\n\t\t\t\t),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc)\n\t\t\t\t__(\n\t\t\t\t\t'Block %1$s is at the beginning of the content and can\u2019t be moved right'\n\t\t\t\t),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Return a label for the block movement controls depending on block position.\n *\n * @param {number} selectedCount Number of blocks selected.\n * @param {number} firstIndex The index (position - 1) of the first block selected.\n * @param {boolean} isFirst This is the first block.\n * @param {boolean} isLast This is the last block.\n * @param {number} dir Direction of movement (> 0 is considered to be going\n * down, < 0 is up).\n * @param {string} orientation The orientation of the block movers, vertical or\n * horizontal.\n *\n * @return {string | undefined} Label for the block movement controls.\n */\nexport function getMultiBlockMoverDescription(\n\tselectedCount,\n\tfirstIndex,\n\tisFirst,\n\tisLast,\n\tdir,\n\torientation\n) {\n\tconst position = firstIndex + 1;\n\n\tif ( isFirst && isLast ) {\n\t\t// All blocks are selected\n\t\treturn __( 'All blocks are selected, and cannot be moved' );\n\t}\n\n\tif ( dir > 0 && ! isLast ) {\n\t\t// moving down\n\t\tconst movementDirection = getMovementDirection( 'down', orientation );\n\n\t\tif ( movementDirection === 'down' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Number of selected blocks, 2: Position of selected blocks\n\t\t\t\t__( 'Move %1$d blocks from position %2$d down by one place' ),\n\t\t\t\tselectedCount,\n\t\t\t\tposition\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Number of selected blocks, 2: Position of selected blocks\n\t\t\t\t__( 'Move %1$d blocks from position %2$d left by one place' ),\n\t\t\t\tselectedCount,\n\t\t\t\tposition\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Number of selected blocks, 2: Position of selected blocks\n\t\t\t\t__( 'Move %1$d blocks from position %2$d right by one place' ),\n\t\t\t\tselectedCount,\n\t\t\t\tposition\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( dir > 0 && isLast ) {\n\t\t// moving down, and the selected blocks are the last item\n\t\tconst movementDirection = getMovementDirection( 'down', orientation );\n\n\t\tif ( movementDirection === 'down' ) {\n\t\t\treturn __(\n\t\t\t\t'Blocks cannot be moved down as they are already at the bottom'\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn __(\n\t\t\t\t'Blocks cannot be moved left as they are already are at the leftmost position'\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn __(\n\t\t\t\t'Blocks cannot be moved right as they are already are at the rightmost position'\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( dir < 0 && ! isFirst ) {\n\t\t// moving up\n\t\tconst movementDirection = getMovementDirection( 'up', orientation );\n\n\t\tif ( movementDirection === 'up' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Number of selected blocks, 2: Position of selected blocks\n\t\t\t\t__( 'Move %1$d blocks from position %2$d up by one place' ),\n\t\t\t\tselectedCount,\n\t\t\t\tposition\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Number of selected blocks, 2: Position of selected blocks\n\t\t\t\t__( 'Move %1$d blocks from position %2$d left by one place' ),\n\t\t\t\tselectedCount,\n\t\t\t\tposition\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Number of selected blocks, 2: Position of selected blocks\n\t\t\t\t__( 'Move %1$d blocks from position %2$d right by one place' ),\n\t\t\t\tselectedCount,\n\t\t\t\tposition\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( dir < 0 && isFirst ) {\n\t\t// moving up, and the selected blocks are the first item\n\t\tconst movementDirection = getMovementDirection( 'up', orientation );\n\n\t\tif ( movementDirection === 'up' ) {\n\t\t\treturn __(\n\t\t\t\t'Blocks cannot be moved up as they are already at the top'\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn __(\n\t\t\t\t'Blocks cannot be moved left as they are already are at the leftmost position'\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn __(\n\t\t\t\t'Blocks cannot be moved right as they are already are at the rightmost position'\n\t\t\t);\n\t\t}\n\t}\n}\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\n\nconst getMovementDirection = ( moveDirection, orientation ) => {\n\tif ( moveDirection === 'up' ) {\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\treturn isRTL() ? 'right' : 'left';\n\t\t}\n\t\treturn 'up';\n\t} else if ( moveDirection === 'down' ) {\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\treturn isRTL() ? 'left' : 'right';\n\t\t}\n\t\treturn 'down';\n\t}\n\treturn null;\n};\n\n/**\n * Return a label for the block movement controls depending on block position.\n *\n * @param {number} selectedCount Number of blocks selected.\n * @param {string} type Block type - in the case of a single block, should\n * define its 'type'. I.e. 'Text', 'Heading', 'Image' etc.\n * @param {number} firstIndex The index (position - 1) of the first block selected.\n * @param {boolean} isFirst This is the first block.\n * @param {boolean} isLast This is the last block.\n * @param {number} dir Direction of movement (> 0 is considered to be going\n * down, < 0 is up).\n * @param {string} orientation The orientation of the block movers, vertical or\n * horizontal.\n *\n * @return {string | undefined} Label for the block movement controls.\n */\nexport function getBlockMoverDescription(\n\tselectedCount,\n\ttype,\n\tfirstIndex,\n\tisFirst,\n\tisLast,\n\tdir,\n\torientation\n) {\n\tconst position = firstIndex + 1;\n\n\tif ( selectedCount > 1 ) {\n\t\treturn getMultiBlockMoverDescription(\n\t\t\tselectedCount,\n\t\t\tfirstIndex,\n\t\t\tisFirst,\n\t\t\tisLast,\n\t\t\tdir,\n\t\t\torientation\n\t\t);\n\t}\n\n\tif ( isFirst && isLast ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: Type of block (i.e. Text, Image etc)\n\t\t\t__( 'Block %s is the only block, and cannot be moved' ),\n\t\t\ttype\n\t\t);\n\t}\n\n\tif ( dir > 0 && ! isLast ) {\n\t\t// Moving down.\n\t\tconst movementDirection = getMovementDirection( 'down', orientation );\n\n\t\tif ( movementDirection === 'down' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position\n\t\t\t\t__(\n\t\t\t\t\t'Move %1$s block from position %2$d down to position %3$d'\n\t\t\t\t),\n\t\t\t\ttype,\n\t\t\t\tposition,\n\t\t\t\tposition + 1\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position\n\t\t\t\t__(\n\t\t\t\t\t'Move %1$s block from position %2$d left to position %3$d'\n\t\t\t\t),\n\t\t\t\ttype,\n\t\t\t\tposition,\n\t\t\t\tposition + 1\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position\n\t\t\t\t__(\n\t\t\t\t\t'Move %1$s block from position %2$d right to position %3$d'\n\t\t\t\t),\n\t\t\t\ttype,\n\t\t\t\tposition,\n\t\t\t\tposition + 1\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( dir > 0 && isLast ) {\n\t\t// Moving down, and is the last item.\n\t\tconst movementDirection = getMovementDirection( 'down', orientation );\n\n\t\tif ( movementDirection === 'down' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc)\n\t\t\t\t__(\n\t\t\t\t\t'Block %1$s is at the end of the content and can’t be moved down'\n\t\t\t\t),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc)\n\t\t\t\t__(\n\t\t\t\t\t'Block %1$s is at the end of the content and can’t be moved left'\n\t\t\t\t),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc)\n\t\t\t\t__(\n\t\t\t\t\t'Block %1$s is at the end of the content and can’t be moved right'\n\t\t\t\t),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( dir < 0 && ! isFirst ) {\n\t\t// Moving up.\n\t\tconst movementDirection = getMovementDirection( 'up', orientation );\n\n\t\tif ( movementDirection === 'up' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position\n\t\t\t\t__( 'Move %1$s block from position %2$d up to position %3$d' ),\n\t\t\t\ttype,\n\t\t\t\tposition,\n\t\t\t\tposition - 1\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position\n\t\t\t\t__(\n\t\t\t\t\t'Move %1$s block from position %2$d left to position %3$d'\n\t\t\t\t),\n\t\t\t\ttype,\n\t\t\t\tposition,\n\t\t\t\tposition - 1\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position\n\t\t\t\t__(\n\t\t\t\t\t'Move %1$s block from position %2$d right to position %3$d'\n\t\t\t\t),\n\t\t\t\ttype,\n\t\t\t\tposition,\n\t\t\t\tposition - 1\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( dir < 0 && isFirst ) {\n\t\t// Moving up, and is the first item.\n\t\tconst movementDirection = getMovementDirection( 'up', orientation );\n\n\t\tif ( movementDirection === 'up' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc)\n\t\t\t\t__(\n\t\t\t\t\t'Block %1$s is at the beginning of the content and can’t be moved up'\n\t\t\t\t),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc)\n\t\t\t\t__(\n\t\t\t\t\t'Block %1$s is at the beginning of the content and can’t be moved left'\n\t\t\t\t),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Type of block (i.e. Text, Image etc)\n\t\t\t\t__(\n\t\t\t\t\t'Block %1$s is at the beginning of the content and can’t be moved right'\n\t\t\t\t),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Return a label for the block movement controls depending on block position.\n *\n * @param {number} selectedCount Number of blocks selected.\n * @param {number} firstIndex The index (position - 1) of the first block selected.\n * @param {boolean} isFirst This is the first block.\n * @param {boolean} isLast This is the last block.\n * @param {number} dir Direction of movement (> 0 is considered to be going\n * down, < 0 is up).\n * @param {string} orientation The orientation of the block movers, vertical or\n * horizontal.\n *\n * @return {string | undefined} Label for the block movement controls.\n */\nexport function getMultiBlockMoverDescription(\n\tselectedCount,\n\tfirstIndex,\n\tisFirst,\n\tisLast,\n\tdir,\n\torientation\n) {\n\tconst position = firstIndex + 1;\n\n\tif ( isFirst && isLast ) {\n\t\t// All blocks are selected\n\t\treturn __( 'All blocks are selected, and cannot be moved' );\n\t}\n\n\tif ( dir > 0 && ! isLast ) {\n\t\t// moving down\n\t\tconst movementDirection = getMovementDirection( 'down', orientation );\n\n\t\tif ( movementDirection === 'down' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Number of selected blocks, 2: Position of selected blocks\n\t\t\t\t__( 'Move %1$d blocks from position %2$d down by one place' ),\n\t\t\t\tselectedCount,\n\t\t\t\tposition\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Number of selected blocks, 2: Position of selected blocks\n\t\t\t\t__( 'Move %1$d blocks from position %2$d left by one place' ),\n\t\t\t\tselectedCount,\n\t\t\t\tposition\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Number of selected blocks, 2: Position of selected blocks\n\t\t\t\t__( 'Move %1$d blocks from position %2$d right by one place' ),\n\t\t\t\tselectedCount,\n\t\t\t\tposition\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( dir > 0 && isLast ) {\n\t\t// moving down, and the selected blocks are the last item\n\t\tconst movementDirection = getMovementDirection( 'down', orientation );\n\n\t\tif ( movementDirection === 'down' ) {\n\t\t\treturn __(\n\t\t\t\t'Blocks cannot be moved down as they are already at the bottom'\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn __(\n\t\t\t\t'Blocks cannot be moved left as they are already are at the leftmost position'\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn __(\n\t\t\t\t'Blocks cannot be moved right as they are already are at the rightmost position'\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( dir < 0 && ! isFirst ) {\n\t\t// moving up\n\t\tconst movementDirection = getMovementDirection( 'up', orientation );\n\n\t\tif ( movementDirection === 'up' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Number of selected blocks, 2: Position of selected blocks\n\t\t\t\t__( 'Move %1$d blocks from position %2$d up by one place' ),\n\t\t\t\tselectedCount,\n\t\t\t\tposition\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Number of selected blocks, 2: Position of selected blocks\n\t\t\t\t__( 'Move %1$d blocks from position %2$d left by one place' ),\n\t\t\t\tselectedCount,\n\t\t\t\tposition\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: 1: Number of selected blocks, 2: Position of selected blocks\n\t\t\t\t__( 'Move %1$d blocks from position %2$d right by one place' ),\n\t\t\t\tselectedCount,\n\t\t\t\tposition\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( dir < 0 && isFirst ) {\n\t\t// moving up, and the selected blocks are the first item\n\t\tconst movementDirection = getMovementDirection( 'up', orientation );\n\n\t\tif ( movementDirection === 'up' ) {\n\t\t\treturn __(\n\t\t\t\t'Blocks cannot be moved up as they are already at the top'\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'left' ) {\n\t\t\treturn __(\n\t\t\t\t'Blocks cannot be moved left as they are already are at the leftmost position'\n\t\t\t);\n\t\t}\n\n\t\tif ( movementDirection === 'right' ) {\n\t\t\treturn __(\n\t\t\t\t'Blocks cannot be moved right as they are already are at the rightmost position'\n\t\t\t);\n\t\t}\n\t}\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmC;AAEnC,IAAM,uBAAuB,CAAE,eAAe,gBAAiB;AAC9D,MAAK,kBAAkB,MAAO;AAC7B,QAAK,gBAAgB,cAAe;AACnC,iBAAO,mBAAM,IAAI,UAAU;AAAA,IAC5B;AACA,WAAO;AAAA,EACR,WAAY,kBAAkB,QAAS;AACtC,QAAK,gBAAgB,cAAe;AACnC,iBAAO,mBAAM,IAAI,SAAS;AAAA,IAC3B;AACA,WAAO;AAAA,EACR;AACA,SAAO;AACR;AAkBO,SAAS,yBACf,eACA,MACA,YACA,SACA,QACA,KACA,aACC;AACD,QAAM,WAAW,aAAa;AAE9B,MAAK,gBAAgB,GAAI;AACxB,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,MAAK,WAAW,QAAS;AACxB,eAAO;AAAA;AAAA,UAEN,gBAAI,iDAAkD;AAAA,MACtD;AAAA,IACD;AAAA,EACD;AAEA,MAAK,MAAM,KAAK,CAAE,QAAS;AAE1B,UAAM,oBAAo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AY;AAEpE,QAAK,sBAAsB,QAAS;AACnC,iBAAO;AAAA,QACN;AAAA,MACD;AAAA,IACD;AAEA,QAAK,sBAAsB,QAAS;AACnC,iBAAO;AAAA,QACN;AAAA,MACD;AAAA,IACD;AAEA,QAAK,sBAAsB,SAAU;AACpC,iBAAO;AAAA,QACN;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,MAAK,MAAM,KAAK,CAAE,SAAU;AAE3B,UAAM,oBAAoB,qBAAsB,MAAM,WAAY;AAElE,QAAK,sBAAsB,MAAO;AACjC,iBAAO;AAAA;AAAA,YAEN,gBAAI,qDAAsD;AAAA,QAC1D;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAEA,QAAK,sBAAsB,QAAS;AACnC,iBAAO;AAAA;AAAA,YAEN,gBAAI,uDAAwD;AAAA,QAC5D;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAEA,QAAK,sBAAsB,SAAU;AACpC,iBAAO;AAAA;AAAA,YAEN,gBAAI,wDAAyD;AAAA,QAC7D;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,MAAK,MAAM,KAAK,SAAU;AAEzB,UAAM,oBAAoB,qBAAsB,MAAM,WAAY;AAElE,QAAK,sBAAsB,MAAO;AACjC,iBAAO;AAAA,QACN;AAAA,MACD;AAAA,IACD;AAEA,QAAK,sBAAsB,QAAS;AACnC,iBAAO;AAAA,QACN;AAAA,MACD;AAAA,IACD;AAEA,QAAK,sBAAsB,SAAU;AACpC,iBAAO;AAAA,QACN;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-patterns-list/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useEffect, useState, forwardRef, useMemo } from '@wordpress/element';\nimport {\n\tComposite,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,oBAA2B;AAC3B,qBAAyD;AACzD,wBAGO;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useEffect, useState, forwardRef, useMemo } from '@wordpress/element';\nimport {\n\tComposite,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { VisuallyHidden, Text, Tooltip } from '@wordpress/ui';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, symbol } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockPreview from '../block-preview';\nimport InserterDraggableBlocks from '../inserter-draggable-blocks';\nimport BlockPatternsPaging from '../block-patterns-paging';\nimport { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';\n\nconst WithToolTip = ( { showTooltip, title, children } ) => {\n\tif ( showTooltip ) {\n\t\treturn (\n\t\t\t<Tooltip.Root>\n\t\t\t\t<Tooltip.Trigger render={ children } />\n\t\t\t\t<Tooltip.Popup>{ title }</Tooltip.Popup>\n\t\t\t</Tooltip.Root>\n\t\t);\n\t}\n\treturn <>{ children }</>;\n};\n\nfunction BlockPattern( {\n\tid,\n\tisDraggable,\n\tpattern,\n\tonClick,\n\tonHover,\n\tshowTitlesAsTooltip,\n\tcategory,\n\tisSelected,\n} ) {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst { blocks, viewportWidth } = pattern;\n\tconst instanceId = useInstanceId( BlockPattern );\n\tconst descriptionId = `block-editor-block-patterns-list__item-description-${ instanceId }`;\n\tconst isUserPattern = pattern.type === INSERTER_PATTERN_TYPES.user;\n\n\t// When we have a selected category and the pattern is draggable, we need to update the\n\t// pattern's categories in metadata to only contain the selected category, and pass this to\n\t// InserterDraggableBlocks component. We do that because we use this information for pattern\n\t// shuffling and it makes more sense to show only the ones from the initially selected category during insertion.\n\tconst patternBlocks = useMemo( () => {\n\t\tif ( ! category || ! isDraggable ) {\n\t\t\treturn blocks;\n\t\t}\n\t\treturn ( blocks ?? [] ).map( ( block ) => {\n\t\t\tconst clonedBlock = cloneBlock( block );\n\t\t\tif (\n\t\t\t\tclonedBlock.attributes.metadata?.categories?.includes(\n\t\t\t\t\tcategory\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tclonedBlock.attributes.metadata.categories = [ category ];\n\t\t\t}\n\t\t\treturn clonedBlock;\n\t\t} );\n\t}, [ blocks, isDraggable, category ] );\n\n\treturn (\n\t\t<InserterDraggableBlocks\n\t\t\tisEnabled={ isDraggable }\n\t\t\tblocks={ patternBlocks }\n\t\t\tpattern={ pattern }\n\t\t>\n\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"block-editor-block-patterns-list__list-item\"\n\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\tonDragStart={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( true );\n\t\t\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\tonDragStart( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonDragEnd={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( false );\n\t\t\t\t\t\tif ( onDragEnd ) {\n\t\t\t\t\t\t\tonDragEnd( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<WithToolTip\n\t\t\t\t\t\tshowTooltip={ showTitlesAsTooltip && ! isUserPattern }\n\t\t\t\t\t\ttitle={ pattern.title }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Composite.Item\n\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\taria-label={ pattern.title }\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\tpattern.description\n\t\t\t\t\t\t\t\t\t\t\t? descriptionId\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__item',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__list-item-synced':\n\t\t\t\t\t\t\t\t\t\t\t\tpattern.type ===\n\t\t\t\t\t\t\t\t\t\t\t\t\tINSERTER_PATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t\t\t\t! pattern.syncStatus,\n\t\t\t\t\t\t\t\t\t\t\t'is-selected': isSelected,\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\tid={ id }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonClick( pattern, blocks );\n\t\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseEnter={ () => {\n\t\t\t\t\t\t\t\tif ( isDragging ) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonHover?.( pattern );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseLeave={ () => onHover?.( null ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockPreview.Async\n\t\t\t\t\t\t\t\tplaceholder={ <BlockPatternPlaceholder /> }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</BlockPreview.Async>\n\t\t\t\t\t\t\t{ ( ! showTitlesAsTooltip || isUserPattern ) && (\n\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-patterns__pattern-details\"\n\t\t\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ isUserPattern && ! pattern.syncStatus && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-patterns__pattern-icon-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\trender={ <div /> }\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-patterns-list__item-title\"\n\t\t\t\t\t\t\t\t\t\tvariant=\"body-sm\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ pattern.title }\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t{ !! pattern.description && (\n\t\t\t\t\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t\t\t\t\t{ pattern.description }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Composite.Item>\n\t\t\t\t\t</WithToolTip>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</InserterDraggableBlocks>\n\t);\n}\n\nfunction BlockPatternPlaceholder() {\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-list__item is-placeholder\" />\n\t);\n}\n\nfunction BlockPatternsList(\n\t{\n\t\tisDraggable,\n\t\tblockPatterns,\n\t\tonHover,\n\t\tonClickPattern,\n\t\torientation,\n\t\tcategory,\n\t\tlabel = __( 'Patterns' ),\n\t\tshowTitlesAsTooltip,\n\t\tpagingProps,\n\t},\n\tref\n) {\n\tconst [ activeCompositeId, setActiveCompositeId ] = useState( undefined );\n\tconst [ activePattern, setActivePattern ] = useState( null ); // State to track active pattern\n\n\tuseEffect( () => {\n\t\t// Reset the active composite item whenever the available patterns change,\n\t\t// to make sure that Composite widget can receive focus correctly when its\n\t\t// composite items change. The first composite item will receive focus.\n\t\tconst firstCompositeItemId = blockPatterns[ 0 ]?.name;\n\t\tsetActiveCompositeId( firstCompositeItemId );\n\t}, [ blockPatterns ] );\n\n\tconst handleClickPattern = ( pattern, blocks ) => {\n\t\tsetActivePattern( pattern.name );\n\t\tonClickPattern( pattern, blocks );\n\t};\n\n\treturn (\n\t\t<Composite\n\t\t\torientation={ orientation }\n\t\t\tactiveId={ activeCompositeId }\n\t\t\tsetActiveId={ setActiveCompositeId }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-editor-block-patterns-list\"\n\t\t\taria-label={ label }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ blockPatterns.map( ( pattern ) => (\n\t\t\t\t<BlockPattern\n\t\t\t\t\tkey={ pattern.name }\n\t\t\t\t\tid={ pattern.name }\n\t\t\t\t\tpattern={ pattern }\n\t\t\t\t\tonClick={ handleClickPattern }\n\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t\t\tcategory={ category }\n\t\t\t\t\tisSelected={\n\t\t\t\t\t\t!! activePattern && activePattern === pattern.name\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ pagingProps && <BlockPatternsPaging { ...pagingProps } /> }\n\t\t</Composite>\n\t);\n}\n\nexport default forwardRef( BlockPatternsList );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,oBAA2B;AAC3B,qBAAyD;AACzD,wBAGO;AACP,gBAA8C;AAC9C,qBAA8B;AAC9B,kBAAmB;AACnB,mBAA6B;AAK7B,2BAAyB;AACzB,uCAAoC;AACpC,mCAAgC;AAChC,mBAAuC;AAKpC;AAHH,IAAM,cAAc,CAAE,EAAE,aAAa,OAAO,SAAS,MAAO;AAC3D,MAAK,aAAc;AAClB,WACC,6CAAC,kBAAQ,MAAR,EACA;AAAA,kDAAC,kBAAQ,SAAR,EAAgB,QAAS,UAAW;AAAA,MACrC,4CAAC,kBAAQ,OAAR,EAAgB,iBAAO;AAAA,OACzB;AAAA,EAEF;AACA,SAAO,2EAAI,UAAU;AACtB;AAEA,SAAS,aAAc;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,YAAY,aAAc,QAAI,yBAAU,KAAM;AACtD,QAAM,EAAE,QAAQ,cAAc,IAAI;AAClC,QAAM,iBAAa,8BAAe,YAAa;AAC/C,QAAM,gBAAgB,sDAAuD,UAAW;AACxF,QAAM,gBAAgB,QAAQ,SAAS,oCAAuB;AAM9D,QAAM,oBAAgB,wBAAS,MAAM;AACpC,QAAK,CAAE,YAAY,CAAE,aAAc;AAClC,aAAO;AAAA,IACR;AACA,YAAS,UAAU,CAAC,GAAI,IAAK,CAAE,UAAW;AACzC,YAAM,kBAAc,0BAAY,KAAM;AACtC,UACC,YAAY,WAAW,UAAU,YAAY;AAAA,QAC5C;AAAA,MACD,GACC;AACD,oBAAY,WAAW,SAAS,aAAa,CAAE,QAAS;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AAS,MAAO;AAAA,EACjC;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,UAAW;AAAA,MACX,aAAc;AAAA,MACd,MAAK;AAAA,MACL,WAAU;AAAA,MACV,cAAa;AAAA,MACb;AAAA,MAEE;AAAA,sBAAc,IAAK,CAAE,YACtB;AAAA,UAAC;AAAA;AAAA,YAEA,IAAK,QAAQ;AAAA,YACb;AAAA,YACA,SAAU;AAAA,YACV;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,YACC,CAAC,CAAE,iBAAiB,kBAAkB,QAAQ;AAAA;AAAA,UATzC,QAAQ;AAAA,QAWf,CACC;AAAA,QACA,eAAe,4CAAC,6BAAAC,SAAA,EAAsB,GAAG,aAAc;AAAA;AAAA;AAAA,EAC1D;AAEF;AAEA,IAAO,kCAAQ,2BAAY,iBAAkB;",
|
|
6
6
|
"names": ["InserterDraggableBlocks", "clsx", "BlockPreview", "HStack", "BlockPatternsPaging"]
|
|
7
7
|
}
|
|
@@ -63,7 +63,7 @@ function Pagination({
|
|
|
63
63
|
size: "compact",
|
|
64
64
|
accessibleWhenDisabled: true,
|
|
65
65
|
className: "block-editor-patterns__grid-pagination-button",
|
|
66
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "
|
|
66
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "«" })
|
|
67
67
|
}
|
|
68
68
|
),
|
|
69
69
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -76,7 +76,7 @@ function Pagination({
|
|
|
76
76
|
size: "compact",
|
|
77
77
|
accessibleWhenDisabled: true,
|
|
78
78
|
className: "block-editor-patterns__grid-pagination-button",
|
|
79
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "
|
|
79
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "‹" })
|
|
80
80
|
}
|
|
81
81
|
)
|
|
82
82
|
]
|
|
@@ -105,7 +105,7 @@ function Pagination({
|
|
|
105
105
|
size: "compact",
|
|
106
106
|
accessibleWhenDisabled: true,
|
|
107
107
|
className: "block-editor-patterns__grid-pagination-button",
|
|
108
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "
|
|
108
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "›" })
|
|
109
109
|
}
|
|
110
110
|
),
|
|
111
111
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -118,7 +118,7 @@ function Pagination({
|
|
|
118
118
|
size: "compact",
|
|
119
119
|
accessibleWhenDisabled: true,
|
|
120
120
|
className: "block-editor-patterns__grid-pagination-button",
|
|
121
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "
|
|
121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "»" })
|
|
122
122
|
}
|
|
123
123
|
)
|
|
124
124
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-patterns-paging/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalText as WCText,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-patterns__grid-pagination-wrapper\">\n\t\t\t<WCText variant=\"muted\">\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\ttotalItems\n\t\t\t\t) }\n\t\t\t</WCText>\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<HStack\n\t\t\t\t\texpanded={ false }\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-previous\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAKO;AACP,kBAAoC;AAUjC;AARY,SAAR,WAA6B;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,6CAAC,kBAAAA,sBAAA,EAAO,WAAU,kDACjB;AAAA,gDAAC,kBAAAC,oBAAA,EAAO,SAAQ,SACb;AAAA;AAAA,UAED,gBAAI,WAAW,YAAY,UAAW;AAAA,MACtC;AAAA,IACD,GACD;AAAA,IACE,WAAW,KACZ;AAAA,MAAC,kBAAAC;AAAA,MAAA;AAAA,QACA,UAAW;AAAA,QACX,SAAU;AAAA,QACV,SAAQ;AAAA,QACR,WAAU;AAAA,QAEV;AAAA;AAAA,YAAC,kBAAAA;AAAA,YAAA;AAAA,cACA,UAAW;AAAA,cACX,SAAU;AAAA,cACV,WAAU;AAAA,cAEV;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACA,SAAQ;AAAA,oBACR,SAAU,MAAM,WAAY,CAAE;AAAA,oBAC9B,UAAW,gBAAgB;AAAA,oBAC3B,kBAAa,gBAAI,YAAa;AAAA,oBAC9B,MAAK;AAAA,oBACL,wBAAsB;AAAA,oBACtB,WAAU;AAAA,oBAEV,sDAAC,UAAK,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalText as WCText,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-patterns__grid-pagination-wrapper\">\n\t\t\t<WCText variant=\"muted\">\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\ttotalItems\n\t\t\t\t) }\n\t\t\t</WCText>\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<HStack\n\t\t\t\t\texpanded={ false }\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-previous\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>«</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'Previous page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>‹</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<WCText variant=\"muted\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: 1: Current page number. 2: Total number of pages.\n\t\t\t\t\t\t\t_x( '%1$s of %2$s', 'paging' ),\n\t\t\t\t\t\t\tcurrentPage,\n\t\t\t\t\t\t\tnumPages\n\t\t\t\t\t\t) }\n\t\t\t\t\t</WCText>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-next\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Next page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>›</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Last page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>»</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAKO;AACP,kBAAoC;AAUjC;AARY,SAAR,WAA6B;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,6CAAC,kBAAAA,sBAAA,EAAO,WAAU,kDACjB;AAAA,gDAAC,kBAAAC,oBAAA,EAAO,SAAQ,SACb;AAAA;AAAA,UAED,gBAAI,WAAW,YAAY,UAAW;AAAA,MACtC;AAAA,IACD,GACD;AAAA,IACE,WAAW,KACZ;AAAA,MAAC,kBAAAC;AAAA,MAAA;AAAA,QACA,UAAW;AAAA,QACX,SAAU;AAAA,QACV,SAAQ;AAAA,QACR,WAAU;AAAA,QAEV;AAAA;AAAA,YAAC,kBAAAA;AAAA,YAAA;AAAA,cACA,UAAW;AAAA,cACX,SAAU;AAAA,cACV,WAAU;AAAA,cAEV;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACA,SAAQ;AAAA,oBACR,SAAU,MAAM,WAAY,CAAE;AAAA,oBAC9B,UAAW,gBAAgB;AAAA,oBAC3B,kBAAa,gBAAI,YAAa;AAAA,oBAC9B,MAAK;AAAA,oBACL,wBAAsB;AAAA,oBACtB,WAAU;AAAA,oBAEV,sDAAC,UAAK,eAAC;AAAA;AAAA,gBACR;AAAA,gBACA;AAAA,kBAAC;AAAA;AAAA,oBACA,SAAQ;AAAA,o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sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { getScrollContainer } from '@wordpress/dom';\n\nconst scrollContainerCache = new WeakMap();\n\n/**\n * Allow scrolling \"through\" popovers over the canvas. This is only called for\n * as long as the pointer is over a popover. Do not use React events because it\n * will bubble through portals.\n *\n * @param {Object} contentRef\n */\nfunction usePopoverScroll( contentRef ) {\n\tconst effect = useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onWheel( event ) {\n\t\t\t\tconst { deltaX, deltaY, target } = event;\n\t\t\t\tconst contentEl = contentRef.current;\n\t\t\t\tlet scrollContainer = scrollContainerCache.get( contentEl );\n\t\t\t\tif ( ! scrollContainer ) {\n\t\t\t\t\tscrollContainer = getScrollContainer( contentEl );\n\t\t\t\t\tscrollContainerCache.set( contentEl, scrollContainer );\n\t\t\t\t}\n\t\t\t\t// Finds a scrollable ancestor of the event
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { getScrollContainer } from '@wordpress/dom';\n\nconst scrollContainerCache = new WeakMap();\n\n/**\n * Allow scrolling \"through\" popovers over the canvas. This is only called for\n * as long as the pointer is over a popover. Do not use React events because it\n * will bubble through portals.\n *\n * @param {Object} contentRef\n */\nfunction usePopoverScroll( contentRef ) {\n\tconst effect = useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onWheel( event ) {\n\t\t\t\tconst { deltaX, deltaY, target } = event;\n\t\t\t\tconst contentEl = contentRef.current;\n\t\t\t\tlet scrollContainer = scrollContainerCache.get( contentEl );\n\t\t\t\tif ( ! scrollContainer ) {\n\t\t\t\t\tscrollContainer = getScrollContainer( contentEl );\n\t\t\t\t\tscrollContainerCache.set( contentEl, scrollContainer );\n\t\t\t\t}\n\t\t\t\t// Finds a scrollable ancestor of the event’s target. It's not cached because the\n\t\t\t\t// it may not remain scrollable due to popover position changes. The cache is also\n\t\t\t\t// less likely to be utilized because the target may be different every event.\n\t\t\t\tconst eventScrollContainer = getScrollContainer( target );\n\t\t\t\t// Scrolls “through” the popover only if another contained scrollable area isn’t\n\t\t\t\t// in front of it. This is to avoid scrolling both containers simultaneously.\n\t\t\t\tif ( ! node.contains( eventScrollContainer ) ) {\n\t\t\t\t\tscrollContainer.scrollBy( deltaX, deltaY );\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Tell the browser that we do not call event.preventDefault\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners\n\t\t\tconst options = { passive: true };\n\t\t\tnode.addEventListener( 'wheel', onWheel, options );\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'wheel', onWheel, options );\n\t\t\t};\n\t\t},\n\t\t[ contentRef ]\n\t);\n\treturn contentRef ? effect : null;\n}\n\nexport default usePopoverScroll;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA6B;AAC7B,iBAAmC;AAEnC,IAAM,uBAAuB,oBAAI,QAAQ;AASzC,SAAS,iBAAkB,YAAa;AACvC,QAAM,aAAS;AAAA,IACd,CAAE,SAAU;AACX,eAAS,QAAS,OAAQ;AACzB,cAAM,EAAE,QAAQ,QAAQ,OAAO,IAAI;AACnC,cAAM,YAAY,WAAW;AAC7B,YAAI,kBAAkB,qBAAqB,IAAK,SAAU;AAC1D,YAAK,CAAE,iBAAkB;AACxB,gCAAkB,+BAAoB,SAAU;AAChD,+BAAqB,IAAK,WAAW,eAAgB;AAAA,QACtD;AAIA,cAAM,2BAAuB,+BAAoB,MAAO;AAGxD,YAAK,CAAE,KAAK,SAAU,oBAAqB,GAAI;AAC9C,0BAAgB,SAAU,QAAQ,MAAO;AAAA,QAC1C;AAAA,MACD;AAGA,YAAM,UAAU,EAAE,SAAS,KAAK;AAChC,WAAK,iBAAkB,SAAS,SAAS,OAAQ;AACjD,aAAO,MAAM;AACZ,aAAK,oBAAqB,SAAS,SAAS,OAAQ;AAAA,MACrD;AAAA,IACD;AAAA,IACA,CAAE,UAAW;AAAA,EACd;AACA,SAAO,aAAa,SAAS;AAC9B;AAEA,IAAO,6BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -41,6 +41,7 @@ var import_store = require("../../store/index.cjs");
|
|
|
41
41
|
var import_block_icon = __toESM(require("../block-icon/index.cjs"));
|
|
42
42
|
var import_use_block_display_information = __toESM(require("../use-block-display-information/index.cjs"));
|
|
43
43
|
var import_use_block_display_title = __toESM(require("../block-title/use-block-display-title.cjs"));
|
|
44
|
+
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
44
45
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
46
|
function BlockQuickNavigation({
|
|
46
47
|
clientIds,
|
|
@@ -69,14 +70,15 @@ function BlockQuickNavigationItem({
|
|
|
69
70
|
hasListViewTab
|
|
70
71
|
}) {
|
|
71
72
|
const blockInformation = (0, import_use_block_display_information.default)(clientId);
|
|
72
|
-
const { isSelected, childBlocks,
|
|
73
|
+
const { isSelected, childBlocks, shouldRenderListView, blockName } = (0, import_data.useSelect)(
|
|
73
74
|
(select) => {
|
|
74
75
|
const {
|
|
75
76
|
isBlockSelected,
|
|
76
77
|
hasSelectedInnerBlock,
|
|
77
78
|
getBlockOrder,
|
|
78
|
-
getBlockName
|
|
79
|
-
|
|
79
|
+
getBlockName,
|
|
80
|
+
shouldRenderBlockListView
|
|
81
|
+
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
80
82
|
const _blockName = getBlockName(clientId);
|
|
81
83
|
return {
|
|
82
84
|
isSelected: isBlockSelected(clientId) || hasSelectedInnerBlock(
|
|
@@ -85,7 +87,7 @@ function BlockQuickNavigationItem({
|
|
|
85
87
|
true
|
|
86
88
|
),
|
|
87
89
|
childBlocks: getBlockOrder(clientId),
|
|
88
|
-
|
|
90
|
+
shouldRenderListView: shouldRenderBlockListView(clientId),
|
|
89
91
|
blockName: _blockName
|
|
90
92
|
};
|
|
91
93
|
},
|
|
@@ -99,7 +101,7 @@ function BlockQuickNavigationItem({
|
|
|
99
101
|
const blockTitle = displayTitle || blockType?.title || blockName;
|
|
100
102
|
const { selectBlock } = (0, import_data.useDispatch)(import_store.store);
|
|
101
103
|
const hasChildren = childBlocks && childBlocks.length > 0;
|
|
102
|
-
const canNavigateToListView = hasChildren && hasListViewTab &&
|
|
104
|
+
const canNavigateToListView = hasChildren && hasListViewTab && shouldRenderListView;
|
|
103
105
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
104
106
|
import_components.Button,
|
|
105
107
|
{
|