@wordpress/block-editor 12.21.0 → 12.22.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 +2 -0
- package/build/components/block-actions/index.js +2 -4
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +5 -5
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.native.js +5 -4
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build/components/block-list/block-crash-boundary.native.js +49 -0
- package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
- package/build/components/block-list/block-crash-warning.native.js +24 -0
- package/build/components/block-list/block-crash-warning.native.js.map +1 -0
- package/build/components/block-list/block.native.js +7 -2
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-settings/container.native.js +2 -1
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +29 -29
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -3
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +3 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +1 -1
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/child-layout-control/index.js +108 -11
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +11 -0
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +8 -33
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +1 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -3
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +34 -30
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/index.js +3 -6
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/menu.js +3 -9
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/search-results.js +2 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -2
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
- package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
- package/build/components/list-view/block-select-button.js +2 -12
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +4 -11
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/utils.js +5 -3
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +4 -0
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/warning/index.native.js +9 -4
- package/build/components/warning/index.native.js.map +1 -1
- package/build/hooks/anchor.js +7 -8
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +39 -2
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/index.js +2 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +28 -6
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +21 -10
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/private-apis.native.js +3 -1
- package/build/private-apis.native.js.map +1 -1
- package/build/store/reducer.js +31 -26
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-actions/index.js +2 -4
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +5 -5
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
- package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
- package/build-module/components/block-list/block-crash-warning.native.js +15 -0
- package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
- package/build-module/components/block-list/block.native.js +7 -2
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +3 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +30 -30
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -3
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +3 -1
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +1 -1
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +109 -12
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +12 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +9 -34
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +0 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +34 -30
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js +3 -6
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/menu.js +3 -9
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/search-results.js +2 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -2
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js +28 -0
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
- package/build-module/components/list-view/block-select-button.js +3 -13
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +6 -13
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/utils.js +2 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +4 -0
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/warning/index.native.js +9 -4
- package/build-module/components/warning/index.native.js.map +1 -1
- package/build-module/hooks/anchor.js +8 -9
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +38 -1
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/index.js +2 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +28 -6
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +21 -10
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/private-apis.native.js +3 -1
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/reducer.js +31 -26
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/content-rtl.css +14 -0
- package/build-style/content.css +14 -0
- package/build-style/style-rtl.css +8 -20
- package/build-style/style.css +8 -20
- package/package.json +31 -31
- package/src/components/block-actions/index.js +2 -8
- package/src/components/block-bindings-toolbar-indicator/style.scss +10 -8
- package/src/components/block-heading-level-dropdown/README.md +5 -5
- package/src/components/block-heading-level-dropdown/index.js +5 -5
- package/src/components/block-heading-level-dropdown/index.native.js +5 -4
- package/src/components/block-list/block-crash-boundary.native.js +43 -0
- package/src/components/block-list/block-crash-warning.native.js +19 -0
- package/src/components/block-list/block.native.js +14 -7
- package/src/components/block-list/content.scss +16 -0
- package/src/components/block-settings/container.native.js +5 -1
- package/src/components/block-settings-menu/block-settings-dropdown.js +41 -56
- package/src/components/block-settings-menu-controls/README.md +0 -9
- package/src/components/block-settings-menu-controls/index.js +1 -6
- package/src/components/block-toolbar/index.js +3 -1
- package/src/components/block-toolbar/shuffle.js +1 -1
- package/src/components/block-toolbar/test/index.native.js +1 -7
- package/src/components/child-layout-control/index.js +147 -35
- package/src/components/convert-to-group-buttons/toolbar.js +13 -1
- package/src/components/global-styles/dimensions-panel.js +9 -34
- package/src/components/global-styles/test/use-global-styles-output.js +31 -0
- package/src/components/global-styles/use-global-styles-output.js +3 -1
- package/src/components/global-styles/utils.js +0 -18
- package/src/components/iframe/index.js +60 -44
- package/src/components/inserter/block-patterns-explorer/index.js +2 -9
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
- package/src/components/inserter/menu.js +4 -10
- package/src/components/inserter/mobile-tab-navigation.js +1 -1
- package/src/components/inserter/search-results.js +1 -2
- package/src/components/inserter/tabs.js +1 -2
- package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
- package/src/components/link-control/style.scss +0 -5
- package/src/components/list-view/block-select-button.js +2 -18
- package/src/components/list-view/block.js +12 -21
- package/src/components/list-view/style.scss +34 -24
- package/src/components/list-view/utils.js +4 -1
- package/src/components/rich-text/README.md +6 -0
- package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/src/components/use-moving-animation/index.js +1 -0
- package/src/components/warning/index.native.js +19 -15
- package/src/hooks/anchor.js +41 -61
- package/src/hooks/background.js +48 -3
- package/src/hooks/index.js +2 -0
- package/src/hooks/layout-child.js +44 -8
- package/src/hooks/layout.js +22 -18
- package/src/hooks/position.js +1 -1
- package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
- package/src/hooks/test/anchor.native.js +32 -0
- package/src/private-apis.native.js +2 -0
- package/src/store/reducer.js +41 -41
- package/tsconfig.json +1 -0
- package/build/utils/calculate-scale.js +0 -17
- package/build/utils/calculate-scale.js.map +0 -1
- package/build-module/utils/calculate-scale.js +0 -11
- package/build-module/utils/calculate-scale.js.map +0 -1
- package/src/utils/calculate-scale.js +0 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","useEffect","__","_n","sprintf","VisuallyHidden","useDebounce","useAsyncList","speak","useSelect","BlockTypesList","BlockPatternsList","__unstableInserterMenuExtension","InserterPanel","InserterNoResults","useInsertionPoint","usePatternsState","useBlockTypesState","searchBlockItems","searchItems","InserterListbox","orderBy","orderInserterBlockItems","store","blockEditorStore","INITIAL_INSERTER_RESULTS","EMPTY_ARRAY","InserterSearchResults","filterValue","onSelect","onHover","onHoverPattern","rootClientId","clientId","isAppender","__experimentalInsertionIndex","maxBlockPatterns","maxBlockTypes","showBlockDirectory","isDraggable","shouldFocusBlock","prioritizePatterns","selectBlockOnInsert","showBlocks","debouncedSpeak","prioritizedBlocks","select","blockListSettings","getBlockListSettings","prioritizedInserterBlocks","destinationRootClientId","onInsertBlocks","insertionIndex","blockTypes","blockTypeCategories","blockTypeCollections","onSelectBlockType","patterns","onClickPattern","filteredBlockPatterns","results","undefined","slice","maxBlockTypesToShow","length","filteredBlockTypes","nonPatternBlockTypes","filter","blockType","name","orderedItems","count","resultsFoundMessage","currentShownBlockTypes","step","currentShownPatterns","hasItems","blocksUI","createElement","title","items","label","patternsUI","className","shownPatterns","blockPatterns","Slot","fillProps","fills"],"sources":["@wordpress/block-editor/src/components/inserter/search-results.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden } from '@wordpress/components';\nimport { useDebounce, useAsyncList } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport BlockPatternsList from '../block-patterns-list';\nimport __unstableInserterMenuExtension from '../inserter-menu-extension';\nimport InserterPanel from './panel';\nimport InserterNoResults from './no-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport usePatternsState from './hooks/use-patterns-state';\nimport useBlockTypesState from './hooks/use-block-types-state';\nimport { searchBlockItems, searchItems } from './search-items';\nimport InserterListbox from '../inserter-listbox';\nimport { orderBy } from '../../utils/sorting';\nimport { orderInserterBlockItems } from '../../utils/order-inserter-block-items';\nimport { store as blockEditorStore } from '../../store';\n\nconst INITIAL_INSERTER_RESULTS = 9;\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation and rerendering the component.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\nfunction InserterSearchResults( {\n\tfilterValue,\n\tonSelect,\n\tonHover,\n\tonHoverPattern,\n\trootClientId,\n\tclientId,\n\tisAppender,\n\t__experimentalInsertionIndex,\n\tmaxBlockPatterns,\n\tmaxBlockTypes,\n\tshowBlockDirectory = false,\n\tisDraggable = true,\n\tshouldFocusBlock = true,\n\tprioritizePatterns,\n\tselectBlockOnInsert,\n\tshowBlocks = true,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\tconst { prioritizedBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst blockListSettings =\n\t\t\t\tselect( blockEditorStore ).getBlockListSettings( rootClientId );\n\n\t\t\treturn {\n\t\t\t\tprioritizedBlocks:\n\t\t\t\t\tblockListSettings?.prioritizedInserterBlocks || EMPTY_ARRAY,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tconst [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {\n\t\tonSelect,\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\tshouldFocusBlock,\n\t\tselectBlockOnInsert,\n\t} );\n\tconst [\n\t\tblockTypes,\n\t\tblockTypeCategories,\n\t\tblockTypeCollections,\n\t\tonSelectBlockType,\n\t] = useBlockTypesState( destinationRootClientId, onInsertBlocks );\n\tconst [ patterns, , onClickPattern ] = usePatternsState(\n\t\tonInsertBlocks,\n\t\tdestinationRootClientId\n\t);\n\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\tif ( maxBlockPatterns === 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst results = searchItems( patterns, filterValue );\n\t\treturn maxBlockPatterns !== undefined\n\t\t\t? results.slice( 0, maxBlockPatterns )\n\t\t\t: results;\n\t}, [ filterValue, patterns, maxBlockPatterns ] );\n\n\tlet maxBlockTypesToShow = maxBlockTypes;\n\tif ( prioritizePatterns && filteredBlockPatterns.length > 2 ) {\n\t\tmaxBlockTypesToShow = 0;\n\t}\n\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( maxBlockTypesToShow === 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst nonPatternBlockTypes = blockTypes.filter(\n\t\t\t( blockType ) => blockType.name !== 'core/block'\n\t\t);\n\t\tlet orderedItems = orderBy( nonPatternBlockTypes, 'frecency', 'desc' );\n\n\t\tif ( ! filterValue && prioritizedBlocks.length ) {\n\t\t\torderedItems = orderInserterBlockItems(\n\t\t\t\torderedItems,\n\t\t\t\tprioritizedBlocks\n\t\t\t);\n\t\t}\n\n\t\tconst results = searchBlockItems(\n\t\t\torderedItems,\n\t\t\tblockTypeCategories,\n\t\t\tblockTypeCollections,\n\t\t\tfilterValue\n\t\t);\n\n\t\treturn maxBlockTypesToShow !== undefined\n\t\t\t? results.slice( 0, maxBlockTypesToShow )\n\t\t\t: results;\n\t}, [\n\t\tfilterValue,\n\t\tblockTypes,\n\t\tblockTypeCategories,\n\t\tblockTypeCollections,\n\t\tmaxBlockTypesToShow,\n\t\tprioritizedBlocks,\n\t] );\n\n\t// Announce search results on change.\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockTypes.length + filteredBlockPatterns.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [\n\t\tfilterValue,\n\t\tdebouncedSpeak,\n\t\tfilteredBlockTypes,\n\t\tfilteredBlockPatterns,\n\t] );\n\n\tconst currentShownBlockTypes = useAsyncList( filteredBlockTypes, {\n\t\tstep: INITIAL_INSERTER_RESULTS,\n\t} );\n\tconst currentShownPatterns = useAsyncList(\n\t\tcurrentShownBlockTypes.length === filteredBlockTypes.length\n\t\t\t? filteredBlockPatterns\n\t\t\t: EMPTY_ARRAY\n\t);\n\n\tconst hasItems =\n\t\tfilteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0;\n\n\tconst blocksUI = showBlocks && !! filteredBlockTypes.length && (\n\t\t<InserterPanel\n\t\t\ttitle={ <VisuallyHidden>{ __( 'Blocks' ) }</VisuallyHidden> }\n\t\t>\n\t\t\t<BlockTypesList\n\t\t\t\titems={ currentShownBlockTypes }\n\t\t\t\tonSelect={ onSelectBlockType }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tlabel={ __( 'Blocks' ) }\n\t\t\t\tisDraggable={ isDraggable }\n\t\t\t/>\n\t\t</InserterPanel>\n\t);\n\n\tconst patternsUI = !! filteredBlockPatterns.length && (\n\t\t<InserterPanel\n\t\t\ttitle={\n\t\t\t\t<VisuallyHidden>{ __( 'Block patterns' ) }</VisuallyHidden>\n\t\t\t}\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-patterns\">\n\t\t\t\t<BlockPatternsList\n\t\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\tonClickPattern={ onClickPattern }\n\t\t\t\t\tonHover={ onHoverPattern }\n\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</InserterPanel>\n\t);\n\n\treturn (\n\t\t<InserterListbox>\n\t\t\t{ ! showBlockDirectory && ! hasItems && <InserterNoResults /> }\n\n\t\t\t{ prioritizePatterns ? patternsUI : blocksUI }\n\n\t\t\t{ !! filteredBlockTypes.length &&\n\t\t\t\t!! filteredBlockPatterns.length && (\n\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t) }\n\n\t\t\t{ prioritizePatterns ? blocksUI : patternsUI }\n\n\t\t\t{ showBlockDirectory && (\n\t\t\t\t<__unstableInserterMenuExtension.Slot\n\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\tonSelect: onSelectBlockType,\n\t\t\t\t\t\tonHover,\n\t\t\t\t\t\tfilterValue,\n\t\t\t\t\t\thasItems,\n\t\t\t\t\t\trootClientId: destinationRootClientId,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ ( fills ) => {\n\t\t\t\t\t\tif ( fills.length ) {\n\t\t\t\t\t\t\treturn fills;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( ! hasItems ) {\n\t\t\t\t\t\t\treturn <InserterNoResults />;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t} }\n\t\t\t\t</__unstableInserterMenuExtension.Slot>\n\t\t\t) }\n\t\t</InserterListbox>\n\t);\n}\n\nexport default InserterSearchResults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CAACD,MAAM,IAC7B,CAAC,CAAEL,qBAAqB,CAACK,MAAM,IAC9Bc,aAAA;IAAKK,SAAS,EAAC;EAAiD,CAAE,CAClE,EAEA1C,kBAAkB,GAAGoC,QAAQ,GAAGK,UAAU,EAE1C5C,kBAAkB,IACnBwC,aAAA,CAAClE,+BAA+B,CAAC0E,IAAI;IACpCC,SAAS,EAAG;MACX1D,QAAQ,EAAE2B,iBAAiB;MAC3B1B,OAAO;MACPF,WAAW;MACXgD,QAAQ;MACR5C,YAAY,EAAEkB;IACf;EAAG,GAECsC,KAAK,IAAM;IACd,IAAKA,KAAK,CAACxB,MAAM,EAAG;MACnB,OAAOwB,KAAK;IACb;IACA,IAAK,CAAEZ,QAAQ,EAAG;MACjB,OAAOE,aAAA,CAAChE,iBAAiB,MAAE,CAAC;IAC7B;IACA,OAAO,IAAI;EACZ,CACqC,CAEvB,CAAC;AAEpB;AAEA,eAAea,qBAAqB"}
|
|
1
|
+
{"version":3,"names":["useMemo","useEffect","__","_n","sprintf","VisuallyHidden","useDebounce","useAsyncList","speak","useSelect","BlockTypesList","BlockPatternsList","__unstableInserterMenuExtension","InserterPanel","InserterNoResults","useInsertionPoint","usePatternsState","useBlockTypesState","searchBlockItems","searchItems","InserterListbox","orderBy","orderInserterBlockItems","store","blockEditorStore","INITIAL_INSERTER_RESULTS","EMPTY_ARRAY","InserterSearchResults","filterValue","onSelect","onHover","onHoverPattern","rootClientId","clientId","isAppender","__experimentalInsertionIndex","maxBlockPatterns","maxBlockTypes","showBlockDirectory","isDraggable","shouldFocusBlock","prioritizePatterns","selectBlockOnInsert","debouncedSpeak","prioritizedBlocks","select","blockListSettings","getBlockListSettings","prioritizedInserterBlocks","destinationRootClientId","onInsertBlocks","insertionIndex","blockTypes","blockTypeCategories","blockTypeCollections","onSelectBlockType","patterns","onClickPattern","filteredBlockPatterns","results","undefined","slice","maxBlockTypesToShow","length","filteredBlockTypes","nonPatternBlockTypes","filter","blockType","name","orderedItems","count","resultsFoundMessage","currentShownBlockTypes","step","currentShownPatterns","hasItems","blocksUI","createElement","title","items","label","patternsUI","className","shownPatterns","blockPatterns","Slot","fillProps","fills"],"sources":["@wordpress/block-editor/src/components/inserter/search-results.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden } from '@wordpress/components';\nimport { useDebounce, useAsyncList } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport BlockPatternsList from '../block-patterns-list';\nimport __unstableInserterMenuExtension from '../inserter-menu-extension';\nimport InserterPanel from './panel';\nimport InserterNoResults from './no-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport usePatternsState from './hooks/use-patterns-state';\nimport useBlockTypesState from './hooks/use-block-types-state';\nimport { searchBlockItems, searchItems } from './search-items';\nimport InserterListbox from '../inserter-listbox';\nimport { orderBy } from '../../utils/sorting';\nimport { orderInserterBlockItems } from '../../utils/order-inserter-block-items';\nimport { store as blockEditorStore } from '../../store';\n\nconst INITIAL_INSERTER_RESULTS = 9;\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation and rerendering the component.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\nfunction InserterSearchResults( {\n\tfilterValue,\n\tonSelect,\n\tonHover,\n\tonHoverPattern,\n\trootClientId,\n\tclientId,\n\tisAppender,\n\t__experimentalInsertionIndex,\n\tmaxBlockPatterns,\n\tmaxBlockTypes,\n\tshowBlockDirectory = false,\n\tisDraggable = true,\n\tshouldFocusBlock = true,\n\tprioritizePatterns,\n\tselectBlockOnInsert,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\tconst { prioritizedBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst blockListSettings =\n\t\t\t\tselect( blockEditorStore ).getBlockListSettings( rootClientId );\n\n\t\t\treturn {\n\t\t\t\tprioritizedBlocks:\n\t\t\t\t\tblockListSettings?.prioritizedInserterBlocks || EMPTY_ARRAY,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tconst [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {\n\t\tonSelect,\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\tshouldFocusBlock,\n\t\tselectBlockOnInsert,\n\t} );\n\tconst [\n\t\tblockTypes,\n\t\tblockTypeCategories,\n\t\tblockTypeCollections,\n\t\tonSelectBlockType,\n\t] = useBlockTypesState( destinationRootClientId, onInsertBlocks );\n\tconst [ patterns, , onClickPattern ] = usePatternsState(\n\t\tonInsertBlocks,\n\t\tdestinationRootClientId\n\t);\n\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\tif ( maxBlockPatterns === 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst results = searchItems( patterns, filterValue );\n\t\treturn maxBlockPatterns !== undefined\n\t\t\t? results.slice( 0, maxBlockPatterns )\n\t\t\t: results;\n\t}, [ filterValue, patterns, maxBlockPatterns ] );\n\n\tlet maxBlockTypesToShow = maxBlockTypes;\n\tif ( prioritizePatterns && filteredBlockPatterns.length > 2 ) {\n\t\tmaxBlockTypesToShow = 0;\n\t}\n\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( maxBlockTypesToShow === 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst nonPatternBlockTypes = blockTypes.filter(\n\t\t\t( blockType ) => blockType.name !== 'core/block'\n\t\t);\n\t\tlet orderedItems = orderBy( nonPatternBlockTypes, 'frecency', 'desc' );\n\n\t\tif ( ! filterValue && prioritizedBlocks.length ) {\n\t\t\torderedItems = orderInserterBlockItems(\n\t\t\t\torderedItems,\n\t\t\t\tprioritizedBlocks\n\t\t\t);\n\t\t}\n\n\t\tconst results = searchBlockItems(\n\t\t\torderedItems,\n\t\t\tblockTypeCategories,\n\t\t\tblockTypeCollections,\n\t\t\tfilterValue\n\t\t);\n\n\t\treturn maxBlockTypesToShow !== undefined\n\t\t\t? results.slice( 0, maxBlockTypesToShow )\n\t\t\t: results;\n\t}, [\n\t\tfilterValue,\n\t\tblockTypes,\n\t\tblockTypeCategories,\n\t\tblockTypeCollections,\n\t\tmaxBlockTypesToShow,\n\t\tprioritizedBlocks,\n\t] );\n\n\t// Announce search results on change.\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockTypes.length + filteredBlockPatterns.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [\n\t\tfilterValue,\n\t\tdebouncedSpeak,\n\t\tfilteredBlockTypes,\n\t\tfilteredBlockPatterns,\n\t] );\n\n\tconst currentShownBlockTypes = useAsyncList( filteredBlockTypes, {\n\t\tstep: INITIAL_INSERTER_RESULTS,\n\t} );\n\tconst currentShownPatterns = useAsyncList(\n\t\tcurrentShownBlockTypes.length === filteredBlockTypes.length\n\t\t\t? filteredBlockPatterns\n\t\t\t: EMPTY_ARRAY\n\t);\n\n\tconst hasItems =\n\t\tfilteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0;\n\n\tconst blocksUI = !! filteredBlockTypes.length && (\n\t\t<InserterPanel\n\t\t\ttitle={ <VisuallyHidden>{ __( 'Blocks' ) }</VisuallyHidden> }\n\t\t>\n\t\t\t<BlockTypesList\n\t\t\t\titems={ currentShownBlockTypes }\n\t\t\t\tonSelect={ onSelectBlockType }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tlabel={ __( 'Blocks' ) }\n\t\t\t\tisDraggable={ isDraggable }\n\t\t\t/>\n\t\t</InserterPanel>\n\t);\n\n\tconst patternsUI = !! filteredBlockPatterns.length && (\n\t\t<InserterPanel\n\t\t\ttitle={\n\t\t\t\t<VisuallyHidden>{ __( 'Block patterns' ) }</VisuallyHidden>\n\t\t\t}\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-patterns\">\n\t\t\t\t<BlockPatternsList\n\t\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\tonClickPattern={ onClickPattern }\n\t\t\t\t\tonHover={ onHoverPattern }\n\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</InserterPanel>\n\t);\n\n\treturn (\n\t\t<InserterListbox>\n\t\t\t{ ! showBlockDirectory && ! hasItems && <InserterNoResults /> }\n\n\t\t\t{ prioritizePatterns ? patternsUI : blocksUI }\n\n\t\t\t{ !! filteredBlockTypes.length &&\n\t\t\t\t!! filteredBlockPatterns.length && (\n\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t) }\n\n\t\t\t{ prioritizePatterns ? blocksUI : patternsUI }\n\n\t\t\t{ showBlockDirectory && (\n\t\t\t\t<__unstableInserterMenuExtension.Slot\n\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\tonSelect: onSelectBlockType,\n\t\t\t\t\t\tonHover,\n\t\t\t\t\t\tfilterValue,\n\t\t\t\t\t\thasItems,\n\t\t\t\t\t\trootClientId: destinationRootClientId,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ ( fills ) => {\n\t\t\t\t\t\tif ( fills.length ) {\n\t\t\t\t\t\t\treturn fills;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( ! hasItems ) {\n\t\t\t\t\t\t\treturn <InserterNoResults />;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t} }\n\t\t\t\t</__unstableInserterMenuExtension.Slot>\n\t\t\t) }\n\t\t</InserterListbox>\n\t);\n}\n\nexport default InserterSearchResults;\n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M,IAC9Bc,aAAA;IAAKK,SAAS,EAAC;EAAiD,CAAE,CAClE,EAEAzC,kBAAkB,GAAGmC,QAAQ,GAAGK,UAAU,EAE1C3C,kBAAkB,IACnBuC,aAAA,CAACjE,+BAA+B,CAACyE,IAAI;IACpCC,SAAS,EAAG;MACXzD,QAAQ,EAAE0B,iBAAiB;MAC3BzB,OAAO;MACPF,WAAW;MACX+C,QAAQ;MACR3C,YAAY,EAAEiB;IACf;EAAG,GAECsC,KAAK,IAAM;IACd,IAAKA,KAAK,CAACxB,MAAM,EAAG;MACnB,OAAOwB,KAAK;IACb;IACA,IAAK,CAAEZ,QAAQ,EAAG;MACjB,OAAOE,aAAA,CAAC/D,iBAAiB,MAAE,CAAC;IAC7B;IACA,OAAO,IAAI;EACZ,CACqC,CAEvB,CAAC;AAEpB;AAEA,eAAea,qBAAqB"}
|
|
@@ -28,13 +28,12 @@ const mediaTab = {
|
|
|
28
28
|
title: __('Media')
|
|
29
29
|
};
|
|
30
30
|
function InserterTabs({
|
|
31
|
-
showBlocks = true,
|
|
32
31
|
showPatterns = false,
|
|
33
32
|
showMedia = false,
|
|
34
33
|
onSelect,
|
|
35
34
|
tabsContents
|
|
36
35
|
}) {
|
|
37
|
-
const tabs = [
|
|
36
|
+
const tabs = [blocksTab, showPatterns && patternsTab, showMedia && mediaTab].filter(Boolean);
|
|
38
37
|
return createElement("div", {
|
|
39
38
|
className: "block-editor-inserter__tabs"
|
|
40
39
|
}, createElement(Tabs, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["privateApis","componentsPrivateApis","__","unlock","Tabs","blocksTab","name","title","patternsTab","mediaTab","InserterTabs","
|
|
1
|
+
{"version":3,"names":["privateApis","componentsPrivateApis","__","unlock","Tabs","blocksTab","name","title","patternsTab","mediaTab","InserterTabs","showPatterns","showMedia","onSelect","tabsContents","tabs","filter","Boolean","createElement","className","TabList","map","tab","Tab","key","tabId","TabPanel","focusable"],"sources":["@wordpress/block-editor/src/components/inserter/tabs.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst blocksTab = {\n\tname: 'blocks',\n\t/* translators: Blocks tab title in the block inserter. */\n\ttitle: __( 'Blocks' ),\n};\nconst patternsTab = {\n\tname: 'patterns',\n\t/* translators: Theme and Directory Patterns tab title in the block inserter. */\n\ttitle: __( 'Patterns' ),\n};\n\nconst mediaTab = {\n\tname: 'media',\n\t/* translators: Media tab title in the block inserter. */\n\ttitle: __( 'Media' ),\n};\n\nfunction InserterTabs( {\n\tshowPatterns = false,\n\tshowMedia = false,\n\tonSelect,\n\ttabsContents,\n} ) {\n\tconst tabs = [\n\t\tblocksTab,\n\t\tshowPatterns && patternsTab,\n\t\tshowMedia && mediaTab,\n\t].filter( Boolean );\n\n\treturn (\n\t\t<div className=\"block-editor-inserter__tabs\">\n\t\t\t<Tabs onSelect={ onSelect }>\n\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t<Tabs.Tab key={ tab.name } tabId={ tab.name }>\n\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t) ) }\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tabsContents[ tab.name ] }\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t) ) }\n\t\t\t</Tabs>\n\t\t</div>\n\t);\n}\n\nexport default InserterTabs;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,qBAA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B,SAAS,EAAG;EAAO,GAEjBb,YAAY,CAAEQ,GAAG,CAAChB,IAAI,CACV,CACd,CACG,CACF,CAAC;AAER;AAEA,eAAeI,YAAY"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { PanelBody } from '@wordpress/components';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import groups from '../inspector-controls/groups';
|
|
12
|
+
export default function AdvancedControls(props) {
|
|
13
|
+
const Slot = groups.advanced?.Slot;
|
|
14
|
+
if (!Slot) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return createElement(Slot, {
|
|
18
|
+
...props
|
|
19
|
+
}, fills => {
|
|
20
|
+
if (!fills.length) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return createElement(PanelBody, {
|
|
24
|
+
title: __('Advanced')
|
|
25
|
+
}, fills);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=advanced-controls-panel.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PanelBody","__","groups","AdvancedControls","props","Slot","advanced","createElement","fills","length","title"],"sources":["@wordpress/block-editor/src/components/inspector-controls-tabs/advanced-controls-panel.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport groups from '../inspector-controls/groups';\n\nexport default function AdvancedControls( props ) {\n\tconst Slot = groups.advanced?.Slot;\n\tif ( ! Slot ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Slot { ...props }>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif ( ! fills.length ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<PanelBody title={ __( 'Advanced' ) }>{ fills }</PanelBody>\n\t\t\t\t);\n\t\t\t} }\n\t\t</Slot>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,uBAAuB;AACjD,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,8BAA8B;AAEjD,eAAe,SAASC,gBAAgBA,CAAEC,KAAK,EAAG;EACjD,MAAMC,IAAI,GAAGH,MAAM,CAACI,QAAQ,EAAED,IAAI;EAClC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAO,IAAI;EACZ;EAEA,OACCE,aAAA,CAACF,IAAI;IAAA,GAAMD;EAAK,GACXI,KAAK,IAAM;IACd,IAAK,CAAEA,KAAK,CAACC,MAAM,EAAG;MACrB,OAAO,IAAI;IACZ;IAEA,OACCF,aAAA,CAACP,SAAS;MAACU,KAAK,EAAGT,EAAE,CAAE,UAAW;IAAG,GAAGO,KAAkB,CAAC;EAE7D,CACK,CAAC;AAET"}
|
|
@@ -10,7 +10,7 @@ import classnames from 'classnames';
|
|
|
10
10
|
import { hasBlockSupport } from '@wordpress/blocks';
|
|
11
11
|
import { Button, __experimentalHStack as HStack, __experimentalTruncate as Truncate, Tooltip } from '@wordpress/components';
|
|
12
12
|
import { forwardRef } from '@wordpress/element';
|
|
13
|
-
import { Icon,
|
|
13
|
+
import { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';
|
|
14
14
|
import { SPACE, ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';
|
|
15
15
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
16
16
|
import { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';
|
|
@@ -28,12 +28,10 @@ import { useBlockLock } from '../block-lock';
|
|
|
28
28
|
import { store as blockEditorStore } from '../../store';
|
|
29
29
|
import useListViewImages from './use-list-view-images';
|
|
30
30
|
import { useListViewContext } from './context';
|
|
31
|
-
import { canBindBlock } from '../../hooks/use-bindings-attributes';
|
|
32
31
|
function ListViewBlockSelectButton({
|
|
33
32
|
className,
|
|
34
33
|
block: {
|
|
35
|
-
clientId
|
|
36
|
-
name: blockName
|
|
34
|
+
clientId
|
|
37
35
|
},
|
|
38
36
|
onClick,
|
|
39
37
|
onContextMenu,
|
|
@@ -45,7 +43,6 @@ function ListViewBlockSelectButton({
|
|
|
45
43
|
onDragEnd,
|
|
46
44
|
draggable,
|
|
47
45
|
isExpanded,
|
|
48
|
-
ariaLabel,
|
|
49
46
|
ariaDescribedBy,
|
|
50
47
|
updateFocusAndSelection
|
|
51
48
|
}, ref) {
|
|
@@ -64,7 +61,6 @@ function ListViewBlockSelectButton({
|
|
|
64
61
|
getBlockRootClientId,
|
|
65
62
|
getBlockOrder,
|
|
66
63
|
getBlocksByClientId,
|
|
67
|
-
getBlockAttributes,
|
|
68
64
|
canRemoveBlocks
|
|
69
65
|
} = useSelect(blockEditorStore);
|
|
70
66
|
const {
|
|
@@ -81,7 +77,6 @@ function ListViewBlockSelectButton({
|
|
|
81
77
|
const {
|
|
82
78
|
rootClientId
|
|
83
79
|
} = useListViewContext();
|
|
84
|
-
const isConnected = getBlockAttributes(clientId)?.metadata?.bindings;
|
|
85
80
|
const positionLabel = blockInformation?.positionLabel ? sprintf(
|
|
86
81
|
// translators: 1: Position of selected block, e.g. "Sticky" or "Fixed".
|
|
87
82
|
__('Position: %1$s'), blockInformation.positionLabel) : '';
|
|
@@ -212,7 +207,6 @@ function ListViewBlockSelectButton({
|
|
|
212
207
|
onDragEnd: onDragEnd,
|
|
213
208
|
draggable: draggable,
|
|
214
209
|
href: `#block-${clientId}`,
|
|
215
|
-
"aria-label": ariaLabel,
|
|
216
210
|
"aria-describedby": ariaDescribedBy,
|
|
217
211
|
"aria-expanded": isExpanded
|
|
218
212
|
}, createElement(ListViewExpander, {
|
|
@@ -235,11 +229,7 @@ function ListViewBlockSelectButton({
|
|
|
235
229
|
}, createElement(Truncate, {
|
|
236
230
|
className: "block-editor-list-view-block-select-button__anchor",
|
|
237
231
|
ellipsizeMode: "auto"
|
|
238
|
-
}, blockInformation.anchor)),
|
|
239
|
-
className: "block-editor-list-view-block-select-button__bindings"
|
|
240
|
-
}, createElement(Icon, {
|
|
241
|
-
icon: connection
|
|
242
|
-
})), positionLabel && isSticky && createElement(Tooltip, {
|
|
232
|
+
}, blockInformation.anchor)), positionLabel && isSticky && createElement(Tooltip, {
|
|
243
233
|
text: positionLabel
|
|
244
234
|
}, createElement(Icon, {
|
|
245
235
|
icon: pinSmall
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","hasBlockSupport","Button","__experimentalHStack","HStack","__experimentalTruncate","Truncate","Tooltip","forwardRef","Icon","connection","lockSmall","lock","pinSmall","SPACE","ENTER","BACKSPACE","DELETE","useSelect","useDispatch","__unstableUseShortcutEventMatch","useShortcutEventMatch","__","sprintf","isShallowEqual","BlockIcon","useBlockDisplayInformation","useBlockDisplayTitle","ListViewExpander","useBlockLock","store","blockEditorStore","useListViewImages","useListViewContext","canBindBlock","ListViewBlockSelectButton","className","block","clientId","name","blockName","onClick","onContextMenu","onMouseDown","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaLabel","ariaDescribedBy","updateFocusAndSelection","ref","blockInformation","blockTitle","context","isLocked","canInsertBlockType","getSelectedBlockClientIds","getPreviousBlockClientId","getBlockRootClientId","getBlockOrder","getBlocksByClientId","getBlockAttributes","canRemoveBlocks","duplicateBlocks","multiSelect","removeBlocks","isMatch","isSticky","positionType","images","rootClientId","isConnected","metadata","bindings","positionLabel","onDragStartHandler","event","dataTransfer","clearData","getBlocksToUpdate","selectedBlockClientIds","isUpdatingSelectedBlocks","includes","firstBlockClientId","firstBlockRootClientId","blocksToUpdate","onKeyDownHandler","keyCode","_getPreviousBlockClie","blocksToDelete","blockToFocus","shouldUpdateSelection","length","defaultPrevented","preventDefault","canDuplicate","every","updatedBlocks","blockClientIds","createElement","Fragment","onKeyDown","href","icon","showColors","alignment","justify","spacing","ellipsizeMode","anchor","text","map","image","index","key","style","backgroundImage","url","zIndex"],"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n\tTooltip,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport {\n\tIcon,\n\tconnection,\n\tlockSmall as lock,\n\tpinSmall,\n} from '@wordpress/icons';\nimport { SPACE, ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { __, sprintf } from '@wordpress/i18n';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\nimport { store as blockEditorStore } from '../../store';\nimport useListViewImages from './use-list-view-images';\nimport { useListViewContext } from './context';\nimport { canBindBlock } from '../../hooks/use-bindings-attributes';\n\nfunction ListViewBlockSelectButton(\n\t{\n\t\tclassName,\n\t\tblock: { clientId, name: blockName },\n\t\tonClick,\n\t\tonContextMenu,\n\t\tonMouseDown,\n\t\tonToggleExpanded,\n\t\ttabIndex,\n\t\tonFocus,\n\t\tonDragStart,\n\t\tonDragEnd,\n\t\tdraggable,\n\t\tisExpanded,\n\t\tariaLabel,\n\t\tariaDescribedBy,\n\t\tupdateFocusAndSelection,\n\t},\n\tref\n) {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst { isLocked } = useBlockLock( clientId );\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetSelectedBlockClientIds,\n\t\tgetPreviousBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tgetBlockAttributes,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { duplicateBlocks, multiSelect, removeBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tconst isMatch = useShortcutEventMatch();\n\tconst isSticky = blockInformation?.positionType === 'sticky';\n\tconst images = useListViewImages( { clientId, isExpanded } );\n\tconst { rootClientId } = useListViewContext();\n\n\tconst isConnected = getBlockAttributes( clientId )?.metadata?.bindings;\n\n\tconst positionLabel = blockInformation?.positionLabel\n\t\t? sprintf(\n\t\t\t\t// translators: 1: Position of selected block, e.g. \"Sticky\" or \"Fixed\".\n\t\t\t\t__( 'Position: %1$s' ),\n\t\t\t\tblockInformation.positionLabel\n\t\t )\n\t\t: '';\n\n\t// The `href` attribute triggers the browser's native HTML drag operations.\n\t// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.\n\t// We need to clear any HTML drag data to prevent `pasteHandler` from firing\n\t// inside the `useOnBlockDrop` hook.\n\tconst onDragStartHandler = ( event ) => {\n\t\tevent.dataTransfer.clearData();\n\t\tonDragStart?.( event );\n\t};\n\n\t// Determine which blocks to update:\n\t// If the current (focused) block is part of the block selection, use the whole selection.\n\t// If the focused block is not part of the block selection, only update the focused block.\n\tfunction getBlocksToUpdate() {\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst isUpdatingSelectedBlocks =\n\t\t\tselectedBlockClientIds.includes( clientId );\n\t\tconst firstBlockClientId = isUpdatingSelectedBlocks\n\t\t\t? selectedBlockClientIds[ 0 ]\n\t\t\t: clientId;\n\t\tconst firstBlockRootClientId =\n\t\t\tgetBlockRootClientId( firstBlockClientId );\n\n\t\tconst blocksToUpdate = isUpdatingSelectedBlocks\n\t\t\t? selectedBlockClientIds\n\t\t\t: [ clientId ];\n\n\t\treturn {\n\t\t\tblocksToUpdate,\n\t\t\tfirstBlockClientId,\n\t\t\tfirstBlockRootClientId,\n\t\t\tselectedBlockClientIds,\n\t\t};\n\t}\n\n\t/**\n\t * @param {KeyboardEvent} event\n\t */\n\tasync function onKeyDownHandler( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t} else if (\n\t\t\tevent.keyCode === BACKSPACE ||\n\t\t\tevent.keyCode === DELETE ||\n\t\t\tisMatch( 'core/block-editor/remove', event )\n\t\t) {\n\t\t\tconst {\n\t\t\t\tblocksToUpdate: blocksToDelete,\n\t\t\t\tfirstBlockClientId,\n\t\t\t\tfirstBlockRootClientId,\n\t\t\t\tselectedBlockClientIds,\n\t\t\t} = getBlocksToUpdate();\n\n\t\t\t// Don't update the selection if the blocks cannot be deleted.\n\t\t\tif ( ! canRemoveBlocks( blocksToDelete, firstBlockRootClientId ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet blockToFocus =\n\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ) ??\n\t\t\t\t// If the previous block is not found (when the first block is deleted),\n\t\t\t\t// fallback to focus the parent block.\n\t\t\t\tfirstBlockRootClientId;\n\n\t\t\tremoveBlocks( blocksToDelete, false );\n\n\t\t\t// Update the selection if the original selection has been removed.\n\t\t\tconst shouldUpdateSelection =\n\t\t\t\tselectedBlockClientIds.length > 0 &&\n\t\t\t\tgetSelectedBlockClientIds().length === 0;\n\n\t\t\t// If there's no previous block nor parent block, focus the first block.\n\t\t\tif ( ! blockToFocus ) {\n\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t}\n\n\t\t\tupdateFocusAndSelection( blockToFocus, shouldUpdateSelection );\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\n\t\t\tconst { blocksToUpdate, firstBlockRootClientId } =\n\t\t\t\tgetBlocksToUpdate();\n\n\t\t\tconst canDuplicate = getBlocksByClientId( blocksToUpdate ).every(\n\t\t\t\t( block ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\thasBlockSupport( block.name, 'multiple', true ) &&\n\t\t\t\t\t\tcanInsertBlockType( block.name, firstBlockRootClientId )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( canDuplicate ) {\n\t\t\t\tconst updatedBlocks = await duplicateBlocks(\n\t\t\t\t\tblocksToUpdate,\n\t\t\t\t\tfalse\n\t\t\t\t);\n\n\t\t\t\tif ( updatedBlocks?.length ) {\n\t\t\t\t\t// If blocks have been duplicated, focus the first duplicated block.\n\t\t\t\t\tupdateFocusAndSelection( updatedBlocks[ 0 ], false );\n\t\t\t\t}\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/select-all', event ) ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\n\t\t\tconst { firstBlockRootClientId, selectedBlockClientIds } =\n\t\t\t\tgetBlocksToUpdate();\n\t\t\tconst blockClientIds = getBlockOrder( firstBlockRootClientId );\n\t\t\tif ( ! blockClientIds.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If we have selected all sibling nested blocks, try selecting up a level.\n\t\t\t// This is a similar implementation to that used by `useSelectAll`.\n\t\t\t// `isShallowEqual` is used for the list view instead of a length check,\n\t\t\t// as the array of siblings of the currently focused block may be a different\n\t\t\t// set of blocks from the current block selection if the user is focused\n\t\t\t// on a different part of the list view from the block selection.\n\t\t\tif ( isShallowEqual( selectedBlockClientIds, blockClientIds ) ) {\n\t\t\t\t// Only select up a level if the first block is not the root block.\n\t\t\t\t// This ensures that the block selection can't break out of the root block\n\t\t\t\t// used by the list view, if the list view is only showing a partial hierarchy.\n\t\t\t\tif (\n\t\t\t\t\tfirstBlockRootClientId &&\n\t\t\t\t\tfirstBlockRootClientId !== rootClientId\n\t\t\t\t) {\n\t\t\t\t\tupdateFocusAndSelection( firstBlockRootClientId, true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Select all while passing `null` to skip focusing to the editor canvas,\n\t\t\t// and retain focus within the list view.\n\t\t\tmultiSelect(\n\t\t\t\tblockClientIds[ 0 ],\n\t\t\t\tblockClientIds[ blockClientIds.length - 1 ],\n\t\t\t\tnull\n\t\t\t);\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-block-select-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonContextMenu={ onContextMenu }\n\t\t\t\tonKeyDown={ onKeyDownHandler }\n\t\t\t\tonMouseDown={ onMouseDown }\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tonDragStart={ onDragStartHandler }\n\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\tdraggable={ draggable }\n\t\t\t\thref={ `#block-${ clientId }` }\n\t\t\t\taria-label={ ariaLabel }\n\t\t\t\taria-describedby={ ariaDescribedBy }\n\t\t\t\taria-expanded={ isExpanded }\n\t\t\t>\n\t\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\t\tshowColors\n\t\t\t\t\tcontext=\"list-view\"\n\t\t\t\t/>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__label-wrapper\"\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tspacing={ 1 }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__title\">\n\t\t\t\t\t\t<Truncate ellipsizeMode=\"auto\">{ blockTitle }</Truncate>\n\t\t\t\t\t</span>\n\t\t\t\t\t{ blockInformation?.anchor && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__anchor-wrapper\">\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__anchor\"\n\t\t\t\t\t\t\t\tellipsizeMode=\"auto\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ blockInformation.anchor }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isConnected && canBindBlock( blockName ) && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__bindings\">\n\t\t\t\t\t\t\t<Icon icon={ connection } />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ positionLabel && isSticky && (\n\t\t\t\t\t\t<Tooltip text={ positionLabel }>\n\t\t\t\t\t\t\t<Icon icon={ pinSmall } />\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t{ images.length ? (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__images\"\n\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ images.map( ( image, index ) => (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__image\"\n\t\t\t\t\t\t\t\t\tkey={ image.clientId }\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\tbackgroundImage: `url(${ image.url })`,\n\t\t\t\t\t\t\t\t\t\tzIndex: images.length - index, // Ensure the first image is on top, and subsequent images are behind.\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</span>\n\t\t\t\t\t) : null }\n\t\t\t\t\t{ isLocked && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__lock\">\n\t\t\t\t\t\t\t<Icon icon={ lock } />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSelectButton );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SACCC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,sBAAsB,IAAIC,QAAQ,EAClCC,OAAO,QACD,uBAAuB;AAC9B,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SACCC,IAAI,EACJC,UAAU,EACVC,SAAS,IAAIC,IAAI,EACjBC,QAAQ,QACF,kBAAkB;AACzB,SAASC,KAAK,EAAEC,KAAK,EAAEC,SAAS,EAAEC,MAAM,QAAQ,qBAAqB;AACrE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,+BAA+B,IAAIC,qBAAqB,QAAQ,+BAA+B;AACxG,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,OAAOC,cAAc,MAAM,6BAA6B;;AAExD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,0BAA0B,MAAM,kCAAkC;AACzE,OAAOC,oBAAoB,MAAM,wCAAwC;AACzE,OAAOC,gBAAgB,MAAM,YAAY;AACzC,SAASC,YAAY,QAAQ,eAAe;AAC5C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,kBAAkB,QAAQ,WAAW;AAC9C,SAASC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AK,CAACK,GAAK,GAAE;MACtCC,MAAM,EAAEjD,MAAM,CAACuB,MAAM,GAAGqB,KAAK,CAAE;IAChC;EAAG,CACH,CACA,CACG,CAAC,GACJ,IAAI,EACN3D,QAAQ,IACT6C,aAAA;IAAMnE,SAAS,EAAC;EAAkD,GACjEmE,aAAA,CAAC9F,IAAI;IAACkG,IAAI,EAAG/F;EAAM,CAAE,CAChB,CAEA,CACD,CACP,CAAC;AAEL;AAEA,eAAeJ,UAAU,CAAE2B,yBAA0B,CAAC"}
|
|
1
|
+
{"version":3,"names":["classnames","hasBlockSupport","Button","__experimentalHStack","HStack","__experimentalTruncate","Truncate","Tooltip","forwardRef","Icon","lockSmall","lock","pinSmall","SPACE","ENTER","BACKSPACE","DELETE","useSelect","useDispatch","__unstableUseShortcutEventMatch","useShortcutEventMatch","__","sprintf","isShallowEqual","BlockIcon","useBlockDisplayInformation","useBlockDisplayTitle","ListViewExpander","useBlockLock","store","blockEditorStore","useListViewImages","useListViewContext","ListViewBlockSelectButton","className","block","clientId","onClick","onContextMenu","onMouseDown","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaDescribedBy","updateFocusAndSelection","ref","blockInformation","blockTitle","context","isLocked","canInsertBlockType","getSelectedBlockClientIds","getPreviousBlockClientId","getBlockRootClientId","getBlockOrder","getBlocksByClientId","canRemoveBlocks","duplicateBlocks","multiSelect","removeBlocks","isMatch","isSticky","positionType","images","rootClientId","positionLabel","onDragStartHandler","event","dataTransfer","clearData","getBlocksToUpdate","selectedBlockClientIds","isUpdatingSelectedBlocks","includes","firstBlockClientId","firstBlockRootClientId","blocksToUpdate","onKeyDownHandler","keyCode","_getPreviousBlockClie","blocksToDelete","blockToFocus","shouldUpdateSelection","length","defaultPrevented","preventDefault","canDuplicate","every","name","updatedBlocks","blockClientIds","createElement","Fragment","onKeyDown","href","icon","showColors","alignment","justify","spacing","ellipsizeMode","anchor","text","map","image","index","key","style","backgroundImage","url","zIndex"],"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n\tTooltip,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';\nimport { SPACE, ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { __, sprintf } from '@wordpress/i18n';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\nimport { store as blockEditorStore } from '../../store';\nimport useListViewImages from './use-list-view-images';\nimport { useListViewContext } from './context';\n\nfunction ListViewBlockSelectButton(\n\t{\n\t\tclassName,\n\t\tblock: { clientId },\n\t\tonClick,\n\t\tonContextMenu,\n\t\tonMouseDown,\n\t\tonToggleExpanded,\n\t\ttabIndex,\n\t\tonFocus,\n\t\tonDragStart,\n\t\tonDragEnd,\n\t\tdraggable,\n\t\tisExpanded,\n\t\tariaDescribedBy,\n\t\tupdateFocusAndSelection,\n\t},\n\tref\n) {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst { isLocked } = useBlockLock( clientId );\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetSelectedBlockClientIds,\n\t\tgetPreviousBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { duplicateBlocks, multiSelect, removeBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tconst isMatch = useShortcutEventMatch();\n\tconst isSticky = blockInformation?.positionType === 'sticky';\n\tconst images = useListViewImages( { clientId, isExpanded } );\n\tconst { rootClientId } = useListViewContext();\n\n\tconst positionLabel = blockInformation?.positionLabel\n\t\t? sprintf(\n\t\t\t\t// translators: 1: Position of selected block, e.g. \"Sticky\" or \"Fixed\".\n\t\t\t\t__( 'Position: %1$s' ),\n\t\t\t\tblockInformation.positionLabel\n\t\t )\n\t\t: '';\n\n\t// The `href` attribute triggers the browser's native HTML drag operations.\n\t// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.\n\t// We need to clear any HTML drag data to prevent `pasteHandler` from firing\n\t// inside the `useOnBlockDrop` hook.\n\tconst onDragStartHandler = ( event ) => {\n\t\tevent.dataTransfer.clearData();\n\t\tonDragStart?.( event );\n\t};\n\n\t// Determine which blocks to update:\n\t// If the current (focused) block is part of the block selection, use the whole selection.\n\t// If the focused block is not part of the block selection, only update the focused block.\n\tfunction getBlocksToUpdate() {\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst isUpdatingSelectedBlocks =\n\t\t\tselectedBlockClientIds.includes( clientId );\n\t\tconst firstBlockClientId = isUpdatingSelectedBlocks\n\t\t\t? selectedBlockClientIds[ 0 ]\n\t\t\t: clientId;\n\t\tconst firstBlockRootClientId =\n\t\t\tgetBlockRootClientId( firstBlockClientId );\n\n\t\tconst blocksToUpdate = isUpdatingSelectedBlocks\n\t\t\t? selectedBlockClientIds\n\t\t\t: [ clientId ];\n\n\t\treturn {\n\t\t\tblocksToUpdate,\n\t\t\tfirstBlockClientId,\n\t\t\tfirstBlockRootClientId,\n\t\t\tselectedBlockClientIds,\n\t\t};\n\t}\n\n\t/**\n\t * @param {KeyboardEvent} event\n\t */\n\tasync function onKeyDownHandler( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t} else if (\n\t\t\tevent.keyCode === BACKSPACE ||\n\t\t\tevent.keyCode === DELETE ||\n\t\t\tisMatch( 'core/block-editor/remove', event )\n\t\t) {\n\t\t\tconst {\n\t\t\t\tblocksToUpdate: blocksToDelete,\n\t\t\t\tfirstBlockClientId,\n\t\t\t\tfirstBlockRootClientId,\n\t\t\t\tselectedBlockClientIds,\n\t\t\t} = getBlocksToUpdate();\n\n\t\t\t// Don't update the selection if the blocks cannot be deleted.\n\t\t\tif ( ! canRemoveBlocks( blocksToDelete, firstBlockRootClientId ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet blockToFocus =\n\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ) ??\n\t\t\t\t// If the previous block is not found (when the first block is deleted),\n\t\t\t\t// fallback to focus the parent block.\n\t\t\t\tfirstBlockRootClientId;\n\n\t\t\tremoveBlocks( blocksToDelete, false );\n\n\t\t\t// Update the selection if the original selection has been removed.\n\t\t\tconst shouldUpdateSelection =\n\t\t\t\tselectedBlockClientIds.length > 0 &&\n\t\t\t\tgetSelectedBlockClientIds().length === 0;\n\n\t\t\t// If there's no previous block nor parent block, focus the first block.\n\t\t\tif ( ! blockToFocus ) {\n\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t}\n\n\t\t\tupdateFocusAndSelection( blockToFocus, shouldUpdateSelection );\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\n\t\t\tconst { blocksToUpdate, firstBlockRootClientId } =\n\t\t\t\tgetBlocksToUpdate();\n\n\t\t\tconst canDuplicate = getBlocksByClientId( blocksToUpdate ).every(\n\t\t\t\t( block ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\thasBlockSupport( block.name, 'multiple', true ) &&\n\t\t\t\t\t\tcanInsertBlockType( block.name, firstBlockRootClientId )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( canDuplicate ) {\n\t\t\t\tconst updatedBlocks = await duplicateBlocks(\n\t\t\t\t\tblocksToUpdate,\n\t\t\t\t\tfalse\n\t\t\t\t);\n\n\t\t\t\tif ( updatedBlocks?.length ) {\n\t\t\t\t\t// If blocks have been duplicated, focus the first duplicated block.\n\t\t\t\t\tupdateFocusAndSelection( updatedBlocks[ 0 ], false );\n\t\t\t\t}\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/select-all', event ) ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\n\t\t\tconst { firstBlockRootClientId, selectedBlockClientIds } =\n\t\t\t\tgetBlocksToUpdate();\n\t\t\tconst blockClientIds = getBlockOrder( firstBlockRootClientId );\n\t\t\tif ( ! blockClientIds.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If we have selected all sibling nested blocks, try selecting up a level.\n\t\t\t// This is a similar implementation to that used by `useSelectAll`.\n\t\t\t// `isShallowEqual` is used for the list view instead of a length check,\n\t\t\t// as the array of siblings of the currently focused block may be a different\n\t\t\t// set of blocks from the current block selection if the user is focused\n\t\t\t// on a different part of the list view from the block selection.\n\t\t\tif ( isShallowEqual( selectedBlockClientIds, blockClientIds ) ) {\n\t\t\t\t// Only select up a level if the first block is not the root block.\n\t\t\t\t// This ensures that the block selection can't break out of the root block\n\t\t\t\t// used by the list view, if the list view is only showing a partial hierarchy.\n\t\t\t\tif (\n\t\t\t\t\tfirstBlockRootClientId &&\n\t\t\t\t\tfirstBlockRootClientId !== rootClientId\n\t\t\t\t) {\n\t\t\t\t\tupdateFocusAndSelection( firstBlockRootClientId, true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Select all while passing `null` to skip focusing to the editor canvas,\n\t\t\t// and retain focus within the list view.\n\t\t\tmultiSelect(\n\t\t\t\tblockClientIds[ 0 ],\n\t\t\t\tblockClientIds[ blockClientIds.length - 1 ],\n\t\t\t\tnull\n\t\t\t);\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-block-select-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonContextMenu={ onContextMenu }\n\t\t\t\tonKeyDown={ onKeyDownHandler }\n\t\t\t\tonMouseDown={ onMouseDown }\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tonDragStart={ onDragStartHandler }\n\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\tdraggable={ draggable }\n\t\t\t\thref={ `#block-${ clientId }` }\n\t\t\t\taria-describedby={ ariaDescribedBy }\n\t\t\t\taria-expanded={ isExpanded }\n\t\t\t>\n\t\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\t\tshowColors\n\t\t\t\t\tcontext=\"list-view\"\n\t\t\t\t/>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__label-wrapper\"\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tspacing={ 1 }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__title\">\n\t\t\t\t\t\t<Truncate ellipsizeMode=\"auto\">{ blockTitle }</Truncate>\n\t\t\t\t\t</span>\n\t\t\t\t\t{ blockInformation?.anchor && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__anchor-wrapper\">\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__anchor\"\n\t\t\t\t\t\t\t\tellipsizeMode=\"auto\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ blockInformation.anchor }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ positionLabel && isSticky && (\n\t\t\t\t\t\t<Tooltip text={ positionLabel }>\n\t\t\t\t\t\t\t<Icon icon={ pinSmall } />\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t{ images.length ? (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__images\"\n\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ images.map( ( image, index ) => (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__image\"\n\t\t\t\t\t\t\t\t\tkey={ image.clientId }\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\tbackgroundImage: `url(${ image.url })`,\n\t\t\t\t\t\t\t\t\t\tzIndex: images.length - index, // Ensure the first image is on top, and subsequent images are behind.\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</span>\n\t\t\t\t\t) : null }\n\t\t\t\t\t{ isLocked && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__lock\">\n\t\t\t\t\t\t\t<Icon icon={ lock } />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSelectButton );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SACCC,MAAM,EACNC,oBAAoB,IAA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CAACxF,OAAO;IAACmG,IAAI,EAAGrC;EAAe,GAC9B0B,aAAA,CAACtF,IAAI;IAAC0F,IAAI,EAAGvF;EAAU,CAAE,CACjB,CACT,EACCuD,MAAM,CAACoB,MAAM,GACdQ,aAAA;IACC7D,SAAS,EAAC,oDAAoD;IAC9D;EAAW,GAETiC,MAAM,CAACwC,GAAG,CAAE,CAAEC,KAAK,EAAEC,KAAK,KAC3Bd,aAAA;IACC7D,SAAS,EAAC,mDAAmD;IAC7D4E,GAAG,EAAGF,KAAK,CAACxE,QAAU;IACtB2E,KAAK,EAAG;MACPC,eAAe,EAAG,OAAOJ,KAAK,CAACK,GAAK,GAAE;MACtCC,MAAM,EAAE/C,MAAM,CAACoB,MAAM,GAAGsB,KAAK,CAAE;IAChC;EAAG,CACH,CACA,CACG,CAAC,GACJ,IAAI,EACNxD,QAAQ,IACT0C,aAAA;IAAM7D,SAAS,EAAC;EAAkD,GACjE6D,aAAA,CAACtF,IAAI;IAAC0F,IAAI,EAAGxF;EAAM,CAAE,CAChB,CAEA,CACD,CACP,CAAC;AAEL;AAEA,eAAeH,UAAU,CAAEyB,yBAA0B,CAAC"}
|
|
@@ -13,7 +13,7 @@ import { useInstanceId } from '@wordpress/compose';
|
|
|
13
13
|
import { moreVertical } from '@wordpress/icons';
|
|
14
14
|
import { useCallback, useMemo, useState, useRef, memo } from '@wordpress/element';
|
|
15
15
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
16
|
-
import {
|
|
16
|
+
import { __ } from '@wordpress/i18n';
|
|
17
17
|
import { ESCAPE } from '@wordpress/keycodes';
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -24,7 +24,7 @@ import useListViewScrollIntoView from './use-list-view-scroll-into-view';
|
|
|
24
24
|
import { BlockMoverUpButton, BlockMoverDownButton } from '../block-mover/button';
|
|
25
25
|
import ListViewBlockContents from './block-contents';
|
|
26
26
|
import { useListViewContext } from './context';
|
|
27
|
-
import { getBlockPositionDescription, focusListItem } from './utils';
|
|
27
|
+
import { getBlockPositionDescription, getBlockPropertiesDescription, focusListItem } from './utils';
|
|
28
28
|
import { store as blockEditorStore } from '../../store';
|
|
29
29
|
import useBlockDisplayInformation from '../use-block-display-information';
|
|
30
30
|
import { useBlockLock } from '../block-lock';
|
|
@@ -66,7 +66,6 @@ function ListViewBlock({
|
|
|
66
66
|
toggleBlockHighlight
|
|
67
67
|
} = useDispatch(blockEditorStore);
|
|
68
68
|
const blockInformation = useBlockDisplayInformation(clientId);
|
|
69
|
-
const blockTitle = blockInformation?.name || blockInformation?.title || __('Untitled');
|
|
70
69
|
const {
|
|
71
70
|
block,
|
|
72
71
|
blockName,
|
|
@@ -92,7 +91,7 @@ function ListViewBlock({
|
|
|
92
91
|
// Don't show the settings menu if block is disabled or content only.
|
|
93
92
|
blockEditingMode === 'default';
|
|
94
93
|
const instanceId = useInstanceId(ListViewBlock);
|
|
95
|
-
const descriptionId = `list-view-block-select-
|
|
94
|
+
const descriptionId = `list-view-block-select-button__description-${instanceId}`;
|
|
96
95
|
const {
|
|
97
96
|
expand,
|
|
98
97
|
collapse,
|
|
@@ -198,12 +197,7 @@ function ListViewBlock({
|
|
|
198
197
|
return null;
|
|
199
198
|
}
|
|
200
199
|
const blockPositionDescription = getBlockPositionDescription(position, siblingBlockCount, level);
|
|
201
|
-
const
|
|
202
|
-
// translators: %s: The title of the block. This string indicates a link to select the locked block.
|
|
203
|
-
__('%s (locked)'), blockTitle) : blockTitle;
|
|
204
|
-
const settingsAriaLabel = sprintf(
|
|
205
|
-
// translators: %s: The title of the block.
|
|
206
|
-
__('Options for %s'), blockTitle);
|
|
200
|
+
const blockPropertiesDescription = getBlockPropertiesDescription(isLocked);
|
|
207
201
|
const hasSiblings = siblingBlockCount > 0;
|
|
208
202
|
const hasRenderedMovers = showBlockMovers && hasSiblings;
|
|
209
203
|
const moverCellClassName = classnames('block-editor-list-view-block__mover-cell', {
|
|
@@ -285,12 +279,11 @@ function ListViewBlock({
|
|
|
285
279
|
onFocus: onFocus,
|
|
286
280
|
isExpanded: canEdit ? isExpanded : undefined,
|
|
287
281
|
selectedClientIds: selectedClientIds,
|
|
288
|
-
ariaLabel: blockAriaLabel,
|
|
289
282
|
ariaDescribedBy: descriptionId,
|
|
290
283
|
updateFocusAndSelection: updateFocusAndSelection
|
|
291
284
|
}), createElement(AriaReferencedText, {
|
|
292
285
|
id: descriptionId
|
|
293
|
-
}, blockPositionDescription))), hasRenderedMovers && createElement(Fragment, null, createElement(TreeGridCell, {
|
|
286
|
+
}, `${blockPositionDescription} ${blockPropertiesDescription}`))), hasRenderedMovers && createElement(Fragment, null, createElement(TreeGridCell, {
|
|
294
287
|
className: moverCellClassName,
|
|
295
288
|
withoutGridItem: true
|
|
296
289
|
}, createElement(TreeGridItem, null, ({
|
|
@@ -325,7 +318,7 @@ function ListViewBlock({
|
|
|
325
318
|
clientIds: dropdownClientIds,
|
|
326
319
|
block: block,
|
|
327
320
|
icon: moreVertical,
|
|
328
|
-
label:
|
|
321
|
+
label: __('Actions'),
|
|
329
322
|
popoverProps: {
|
|
330
323
|
anchor: settingsPopoverAnchor // Used to position the settings at the cursor on right-click.
|
|
331
324
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","hasBlockSupport","__experimentalTreeGridCell","TreeGridCell","__experimentalTreeGridItem","TreeGridItem","useInstanceId","moreVertical","useCallback","useMemo","useState","useRef","memo","useDispatch","useSelect","sprintf","__","ESCAPE","ListViewLeaf","useListViewScrollIntoView","BlockMoverUpButton","BlockMoverDownButton","ListViewBlockContents","useListViewContext","getBlockPositionDescription","focusListItem","store","blockEditorStore","useBlockDisplayInformation","useBlockLock","AriaReferencedText","ListViewBlock","block","clientId","displacement","isAfterDraggedBlocks","isDragged","isNesting","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","isSyncedBranch","cellRef","rowRef","settingsRef","isHovered","setIsHovered","settingsAnchorRect","setSettingsAnchorRect","isLocked","canEdit","canMove","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","blockInformation","blockTitle","name","title","blockName","blockEditingMode","select","getBlock","getBlockName","getBlockEditingMode","allowRightClickOverrides","getSettings","showBlockActions","instanceId","descriptionId","expand","collapse","BlockSettingsMenu","listViewInstanceId","expandedState","setInsertedBlock","treeGridElementRef","onKeyDown","event","keyCode","defaultPrevented","stopPropagation","preventDefault","undefined","onMouseEnter","onMouseLeave","selectEditorBlock","updateFocusAndSelection","focusClientId","shouldSelectBlock","current","toggleExpanded","onContextMenu","click","window","DOMRect","clientX","clientY","onMouseDown","button","settingsPopoverAnchor","ownerDocument","getBoundingClientRect","clearSettingsAnchorRect","rowItemRef","blockPositionDescription","blockAriaLabel","settingsAriaLabel","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","colSpan","classes","isSynced","dropdownClientIds","includes","currentlyEditingBlockInCanvas","createElement","className","onFocus","onBlur","id","ref","tabIndex","onClick","onToggleExpanded","ariaLabel","ariaDescribedBy","Fragment","withoutGridItem","orientation","clientIds","icon","label","popoverProps","anchor","toggleProps","disableOpenOnArrowDown","__experimentalSelectBlock"],"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tuseCallback,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport useListViewScrollIntoView from './use-list-view-scroll-into-view';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport { useListViewContext } from './context';\nimport { getBlockPositionDescription, focusListItem } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { useBlockLock } from '../block-lock';\nimport AriaReferencedText from './aria-referenced-text';\n\nfunction ListViewBlock( {\n\tblock: { clientId },\n\tdisplacement,\n\tisAfterDraggedBlocks,\n\tisDragged,\n\tisNesting,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n\tselectedClientIds,\n\tisSyncedBranch,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst rowRef = useRef( null );\n\tconst settingsRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ settingsAnchorRect, setSettingsAnchorRect ] = useState();\n\n\tconst { isLocked, canEdit, canMove } = useBlockLock( clientId );\n\n\tconst isFirstSelectedBlock =\n\t\tisSelected && selectedClientIds[ 0 ] === clientId;\n\tconst isLastSelectedBlock =\n\t\tisSelected &&\n\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId;\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle =\n\t\tblockInformation?.name || blockInformation?.title || __( 'Untitled' );\n\n\tconst { block, blockName, blockEditingMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getBlockName, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tblock: getBlock( clientId ),\n\t\t\t\tblockName: getBlockName( clientId ),\n\t\t\t\tblockEditingMode: getBlockEditingMode( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst allowRightClickOverrides = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().allowRightClickOverrides,\n\t\t[]\n\t);\n\n\tconst showBlockActions =\n\t\t// When a block hides its toolbar it also hides the block settings menu,\n\t\t// since that menu is part of the toolbar in the editor canvas.\n\t\t// List View respects this by also hiding the block settings menu.\n\t\thasBlockSupport( blockName, '__experimentalToolbar', true ) &&\n\t\t// Don't show the settings menu if block is disabled or content only.\n\t\tblockEditingMode === 'default';\n\tconst instanceId = useInstanceId( ListViewBlock );\n\tconst descriptionId = `list-view-block-select-button__${ instanceId }`;\n\n\tconst {\n\t\texpand,\n\t\tcollapse,\n\t\tBlockSettingsMenu,\n\t\tlistViewInstanceId,\n\t\texpandedState,\n\t\tsetInsertedBlock,\n\t\ttreeGridElementRef,\n\t} = useListViewContext();\n\n\t// If multiple blocks are selected, deselect all blocks when the user\n\t// presses the escape key.\n\tconst onKeyDown = ( event ) => {\n\t\tif (\n\t\t\tevent.keyCode === ESCAPE &&\n\t\t\t! event.defaultPrevented &&\n\t\t\tselectedClientIds.length > 0\n\t\t) {\n\t\t\tevent.stopPropagation();\n\t\t\tevent.preventDefault();\n\t\t\tselectBlock( event, undefined );\n\t\t}\n\t};\n\n\tconst onMouseEnter = useCallback( () => {\n\t\tsetIsHovered( true );\n\t\ttoggleBlockHighlight( clientId, true );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\tconst onMouseLeave = useCallback( () => {\n\t\tsetIsHovered( false );\n\t\ttoggleBlockHighlight( clientId, false );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\n\tconst selectEditorBlock = useCallback(\n\t\t( event ) => {\n\t\t\tselectBlock( event, clientId );\n\t\t\tevent.preventDefault();\n\t\t},\n\t\t[ clientId, selectBlock ]\n\t);\n\n\tconst updateFocusAndSelection = useCallback(\n\t\t( focusClientId, shouldSelectBlock ) => {\n\t\t\tif ( shouldSelectBlock ) {\n\t\t\t\tselectBlock( undefined, focusClientId, null, null );\n\t\t\t}\n\n\t\t\tfocusListItem( focusClientId, treeGridElementRef?.current );\n\t\t},\n\t\t[ selectBlock, treeGridElementRef ]\n\t);\n\n\tconst toggleExpanded = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent shift+click from opening link in a new window when toggling.\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tif ( isExpanded === true ) {\n\t\t\t\tcollapse( clientId );\n\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\texpand( clientId );\n\t\t\t}\n\t\t},\n\t\t[ clientId, expand, collapse, isExpanded ]\n\t);\n\n\t// Allow right-clicking an item in the List View to open up the block settings dropdown.\n\tconst onContextMenu = useCallback(\n\t\t( event ) => {\n\t\t\tif ( showBlockActions && allowRightClickOverrides ) {\n\t\t\t\tsettingsRef.current?.click();\n\t\t\t\t// Ensure the position of the settings dropdown is at the cursor.\n\t\t\t\tsetSettingsAnchorRect(\n\t\t\t\t\tnew window.DOMRect( event.clientX, event.clientY, 0, 0 )\n\t\t\t\t);\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ allowRightClickOverrides, settingsRef, showBlockActions ]\n\t);\n\n\tconst onMouseDown = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent right-click from focusing the block,\n\t\t\t// because focus will be handled when opening the block settings dropdown.\n\t\t\tif ( allowRightClickOverrides && event.button === 2 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ allowRightClickOverrides ]\n\t);\n\n\tconst settingsPopoverAnchor = useMemo( () => {\n\t\tconst { ownerDocument } = rowRef?.current || {};\n\n\t\t// If no custom position is set, the settings dropdown will be anchored to the\n\t\t// DropdownMenu toggle button.\n\t\tif ( ! settingsAnchorRect || ! ownerDocument ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Position the settings dropdown at the cursor when right-clicking a block.\n\t\treturn {\n\t\t\townerDocument,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\treturn settingsAnchorRect;\n\t\t\t},\n\t\t};\n\t}, [ settingsAnchorRect ] );\n\n\tconst clearSettingsAnchorRect = useCallback( () => {\n\t\t// Clear the custom position for the settings dropdown so that it is restored back\n\t\t// to being anchored to the DropdownMenu toggle button.\n\t\tsetSettingsAnchorRect( undefined );\n\t}, [ setSettingsAnchorRect ] );\n\n\t// Pass in a ref to the row, so that it can be scrolled\n\t// into view when selected. For long lists, the placeholder for the\n\t// selected block is also observed, within ListViewLeafPlaceholder.\n\tuseListViewScrollIntoView( {\n\t\tisSelected,\n\t\trowItemRef: rowRef,\n\t\tselectedClientIds,\n\t} );\n\n\t// When switching between rendering modes (such as template preview and content only),\n\t// it is possible for a block to temporarily be unavailable. In this case, we should not\n\t// render the leaf, to avoid errors further down the tree.\n\tif ( ! block ) {\n\t\treturn null;\n\t}\n\n\tconst blockPositionDescription = getBlockPositionDescription(\n\t\tposition,\n\t\tsiblingBlockCount,\n\t\tlevel\n\t);\n\n\tconst blockAriaLabel = isLocked\n\t\t? sprintf(\n\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the locked block.\n\t\t\t\t__( '%s (locked)' ),\n\t\t\t\tblockTitle\n\t\t )\n\t\t: blockTitle;\n\n\tconst settingsAriaLabel = sprintf(\n\t\t// translators: %s: The title of the block.\n\t\t__( 'Options for %s' ),\n\t\tblockTitle\n\t);\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isFirstSelectedBlock }\n\t);\n\n\tlet colSpan;\n\tif ( hasRenderedMovers ) {\n\t\tcolSpan = 2;\n\t} else if ( ! showBlockActions ) {\n\t\tcolSpan = 3;\n\t}\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected,\n\t\t'is-first-selected': isFirstSelectedBlock,\n\t\t'is-last-selected': isLastSelectedBlock,\n\t\t'is-branch-selected': isBranchSelected,\n\t\t'is-synced-branch': isSyncedBranch,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\n\t\t'is-synced': blockInformation?.isSynced,\n\t\t'is-draggable': canMove,\n\t\t'is-displacement-normal': displacement === 'normal',\n\t\t'is-displacement-up': displacement === 'up',\n\t\t'is-displacement-down': displacement === 'down',\n\t\t'is-after-dragged-blocks': isAfterDraggedBlocks,\n\t\t'is-nesting': isNesting,\n\t} );\n\n\t// Only include all selected blocks if the currently clicked on block\n\t// is one of the selected blocks. This ensures that if a user attempts\n\t// to alter a block that isn't part of the selection, they're still able\n\t// to do so.\n\tconst dropdownClientIds = selectedClientIds.includes( clientId )\n\t\t? selectedClientIds\n\t\t: [ clientId ];\n\n\t// Detect if there is a block in the canvas currently being edited and multi-selection is not happening.\n\tconst currentlyEditingBlockInCanvas =\n\t\tisSelected && selectedClientIds.length === 1;\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tisDragged={ isDragged }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-${ listViewInstanceId }-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tdata-expanded={ canEdit ? isExpanded : undefined }\n\t\t\tref={ rowRef }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ colSpan }\n\t\t\t\tref={ cellRef }\n\t\t\t\taria-selected={ !! isSelected }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonContextMenu={ onContextMenu }\n\t\t\t\t\t\t\tonMouseDown={ onMouseDown }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={\n\t\t\t\t\t\t\t\tcurrentlyEditingBlockInCanvas ? 0 : tabIndex\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ canEdit ? isExpanded : undefined }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tariaLabel={ blockAriaLabel }\n\t\t\t\t\t\t\tariaDescribedBy={ descriptionId }\n\t\t\t\t\t\t\tupdateFocusAndSelection={ updateFocusAndSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<AriaReferencedText id={ descriptionId }>\n\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t</AriaReferencedText>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ showBlockActions && BlockSettingsMenu && (\n\t\t\t\t<TreeGridCell\n\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\taria-selected={ !! isSelected }\n\t\t\t\t\tref={ settingsRef }\n\t\t\t\t>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsMenu\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ settingsAriaLabel }\n\t\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\t\tanchor: settingsPopoverAnchor, // Used to position the settings at the cursor on right-click.\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\tclassName: 'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\tonClick: clearSettingsAnchorRect,\n\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\texpand={ expand }\n\t\t\t\t\t\t\texpandedState={ expandedState }\n\t\t\t\t\t\t\tsetInsertedBlock={ setInsertedBlock }\n\t\t\t\t\t\t\t__experimentalSelectBlock={\n\t\t\t\t\t\t\t\tupdateFocusAndSelection\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SACCC,0BAA0B,IAAIC,YAAY,EAC1CC,0BAA0B,IAAIC,YAAY,QACpC,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SACCC,WAAW,EACXC,OAAO,EACPC,QAAQ,EACRC,MAAM,EACNC,IAAI,QACE,oBAAoB;AAC3B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,QAAQ,qBAAqB;;AAE5C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,QAAQ;AACjC,OAAOC,yBAAyB,MAAM,kCAAkC;AACxE,SACCC,kBAAkB,EAClBC,oBAAoB,QACd,uBAAuB;AAC9B,OAAOC,qBAAqB,MAAM,kBAAkB;AACpD,SAASC,kBAAkB,QAAQ,WAAW;AAC9C,SAASC,2BAA2B,EAAEC,aAAa,QAAQ,SAAS;AACpE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,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AI;IAC1BmG,GAAG,EAAGA,GAAK;IACXC,QAAQ,EAAGA,QAAU;IACrBJ,OAAO,EAAGA;EAAS,CACnB,CAEW,CACD,CACb,CACF,EAECrD,gBAAgB,IAAIK,iBAAiB,IACtC8C,aAAA,CAAC5H,YAAY;IACZ6H,SAAS,EAAGR,8BAAgC;IAC5C,iBAAgB,CAAC,CAAElF,UAAY;IAC/B8F,GAAG,EAAGhF;EAAa,GAEjB,CAAE;IAAEgF,GAAG;IAAEC,QAAQ;IAAEJ;EAAQ,CAAC,KAC7BF,aAAA,CAAC9C,iBAAiB;IACjB4D,SAAS,EAAGjB,iBAAmB;IAC/B5F,KAAK,EAAGA,KAAO;IACf8G,IAAI,EAAGvI,YAAc;IACrBwI,KAAK,EAAG3B,iBAAmB;IAC3B4B,YAAY,EAAG;MACdC,MAAM,EAAEpC,qBAAqB,CAAE;IAChC,CAAG;IACHqC,WAAW,EAAG;MACbd,GAAG;MACHJ,SAAS,EAAE,oCAAoC;MAC/CK,QAAQ;MACRC,OAAO,EAAEtB,uBAAuB;MAChCiB;IACD,CAAG;IACHkB,sBAAsB;IACtBpE,MAAM,EAAGA,MAAQ;IACjBI,aAAa,EAAGA,aAAe;IAC/BC,gBAAgB,EAAGA,gBAAkB;IACrCgE,yBAAyB,EACxBpD;EACA,CACD,CAEW,CAEF,CAAC;AAEjB;AAEA,eAAepF,IAAI,CAAEmB,aAAc,CAAC"}
|
|
1
|
+
{"version":3,"names":["classnames","hasBlockSupport","__experimentalTreeGridCell","TreeGridCell","__experimentalTreeGridItem","TreeGridItem","useInstanceId","moreVertical","useCallback","useMemo","useState","useRef","memo","useDispatch","useSelect","__","ESCAPE","ListViewLeaf","useListViewScrollIntoView","BlockMoverUpButton","BlockMoverDownButton","ListViewBlockContents","useListViewContext","getBlockPositionDescription","getBlockPropertiesDescription","focusListItem","store","blockEditorStore","useBlockDisplayInformation","useBlockLock","AriaReferencedText","ListViewBlock","block","clientId","displacement","isAfterDraggedBlocks","isDragged","isNesting","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","isSyncedBranch","cellRef","rowRef","settingsRef","isHovered","setIsHovered","settingsAnchorRect","setSettingsAnchorRect","isLocked","canEdit","canMove","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","blockInformation","blockName","blockEditingMode","select","getBlock","getBlockName","getBlockEditingMode","allowRightClickOverrides","getSettings","showBlockActions","instanceId","descriptionId","expand","collapse","BlockSettingsMenu","listViewInstanceId","expandedState","setInsertedBlock","treeGridElementRef","onKeyDown","event","keyCode","defaultPrevented","stopPropagation","preventDefault","undefined","onMouseEnter","onMouseLeave","selectEditorBlock","updateFocusAndSelection","focusClientId","shouldSelectBlock","current","toggleExpanded","onContextMenu","click","window","DOMRect","clientX","clientY","onMouseDown","button","settingsPopoverAnchor","ownerDocument","getBoundingClientRect","clearSettingsAnchorRect","rowItemRef","blockPositionDescription","blockPropertiesDescription","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","colSpan","classes","isSynced","dropdownClientIds","includes","currentlyEditingBlockInCanvas","createElement","className","onFocus","onBlur","id","ref","tabIndex","onClick","onToggleExpanded","ariaDescribedBy","Fragment","withoutGridItem","orientation","clientIds","icon","label","popoverProps","anchor","toggleProps","disableOpenOnArrowDown","__experimentalSelectBlock"],"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tuseCallback,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport useListViewScrollIntoView from './use-list-view-scroll-into-view';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport { useListViewContext } from './context';\nimport {\n\tgetBlockPositionDescription,\n\tgetBlockPropertiesDescription,\n\tfocusListItem,\n} from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { useBlockLock } from '../block-lock';\nimport AriaReferencedText from './aria-referenced-text';\n\nfunction ListViewBlock( {\n\tblock: { clientId },\n\tdisplacement,\n\tisAfterDraggedBlocks,\n\tisDragged,\n\tisNesting,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n\tselectedClientIds,\n\tisSyncedBranch,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst rowRef = useRef( null );\n\tconst settingsRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ settingsAnchorRect, setSettingsAnchorRect ] = useState();\n\n\tconst { isLocked, canEdit, canMove } = useBlockLock( clientId );\n\n\tconst isFirstSelectedBlock =\n\t\tisSelected && selectedClientIds[ 0 ] === clientId;\n\tconst isLastSelectedBlock =\n\t\tisSelected &&\n\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId;\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\tconst { block, blockName, blockEditingMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getBlockName, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tblock: getBlock( clientId ),\n\t\t\t\tblockName: getBlockName( clientId ),\n\t\t\t\tblockEditingMode: getBlockEditingMode( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst allowRightClickOverrides = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().allowRightClickOverrides,\n\t\t[]\n\t);\n\n\tconst showBlockActions =\n\t\t// When a block hides its toolbar it also hides the block settings menu,\n\t\t// since that menu is part of the toolbar in the editor canvas.\n\t\t// List View respects this by also hiding the block settings menu.\n\t\thasBlockSupport( blockName, '__experimentalToolbar', true ) &&\n\t\t// Don't show the settings menu if block is disabled or content only.\n\t\tblockEditingMode === 'default';\n\tconst instanceId = useInstanceId( ListViewBlock );\n\tconst descriptionId = `list-view-block-select-button__description-${ instanceId }`;\n\n\tconst {\n\t\texpand,\n\t\tcollapse,\n\t\tBlockSettingsMenu,\n\t\tlistViewInstanceId,\n\t\texpandedState,\n\t\tsetInsertedBlock,\n\t\ttreeGridElementRef,\n\t} = useListViewContext();\n\n\t// If multiple blocks are selected, deselect all blocks when the user\n\t// presses the escape key.\n\tconst onKeyDown = ( event ) => {\n\t\tif (\n\t\t\tevent.keyCode === ESCAPE &&\n\t\t\t! event.defaultPrevented &&\n\t\t\tselectedClientIds.length > 0\n\t\t) {\n\t\t\tevent.stopPropagation();\n\t\t\tevent.preventDefault();\n\t\t\tselectBlock( event, undefined );\n\t\t}\n\t};\n\n\tconst onMouseEnter = useCallback( () => {\n\t\tsetIsHovered( true );\n\t\ttoggleBlockHighlight( clientId, true );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\tconst onMouseLeave = useCallback( () => {\n\t\tsetIsHovered( false );\n\t\ttoggleBlockHighlight( clientId, false );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\n\tconst selectEditorBlock = useCallback(\n\t\t( event ) => {\n\t\t\tselectBlock( event, clientId );\n\t\t\tevent.preventDefault();\n\t\t},\n\t\t[ clientId, selectBlock ]\n\t);\n\n\tconst updateFocusAndSelection = useCallback(\n\t\t( focusClientId, shouldSelectBlock ) => {\n\t\t\tif ( shouldSelectBlock ) {\n\t\t\t\tselectBlock( undefined, focusClientId, null, null );\n\t\t\t}\n\n\t\t\tfocusListItem( focusClientId, treeGridElementRef?.current );\n\t\t},\n\t\t[ selectBlock, treeGridElementRef ]\n\t);\n\n\tconst toggleExpanded = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent shift+click from opening link in a new window when toggling.\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tif ( isExpanded === true ) {\n\t\t\t\tcollapse( clientId );\n\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\texpand( clientId );\n\t\t\t}\n\t\t},\n\t\t[ clientId, expand, collapse, isExpanded ]\n\t);\n\n\t// Allow right-clicking an item in the List View to open up the block settings dropdown.\n\tconst onContextMenu = useCallback(\n\t\t( event ) => {\n\t\t\tif ( showBlockActions && allowRightClickOverrides ) {\n\t\t\t\tsettingsRef.current?.click();\n\t\t\t\t// Ensure the position of the settings dropdown is at the cursor.\n\t\t\t\tsetSettingsAnchorRect(\n\t\t\t\t\tnew window.DOMRect( event.clientX, event.clientY, 0, 0 )\n\t\t\t\t);\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ allowRightClickOverrides, settingsRef, showBlockActions ]\n\t);\n\n\tconst onMouseDown = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent right-click from focusing the block,\n\t\t\t// because focus will be handled when opening the block settings dropdown.\n\t\t\tif ( allowRightClickOverrides && event.button === 2 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ allowRightClickOverrides ]\n\t);\n\n\tconst settingsPopoverAnchor = useMemo( () => {\n\t\tconst { ownerDocument } = rowRef?.current || {};\n\n\t\t// If no custom position is set, the settings dropdown will be anchored to the\n\t\t// DropdownMenu toggle button.\n\t\tif ( ! settingsAnchorRect || ! ownerDocument ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Position the settings dropdown at the cursor when right-clicking a block.\n\t\treturn {\n\t\t\townerDocument,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\treturn settingsAnchorRect;\n\t\t\t},\n\t\t};\n\t}, [ settingsAnchorRect ] );\n\n\tconst clearSettingsAnchorRect = useCallback( () => {\n\t\t// Clear the custom position for the settings dropdown so that it is restored back\n\t\t// to being anchored to the DropdownMenu toggle button.\n\t\tsetSettingsAnchorRect( undefined );\n\t}, [ setSettingsAnchorRect ] );\n\n\t// Pass in a ref to the row, so that it can be scrolled\n\t// into view when selected. For long lists, the placeholder for the\n\t// selected block is also observed, within ListViewLeafPlaceholder.\n\tuseListViewScrollIntoView( {\n\t\tisSelected,\n\t\trowItemRef: rowRef,\n\t\tselectedClientIds,\n\t} );\n\n\t// When switching between rendering modes (such as template preview and content only),\n\t// it is possible for a block to temporarily be unavailable. In this case, we should not\n\t// render the leaf, to avoid errors further down the tree.\n\tif ( ! block ) {\n\t\treturn null;\n\t}\n\n\tconst blockPositionDescription = getBlockPositionDescription(\n\t\tposition,\n\t\tsiblingBlockCount,\n\t\tlevel\n\t);\n\n\tconst blockPropertiesDescription =\n\t\tgetBlockPropertiesDescription( isLocked );\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isFirstSelectedBlock }\n\t);\n\n\tlet colSpan;\n\tif ( hasRenderedMovers ) {\n\t\tcolSpan = 2;\n\t} else if ( ! showBlockActions ) {\n\t\tcolSpan = 3;\n\t}\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected,\n\t\t'is-first-selected': isFirstSelectedBlock,\n\t\t'is-last-selected': isLastSelectedBlock,\n\t\t'is-branch-selected': isBranchSelected,\n\t\t'is-synced-branch': isSyncedBranch,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\n\t\t'is-synced': blockInformation?.isSynced,\n\t\t'is-draggable': canMove,\n\t\t'is-displacement-normal': displacement === 'normal',\n\t\t'is-displacement-up': displacement === 'up',\n\t\t'is-displacement-down': displacement === 'down',\n\t\t'is-after-dragged-blocks': isAfterDraggedBlocks,\n\t\t'is-nesting': isNesting,\n\t} );\n\n\t// Only include all selected blocks if the currently clicked on block\n\t// is one of the selected blocks. This ensures that if a user attempts\n\t// to alter a block that isn't part of the selection, they're still able\n\t// to do so.\n\tconst dropdownClientIds = selectedClientIds.includes( clientId )\n\t\t? selectedClientIds\n\t\t: [ clientId ];\n\n\t// Detect if there is a block in the canvas currently being edited and multi-selection is not happening.\n\tconst currentlyEditingBlockInCanvas =\n\t\tisSelected && selectedClientIds.length === 1;\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tisDragged={ isDragged }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-${ listViewInstanceId }-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tdata-expanded={ canEdit ? isExpanded : undefined }\n\t\t\tref={ rowRef }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ colSpan }\n\t\t\t\tref={ cellRef }\n\t\t\t\taria-selected={ !! isSelected }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonContextMenu={ onContextMenu }\n\t\t\t\t\t\t\tonMouseDown={ onMouseDown }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={\n\t\t\t\t\t\t\t\tcurrentlyEditingBlockInCanvas ? 0 : tabIndex\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ canEdit ? isExpanded : undefined }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tariaDescribedBy={ descriptionId }\n\t\t\t\t\t\t\tupdateFocusAndSelection={ updateFocusAndSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<AriaReferencedText id={ descriptionId }>\n\t\t\t\t\t\t\t{ `${ blockPositionDescription } ${ blockPropertiesDescription }` }\n\t\t\t\t\t\t</AriaReferencedText>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ showBlockActions && BlockSettingsMenu && (\n\t\t\t\t<TreeGridCell\n\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\taria-selected={ !! isSelected }\n\t\t\t\t\tref={ settingsRef }\n\t\t\t\t>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsMenu\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\t\tanchor: settingsPopoverAnchor, // Used to position the settings at the cursor on right-click.\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\tclassName: 'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\tonClick: clearSettingsAnchorRect,\n\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\texpand={ expand }\n\t\t\t\t\t\t\texpandedState={ expandedState }\n\t\t\t\t\t\t\tsetInsertedBlock={ setInsertedBlock }\n\t\t\t\t\t\t\t__experimentalSelectBlock={\n\t\t\t\t\t\t\t\tupdateFocusAndSelection\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SACCC,0BAA0B,IAAIC,YAAY,EAC1CC,0BAA0B,IAAIC,YAAY,QACpC,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SACCC,WAAW,EACXC,OAAO,EACPC,QAAQ,EACRC,MAAM,EACNC,IAAI,QACE,oBAAoB;AAC3B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,qBAAqB;;AAE5C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,QAAQ;AACjC,OAAOC,yBAAyB,MAAM,kCAAkC;AACxE,SACCC,kBAAkB,EAClBC,oBAAoB,QACd,uBAAuB;AAC9B,OAAOC,qBAAqB,MAAM,kBAAkB;AACpD,SAASC,kBAAkB,QAAQ,WAAW;AAC9C,SACCC,2BAA2B,EAC3BC,6BAA6B,EAC7BC,aAAa,QACP,SAAS;AAChB,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,0BAA0B,MAAM,kCAAkC;AACzE,SAASC,YAAY,QAAQ,eAAe;AAC5C,OAAOC,kBAAkB,MAAM,wBAAwB;AAEvD,SAASC,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iBAAmB;IAC/BxF,KAAK,EAAGA,KAAO;IACfyG,IAAI,EAAGlI,YAAc;IACrBmI,KAAK,EAAG3H,EAAE,CAAE,SAAU,CAAG;IACzB4H,YAAY,EAAG;MACdC,MAAM,EAAElC,qBAAqB,CAAE;IAChC,CAAG;IACHmC,WAAW,EAAG;MACbb,GAAG;MACHJ,SAAS,EAAE,oCAAoC;MAC/CK,QAAQ;MACRC,OAAO,EAAErB,uBAAuB;MAChCgB;IACD,CAAG;IACHiB,sBAAsB;IACtBlE,MAAM,EAAGA,MAAQ;IACjBI,aAAa,EAAGA,aAAe;IAC/BC,gBAAgB,EAAGA,gBAAkB;IACrC8D,yBAAyB,EACxBlD;EACA,CACD,CAEW,CAEF,CAAC;AAEjB;AAEA,eAAejF,IAAI,CAAEmB,aAAc,CAAC"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import { focus } from '@wordpress/dom';
|
|
6
6
|
export const getBlockPositionDescription = (position, siblingCount, level) => sprintf( /* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */
|
|
7
|
-
__('Block %1$d of %2$d, Level %3$d'), position, siblingCount, level);
|
|
7
|
+
__('Block %1$d of %2$d, Level %3$d.'), position, siblingCount, level);
|
|
8
|
+
export const getBlockPropertiesDescription = isLocked => isLocked ? __('This block is locked.') : '';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Returns true if the client ID occurs within the block selection or multi-selection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","sprintf","focus","getBlockPositionDescription","position","siblingCount","level","isClientIdSelected","clientId","selectedBlockClientIds","Array","isArray","length","indexOf","getCommonDepthClientIds","startId","endId","startParents","endParents","startPath","endPath","depth","Math","min","start","end","focusListItem","focusClientId","treeGridElement","getFocusElement","row","querySelector","focusable","find","focusElement","window","requestAnimationFrame","getDragDisplacementValues","blockIndexes","blockDropTargetIndex","blockDropPosition","firstDraggedBlockIndex","isDragged","displacement","isNesting","isAfterDraggedBlocks","thisBlockIndex","undefined"],"sources":["@wordpress/block-editor/src/components/list-view/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { focus } from '@wordpress/dom';\n\nexport const getBlockPositionDescription = ( position, siblingCount, level ) =>\n\tsprintf(\n\t\t/* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */\n\t\t__( 'Block %1$d of %2$d, Level %3$d' ),\n\t\tposition,\n\t\tsiblingCount,\n\t\tlevel\n\t);\n\n/**\n * Returns true if the client ID occurs within the block selection or multi-selection,\n * or false otherwise.\n *\n * @param {string} clientId Block client ID.\n * @param {string|string[]} selectedBlockClientIds Selected block client ID, or an array of multi-selected blocks client IDs.\n *\n * @return {boolean} Whether the block is in multi-selection set.\n */\nexport const isClientIdSelected = ( clientId, selectedBlockClientIds ) =>\n\tArray.isArray( selectedBlockClientIds ) && selectedBlockClientIds.length\n\t\t? selectedBlockClientIds.indexOf( clientId ) !== -1\n\t\t: selectedBlockClientIds === clientId;\n\n/**\n * From a start and end clientId of potentially different nesting levels,\n * return the nearest-depth ids that have a common level of depth in the\n * nesting hierarchy. For multiple block selection, this ensure that the\n * selection is always at the same nesting level, and not split across\n * separate levels.\n *\n * @param {string} startId The first id of a selection.\n * @param {string} endId The end id of a selection, usually one that has been clicked on.\n * @param {string[]} startParents An array of ancestor ids for the start id, in descending order.\n * @param {string[]} endParents An array of ancestor ids for the end id, in descending order.\n * @return {Object} An object containing the start and end ids.\n */\nexport function getCommonDepthClientIds(\n\tstartId,\n\tendId,\n\tstartParents,\n\tendParents\n) {\n\tconst startPath = [ ...startParents, startId ];\n\tconst endPath = [ ...endParents, endId ];\n\tconst depth = Math.min( startPath.length, endPath.length ) - 1;\n\tconst start = startPath[ depth ];\n\tconst end = endPath[ depth ];\n\n\treturn {\n\t\tstart,\n\t\tend,\n\t};\n}\n\n/**\n * Shift focus to the list view item associated with a particular clientId.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {string} focusClientId The client ID of the block to focus.\n * @param {?HTMLElement} treeGridElement The container element to search within.\n */\nexport function focusListItem( focusClientId, treeGridElement ) {\n\tconst getFocusElement = () => {\n\t\tconst row = treeGridElement?.querySelector(\n\t\t\t`[role=row][data-block=\"${ focusClientId }\"]`\n\t\t);\n\t\tif ( ! row ) return null;\n\t\t// Focus the first focusable in the row, which is the ListViewBlockSelectButton.\n\t\treturn focus.focusable.find( row )[ 0 ];\n\t};\n\n\tlet focusElement = getFocusElement();\n\tif ( focusElement ) {\n\t\tfocusElement.focus();\n\t} else {\n\t\t// The element hasn't been painted yet. Defer focusing on the next frame.\n\t\t// This could happen when all blocks have been deleted and the default block\n\t\t// hasn't been added to the editor yet.\n\t\twindow.requestAnimationFrame( () => {\n\t\t\tfocusElement = getFocusElement();\n\n\t\t\t// Ignore if the element still doesn't exist.\n\t\t\tif ( focusElement ) {\n\t\t\t\tfocusElement.focus();\n\t\t\t}\n\t\t} );\n\t}\n}\n\n/**\n * Get values for the block that flag whether the block should be displaced up or down,\n * whether the block is being nested, and whether the block appears after the dragged\n * blocks. These values are used to determine the class names to apply to the block.\n * The list view rows are displaced visually via CSS rules. Displacement rules:\n * - `normal`: no displacement — used to apply a translateY of `0` so that the block\n * appears in its original position, and moves to that position smoothly when dragging\n * outside of the list view area.\n * - `up`: the block should be displaced up, creating room beneath the block for the drop indicator.\n * - `down`: the block should be displaced down, creating room above the block for the drop indicator.\n *\n * @param {Object} props\n * @param {Object} props.blockIndexes The indexes of all the blocks in the list view, keyed by clientId.\n * @param {number|null|undefined} props.blockDropTargetIndex The index of the block that the user is dropping to.\n * @param {?string} props.blockDropPosition The position relative to the block that the user is dropping to.\n * @param {string} props.clientId The client id for the current block.\n * @param {?number} props.firstDraggedBlockIndex The index of the first dragged block.\n * @param {?boolean} props.isDragged Whether the current block is being dragged. Dragged blocks skip displacement.\n * @return {Object} An object containing the `displacement`, `isAfterDraggedBlocks` and `isNesting` values.\n */\nexport function getDragDisplacementValues( {\n\tblockIndexes,\n\tblockDropTargetIndex,\n\tblockDropPosition,\n\tclientId,\n\tfirstDraggedBlockIndex,\n\tisDragged,\n} ) {\n\tlet displacement;\n\tlet isNesting;\n\tlet isAfterDraggedBlocks;\n\n\tif ( ! isDragged ) {\n\t\tisNesting = false;\n\t\tconst thisBlockIndex = blockIndexes[ clientId ];\n\t\tisAfterDraggedBlocks = thisBlockIndex > firstDraggedBlockIndex;\n\n\t\t// Determine where to displace the position of the current block, relative\n\t\t// to the blocks being dragged (in their original position) and the drop target\n\t\t// (the position where a user is currently dragging the blocks to).\n\t\tif (\n\t\t\tblockDropTargetIndex !== undefined &&\n\t\t\tblockDropTargetIndex !== null &&\n\t\t\tfirstDraggedBlockIndex !== undefined\n\t\t) {\n\t\t\t// If the block is being dragged and there is a valid drop target,\n\t\t\t// determine if the block being rendered should be displaced up or down.\n\n\t\t\tif ( thisBlockIndex !== undefined ) {\n\t\t\t\tif (\n\t\t\t\t\tthisBlockIndex >= firstDraggedBlockIndex &&\n\t\t\t\t\tthisBlockIndex < blockDropTargetIndex\n\t\t\t\t) {\n\t\t\t\t\t// If the current block appears after the set of dragged blocks\n\t\t\t\t\t// (in their original position), but is before the drop target,\n\t\t\t\t\t// then the current block should be displaced up.\n\t\t\t\t\tdisplacement = 'up';\n\t\t\t\t} else if (\n\t\t\t\t\tthisBlockIndex < firstDraggedBlockIndex &&\n\t\t\t\t\tthisBlockIndex >= blockDropTargetIndex\n\t\t\t\t) {\n\t\t\t\t\t// If the current block appears before the set of dragged blocks\n\t\t\t\t\t// (in their original position), but is after the drop target,\n\t\t\t\t\t// then the current block should be displaced down.\n\t\t\t\t\tdisplacement = 'down';\n\t\t\t\t} else {\n\t\t\t\t\tdisplacement = 'normal';\n\t\t\t\t}\n\t\t\t\tisNesting =\n\t\t\t\t\ttypeof blockDropTargetIndex === 'number' &&\n\t\t\t\t\tblockDropTargetIndex - 1 === thisBlockIndex &&\n\t\t\t\t\tblockDropPosition === 'inside';\n\t\t\t}\n\t\t} else if (\n\t\t\tblockDropTargetIndex === null &&\n\t\t\tfirstDraggedBlockIndex !== undefined\n\t\t) {\n\t\t\t// A `null` value for `blockDropTargetIndex` indicates that the\n\t\t\t// drop target is outside of the valid areas within the list view.\n\t\t\t// In this case, the drag is still active, but as there is no\n\t\t\t// valid drop target, we should remove the gap indicating where\n\t\t\t// the block would be inserted.\n\t\t\tif (\n\t\t\t\tthisBlockIndex !== undefined &&\n\t\t\t\tthisBlockIndex >= firstDraggedBlockIndex\n\t\t\t) {\n\t\t\t\tdisplacement = 'up';\n\t\t\t} else {\n\t\t\t\tdisplacement = 'normal';\n\t\t\t}\n\t\t} else if (\n\t\t\tblockDropTargetIndex !== undefined &&\n\t\t\tblockDropTargetIndex !== null &&\n\t\t\tfirstDraggedBlockIndex === undefined\n\t\t) {\n\t\t\t// If the blockdrop target is defined, but there are no dragged blocks,\n\t\t\t// then the block should be displaced relative to the drop target.\n\t\t\tif ( thisBlockIndex !== undefined ) {\n\t\t\t\tif ( thisBlockIndex < blockDropTargetIndex ) {\n\t\t\t\t\tdisplacement = 'normal';\n\t\t\t\t} else {\n\t\t\t\t\tdisplacement = 'down';\n\t\t\t\t}\n\t\t\t}\n\t\t} else if ( blockDropTargetIndex === null ) {\n\t\t\tdisplacement = 'normal';\n\t\t}\n\t}\n\n\treturn {\n\t\tdisplacement,\n\t\tisNesting,\n\t\tisAfterDraggedBlocks,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,QAAQ,gBAAgB;AAEtC,OAAO,MAAMC,2BAA2B,GAAGA,CAAEC,QAAQ,EAAEC,YAAY,EAAEC,KAAK,KACzEL,OAAO,EACN;AACAD,EAAE,CAAE,gCAAiC,CAAC,EACtCI,QAAQ,EACRC,YAAY,EACZC,KACD,CAAC;;AAEF;A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cAAc,IAC3CN,iBAAiB,KAAK,QAAQ;MAChC;IACD,CAAC,MAAM,IACND,oBAAoB,KAAK,IAAI,IAC7BE,sBAAsB,KAAKM,SAAS,EACnC;MACD;MACA;MACA;MACA;MACA;MACA,IACCD,cAAc,KAAKC,SAAS,IAC5BD,cAAc,IAAIL,sBAAsB,EACvC;QACDE,YAAY,GAAG,IAAI;MACpB,CAAC,MAAM;QACNA,YAAY,GAAG,QAAQ;MACxB;IACD,CAAC,MAAM,IACNJ,oBAAoB,KAAKQ,SAAS,IAClCR,oBAAoB,KAAK,IAAI,IAC7BE,sBAAsB,KAAKM,SAAS,EACnC;MACD;MACA;MACA,IAAKD,cAAc,KAAKC,SAAS,EAAG;QACnC,IAAKD,cAAc,GAAGP,oBAAoB,EAAG;UAC5CI,YAAY,GAAG,QAAQ;QACxB,CAAC,MAAM;UACNA,YAAY,GAAG,MAAM;QACtB;MACD;IACD,CAAC,MAAM,IAAKJ,oBAAoB,KAAK,IAAI,EAAG;MAC3CI,YAAY,GAAG,QAAQ;IACxB;EACD;EAEA,OAAO;IACNA,YAAY;IACZC,SAAS;IACTC;EACD,CAAC;AACF"}
|
|
1
|
+
{"version":3,"names":["__","sprintf","focus","getBlockPositionDescription","position","siblingCount","level","getBlockPropertiesDescription","isLocked","isClientIdSelected","clientId","selectedBlockClientIds","Array","isArray","length","indexOf","getCommonDepthClientIds","startId","endId","startParents","endParents","startPath","endPath","depth","Math","min","start","end","focusListItem","focusClientId","treeGridElement","getFocusElement","row","querySelector","focusable","find","focusElement","window","requestAnimationFrame","getDragDisplacementValues","blockIndexes","blockDropTargetIndex","blockDropPosition","firstDraggedBlockIndex","isDragged","displacement","isNesting","isAfterDraggedBlocks","thisBlockIndex","undefined"],"sources":["@wordpress/block-editor/src/components/list-view/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { focus } from '@wordpress/dom';\n\nexport const getBlockPositionDescription = ( position, siblingCount, level ) =>\n\tsprintf(\n\t\t/* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */\n\t\t__( 'Block %1$d of %2$d, Level %3$d.' ),\n\t\tposition,\n\t\tsiblingCount,\n\t\tlevel\n\t);\n\nexport const getBlockPropertiesDescription = ( isLocked ) =>\n\tisLocked ? __( 'This block is locked.' ) : '';\n\n/**\n * Returns true if the client ID occurs within the block selection or multi-selection,\n * or false otherwise.\n *\n * @param {string} clientId Block client ID.\n * @param {string|string[]} selectedBlockClientIds Selected block client ID, or an array of multi-selected blocks client IDs.\n *\n * @return {boolean} Whether the block is in multi-selection set.\n */\nexport const isClientIdSelected = ( clientId, selectedBlockClientIds ) =>\n\tArray.isArray( selectedBlockClientIds ) && selectedBlockClientIds.length\n\t\t? selectedBlockClientIds.indexOf( clientId ) !== -1\n\t\t: selectedBlockClientIds === clientId;\n\n/**\n * From a start and end clientId of potentially different nesting levels,\n * return the nearest-depth ids that have a common level of depth in the\n * nesting hierarchy. For multiple block selection, this ensure that the\n * selection is always at the same nesting level, and not split across\n * separate levels.\n *\n * @param {string} startId The first id of a selection.\n * @param {string} endId The end id of a selection, usually one that has been clicked on.\n * @param {string[]} startParents An array of ancestor ids for the start id, in descending order.\n * @param {string[]} endParents An array of ancestor ids for the end id, in descending order.\n * @return {Object} An object containing the start and end ids.\n */\nexport function getCommonDepthClientIds(\n\tstartId,\n\tendId,\n\tstartParents,\n\tendParents\n) {\n\tconst startPath = [ ...startParents, startId ];\n\tconst endPath = [ ...endParents, endId ];\n\tconst depth = Math.min( startPath.length, endPath.length ) - 1;\n\tconst start = startPath[ depth ];\n\tconst end = endPath[ depth ];\n\n\treturn {\n\t\tstart,\n\t\tend,\n\t};\n}\n\n/**\n * Shift focus to the list view item associated with a particular clientId.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {string} focusClientId The client ID of the block to focus.\n * @param {?HTMLElement} treeGridElement The container element to search within.\n */\nexport function focusListItem( focusClientId, treeGridElement ) {\n\tconst getFocusElement = () => {\n\t\tconst row = treeGridElement?.querySelector(\n\t\t\t`[role=row][data-block=\"${ focusClientId }\"]`\n\t\t);\n\t\tif ( ! row ) return null;\n\t\t// Focus the first focusable in the row, which is the ListViewBlockSelectButton.\n\t\treturn focus.focusable.find( row )[ 0 ];\n\t};\n\n\tlet focusElement = getFocusElement();\n\tif ( focusElement ) {\n\t\tfocusElement.focus();\n\t} else {\n\t\t// The element hasn't been painted yet. Defer focusing on the next frame.\n\t\t// This could happen when all blocks have been deleted and the default block\n\t\t// hasn't been added to the editor yet.\n\t\twindow.requestAnimationFrame( () => {\n\t\t\tfocusElement = getFocusElement();\n\n\t\t\t// Ignore if the element still doesn't exist.\n\t\t\tif ( focusElement ) {\n\t\t\t\tfocusElement.focus();\n\t\t\t}\n\t\t} );\n\t}\n}\n\n/**\n * Get values for the block that flag whether the block should be displaced up or down,\n * whether the block is being nested, and whether the block appears after the dragged\n * blocks. These values are used to determine the class names to apply to the block.\n * The list view rows are displaced visually via CSS rules. Displacement rules:\n * - `normal`: no displacement — used to apply a translateY of `0` so that the block\n * appears in its original position, and moves to that position smoothly when dragging\n * outside of the list view area.\n * - `up`: the block should be displaced up, creating room beneath the block for the drop indicator.\n * - `down`: the block should be displaced down, creating room above the block for the drop indicator.\n *\n * @param {Object} props\n * @param {Object} props.blockIndexes The indexes of all the blocks in the list view, keyed by clientId.\n * @param {number|null|undefined} props.blockDropTargetIndex The index of the block that the user is dropping to.\n * @param {?string} props.blockDropPosition The position relative to the block that the user is dropping to.\n * @param {string} props.clientId The client id for the current block.\n * @param {?number} props.firstDraggedBlockIndex The index of the first dragged block.\n * @param {?boolean} props.isDragged Whether the current block is being dragged. Dragged blocks skip displacement.\n * @return {Object} An object containing the `displacement`, `isAfterDraggedBlocks` and `isNesting` values.\n */\nexport function getDragDisplacementValues( {\n\tblockIndexes,\n\tblockDropTargetIndex,\n\tblockDropPosition,\n\tclientId,\n\tfirstDraggedBlockIndex,\n\tisDragged,\n} ) {\n\tlet displacement;\n\tlet isNesting;\n\tlet isAfterDraggedBlocks;\n\n\tif ( ! isDragged ) {\n\t\tisNesting = false;\n\t\tconst thisBlockIndex = blockIndexes[ clientId ];\n\t\tisAfterDraggedBlocks = thisBlockIndex > firstDraggedBlockIndex;\n\n\t\t// Determine where to displace the position of the current block, relative\n\t\t// to the blocks being dragged (in their original position) and the drop target\n\t\t// (the position where a user is currently dragging the blocks to).\n\t\tif (\n\t\t\tblockDropTargetIndex !== undefined &&\n\t\t\tblockDropTargetIndex !== null &&\n\t\t\tfirstDraggedBlockIndex !== undefined\n\t\t) {\n\t\t\t// If the block is being dragged and there is a valid drop target,\n\t\t\t// determine if the block being rendered should be displaced up or down.\n\n\t\t\tif ( thisBlockIndex !== undefined ) {\n\t\t\t\tif (\n\t\t\t\t\tthisBlockIndex >= firstDraggedBlockIndex &&\n\t\t\t\t\tthisBlockIndex < blockDropTargetIndex\n\t\t\t\t) {\n\t\t\t\t\t// If the current block appears after the set of dragged blocks\n\t\t\t\t\t// (in their original position), but is before the drop target,\n\t\t\t\t\t// then the current block should be displaced up.\n\t\t\t\t\tdisplacement = 'up';\n\t\t\t\t} else if (\n\t\t\t\t\tthisBlockIndex < firstDraggedBlockIndex &&\n\t\t\t\t\tthisBlockIndex >= blockDropTargetIndex\n\t\t\t\t) {\n\t\t\t\t\t// If the current block appears before the set of dragged blocks\n\t\t\t\t\t// (in their original position), but is after the drop target,\n\t\t\t\t\t// then the current block should be displaced down.\n\t\t\t\t\tdisplacement = 'down';\n\t\t\t\t} else {\n\t\t\t\t\tdisplacement = 'normal';\n\t\t\t\t}\n\t\t\t\tisNesting =\n\t\t\t\t\ttypeof blockDropTargetIndex === 'number' &&\n\t\t\t\t\tblockDropTargetIndex - 1 === thisBlockIndex &&\n\t\t\t\t\tblockDropPosition === 'inside';\n\t\t\t}\n\t\t} else if (\n\t\t\tblockDropTargetIndex === null &&\n\t\t\tfirstDraggedBlockIndex !== undefined\n\t\t) {\n\t\t\t// A `null` value for `blockDropTargetIndex` indicates that the\n\t\t\t// drop target is outside of the valid areas within the list view.\n\t\t\t// In this case, the drag is still active, but as there is no\n\t\t\t// valid drop target, we should remove the gap indicating where\n\t\t\t// the block would be inserted.\n\t\t\tif (\n\t\t\t\tthisBlockIndex !== undefined &&\n\t\t\t\tthisBlockIndex >= firstDraggedBlockIndex\n\t\t\t) {\n\t\t\t\tdisplacement = 'up';\n\t\t\t} else {\n\t\t\t\tdisplacement = 'normal';\n\t\t\t}\n\t\t} else if (\n\t\t\tblockDropTargetIndex !== undefined &&\n\t\t\tblockDropTargetIndex !== null &&\n\t\t\tfirstDraggedBlockIndex === undefined\n\t\t) {\n\t\t\t// If the blockdrop target is defined, but there are no dragged blocks,\n\t\t\t// then the block should be displaced relative to the drop target.\n\t\t\tif ( thisBlockIndex !== undefined ) {\n\t\t\t\tif ( thisBlockIndex < blockDropTargetIndex ) {\n\t\t\t\t\tdisplacement = 'normal';\n\t\t\t\t} else {\n\t\t\t\t\tdisplacement = 'down';\n\t\t\t\t}\n\t\t\t}\n\t\t} else if ( blockDropTargetIndex === null ) {\n\t\t\tdisplacement = 'normal';\n\t\t}\n\t}\n\n\treturn {\n\t\tdisplacement,\n\t\tisNesting,\n\t\tisAfterDraggedBlocks,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,QAAQ,gBAAgB;AAEtC,OAAO,MAAMC,2BAA2B,GAAGA,CAAEC,QAAQ,EAAEC,YAAY,EAAEC,KAAK,KACzEL,OAAO,EACN;AACAD,EAAE,CAAE,iCAAkC,CAAC,EACvCI,QAAQ,EACRC,YAAY,EACZC,KACD,CAAC;AAEF,OAAO,MAAMC,6BAA6B,GAAKC,QAAQ,IACtDA,QAAQ,GAAGR,EAAE,CAAE,uBAAwB,CAAC,GAAG,EAAE;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAA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