@wordpress/block-editor 15.3.1-next.6870dfe5b.0 → 15.3.1-next.6f42e1382.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/autocompleters/block.js +2 -4
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-list/index.js +3 -1
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-switcher/index.js +10 -5
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +5 -2
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +10 -0
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +9 -5
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/link-control/search-item.js +30 -12
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/store/private-selectors.js +7 -20
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +60 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +16 -30
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +18 -0
- package/build/store/utils.js.map +1 -1
- package/build-module/autocompleters/block.js +3 -5
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-list/index.js +3 -1
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +10 -5
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +5 -2
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +11 -1
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +9 -5
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/link-control/search-item.js +30 -12
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/store/private-selectors.js +7 -20
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +60 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +16 -30
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +17 -0
- package/build-module/store/utils.js.map +1 -1
- package/build-style/style-rtl.css +0 -1
- package/build-style/style.css +0 -1
- package/package.json +34 -34
- package/src/autocompleters/block.js +6 -11
- package/src/components/block-list/index.js +7 -1
- package/src/components/block-switcher/index.js +8 -1
- package/src/components/block-toolbar/index.js +11 -5
- package/src/components/block-tools/insertion-point.js +19 -1
- package/src/components/block-variation-transforms/index.js +38 -27
- package/src/components/link-control/search-item.js +31 -12
- package/src/components/link-control/style.scss +0 -1
- package/src/components/link-control/test/index.js +14 -2
- package/src/store/private-selectors.js +10 -23
- package/src/store/reducer.js +105 -0
- package/src/store/selectors.js +38 -59
- package/src/store/test/reducer.js +107 -0
- package/src/store/test/selectors.js +65 -192
- package/src/store/utils.js +21 -0
|
@@ -98,13 +98,11 @@ function createBlockCompleter() {
|
|
|
98
98
|
initialAttributes,
|
|
99
99
|
innerBlocks,
|
|
100
100
|
syncStatus,
|
|
101
|
-
|
|
101
|
+
blocks
|
|
102
102
|
} = inserterItem;
|
|
103
103
|
return {
|
|
104
104
|
action: 'replace',
|
|
105
|
-
value: syncStatus === 'unsynced' ? (0, _blocks.
|
|
106
|
-
__unstableSkipMigrationLogs: true
|
|
107
|
-
}) : (0, _blocks.createBlock)(name, initialAttributes, (0, _blocks.createBlocksFromInnerBlocksTemplate)(innerBlocks))
|
|
105
|
+
value: syncStatus === 'unsynced' ? (blocks !== null && blocks !== void 0 ? blocks : []).map(block => (0, _blocks.cloneBlock)(block)) : (0, _blocks.createBlock)(name, initialAttributes, (0, _blocks.createBlocksFromInnerBlocksTemplate)(innerBlocks))
|
|
108
106
|
};
|
|
109
107
|
}
|
|
110
108
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blocks","_element","_searchItems","_useBlockTypesState","_interopRequireDefault","_blockIcon","_store","_sorting","_orderInserterBlockItems","_jsxRuntime","noop","SHOWN_BLOCK_TYPES","createBlockCompleter","name","className","triggerPrefix","useItems","filterValue","rootClientId","selectedBlockId","prioritizedBlocks","useSelect","select","getSelectedBlockClientId","getBlock","getBlockListSettings","getBlockRootClientId","blockEditorStore","getActiveBlockVariation","blocksStore","selectedBlockClientId","blockName","attributes","activeBlockVariation","_rootClientId","prioritizedInserterBlocks","items","categories","collections","useBlockTypesState","filteredItems","useMemo","initialFilteredItems","trim","searchBlockItems","orderInserterBlockItems","orderBy","filter","item","id","slice","options","map","blockItem","title","icon","isDisabled","key","value","label","jsxs","Fragment","children","jsx","default","showColors","allowContext","before","after","test","getOptionCompletion","inserterItem","initialAttributes","innerBlocks","syncStatus","
|
|
1
|
+
{"version":3,"names":["_data","require","_blocks","_element","_searchItems","_useBlockTypesState","_interopRequireDefault","_blockIcon","_store","_sorting","_orderInserterBlockItems","_jsxRuntime","noop","SHOWN_BLOCK_TYPES","createBlockCompleter","name","className","triggerPrefix","useItems","filterValue","rootClientId","selectedBlockId","prioritizedBlocks","useSelect","select","getSelectedBlockClientId","getBlock","getBlockListSettings","getBlockRootClientId","blockEditorStore","getActiveBlockVariation","blocksStore","selectedBlockClientId","blockName","attributes","activeBlockVariation","_rootClientId","prioritizedInserterBlocks","items","categories","collections","useBlockTypesState","filteredItems","useMemo","initialFilteredItems","trim","searchBlockItems","orderInserterBlockItems","orderBy","filter","item","id","slice","options","map","blockItem","title","icon","isDisabled","key","value","label","jsxs","Fragment","children","jsx","default","showColors","allowContext","before","after","test","getOptionCompletion","inserterItem","initialAttributes","innerBlocks","syncStatus","blocks","action","block","cloneBlock","createBlock","createBlocksFromInnerBlocksTemplate","_default","exports"],"sources":["@wordpress/block-editor/src/autocompleters/block.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tcloneBlock,\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { searchBlockItems } from '../components/inserter/search-items';\nimport useBlockTypesState from '../components/inserter/hooks/use-block-types-state';\nimport BlockIcon from '../components/block-icon';\nimport { store as blockEditorStore } from '../store';\nimport { orderBy } from '../utils/sorting';\nimport { orderInserterBlockItems } from '../utils/order-inserter-block-items';\n\nconst noop = () => {};\nconst SHOWN_BLOCK_TYPES = 9;\n\n/**\n * Creates a blocks repeater for replacing the current block with a selected block type.\n *\n * @return {Object} A blocks completer.\n */\nfunction createBlockCompleter() {\n\treturn {\n\t\tname: 'blocks',\n\t\tclassName: 'block-editor-autocompleters__block',\n\t\ttriggerPrefix: '/',\n\n\t\tuseItems( filterValue ) {\n\t\t\tconst { rootClientId, selectedBlockId, prioritizedBlocks } =\n\t\t\t\tuseSelect( ( select ) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\t\t\tgetBlock,\n\t\t\t\t\t\tgetBlockListSettings,\n\t\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\t} = select( blockEditorStore );\n\t\t\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\t\t\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\t\t\tconst { name: blockName, attributes } = getBlock(\n\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t);\n\t\t\t\t\tconst activeBlockVariation = getActiveBlockVariation(\n\t\t\t\t\t\tblockName,\n\t\t\t\t\t\tattributes\n\t\t\t\t\t);\n\t\t\t\t\tconst _rootClientId = getBlockRootClientId(\n\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tselectedBlockId: activeBlockVariation\n\t\t\t\t\t\t\t? `${ blockName }/${ activeBlockVariation.name }`\n\t\t\t\t\t\t\t: blockName,\n\t\t\t\t\t\trootClientId: _rootClientId,\n\t\t\t\t\t\tprioritizedBlocks:\n\t\t\t\t\t\t\tgetBlockListSettings( _rootClientId )\n\t\t\t\t\t\t\t\t?.prioritizedInserterBlocks,\n\t\t\t\t\t};\n\t\t\t\t}, [] );\n\t\t\tconst [ items, categories, collections ] = useBlockTypesState(\n\t\t\t\trootClientId,\n\t\t\t\tnoop,\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\tconst filteredItems = useMemo( () => {\n\t\t\t\tconst initialFilteredItems = !! filterValue.trim()\n\t\t\t\t\t? searchBlockItems(\n\t\t\t\t\t\t\titems,\n\t\t\t\t\t\t\tcategories,\n\t\t\t\t\t\t\tcollections,\n\t\t\t\t\t\t\tfilterValue\n\t\t\t\t\t )\n\t\t\t\t\t: orderInserterBlockItems(\n\t\t\t\t\t\t\torderBy( items, 'frecency', 'desc' ),\n\t\t\t\t\t\t\tprioritizedBlocks\n\t\t\t\t\t );\n\n\t\t\t\treturn initialFilteredItems\n\t\t\t\t\t.filter( ( item ) => item.id !== selectedBlockId )\n\t\t\t\t\t.slice( 0, SHOWN_BLOCK_TYPES );\n\t\t\t}, [\n\t\t\t\tfilterValue,\n\t\t\t\tselectedBlockId,\n\t\t\t\titems,\n\t\t\t\tcategories,\n\t\t\t\tcollections,\n\t\t\t\tprioritizedBlocks,\n\t\t\t] );\n\n\t\t\tconst options = useMemo(\n\t\t\t\t() =>\n\t\t\t\t\tfilteredItems.map( ( blockItem ) => {\n\t\t\t\t\t\tconst { title, icon, isDisabled } = blockItem;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkey: `block-${ blockItem.id }`,\n\t\t\t\t\t\t\tvalue: blockItem,\n\t\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\t\t\tkey=\"icon\"\n\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\tshowColors\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tisDisabled,\n\t\t\t\t\t\t};\n\t\t\t\t\t} ),\n\t\t\t\t[ filteredItems ]\n\t\t\t);\n\n\t\t\treturn [ options ];\n\t\t},\n\t\tallowContext( before, after ) {\n\t\t\treturn ! ( /\\S/.test( before ) || /\\S/.test( after ) );\n\t\t},\n\t\tgetOptionCompletion( inserterItem ) {\n\t\t\tconst { name, initialAttributes, innerBlocks, syncStatus, blocks } =\n\t\t\t\tinserterItem;\n\n\t\t\treturn {\n\t\t\t\taction: 'replace',\n\t\t\t\tvalue:\n\t\t\t\t\tsyncStatus === 'unsynced'\n\t\t\t\t\t\t? ( blocks ?? [] ).map( ( block ) =>\n\t\t\t\t\t\t\t\tcloneBlock( block )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: createBlock(\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tinitialAttributes,\n\t\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\t\tinnerBlocks\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t ),\n\t\t\t};\n\t\t},\n\t};\n}\n\n/**\n * Creates a blocks repeater for replacing the current block with a selected block type.\n *\n * @return {Object} A blocks completer.\n */\nexport default createBlockCompleter();\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,UAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,wBAAA,GAAAT,OAAA;AAA8E,IAAAU,WAAA,GAAAV,OAAA;AApB9E;AACA;AACA;;AAUA;AACA;AACA;;AAQA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,CAAE;IACvD,CAAC;IACDE,mBAAmBA,CAAEC,YAAY,EAAG;MACnC,MAAM;QAAE1D,IAAI;QAAE2D,iBAAiB;QAAEC,WAAW;QAAEC,UAAU;QAAEC;MAAO,CAAC,GACjEJ,YAAY;MAEb,OAAO;QACNK,MAAM,EAAE,SAAS;QACjBlB,KAAK,EACJgB,UAAU,KAAK,UAAU,GACtB,CAAEC,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI,EAAE,EAAGvB,GAAG,CAAIyB,KAAK,IAC7B,IAAAC,kBAAU,EAAED,KAAM,CAClB,CAAC,GACD,IAAAE,mBAAW,EACXlE,IAAI,EACJ2D,iBAAiB,EACjB,IAAAQ,2CAAmC,EAClCP,WACD,CACA;MACL,CAAC;IACF;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AAJA,IAAAQ,QAAA,GAAAC,OAAA,CAAAlB,OAAA,GAKepD,oBAAoB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -166,6 +166,8 @@ function Items({
|
|
|
166
166
|
getTemplateLock,
|
|
167
167
|
getBlockEditingMode,
|
|
168
168
|
isSectionBlock,
|
|
169
|
+
isContainerInsertableToInWriteMode,
|
|
170
|
+
getBlockName,
|
|
169
171
|
isZoomOut: _isZoomOut,
|
|
170
172
|
canInsertBlockType
|
|
171
173
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
@@ -186,7 +188,7 @@ function Items({
|
|
|
186
188
|
selectedBlocks: selectedBlockClientIds,
|
|
187
189
|
visibleBlocks: __unstableGetVisibleBlocks(),
|
|
188
190
|
isZoomOut: _isZoomOut(),
|
|
189
|
-
shouldRenderAppender: !isSectionBlock(rootClientId) && getBlockEditingMode(rootClientId) !== 'disabled' && !getTemplateLock(rootClientId) && hasAppender && !_isZoomOut() && (hasCustomAppender || hasSelectedRoot || showRootAppender)
|
|
191
|
+
shouldRenderAppender: (!isSectionBlock(rootClientId) || isContainerInsertableToInWriteMode(getBlockName(selectedBlockClientId), rootClientId)) && getBlockEditingMode(rootClientId) !== 'disabled' && !getTemplateLock(rootClientId) && hasAppender && !_isZoomOut() && (hasCustomAppender || hasSelectedRoot || showRootAppender)
|
|
190
192
|
};
|
|
191
193
|
}, [rootClientId, hasAppender, hasCustomAppender]);
|
|
192
194
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_layout.LayoutProvider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_compose","_element","_blocks","_block","_blockListAppender","_useInBetweenInserter","_store","_layout","_blockSelectionClearer","_innerBlocks","_context","_observeTyping","_zoomOutSeparator","_lockUnlock","_jsxRuntime","IntersectionObserver","exports","createContext","displayName","pendingBlockVisibilityUpdatesPerRegistry","WeakMap","Root","className","settings","isOutlineMode","isFocusMode","temporarilyEditingAsBlocks","useSelect","select","getSettings","getTemporarilyEditingAsBlocks","isTyping","unlock","blockEditorStore","outlineMode","focusMode","registry","useRegistry","setBlockVisibility","useDispatch","delayedBlockVisibilityUpdates","useDebounce","useCallback","updates","get","forEach","id","isIntersecting","trailing","intersectionObserver","useMemo","Observer","window","entries","set","entry","clientId","target","getAttribute","push","innerBlocksProps","useInnerBlocksProps","ref","useMergeRefs","useBlockSelectionClearer","useInBetweenInserter","useTypingObserver","clsx","jsxs","Provider","value","children","jsx","StopEditingAsBlocksOnOutsideSelect","stopEditingAsBlocks","isBlockOrDescendantSelected","isBlockSelected","hasSelectedInnerBlock","useEffect","BlockList","BlockEditContextProvider","DEFAULT_BLOCK_EDIT_CONTEXT","EMPTY_ARRAY","EMPTY_SET","Set","Items","placeholder","rootClientId","renderAppender","CustomAppender","__experimentalAppenderTagName","layout","defaultLayout","hasAppender","hasCustomAppender","order","isZoomOut","selectedBlocks","visibleBlocks","shouldRenderAppender","getBlockOrder","getSelectedBlockClientIds","__unstableGetVisibleBlocks","getTemplateLock","getBlockEditingMode","isSectionBlock","_isZoomOut","canInsertBlockType","_order","isPreviewMode","selectedBlockClientIds","selectedBlockClientId","showRootAppender","length","getDefaultBlockName","hasSelectedRoot","LayoutProvider","map","AsyncModeProvider","has","includes","ZoomOutSeparator","position","default","tagName","BlockListItems","props"],"sources":["@wordpress/block-editor/src/components/block-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAsyncModeProvider,\n\tuseSelect,\n\tuseDispatch,\n\tuseRegistry,\n} from '@wordpress/data';\nimport { useMergeRefs, useDebounce } from '@wordpress/compose';\nimport {\n\tcreateContext,\n\tuseMemo,\n\tuseCallback,\n\tuseEffect,\n} from '@wordpress/element';\nimport { getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport BlockListBlock from './block';\nimport BlockListAppender from '../block-list-appender';\nimport { useInBetweenInserter } from './use-in-between-inserter';\nimport { store as blockEditorStore } from '../../store';\nimport { LayoutProvider, defaultLayout } from './layout';\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useInnerBlocksProps } from '../inner-blocks';\nimport {\n\tBlockEditContextProvider,\n\tDEFAULT_BLOCK_EDIT_CONTEXT,\n} from '../block-edit/context';\nimport { useTypingObserver } from '../observe-typing';\nimport { ZoomOutSeparator } from './zoom-out-separator';\nimport { unlock } from '../../lock-unlock';\n\nexport const IntersectionObserver = createContext();\nIntersectionObserver.displayName = 'IntersectionObserverContext';\n\nconst pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();\n\nfunction Root( { className, ...settings } ) {\n\tconst { isOutlineMode, isFocusMode, temporarilyEditingAsBlocks } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getSettings, getTemporarilyEditingAsBlocks, isTyping } =\n\t\t\t\tunlock( select( blockEditorStore ) );\n\t\t\tconst { outlineMode, focusMode } = getSettings();\n\t\t\treturn {\n\t\t\t\tisOutlineMode: outlineMode && ! isTyping(),\n\t\t\t\tisFocusMode: focusMode,\n\t\t\t\ttemporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks(),\n\t\t\t};\n\t\t}, [] );\n\tconst registry = useRegistry();\n\tconst { setBlockVisibility } = useDispatch( blockEditorStore );\n\n\tconst delayedBlockVisibilityUpdates = useDebounce(\n\t\tuseCallback( () => {\n\t\t\tconst updates = {};\n\t\t\tpendingBlockVisibilityUpdatesPerRegistry\n\t\t\t\t.get( registry )\n\t\t\t\t.forEach( ( [ id, isIntersecting ] ) => {\n\t\t\t\t\tupdates[ id ] = isIntersecting;\n\t\t\t\t} );\n\t\t\tsetBlockVisibility( updates );\n\t\t}, [ registry ] ),\n\t\t300,\n\t\t{\n\t\t\ttrailing: true,\n\t\t}\n\t);\n\tconst intersectionObserver = useMemo( () => {\n\t\tconst { IntersectionObserver: Observer } = window;\n\n\t\tif ( ! Observer ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn new Observer( ( entries ) => {\n\t\t\tif ( ! pendingBlockVisibilityUpdatesPerRegistry.get( registry ) ) {\n\t\t\t\tpendingBlockVisibilityUpdatesPerRegistry.set( registry, [] );\n\t\t\t}\n\t\t\tfor ( const entry of entries ) {\n\t\t\t\tconst clientId = entry.target.getAttribute( 'data-block' );\n\t\t\t\tpendingBlockVisibilityUpdatesPerRegistry\n\t\t\t\t\t.get( registry )\n\t\t\t\t\t.push( [ clientId, entry.isIntersecting ] );\n\t\t\t}\n\t\t\tdelayedBlockVisibilityUpdates();\n\t\t} );\n\t}, [] );\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tref: useMergeRefs( [\n\t\t\t\tuseBlockSelectionClearer(),\n\t\t\t\tuseInBetweenInserter(),\n\t\t\t\tuseTypingObserver(),\n\t\t\t] ),\n\t\t\tclassName: clsx( 'is-root-container', className, {\n\t\t\t\t'is-outline-mode': isOutlineMode,\n\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t} ),\n\t\t},\n\t\tsettings\n\t);\n\treturn (\n\t\t<IntersectionObserver.Provider value={ intersectionObserver }>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t\t{ !! temporarilyEditingAsBlocks && (\n\t\t\t\t<StopEditingAsBlocksOnOutsideSelect\n\t\t\t\t\tclientId={ temporarilyEditingAsBlocks }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</IntersectionObserver.Provider>\n\t);\n}\n\nfunction StopEditingAsBlocksOnOutsideSelect( { clientId } ) {\n\tconst { stopEditingAsBlocks } = unlock( useDispatch( blockEditorStore ) );\n\tconst isBlockOrDescendantSelected = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tisBlockSelected( clientId ) ||\n\t\t\t\thasSelectedInnerBlock( clientId, true )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tuseEffect( () => {\n\t\tif ( ! isBlockOrDescendantSelected ) {\n\t\t\tstopEditingAsBlocks( clientId );\n\t\t}\n\t}, [ isBlockOrDescendantSelected, clientId, stopEditingAsBlocks ] );\n\treturn null;\n}\n\nexport default function BlockList( settings ) {\n\treturn (\n\t\t<BlockEditContextProvider value={ DEFAULT_BLOCK_EDIT_CONTEXT }>\n\t\t\t<Root { ...settings } />\n\t\t</BlockEditContextProvider>\n\t);\n}\n\nconst EMPTY_ARRAY = [];\nconst EMPTY_SET = new Set();\n\nfunction Items( {\n\tplaceholder,\n\trootClientId,\n\trenderAppender: CustomAppender,\n\t__experimentalAppenderTagName,\n\tlayout = defaultLayout,\n} ) {\n\t// Avoid passing CustomAppender to useSelect because it could be a new\n\t// function on every render.\n\tconst hasAppender = CustomAppender !== false;\n\tconst hasCustomAppender = !! CustomAppender;\n\tconst {\n\t\torder,\n\t\tisZoomOut,\n\t\tselectedBlocks,\n\t\tvisibleBlocks,\n\t\tshouldRenderAppender,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\t__unstableGetVisibleBlocks,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tisSectionBlock,\n\t\t\t\tisZoomOut: _isZoomOut,\n\t\t\t\tcanInsertBlockType,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst _order = getBlockOrder( rootClientId );\n\n\t\t\tif ( getSettings().isPreviewMode ) {\n\t\t\t\treturn {\n\t\t\t\t\torder: _order,\n\t\t\t\t\tselectedBlocks: EMPTY_ARRAY,\n\t\t\t\t\tvisibleBlocks: EMPTY_SET,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\t\tconst showRootAppender =\n\t\t\t\t! rootClientId &&\n\t\t\t\t! selectedBlockClientId &&\n\t\t\t\t( ! _order.length ||\n\t\t\t\t\t! canInsertBlockType(\n\t\t\t\t\t\tgetDefaultBlockName(),\n\t\t\t\t\t\trootClientId\n\t\t\t\t\t) );\n\t\t\tconst hasSelectedRoot = !! (\n\t\t\t\trootClientId &&\n\t\t\t\tselectedBlockClientId &&\n\t\t\t\trootClientId === selectedBlockClientId\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\torder: _order,\n\t\t\t\tselectedBlocks: selectedBlockClientIds,\n\t\t\t\tvisibleBlocks: __unstableGetVisibleBlocks(),\n\t\t\t\tisZoomOut: _isZoomOut(),\n\t\t\t\tshouldRenderAppender:\n\t\t\t\t\t! isSectionBlock( rootClientId ) &&\n\t\t\t\t\tgetBlockEditingMode( rootClientId ) !== 'disabled' &&\n\t\t\t\t\t! getTemplateLock( rootClientId ) &&\n\t\t\t\t\thasAppender &&\n\t\t\t\t\t! _isZoomOut() &&\n\t\t\t\t\t( hasCustomAppender ||\n\t\t\t\t\t\thasSelectedRoot ||\n\t\t\t\t\t\tshowRootAppender ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId, hasAppender, hasCustomAppender ]\n\t);\n\n\treturn (\n\t\t<LayoutProvider value={ layout }>\n\t\t\t{ order.map( ( clientId ) => (\n\t\t\t\t<AsyncModeProvider\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t\tvalue={\n\t\t\t\t\t\t// Only provide data asynchronously if the block is\n\t\t\t\t\t\t// not visible and not selected.\n\t\t\t\t\t\t! visibleBlocks.has( clientId ) &&\n\t\t\t\t\t\t! selectedBlocks.includes( clientId )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isZoomOut && (\n\t\t\t\t\t\t<ZoomOutSeparator\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tposition=\"top\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isZoomOut && (\n\t\t\t\t\t\t<ZoomOutSeparator\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tposition=\"bottom\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</AsyncModeProvider>\n\t\t\t) ) }\n\t\t\t{ order.length < 1 && placeholder }\n\t\t\t{ shouldRenderAppender && (\n\t\t\t\t<BlockListAppender\n\t\t\t\t\ttagName={ __experimentalAppenderTagName }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\tCustomAppender={ CustomAppender }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</LayoutProvider>\n\t);\n}\n\nexport function BlockListItems( props ) {\n\t// This component needs to always be synchronous as it's the one changing\n\t// the async mode depending on the block selection.\n\treturn (\n\t\t<AsyncModeProvider value={ false }>\n\t\t\t<Items { ...props } />\n\t\t</AsyncModeProvider>\n\t);\n}\n"],"mappings":";;;;;;;;;AA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QAAS,CAAC,IAC/B,CAAEyC,cAAc,CAACuB,QAAQ,CAAEhE,QAAS,CACpC;MAAAe,QAAA,GAECyB,SAAS,iBACV,IAAAlF,WAAA,CAAA0D,GAAA,EAAC5D,iBAAA,CAAA6G,gBAAgB;QAChBjE,QAAQ,EAAGA,QAAU;QACrB+B,YAAY,EAAGA,YAAc;QAC7BmC,QAAQ,EAAC;MAAK,CACd,CACD,eACD,IAAA5G,WAAA,CAAA0D,GAAA,EAACrE,MAAA,CAAAwH,OAAc;QACdpC,YAAY,EAAGA,YAAc;QAC7B/B,QAAQ,EAAGA;MAAU,CACrB,CAAC,EACAwC,SAAS,iBACV,IAAAlF,WAAA,CAAA0D,GAAA,EAAC5D,iBAAA,CAAA6G,gBAAgB;QAChBjE,QAAQ,EAAGA,QAAU;QACrB+B,YAAY,EAAGA,YAAc;QAC7BmC,QAAQ,EAAC;MAAQ,CACjB,CACD;IAAA,GAzBKlE,QA0BY,CAClB,CAAC,EACDuC,KAAK,CAACkB,MAAM,GAAG,CAAC,IAAI3B,WAAW,EAC/Ba,oBAAoB,iBACrB,IAAArF,WAAA,CAAA0D,GAAA,EAACpE,kBAAA,CAAAuH,OAAiB;MACjBC,OAAO,EAAGlC,6BAA+B;MACzCH,YAAY,EAAGA,YAAc;MAC7BE,cAAc,EAAGA;IAAgB,CACjC,CACD;EAAA,CACc,CAAC;AAEnB;AAEO,SAASoC,cAAcA,CAAEC,KAAK,EAAG;EACvC;EACA;EACA,oBACC,IAAAhH,WAAA,CAAA0D,GAAA,EAACzE,KAAA,CAAAuH,iBAAiB;IAAChD,KAAK,EAAG,KAAO;IAAAC,QAAA,eACjC,IAAAzD,WAAA,CAAA0D,GAAA,EAACa,KAAK;MAAA,GAAMyC;IAAK,CAAI;EAAC,CACJ,CAAC;AAEtB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_compose","_element","_blocks","_block","_blockListAppender","_useInBetweenInserter","_store","_layout","_blockSelectionClearer","_innerBlocks","_context","_observeTyping","_zoomOutSeparator","_lockUnlock","_jsxRuntime","IntersectionObserver","exports","createContext","displayName","pendingBlockVisibilityUpdatesPerRegistry","WeakMap","Root","className","settings","isOutlineMode","isFocusMode","temporarilyEditingAsBlocks","useSelect","select","getSettings","getTemporarilyEditingAsBlocks","isTyping","unlock","blockEditorStore","outlineMode","focusMode","registry","useRegistry","setBlockVisibility","useDispatch","delayedBlockVisibilityUpdates","useDebounce","useCallback","updates","get","forEach","id","isIntersecting","trailing","intersectionObserver","useMemo","Observer","window","entries","set","entry","clientId","target","getAttribute","push","innerBlocksProps","useInnerBlocksProps","ref","useMergeRefs","useBlockSelectionClearer","useInBetweenInserter","useTypingObserver","clsx","jsxs","Provider","value","children","jsx","StopEditingAsBlocksOnOutsideSelect","stopEditingAsBlocks","isBlockOrDescendantSelected","isBlockSelected","hasSelectedInnerBlock","useEffect","BlockList","BlockEditContextProvider","DEFAULT_BLOCK_EDIT_CONTEXT","EMPTY_ARRAY","EMPTY_SET","Set","Items","placeholder","rootClientId","renderAppender","CustomAppender","__experimentalAppenderTagName","layout","defaultLayout","hasAppender","hasCustomAppender","order","isZoomOut","selectedBlocks","visibleBlocks","shouldRenderAppender","getBlockOrder","getSelectedBlockClientIds","__unstableGetVisibleBlocks","getTemplateLock","getBlockEditingMode","isSectionBlock","isContainerInsertableToInWriteMode","getBlockName","_isZoomOut","canInsertBlockType","_order","isPreviewMode","selectedBlockClientIds","selectedBlockClientId","showRootAppender","length","getDefaultBlockName","hasSelectedRoot","LayoutProvider","map","AsyncModeProvider","has","includes","ZoomOutSeparator","position","default","tagName","BlockListItems","props"],"sources":["@wordpress/block-editor/src/components/block-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAsyncModeProvider,\n\tuseSelect,\n\tuseDispatch,\n\tuseRegistry,\n} from '@wordpress/data';\nimport { useMergeRefs, useDebounce } from '@wordpress/compose';\nimport {\n\tcreateContext,\n\tuseMemo,\n\tuseCallback,\n\tuseEffect,\n} from '@wordpress/element';\nimport { getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport BlockListBlock from './block';\nimport BlockListAppender from '../block-list-appender';\nimport { useInBetweenInserter } from './use-in-between-inserter';\nimport { store as blockEditorStore } from '../../store';\nimport { LayoutProvider, defaultLayout } from './layout';\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useInnerBlocksProps } from '../inner-blocks';\nimport {\n\tBlockEditContextProvider,\n\tDEFAULT_BLOCK_EDIT_CONTEXT,\n} from '../block-edit/context';\nimport { useTypingObserver } from '../observe-typing';\nimport { ZoomOutSeparator } from './zoom-out-separator';\nimport { unlock } from '../../lock-unlock';\n\nexport const IntersectionObserver = createContext();\nIntersectionObserver.displayName = 'IntersectionObserverContext';\n\nconst pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();\n\nfunction Root( { className, ...settings } ) {\n\tconst { isOutlineMode, isFocusMode, temporarilyEditingAsBlocks } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getSettings, getTemporarilyEditingAsBlocks, isTyping } =\n\t\t\t\tunlock( select( blockEditorStore ) );\n\t\t\tconst { outlineMode, focusMode } = getSettings();\n\t\t\treturn {\n\t\t\t\tisOutlineMode: outlineMode && ! isTyping(),\n\t\t\t\tisFocusMode: focusMode,\n\t\t\t\ttemporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks(),\n\t\t\t};\n\t\t}, [] );\n\tconst registry = useRegistry();\n\tconst { setBlockVisibility } = useDispatch( blockEditorStore );\n\n\tconst delayedBlockVisibilityUpdates = useDebounce(\n\t\tuseCallback( () => {\n\t\t\tconst updates = {};\n\t\t\tpendingBlockVisibilityUpdatesPerRegistry\n\t\t\t\t.get( registry )\n\t\t\t\t.forEach( ( [ id, isIntersecting ] ) => {\n\t\t\t\t\tupdates[ id ] = isIntersecting;\n\t\t\t\t} );\n\t\t\tsetBlockVisibility( updates );\n\t\t}, [ registry ] ),\n\t\t300,\n\t\t{\n\t\t\ttrailing: true,\n\t\t}\n\t);\n\tconst intersectionObserver = useMemo( () => {\n\t\tconst { IntersectionObserver: Observer } = window;\n\n\t\tif ( ! Observer ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn new Observer( ( entries ) => {\n\t\t\tif ( ! pendingBlockVisibilityUpdatesPerRegistry.get( registry ) ) {\n\t\t\t\tpendingBlockVisibilityUpdatesPerRegistry.set( registry, [] );\n\t\t\t}\n\t\t\tfor ( const entry of entries ) {\n\t\t\t\tconst clientId = entry.target.getAttribute( 'data-block' );\n\t\t\t\tpendingBlockVisibilityUpdatesPerRegistry\n\t\t\t\t\t.get( registry )\n\t\t\t\t\t.push( [ clientId, entry.isIntersecting ] );\n\t\t\t}\n\t\t\tdelayedBlockVisibilityUpdates();\n\t\t} );\n\t}, [] );\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tref: useMergeRefs( [\n\t\t\t\tuseBlockSelectionClearer(),\n\t\t\t\tuseInBetweenInserter(),\n\t\t\t\tuseTypingObserver(),\n\t\t\t] ),\n\t\t\tclassName: clsx( 'is-root-container', className, {\n\t\t\t\t'is-outline-mode': isOutlineMode,\n\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t} ),\n\t\t},\n\t\tsettings\n\t);\n\treturn (\n\t\t<IntersectionObserver.Provider value={ intersectionObserver }>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t\t{ !! temporarilyEditingAsBlocks && (\n\t\t\t\t<StopEditingAsBlocksOnOutsideSelect\n\t\t\t\t\tclientId={ temporarilyEditingAsBlocks }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</IntersectionObserver.Provider>\n\t);\n}\n\nfunction StopEditingAsBlocksOnOutsideSelect( { clientId } ) {\n\tconst { stopEditingAsBlocks } = unlock( useDispatch( blockEditorStore ) );\n\tconst isBlockOrDescendantSelected = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tisBlockSelected( clientId ) ||\n\t\t\t\thasSelectedInnerBlock( clientId, true )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tuseEffect( () => {\n\t\tif ( ! isBlockOrDescendantSelected ) {\n\t\t\tstopEditingAsBlocks( clientId );\n\t\t}\n\t}, [ isBlockOrDescendantSelected, clientId, stopEditingAsBlocks ] );\n\treturn null;\n}\n\nexport default function BlockList( settings ) {\n\treturn (\n\t\t<BlockEditContextProvider value={ DEFAULT_BLOCK_EDIT_CONTEXT }>\n\t\t\t<Root { ...settings } />\n\t\t</BlockEditContextProvider>\n\t);\n}\n\nconst EMPTY_ARRAY = [];\nconst EMPTY_SET = new Set();\n\nfunction Items( {\n\tplaceholder,\n\trootClientId,\n\trenderAppender: CustomAppender,\n\t__experimentalAppenderTagName,\n\tlayout = defaultLayout,\n} ) {\n\t// Avoid passing CustomAppender to useSelect because it could be a new\n\t// function on every render.\n\tconst hasAppender = CustomAppender !== false;\n\tconst hasCustomAppender = !! CustomAppender;\n\tconst {\n\t\torder,\n\t\tisZoomOut,\n\t\tselectedBlocks,\n\t\tvisibleBlocks,\n\t\tshouldRenderAppender,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\t__unstableGetVisibleBlocks,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tisSectionBlock,\n\t\t\t\tisContainerInsertableToInWriteMode,\n\t\t\t\tgetBlockName,\n\t\t\t\tisZoomOut: _isZoomOut,\n\t\t\t\tcanInsertBlockType,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst _order = getBlockOrder( rootClientId );\n\n\t\t\tif ( getSettings().isPreviewMode ) {\n\t\t\t\treturn {\n\t\t\t\t\torder: _order,\n\t\t\t\t\tselectedBlocks: EMPTY_ARRAY,\n\t\t\t\t\tvisibleBlocks: EMPTY_SET,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\t\tconst showRootAppender =\n\t\t\t\t! rootClientId &&\n\t\t\t\t! selectedBlockClientId &&\n\t\t\t\t( ! _order.length ||\n\t\t\t\t\t! canInsertBlockType(\n\t\t\t\t\t\tgetDefaultBlockName(),\n\t\t\t\t\t\trootClientId\n\t\t\t\t\t) );\n\t\t\tconst hasSelectedRoot = !! (\n\t\t\t\trootClientId &&\n\t\t\t\tselectedBlockClientId &&\n\t\t\t\trootClientId === selectedBlockClientId\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\torder: _order,\n\t\t\t\tselectedBlocks: selectedBlockClientIds,\n\t\t\t\tvisibleBlocks: __unstableGetVisibleBlocks(),\n\t\t\t\tisZoomOut: _isZoomOut(),\n\t\t\t\tshouldRenderAppender:\n\t\t\t\t\t( ! isSectionBlock( rootClientId ) ||\n\t\t\t\t\t\tisContainerInsertableToInWriteMode(\n\t\t\t\t\t\t\tgetBlockName( selectedBlockClientId ),\n\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t) ) &&\n\t\t\t\t\tgetBlockEditingMode( rootClientId ) !== 'disabled' &&\n\t\t\t\t\t! getTemplateLock( rootClientId ) &&\n\t\t\t\t\thasAppender &&\n\t\t\t\t\t! _isZoomOut() &&\n\t\t\t\t\t( hasCustomAppender ||\n\t\t\t\t\t\thasSelectedRoot ||\n\t\t\t\t\t\tshowRootAppender ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId, hasAppender, hasCustomAppender ]\n\t);\n\n\treturn (\n\t\t<LayoutProvider value={ layout }>\n\t\t\t{ order.map( ( clientId ) => (\n\t\t\t\t<AsyncModeProvider\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t\tvalue={\n\t\t\t\t\t\t// Only provide data asynchronously if the block is\n\t\t\t\t\t\t// not visible and not selected.\n\t\t\t\t\t\t! visibleBlocks.has( clientId ) &&\n\t\t\t\t\t\t! selectedBlocks.includes( clientId )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isZoomOut && (\n\t\t\t\t\t\t<ZoomOutSeparator\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tposition=\"top\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isZoomOut && (\n\t\t\t\t\t\t<ZoomOutSeparator\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tposition=\"bottom\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</AsyncModeProvider>\n\t\t\t) ) }\n\t\t\t{ order.length < 1 && placeholder }\n\t\t\t{ shouldRenderAppender && (\n\t\t\t\t<BlockListAppender\n\t\t\t\t\ttagName={ __experimentalAppenderTagName }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\tCustomAppender={ CustomAppender }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</LayoutProvider>\n\t);\n}\n\nexport function BlockListItems( props ) {\n\t// This component needs to always be synchronous as it's the one changing\n\t// the async mode depending on the block selection.\n\treturn (\n\t\t<AsyncModeProvider value={ false }>\n\t\t\t<Items { ...props } />\n\t\t</AsyncModeProvider>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAMA,I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,CAAElE,QAAS,CACpC;MAAAe,QAAA,GAECyB,SAAS,iBACV,IAAAlF,WAAA,CAAA0D,GAAA,EAAC5D,iBAAA,CAAA+G,gBAAgB;QAChBnE,QAAQ,EAAGA,QAAU;QACrB+B,YAAY,EAAGA,YAAc;QAC7BqC,QAAQ,EAAC;MAAK,CACd,CACD,eACD,IAAA9G,WAAA,CAAA0D,GAAA,EAACrE,MAAA,CAAA0H,OAAc;QACdtC,YAAY,EAAGA,YAAc;QAC7B/B,QAAQ,EAAGA;MAAU,CACrB,CAAC,EACAwC,SAAS,iBACV,IAAAlF,WAAA,CAAA0D,GAAA,EAAC5D,iBAAA,CAAA+G,gBAAgB;QAChBnE,QAAQ,EAAGA,QAAU;QACrB+B,YAAY,EAAGA,YAAc;QAC7BqC,QAAQ,EAAC;MAAQ,CACjB,CACD;IAAA,GAzBKpE,QA0BY,CAClB,CAAC,EACDuC,KAAK,CAACoB,MAAM,GAAG,CAAC,IAAI7B,WAAW,EAC/Ba,oBAAoB,iBACrB,IAAArF,WAAA,CAAA0D,GAAA,EAACpE,kBAAA,CAAAyH,OAAiB;MACjBC,OAAO,EAAGpC,6BAA+B;MACzCH,YAAY,EAAGA,YAAc;MAC7BE,cAAc,EAAGA;IAAgB,CACjC,CACD;EAAA,CACc,CAAC;AAEnB;AAEO,SAASsC,cAAcA,CAAEC,KAAK,EAAG;EACvC;EACA;EACA,oBACC,IAAAlH,WAAA,CAAA0D,GAAA,EAACzE,KAAA,CAAAyH,iBAAiB;IAAClD,KAAK,EAAG,KAAO;IAAAC,QAAA,eACjC,IAAAzD,WAAA,CAAA0D,GAAA,EAACa,KAAK;MAAA,GAAM2C;IAAK,CAAI;EAAC,CACJ,CAAC;AAEtB","ignoreList":[]}
|
|
@@ -18,6 +18,7 @@ var _blockVariationTransformations = require("./block-variation-transformations"
|
|
|
18
18
|
var _blockStylesMenu = _interopRequireDefault(require("./block-styles-menu"));
|
|
19
19
|
var _patternTransformationsMenu = _interopRequireDefault(require("./pattern-transformations-menu"));
|
|
20
20
|
var _useBlockDisplayTitle = _interopRequireDefault(require("../block-title/use-block-display-title"));
|
|
21
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
21
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
23
|
/**
|
|
23
24
|
* WordPress dependencies
|
|
@@ -150,15 +151,17 @@ const BlockSwitcher = ({
|
|
|
150
151
|
invalidBlocks,
|
|
151
152
|
isReusable,
|
|
152
153
|
isTemplate,
|
|
153
|
-
isDisabled
|
|
154
|
+
isDisabled,
|
|
155
|
+
isSection
|
|
154
156
|
} = (0, _data.useSelect)(select => {
|
|
155
157
|
const {
|
|
156
158
|
getTemplateLock,
|
|
157
159
|
getBlocksByClientId,
|
|
158
160
|
getBlockAttributes,
|
|
159
161
|
canRemoveBlocks,
|
|
160
|
-
getBlockEditingMode
|
|
161
|
-
|
|
162
|
+
getBlockEditingMode,
|
|
163
|
+
isSectionBlock
|
|
164
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
162
165
|
const {
|
|
163
166
|
getBlockStyles,
|
|
164
167
|
getBlockType,
|
|
@@ -199,7 +202,8 @@ const BlockSwitcher = ({
|
|
|
199
202
|
isReusable: _isSingleBlockSelected && (0, _blocks2.isReusableBlock)(_blocks[0]),
|
|
200
203
|
isTemplate: _isSingleBlockSelected && (0, _blocks2.isTemplatePart)(_blocks[0]),
|
|
201
204
|
hasContentOnlyLocking: _hasTemplateLock,
|
|
202
|
-
isDisabled: editingMode !== 'default'
|
|
205
|
+
isDisabled: editingMode !== 'default',
|
|
206
|
+
isSection: isSectionBlock(clientIds[0])
|
|
203
207
|
};
|
|
204
208
|
}, [clientIds]);
|
|
205
209
|
const blockTitle = (0, _useBlockDisplayTitle.default)({
|
|
@@ -213,7 +217,8 @@ const BlockSwitcher = ({
|
|
|
213
217
|
const isSingleBlock = clientIds.length === 1;
|
|
214
218
|
const blockSwitcherLabel = isSingleBlock ? blockTitle : (0, _i18n.__)('Multiple blocks selected');
|
|
215
219
|
const blockIndicatorText = (isReusable || isTemplate) && !showIconLabels && blockTitle ? blockTitle : undefined;
|
|
216
|
-
const
|
|
220
|
+
const hideTransformsForSections = window?.__experimentalContentOnlyPatternInsertion && isSection;
|
|
221
|
+
const hideDropdown = hideTransformsForSections || isDisabled || !hasBlockStyles && !canRemove || hasContentOnlyLocking;
|
|
217
222
|
if (hideDropdown) {
|
|
218
223
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarGroup, {
|
|
219
224
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_blocks2","_data","_icons","_preferences","_store","_blockIcon","_interopRequireDefault","_blockTransformationsMenu","_blockVariationTransformations","_blockStylesMenu","_patternTransformationsMenu","_useBlockDisplayTitle","_jsxRuntime","BlockSwitcherDropdownMenuContents","onClose","clientIds","hasBlockStyles","canRemove","replaceBlocks","multiSelect","updateBlockAttributes","useDispatch","blockEditorStore","possibleBlockTransformations","patterns","blocks","isUsingBindings","useSelect","select","getBlockAttributes","getBlocksByClientId","getBlockRootClientId","getBlockTransformItems","__experimentalGetPatternTransformItems","rootClientId","_blocks","every","clientId","metadata","bindings","blockVariationTransformations","useBlockVariationTransforms","selectForMultipleBlocks","insertedBlocks","length","onBlockTransform","name","newBlocks","switchToBlockType","onBlockVariationTransform","find","variationName","attributes","onPatternTransform","transformedBlocks","isSingleBlock","isTemplate","isTemplatePart","hasPossibleBlockTransformations","hasPossibleBlockVariationTransformations","hasPatternTransformation","hasBlockOrBlockVariationTransforms","hasContents","jsx","className","children","__","connectedBlockDescription","_x","jsxs","default","onSelect","possibleBlockVariationTransformations","onSelectVariation","hoveredBlock","onSwitch","MenuGroup","__experimentalText","BlockSwitcher","hasContentOnlyLocking","icon","invalidBlocks","isReusable","isDisabled","getTemplateLock","canRemoveBlocks","getBlockEditingMode","getBlockStyles","getBlockType","getActiveBlockVariation","blocksStore","some","block","firstBlockName","_isSingleBlockSelected","blockType","editingMode","_icon","_hasTemplateLock","match","isSelectionOfSameType","Set","map","size","id","copy","isReusableBlock","blockTitle","useBlockDisplayTitle","maximumLength","showIconLabels","preferencesStore","get","blockSwitcherLabel","blockIndicatorText","undefined","hideDropdown","ToolbarGroup","ToolbarButton","disabled","title","showColors","text","blockSwitcherDescription","sprintf","_n","ToolbarItem","toggleProps","DropdownMenu","label","popoverProps","placement","description","menuProps","orientation","exports","_default"],"sources":["@wordpress/block-editor/src/components/block-switcher/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf, _x } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tToolbarButton,\n\tToolbarGroup,\n\tToolbarItem,\n\t__experimentalText as Text,\n\tMenuGroup,\n} from '@wordpress/components';\nimport {\n\tswitchToBlockType,\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { copy } from '@wordpress/icons';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport BlockIcon from '../block-icon';\nimport BlockTransformationsMenu from './block-transformations-menu';\nimport { useBlockVariationTransforms } from './block-variation-transformations';\nimport BlockStylesMenu from './block-styles-menu';\nimport PatternTransformationsMenu from './pattern-transformations-menu';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\n\nfunction BlockSwitcherDropdownMenuContents( {\n\tonClose,\n\tclientIds,\n\thasBlockStyles,\n\tcanRemove,\n} ) {\n\tconst { replaceBlocks, multiSelect, updateBlockAttributes } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { possibleBlockTransformations, patterns, blocks, isUsingBindings } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockAttributes,\n\t\t\t\t\tgetBlocksByClientId,\n\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\tgetBlockTransformItems,\n\t\t\t\t\t__experimentalGetPatternTransformItems,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tconst _blocks = getBlocksByClientId( clientIds );\n\t\t\t\treturn {\n\t\t\t\t\tblocks: _blocks,\n\t\t\t\t\tpossibleBlockTransformations: getBlockTransformItems(\n\t\t\t\t\t\t_blocks,\n\t\t\t\t\t\trootClientId\n\t\t\t\t\t),\n\t\t\t\t\tpatterns: __experimentalGetPatternTransformItems(\n\t\t\t\t\t\t_blocks,\n\t\t\t\t\t\trootClientId\n\t\t\t\t\t),\n\t\t\t\t\tisUsingBindings: clientIds.every(\n\t\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t\t!! getBlockAttributes( clientId )?.metadata\n\t\t\t\t\t\t\t\t?.bindings\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientIds ]\n\t\t);\n\tconst blockVariationTransformations = useBlockVariationTransforms( {\n\t\tclientIds,\n\t\tblocks,\n\t} );\n\tfunction selectForMultipleBlocks( insertedBlocks ) {\n\t\tif ( insertedBlocks.length > 1 ) {\n\t\t\tmultiSelect(\n\t\t\t\tinsertedBlocks[ 0 ].clientId,\n\t\t\t\tinsertedBlocks[ insertedBlocks.length - 1 ].clientId\n\t\t\t);\n\t\t}\n\t}\n\t// Simple block transformation based on the `Block Transforms` API.\n\tfunction onBlockTransform( name ) {\n\t\tconst newBlocks = switchToBlockType( blocks, name );\n\t\treplaceBlocks( clientIds, newBlocks );\n\t\tselectForMultipleBlocks( newBlocks );\n\t}\n\tfunction onBlockVariationTransform( name ) {\n\t\tupdateBlockAttributes( blocks[ 0 ].clientId, {\n\t\t\t...blockVariationTransformations.find(\n\t\t\t\t( { name: variationName } ) => variationName === name\n\t\t\t).attributes,\n\t\t} );\n\t}\n\t// Pattern transformation through the `Patterns` API.\n\tfunction onPatternTransform( transformedBlocks ) {\n\t\treplaceBlocks( clientIds, transformedBlocks );\n\t\tselectForMultipleBlocks( transformedBlocks );\n\t}\n\t/**\n\t * The `isTemplate` check is a stopgap solution here.\n\t * Ideally, the Transforms API should handle this\n\t * by allowing to exclude blocks from wildcard transformations.\n\t */\n\tconst isSingleBlock = blocks.length === 1;\n\tconst isTemplate = isSingleBlock && isTemplatePart( blocks[ 0 ] );\n\tconst hasPossibleBlockTransformations =\n\t\t!! possibleBlockTransformations.length && canRemove && ! isTemplate;\n\tconst hasPossibleBlockVariationTransformations =\n\t\t!! blockVariationTransformations?.length;\n\tconst hasPatternTransformation = !! patterns?.length && canRemove;\n\tconst hasBlockOrBlockVariationTransforms =\n\t\thasPossibleBlockTransformations ||\n\t\thasPossibleBlockVariationTransformations;\n\tconst hasContents =\n\t\thasBlockStyles ||\n\t\thasBlockOrBlockVariationTransforms ||\n\t\thasPatternTransformation;\n\tif ( ! hasContents ) {\n\t\treturn (\n\t\t\t<p className=\"block-editor-block-switcher__no-transforms\">\n\t\t\t\t{ __( 'No transforms.' ) }\n\t\t\t</p>\n\t\t);\n\t}\n\n\tconst connectedBlockDescription = isSingleBlock\n\t\t? _x(\n\t\t\t\t'This block is connected.',\n\t\t\t\t'block toolbar button label and description'\n\t\t )\n\t\t: _x(\n\t\t\t\t'These blocks are connected.',\n\t\t\t\t'block toolbar button label and description'\n\t\t );\n\n\treturn (\n\t\t<div className=\"block-editor-block-switcher__container\">\n\t\t\t{ hasPatternTransformation && (\n\t\t\t\t<PatternTransformationsMenu\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tpatterns={ patterns }\n\t\t\t\t\tonSelect={ ( transformedBlocks ) => {\n\t\t\t\t\t\tonPatternTransform( transformedBlocks );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBlockOrBlockVariationTransforms && (\n\t\t\t\t<BlockTransformationsMenu\n\t\t\t\t\tclassName=\"block-editor-block-switcher__transforms__menugroup\"\n\t\t\t\t\tpossibleBlockTransformations={\n\t\t\t\t\t\tpossibleBlockTransformations\n\t\t\t\t\t}\n\t\t\t\t\tpossibleBlockVariationTransformations={\n\t\t\t\t\t\tblockVariationTransformations\n\t\t\t\t\t}\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tonSelect={ ( name ) => {\n\t\t\t\t\t\tonBlockTransform( name );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t\tonSelectVariation={ ( name ) => {\n\t\t\t\t\t\tonBlockVariationTransform( name );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBlockStyles && (\n\t\t\t\t<BlockStylesMenu\n\t\t\t\t\thoveredBlock={ blocks[ 0 ] }\n\t\t\t\t\tonSwitch={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isUsingBindings && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<Text className=\"block-editor-block-switcher__binding-indicator\">\n\t\t\t\t\t\t{ connectedBlockDescription }\n\t\t\t\t\t</Text>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport const BlockSwitcher = ( { clientIds } ) => {\n\tconst {\n\t\thasContentOnlyLocking,\n\t\tcanRemove,\n\t\thasBlockStyles,\n\t\ticon,\n\t\tinvalidBlocks,\n\t\tisReusable,\n\t\tisTemplate,\n\t\tisDisabled,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tcanRemoveBlocks,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockStyles, getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst _blocks = getBlocksByClientId( clientIds );\n\t\t\tif ( ! _blocks.length || _blocks.some( ( block ) => ! block ) ) {\n\t\t\t\treturn { invalidBlocks: true };\n\t\t\t}\n\t\t\tconst [ { name: firstBlockName } ] = _blocks;\n\t\t\tconst _isSingleBlockSelected = _blocks.length === 1;\n\t\t\tconst blockType = getBlockType( firstBlockName );\n\t\t\tconst editingMode = getBlockEditingMode( clientIds[ 0 ] );\n\n\t\t\tlet _icon;\n\t\t\tlet _hasTemplateLock;\n\t\t\tif ( _isSingleBlockSelected ) {\n\t\t\t\tconst match = getActiveBlockVariation(\n\t\t\t\t\tfirstBlockName,\n\t\t\t\t\tgetBlockAttributes( clientIds[ 0 ] )\n\t\t\t\t);\n\t\t\t\t// Take into account active block variations.\n\t\t\t\t_icon = match?.icon || blockType.icon;\n\t\t\t\t_hasTemplateLock =\n\t\t\t\t\tgetTemplateLock( clientIds[ 0 ] ) === 'contentOnly';\n\t\t\t} else {\n\t\t\t\tconst isSelectionOfSameType =\n\t\t\t\t\tnew Set( _blocks.map( ( { name } ) => name ) ).size === 1;\n\t\t\t\t_hasTemplateLock = clientIds.some(\n\t\t\t\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t\t\t\t);\n\t\t\t\t// When selection consists of blocks of multiple types, display an\n\t\t\t\t// appropriate icon to communicate the non-uniformity.\n\t\t\t\t_icon = isSelectionOfSameType ? blockType.icon : copy;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcanRemove: canRemoveBlocks( clientIds ),\n\t\t\t\thasBlockStyles:\n\t\t\t\t\t_isSingleBlockSelected &&\n\t\t\t\t\t!! getBlockStyles( firstBlockName )?.length,\n\t\t\t\ticon: _icon,\n\t\t\t\tisReusable:\n\t\t\t\t\t_isSingleBlockSelected && isReusableBlock( _blocks[ 0 ] ),\n\t\t\t\tisTemplate:\n\t\t\t\t\t_isSingleBlockSelected && isTemplatePart( _blocks[ 0 ] ),\n\t\t\t\thasContentOnlyLocking: _hasTemplateLock,\n\t\t\t\tisDisabled: editingMode !== 'default',\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId: clientIds?.[ 0 ],\n\t\tmaximumLength: 35,\n\t} );\n\tconst showIconLabels = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get( 'core', 'showIconLabels' ),\n\t\t[]\n\t);\n\n\tif ( invalidBlocks ) {\n\t\treturn null;\n\t}\n\n\tconst isSingleBlock = clientIds.length === 1;\n\tconst blockSwitcherLabel = isSingleBlock\n\t\t? blockTitle\n\t\t: __( 'Multiple blocks selected' );\n\n\tconst blockIndicatorText =\n\t\t( isReusable || isTemplate ) && ! showIconLabels && blockTitle\n\t\t\t? blockTitle\n\t\t\t: undefined;\n\n\tconst hideDropdown =\n\t\tisDisabled ||\n\t\t( ! hasBlockStyles && ! canRemove ) ||\n\t\thasContentOnlyLocking;\n\n\tif ( hideDropdown ) {\n\t\treturn (\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tdisabled\n\t\t\t\t\tclassName=\"block-editor-block-switcher__no-switcher-icon\"\n\t\t\t\t\ttitle={ blockSwitcherLabel }\n\t\t\t\t\ticon={\n\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\tclassName=\"block-editor-block-switcher__toggle\"\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tshowColors\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\ttext={ blockIndicatorText }\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t);\n\t}\n\n\tconst blockSwitcherDescription = isSingleBlock\n\t\t? __( 'Change block type or style' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t_n(\n\t\t\t\t\t'Change type of %d block',\n\t\t\t\t\t'Change type of %d blocks',\n\t\t\t\t\tclientIds.length\n\t\t\t\t),\n\t\t\t\tclientIds.length\n\t\t );\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarItem>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\tclassName=\"block-editor-block-switcher\"\n\t\t\t\t\t\tlabel={ blockSwitcherLabel }\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tplacement: 'bottom-start',\n\t\t\t\t\t\t\tclassName: 'block-editor-block-switcher__popover',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-switcher__toggle\"\n\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\tshowColors\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext={ blockIndicatorText }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tdescription: blockSwitcherDescription,\n\t\t\t\t\t\t\t...toggleProps,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmenuProps={ { orientation: 'both' } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<BlockSwitcherDropdownMenuContents\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\t\t\t\t\tcanRemove={ canRemove }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t</ToolbarGroup>\n\t);\n};\n\nexport default BlockSwitcher;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAQA,IAAAE,QAAA,GAAAF,OAAA;AAMA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAK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,CAAAzD,aAAA,GAAAA,aAAA;AAAA,IAAA0D,QAAA,GAAAD,OAAA,CAAAjE,OAAA,GAEaQ,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_blocks2","_data","_icons","_preferences","_store","_blockIcon","_interopRequireDefault","_blockTransformationsMenu","_blockVariationTransformations","_blockStylesMenu","_patternTransformationsMenu","_useBlockDisplayTitle","_lockUnlock","_jsxRuntime","BlockSwitcherDropdownMenuContents","onClose","clientIds","hasBlockStyles","canRemove","replaceBlocks","multiSelect","updateBlockAttributes","useDispatch","blockEditorStore","possibleBlockTransformations","patterns","blocks","isUsingBindings","useSelect","select","getBlockAttributes","getBlocksByClientId","getBlockRootClientId","getBlockTransformItems","__experimentalGetPatternTransformItems","rootClientId","_blocks","every","clientId","metadata","bindings","blockVariationTransformations","useBlockVariationTransforms","selectForMultipleBlocks","insertedBlocks","length","onBlockTransform","name","newBlocks","switchToBlockType","onBlockVariationTransform","find","variationName","attributes","onPatternTransform","transformedBlocks","isSingleBlock","isTemplate","isTemplatePart","hasPossibleBlockTransformations","hasPossibleBlockVariationTransformations","hasPatternTransformation","hasBlockOrBlockVariationTransforms","hasContents","jsx","className","children","__","connectedBlockDescription","_x","jsxs","default","onSelect","possibleBlockVariationTransformations","onSelectVariation","hoveredBlock","onSwitch","MenuGroup","__experimentalText","BlockSwitcher","hasContentOnlyLocking","icon","invalidBlocks","isReusable","isDisabled","isSection","getTemplateLock","canRemoveBlocks","getBlockEditingMode","isSectionBlock","unlock","getBlockStyles","getBlockType","getActiveBlockVariation","blocksStore","some","block","firstBlockName","_isSingleBlockSelected","blockType","editingMode","_icon","_hasTemplateLock","match","isSelectionOfSameType","Set","map","size","id","copy","isReusableBlock","blockTitle","useBlockDisplayTitle","maximumLength","showIconLabels","preferencesStore","get","blockSwitcherLabel","blockIndicatorText","undefined","hideTransformsForSections","window","__experimentalContentOnlyPatternInsertion","hideDropdown","ToolbarGroup","ToolbarButton","disabled","title","showColors","text","blockSwitcherDescription","sprintf","_n","ToolbarItem","toggleProps","DropdownMenu","label","popoverProps","placement","description","menuProps","orientation","exports","_default"],"sources":["@wordpress/block-editor/src/components/block-switcher/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf, _x } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tToolbarButton,\n\tToolbarGroup,\n\tToolbarItem,\n\t__experimentalText as Text,\n\tMenuGroup,\n} from '@wordpress/components';\nimport {\n\tswitchToBlockType,\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { copy } from '@wordpress/icons';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport BlockIcon from '../block-icon';\nimport BlockTransformationsMenu from './block-transformations-menu';\nimport { useBlockVariationTransforms } from './block-variation-transformations';\nimport BlockStylesMenu from './block-styles-menu';\nimport PatternTransformationsMenu from './pattern-transformations-menu';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { unlock } from '../../lock-unlock';\n\nfunction BlockSwitcherDropdownMenuContents( {\n\tonClose,\n\tclientIds,\n\thasBlockStyles,\n\tcanRemove,\n} ) {\n\tconst { replaceBlocks, multiSelect, updateBlockAttributes } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { possibleBlockTransformations, patterns, blocks, isUsingBindings } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockAttributes,\n\t\t\t\t\tgetBlocksByClientId,\n\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\tgetBlockTransformItems,\n\t\t\t\t\t__experimentalGetPatternTransformItems,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tconst _blocks = getBlocksByClientId( clientIds );\n\t\t\t\treturn {\n\t\t\t\t\tblocks: _blocks,\n\t\t\t\t\tpossibleBlockTransformations: getBlockTransformItems(\n\t\t\t\t\t\t_blocks,\n\t\t\t\t\t\trootClientId\n\t\t\t\t\t),\n\t\t\t\t\tpatterns: __experimentalGetPatternTransformItems(\n\t\t\t\t\t\t_blocks,\n\t\t\t\t\t\trootClientId\n\t\t\t\t\t),\n\t\t\t\t\tisUsingBindings: clientIds.every(\n\t\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t\t!! getBlockAttributes( clientId )?.metadata\n\t\t\t\t\t\t\t\t?.bindings\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientIds ]\n\t\t);\n\tconst blockVariationTransformations = useBlockVariationTransforms( {\n\t\tclientIds,\n\t\tblocks,\n\t} );\n\tfunction selectForMultipleBlocks( insertedBlocks ) {\n\t\tif ( insertedBlocks.length > 1 ) {\n\t\t\tmultiSelect(\n\t\t\t\tinsertedBlocks[ 0 ].clientId,\n\t\t\t\tinsertedBlocks[ insertedBlocks.length - 1 ].clientId\n\t\t\t);\n\t\t}\n\t}\n\t// Simple block transformation based on the `Block Transforms` API.\n\tfunction onBlockTransform( name ) {\n\t\tconst newBlocks = switchToBlockType( blocks, name );\n\t\treplaceBlocks( clientIds, newBlocks );\n\t\tselectForMultipleBlocks( newBlocks );\n\t}\n\tfunction onBlockVariationTransform( name ) {\n\t\tupdateBlockAttributes( blocks[ 0 ].clientId, {\n\t\t\t...blockVariationTransformations.find(\n\t\t\t\t( { name: variationName } ) => variationName === name\n\t\t\t).attributes,\n\t\t} );\n\t}\n\t// Pattern transformation through the `Patterns` API.\n\tfunction onPatternTransform( transformedBlocks ) {\n\t\treplaceBlocks( clientIds, transformedBlocks );\n\t\tselectForMultipleBlocks( transformedBlocks );\n\t}\n\t/**\n\t * The `isTemplate` check is a stopgap solution here.\n\t * Ideally, the Transforms API should handle this\n\t * by allowing to exclude blocks from wildcard transformations.\n\t */\n\tconst isSingleBlock = blocks.length === 1;\n\tconst isTemplate = isSingleBlock && isTemplatePart( blocks[ 0 ] );\n\tconst hasPossibleBlockTransformations =\n\t\t!! possibleBlockTransformations.length && canRemove && ! isTemplate;\n\tconst hasPossibleBlockVariationTransformations =\n\t\t!! blockVariationTransformations?.length;\n\tconst hasPatternTransformation = !! patterns?.length && canRemove;\n\tconst hasBlockOrBlockVariationTransforms =\n\t\thasPossibleBlockTransformations ||\n\t\thasPossibleBlockVariationTransformations;\n\tconst hasContents =\n\t\thasBlockStyles ||\n\t\thasBlockOrBlockVariationTransforms ||\n\t\thasPatternTransformation;\n\tif ( ! hasContents ) {\n\t\treturn (\n\t\t\t<p className=\"block-editor-block-switcher__no-transforms\">\n\t\t\t\t{ __( 'No transforms.' ) }\n\t\t\t</p>\n\t\t);\n\t}\n\n\tconst connectedBlockDescription = isSingleBlock\n\t\t? _x(\n\t\t\t\t'This block is connected.',\n\t\t\t\t'block toolbar button label and description'\n\t\t )\n\t\t: _x(\n\t\t\t\t'These blocks are connected.',\n\t\t\t\t'block toolbar button label and description'\n\t\t );\n\n\treturn (\n\t\t<div className=\"block-editor-block-switcher__container\">\n\t\t\t{ hasPatternTransformation && (\n\t\t\t\t<PatternTransformationsMenu\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tpatterns={ patterns }\n\t\t\t\t\tonSelect={ ( transformedBlocks ) => {\n\t\t\t\t\t\tonPatternTransform( transformedBlocks );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBlockOrBlockVariationTransforms && (\n\t\t\t\t<BlockTransformationsMenu\n\t\t\t\t\tclassName=\"block-editor-block-switcher__transforms__menugroup\"\n\t\t\t\t\tpossibleBlockTransformations={\n\t\t\t\t\t\tpossibleBlockTransformations\n\t\t\t\t\t}\n\t\t\t\t\tpossibleBlockVariationTransformations={\n\t\t\t\t\t\tblockVariationTransformations\n\t\t\t\t\t}\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tonSelect={ ( name ) => {\n\t\t\t\t\t\tonBlockTransform( name );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t\tonSelectVariation={ ( name ) => {\n\t\t\t\t\t\tonBlockVariationTransform( name );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBlockStyles && (\n\t\t\t\t<BlockStylesMenu\n\t\t\t\t\thoveredBlock={ blocks[ 0 ] }\n\t\t\t\t\tonSwitch={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isUsingBindings && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<Text className=\"block-editor-block-switcher__binding-indicator\">\n\t\t\t\t\t\t{ connectedBlockDescription }\n\t\t\t\t\t</Text>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport const BlockSwitcher = ( { clientIds } ) => {\n\tconst {\n\t\thasContentOnlyLocking,\n\t\tcanRemove,\n\t\thasBlockStyles,\n\t\ticon,\n\t\tinvalidBlocks,\n\t\tisReusable,\n\t\tisTemplate,\n\t\tisDisabled,\n\t\tisSection,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tcanRemoveBlocks,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tisSectionBlock,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tconst { getBlockStyles, getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst _blocks = getBlocksByClientId( clientIds );\n\t\t\tif ( ! _blocks.length || _blocks.some( ( block ) => ! block ) ) {\n\t\t\t\treturn { invalidBlocks: true };\n\t\t\t}\n\t\t\tconst [ { name: firstBlockName } ] = _blocks;\n\t\t\tconst _isSingleBlockSelected = _blocks.length === 1;\n\t\t\tconst blockType = getBlockType( firstBlockName );\n\t\t\tconst editingMode = getBlockEditingMode( clientIds[ 0 ] );\n\n\t\t\tlet _icon;\n\t\t\tlet _hasTemplateLock;\n\t\t\tif ( _isSingleBlockSelected ) {\n\t\t\t\tconst match = getActiveBlockVariation(\n\t\t\t\t\tfirstBlockName,\n\t\t\t\t\tgetBlockAttributes( clientIds[ 0 ] )\n\t\t\t\t);\n\t\t\t\t// Take into account active block variations.\n\t\t\t\t_icon = match?.icon || blockType.icon;\n\t\t\t\t_hasTemplateLock =\n\t\t\t\t\tgetTemplateLock( clientIds[ 0 ] ) === 'contentOnly';\n\t\t\t} else {\n\t\t\t\tconst isSelectionOfSameType =\n\t\t\t\t\tnew Set( _blocks.map( ( { name } ) => name ) ).size === 1;\n\t\t\t\t_hasTemplateLock = clientIds.some(\n\t\t\t\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t\t\t\t);\n\t\t\t\t// When selection consists of blocks of multiple types, display an\n\t\t\t\t// appropriate icon to communicate the non-uniformity.\n\t\t\t\t_icon = isSelectionOfSameType ? blockType.icon : copy;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcanRemove: canRemoveBlocks( clientIds ),\n\t\t\t\thasBlockStyles:\n\t\t\t\t\t_isSingleBlockSelected &&\n\t\t\t\t\t!! getBlockStyles( firstBlockName )?.length,\n\t\t\t\ticon: _icon,\n\t\t\t\tisReusable:\n\t\t\t\t\t_isSingleBlockSelected && isReusableBlock( _blocks[ 0 ] ),\n\t\t\t\tisTemplate:\n\t\t\t\t\t_isSingleBlockSelected && isTemplatePart( _blocks[ 0 ] ),\n\t\t\t\thasContentOnlyLocking: _hasTemplateLock,\n\t\t\t\tisDisabled: editingMode !== 'default',\n\t\t\t\tisSection: isSectionBlock( clientIds[ 0 ] ),\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId: clientIds?.[ 0 ],\n\t\tmaximumLength: 35,\n\t} );\n\tconst showIconLabels = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get( 'core', 'showIconLabels' ),\n\t\t[]\n\t);\n\n\tif ( invalidBlocks ) {\n\t\treturn null;\n\t}\n\n\tconst isSingleBlock = clientIds.length === 1;\n\tconst blockSwitcherLabel = isSingleBlock\n\t\t? blockTitle\n\t\t: __( 'Multiple blocks selected' );\n\n\tconst blockIndicatorText =\n\t\t( isReusable || isTemplate ) && ! showIconLabels && blockTitle\n\t\t\t? blockTitle\n\t\t\t: undefined;\n\n\tconst hideTransformsForSections =\n\t\twindow?.__experimentalContentOnlyPatternInsertion && isSection;\n\tconst hideDropdown =\n\t\thideTransformsForSections ||\n\t\tisDisabled ||\n\t\t( ! hasBlockStyles && ! canRemove ) ||\n\t\thasContentOnlyLocking;\n\n\tif ( hideDropdown ) {\n\t\treturn (\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tdisabled\n\t\t\t\t\tclassName=\"block-editor-block-switcher__no-switcher-icon\"\n\t\t\t\t\ttitle={ blockSwitcherLabel }\n\t\t\t\t\ticon={\n\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\tclassName=\"block-editor-block-switcher__toggle\"\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tshowColors\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\ttext={ blockIndicatorText }\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t);\n\t}\n\n\tconst blockSwitcherDescription = isSingleBlock\n\t\t? __( 'Change block type or style' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t_n(\n\t\t\t\t\t'Change type of %d block',\n\t\t\t\t\t'Change type of %d blocks',\n\t\t\t\t\tclientIds.length\n\t\t\t\t),\n\t\t\t\tclientIds.length\n\t\t );\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarItem>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\tclassName=\"block-editor-block-switcher\"\n\t\t\t\t\t\tlabel={ blockSwitcherLabel }\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tplacement: 'bottom-start',\n\t\t\t\t\t\t\tclassName: 'block-editor-block-switcher__popover',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-switcher__toggle\"\n\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\tshowColors\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext={ blockIndicatorText }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tdescription: blockSwitcherDescription,\n\t\t\t\t\t\t\t...toggleProps,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmenuProps={ { orientation: 'both' } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<BlockSwitcherDropdownMenuContents\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\t\t\t\t\tcanRemove={ canRemove }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t</ToolbarGroup>\n\t);\n};\n\nexport default BlockSwitcher;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAQA,IAAAE,QAAA,GAAAF,OAAA;AAMA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAA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AF,WAAA,CAAAmD,GAAA,EAAClD,iCAAiC;UACjCC,OAAO,EAAGA,OAAS;UACnBC,SAAS,EAAGA,SAAW;UACvBC,cAAc,EAAGA,cAAgB;UACjCC,SAAS,EAAGA;QAAW,CACvB;MACD,CACY;IACd,CACW;EAAC,CACD,CAAC;AAEjB,CAAC;AAAC4H,OAAA,CAAA/D,aAAA,GAAAA,aAAA;AAAA,IAAAgE,QAAA,GAAAD,OAAA,CAAAvE,OAAA,GAEaQ,aAAa","ignoreList":[]}
|
|
@@ -116,6 +116,10 @@ function PrivateBlockToolbar({
|
|
|
116
116
|
// If one or more selected blocks are locked, do not show the BlockGroupToolbar.
|
|
117
117
|
const _hasTemplateLock = selectedBlockClientIds.some(id => getTemplateLock(id) === 'contentOnly');
|
|
118
118
|
const _isZoomOut = isZoomOut();
|
|
119
|
+
|
|
120
|
+
// The switch style button appears more prominently with the
|
|
121
|
+
// content only pattern experiment.
|
|
122
|
+
const _showSwitchSectionStyleButton = window?.__experimentalContentOnlyPatternInsertion ? _isZoomOut || isSectionBlock(selectedBlockClientId) : _isZoomOut || isNavigationModeEnabled && editingMode === 'contentOnly' && isSectionBlock(selectedBlockClientId);
|
|
119
123
|
return {
|
|
120
124
|
blockClientId: selectedBlockClientId,
|
|
121
125
|
blockClientIds: selectedBlockClientIds,
|
|
@@ -131,8 +135,7 @@ function PrivateBlockToolbar({
|
|
|
131
135
|
showSlots: !_isZoomOut,
|
|
132
136
|
showGroupButtons: !_isZoomOut,
|
|
133
137
|
showLockButtons: !_isZoomOut,
|
|
134
|
-
showSwitchSectionStyleButton:
|
|
135
|
-
// Zoom out or Write Mode Section Blocks
|
|
138
|
+
showSwitchSectionStyleButton: _showSwitchSectionStyleButton,
|
|
136
139
|
hasFixedToolbar: getSettings().hasFixedToolbar,
|
|
137
140
|
isNavigationMode: isNavigationModeEnabled
|
|
138
141
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_data","_element","_compose","_blocks","_components","_blockMover","_blockParentSelector","_blockSwitcher","_blockControls","_blockToolbarLastItem","_blockSettingsMenu","_blockLock","_convertToGroupButtons","_blockEditVisuallyButton","_utils","_store","_blockNameContext","_navigableToolbar","_useHasBlockToolbar","_changeDesign","_switchSectionStyle","_lockUnlock","_jsxRuntime","PrivateBlockToolbar","hideDragHandle","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","variant","blockClientId","blockClientIds","isDefaultEditingMode","blockType","toolbarKey","shouldShowVisualToolbar","showParentSelector","isUsingBindings","hasParentPattern","hasContentOnlyLocking","showShuffleButton","showSlots","showGroupButtons","showLockButtons","showSwitchSectionStyleButton","hasFixedToolbar","isNavigationMode","useSelect","select","getBlockName","getBlockMode","getBlockParents","getSelectedBlockClientIds","isBlockValid","getBlockEditingMode","getBlockAttributes","getBlockParentsByBlockName","getTemplateLock","getSettings","getParentSectionBlock","isZoomOut","_isNavigationMode","isSectionBlock","unlock","blockEditorStore","selectedBlockClientIds","selectedBlockClientId","parents","parentSection","parentClientId","length","parentBlockName","parentBlockType","getBlockType","editingMode","isNavigationModeEnabled","_isDefaultEditingMode","_blockName","isValid","every","id","isVisual","_isUsingBindings","clientId","metadata","bindings","_hasParentPattern","_hasTemplateLock","some","_isZoomOut","hasBlockSupport","toolbarWrapperRef","useRef","nodeRef","showHoveredOrFocusedGestures","useShowHoveredOrFocusedGestures","ref","isLargeViewport","useViewportMatch","hasBlockToolbar","useHasBlockToolbar","isMultiToolbar","isSynced","isReusableBlock","isTemplatePart","classes","clsx","innerClasses","jsx","default","focusEditorOnEscape","className","__","undefined","children","jsxs","ToolbarGroup","clientIds","BlockLockToolbar","BlockGroupToolbar","Fragment","Slot","group","Provider","value","name","BlockToolbar"],"sources":["@wordpress/block-editor/src/components/block-toolbar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockSwitcher from '../block-switcher';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport __unstableBlockNameContext from './block-name-context';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasBlockToolbar } from './use-has-block-toolbar';\nimport ChangeDesign from './change-design';\nimport SwitchSectionStyle from './switch-section-style';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\ttoolbarKey,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t\tisUsingBindings,\n\t\thasParentPattern,\n\t\thasContentOnlyLocking,\n\t\tshowShuffleButton,\n\t\tshowSlots,\n\t\tshowGroupButtons,\n\t\tshowLockButtons,\n\t\tshowSwitchSectionStyleButton,\n\t\thasFixedToolbar,\n\t\tisNavigationMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetBlockAttributes,\n\t\t\tgetBlockParentsByBlockName,\n\t\t\tgetTemplateLock,\n\t\t\tgetSettings,\n\t\t\tgetParentSectionBlock,\n\t\t\tisZoomOut,\n\t\t\tisNavigationMode: _isNavigationMode,\n\t\t\tisSectionBlock,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst parentSection = getParentSectionBlock( selectedBlockClientId );\n\t\tconst parentClientId = parentSection ?? parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst editingMode = getBlockEditingMode( selectedBlockClientId );\n\t\tconst isNavigationModeEnabled = _isNavigationMode();\n\t\tconst _isDefaultEditingMode = editingMode === 'default';\n\t\tconst _blockName = getBlockName( selectedBlockClientId );\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\tconst _isUsingBindings = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t);\n\n\t\tconst _hasParentPattern = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true )\n\t\t\t\t\t.length > 0\n\t\t);\n\n\t\t// If one or more selected blocks are locked, do not show the BlockGroupToolbar.\n\t\tconst _hasTemplateLock = selectedBlockClientIds.some(\n\t\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t\t);\n\n\t\tconst _isZoomOut = isZoomOut();\n\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType: selectedBlockClientId && getBlockType( _blockName ),\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\ttoolbarKey: `${ selectedBlockClientId }${ parentClientId }`,\n\t\t\tshowParentSelector:\n\t\t\t\t! _isZoomOut &&\n\t\t\t\tparentBlockType &&\n\t\t\t\teditingMode !== 'contentOnly' &&\n\t\t\t\tgetBlockEditingMode( parentClientId ) !== 'disabled' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1,\n\t\t\tisUsingBindings: _isUsingBindings,\n\t\t\thasParentPattern: _hasParentPattern,\n\t\t\thasContentOnlyLocking: _hasTemplateLock,\n\t\t\tshowShuffleButton: _isZoomOut,\n\t\t\tshowSlots: ! _isZoomOut,\n\t\t\tshowGroupButtons: ! _isZoomOut,\n\t\t\tshowLockButtons: ! _isZoomOut,\n\t\t\tshowSwitchSectionStyleButton:\n\t\t\t\t_isZoomOut ||\n\t\t\t\t( isNavigationModeEnabled &&\n\t\t\t\t\teditingMode === 'contentOnly' &&\n\t\t\t\t\tisSectionBlock( selectedBlockClientId ) ), // Zoom out or Write Mode Section Blocks\n\t\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\t\tisNavigationMode: isNavigationModeEnabled,\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = clsx( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t\t'is-inverted-toolbar': isNavigationMode && ! hasFixedToolbar,\n\t} );\n\n\tconst innerClasses = clsx( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t\t'is-connected': isUsingBindings,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ toolbarKey }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ showParentSelector && ! isMultiToolbar && isLargeViewport && (\n\t\t\t\t\t<BlockParentSelector />\n\t\t\t\t) }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) &&\n\t\t\t\t\t! hasParentPattern && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ nodeRef }\n\t\t\t\t\t\t\t{ ...showHoveredOrFocusedGestures }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t\t<BlockSwitcher clientIds={ blockClientIds } />\n\t\t\t\t\t\t\t\t{ ! isMultiToolbar &&\n\t\t\t\t\t\t\t\t\tisDefaultEditingMode &&\n\t\t\t\t\t\t\t\t\tshowLockButtons && (\n\t\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<BlockMover\n\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t{ ! hasContentOnlyLocking &&\n\t\t\t\t\tshouldShowVisualToolbar &&\n\t\t\t\t\tisMultiToolbar &&\n\t\t\t\t\tshowGroupButtons && <BlockGroupToolbar /> }\n\t\t\t\t{ showShuffleButton && (\n\t\t\t\t\t<ChangeDesign clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ showSwitchSectionStyleButton && (\n\t\t\t\t\t<SwitchSectionStyle clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && showSlots && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<__unstableBlockNameContext.Provider\n\t\t\t\t\t\t\tvalue={ blockType?.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</__unstableBlockNameContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t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Y,IAAI;UAClBC,KAAK,EAAC,OAAO;UACbX,SAAS,EAAC;QAAkC,CAC5C,CAAC,eACF,IAAAxF,WAAA,CAAAqF,GAAA,EAAC3F,iBAAA,CAAA4F,OAA0B,CAACc,QAAQ;UACnCC,KAAK,EAAG3F,SAAS,EAAE4F,IAAM;UAAAX,QAAA,eAEzB,IAAA3F,WAAA,CAAAqF,GAAA,EAAClG,qBAAA,CAAAmG,OAA8B,CAACY,IAAI,IAAE;QAAC,CACH,CAAC;MAAA,CACrC,CACF,eACD,IAAAlG,WAAA,CAAAqF,GAAA,EAAC9F,wBAAA,CAAA+F,OAAuB;QAACQ,SAAS,EAAGtF;MAAgB,CAAE,CAAC,eACxD,IAAAR,WAAA,CAAAqF,GAAA,EAACjG,kBAAA,CAAAkG,OAAiB;QAACQ,SAAS,EAAGtF;MAAgB,CAAE,CAAC;IAAA,CAC9C;EAAC,GAlEAG,UAmEW,CAAC;AAErB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS4F,YAAYA,CAAE;EAAErG,cAAc;EAAEI;AAAQ,CAAC,EAAG;EACnE,oBACC,IAAAN,WAAA,CAAAqF,GAAA,EAACpF,mBAAmB;IACnBC,cAAc,EAAGA,cAAgB;IACjCI,OAAO,EAAGA,OAAS;IACnBH,YAAY,EAAGuF,SAAW;IAC1BtF,0BAA0B,EAAGsF,SAAW;IACxCrF,2BAA2B,EAAGqF;EAAW,CACzC,CAAC;AAEJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_data","_element","_compose","_blocks","_components","_blockMover","_blockParentSelector","_blockSwitcher","_blockControls","_blockToolbarLastItem","_blockSettingsMenu","_blockLock","_convertToGroupButtons","_blockEditVisuallyButton","_utils","_store","_blockNameContext","_navigableToolbar","_useHasBlockToolbar","_changeDesign","_switchSectionStyle","_lockUnlock","_jsxRuntime","PrivateBlockToolbar","hideDragHandle","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","variant","blockClientId","blockClientIds","isDefaultEditingMode","blockType","toolbarKey","shouldShowVisualToolbar","showParentSelector","isUsingBindings","hasParentPattern","hasContentOnlyLocking","showShuffleButton","showSlots","showGroupButtons","showLockButtons","showSwitchSectionStyleButton","hasFixedToolbar","isNavigationMode","useSelect","select","getBlockName","getBlockMode","getBlockParents","getSelectedBlockClientIds","isBlockValid","getBlockEditingMode","getBlockAttributes","getBlockParentsByBlockName","getTemplateLock","getSettings","getParentSectionBlock","isZoomOut","_isNavigationMode","isSectionBlock","unlock","blockEditorStore","selectedBlockClientIds","selectedBlockClientId","parents","parentSection","parentClientId","length","parentBlockName","parentBlockType","getBlockType","editingMode","isNavigationModeEnabled","_isDefaultEditingMode","_blockName","isValid","every","id","isVisual","_isUsingBindings","clientId","metadata","bindings","_hasParentPattern","_hasTemplateLock","some","_isZoomOut","_showSwitchSectionStyleButton","window","__experimentalContentOnlyPatternInsertion","hasBlockSupport","toolbarWrapperRef","useRef","nodeRef","showHoveredOrFocusedGestures","useShowHoveredOrFocusedGestures","ref","isLargeViewport","useViewportMatch","hasBlockToolbar","useHasBlockToolbar","isMultiToolbar","isSynced","isReusableBlock","isTemplatePart","classes","clsx","innerClasses","jsx","default","focusEditorOnEscape","className","__","undefined","children","jsxs","ToolbarGroup","clientIds","BlockLockToolbar","BlockGroupToolbar","Fragment","Slot","group","Provider","value","name","BlockToolbar"],"sources":["@wordpress/block-editor/src/components/block-toolbar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockSwitcher from '../block-switcher';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport __unstableBlockNameContext from './block-name-context';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasBlockToolbar } from './use-has-block-toolbar';\nimport ChangeDesign from './change-design';\nimport SwitchSectionStyle from './switch-section-style';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\ttoolbarKey,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t\tisUsingBindings,\n\t\thasParentPattern,\n\t\thasContentOnlyLocking,\n\t\tshowShuffleButton,\n\t\tshowSlots,\n\t\tshowGroupButtons,\n\t\tshowLockButtons,\n\t\tshowSwitchSectionStyleButton,\n\t\thasFixedToolbar,\n\t\tisNavigationMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetBlockAttributes,\n\t\t\tgetBlockParentsByBlockName,\n\t\t\tgetTemplateLock,\n\t\t\tgetSettings,\n\t\t\tgetParentSectionBlock,\n\t\t\tisZoomOut,\n\t\t\tisNavigationMode: _isNavigationMode,\n\t\t\tisSectionBlock,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst parentSection = getParentSectionBlock( selectedBlockClientId );\n\t\tconst parentClientId = parentSection ?? parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst editingMode = getBlockEditingMode( selectedBlockClientId );\n\t\tconst isNavigationModeEnabled = _isNavigationMode();\n\t\tconst _isDefaultEditingMode = editingMode === 'default';\n\t\tconst _blockName = getBlockName( selectedBlockClientId );\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\tconst _isUsingBindings = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t);\n\n\t\tconst _hasParentPattern = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true )\n\t\t\t\t\t.length > 0\n\t\t);\n\n\t\t// If one or more selected blocks are locked, do not show the BlockGroupToolbar.\n\t\tconst _hasTemplateLock = selectedBlockClientIds.some(\n\t\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t\t);\n\n\t\tconst _isZoomOut = isZoomOut();\n\n\t\t// The switch style button appears more prominently with the\n\t\t// content only pattern experiment.\n\t\tconst _showSwitchSectionStyleButton =\n\t\t\twindow?.__experimentalContentOnlyPatternInsertion\n\t\t\t\t? _isZoomOut || isSectionBlock( selectedBlockClientId )\n\t\t\t\t: _isZoomOut ||\n\t\t\t\t ( isNavigationModeEnabled &&\n\t\t\t\t\t\teditingMode === 'contentOnly' &&\n\t\t\t\t\t\tisSectionBlock( selectedBlockClientId ) );\n\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType: selectedBlockClientId && getBlockType( _blockName ),\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\ttoolbarKey: `${ selectedBlockClientId }${ parentClientId }`,\n\t\t\tshowParentSelector:\n\t\t\t\t! _isZoomOut &&\n\t\t\t\tparentBlockType &&\n\t\t\t\teditingMode !== 'contentOnly' &&\n\t\t\t\tgetBlockEditingMode( parentClientId ) !== 'disabled' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1,\n\t\t\tisUsingBindings: _isUsingBindings,\n\t\t\thasParentPattern: _hasParentPattern,\n\t\t\thasContentOnlyLocking: _hasTemplateLock,\n\t\t\tshowShuffleButton: _isZoomOut,\n\t\t\tshowSlots: ! _isZoomOut,\n\t\t\tshowGroupButtons: ! _isZoomOut,\n\t\t\tshowLockButtons: ! _isZoomOut,\n\t\t\tshowSwitchSectionStyleButton: _showSwitchSectionStyleButton,\n\t\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\t\tisNavigationMode: isNavigationModeEnabled,\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = clsx( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t\t'is-inverted-toolbar': isNavigationMode && ! hasFixedToolbar,\n\t} );\n\n\tconst innerClasses = clsx( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t\t'is-connected': isUsingBindings,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ toolbarKey }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ showParentSelector && ! isMultiToolbar && isLargeViewport && (\n\t\t\t\t\t<BlockParentSelector />\n\t\t\t\t) }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) &&\n\t\t\t\t\t! hasParentPattern && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ nodeRef }\n\t\t\t\t\t\t\t{ ...showHoveredOrFocusedGestures }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t\t<BlockSwitcher clientIds={ blockClientIds } />\n\t\t\t\t\t\t\t\t{ ! isMultiToolbar &&\n\t\t\t\t\t\t\t\t\tisDefaultEditingMode &&\n\t\t\t\t\t\t\t\t\tshowLockButtons && (\n\t\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<BlockMover\n\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t{ ! hasContentOnlyLocking &&\n\t\t\t\t\tshouldShowVisualToolbar &&\n\t\t\t\t\tisMultiToolbar &&\n\t\t\t\t\tshowGroupButtons && <BlockGroupToolbar /> }\n\t\t\t\t{ showShuffleButton && (\n\t\t\t\t\t<ChangeDesign clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ showSwitchSectionStyleButton && (\n\t\t\t\t\t<SwitchSectionStyle clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && showSlots && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<__unstableBlockNameContext.Provider\n\t\t\t\t\t\t\tvalue={ blockType?.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</__unstableBlockNameContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,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F,IAAA3F,WAAA,CAAAwF,GAAA,EAACtG,cAAA,CAAAuG,OAAa,CAACY,IAAI;UAClBC,KAAK,EAAC,OAAO;UACbX,SAAS,EAAC;QAAkC,CAC5C,CAAC,eACF,IAAA3F,WAAA,CAAAwF,GAAA,EAAC9F,iBAAA,CAAA+F,OAA0B,CAACc,QAAQ;UACnCC,KAAK,EAAG9F,SAAS,EAAE+F,IAAM;UAAAX,QAAA,eAEzB,IAAA9F,WAAA,CAAAwF,GAAA,EAACrG,qBAAA,CAAAsG,OAA8B,CAACY,IAAI,IAAE;QAAC,CACH,CAAC;MAAA,CACrC,CACF,eACD,IAAArG,WAAA,CAAAwF,GAAA,EAACjG,wBAAA,CAAAkG,OAAuB;QAACQ,SAAS,EAAGzF;MAAgB,CAAE,CAAC,eACxD,IAAAR,WAAA,CAAAwF,GAAA,EAACpG,kBAAA,CAAAqG,OAAiB;QAACQ,SAAS,EAAGzF;MAAgB,CAAE,CAAC;IAAA,CAC9C;EAAC,GAlEAG,UAmEW,CAAC;AAErB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS+F,YAAYA,CAAE;EAAExG,cAAc;EAAEI;AAAQ,CAAC,EAAG;EACnE,oBACC,IAAAN,WAAA,CAAAwF,GAAA,EAACvF,mBAAmB;IACnBC,cAAc,EAAGA,cAAgB;IACjCI,OAAO,EAAGA,OAAS;IACnBH,YAAY,EAAG0F,SAAW;IAC1BzF,0BAA0B,EAAGyF,SAAW;IACxCxF,2BAA2B,EAAGwF;EAAW,CACzC,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -109,6 +109,15 @@ function InbetweenInsertionPointPopover({
|
|
|
109
109
|
openRef.current = true;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
+
|
|
113
|
+
// Reset the insertion point reference when the Inserter unmounts,
|
|
114
|
+
// avoids stale references when `onSelectOrClose` is not called.
|
|
115
|
+
// See: https://github.com/WordPress/gutenberg/issues/65598#issuecomment-3249229264.
|
|
116
|
+
const maybeResetOpenRef = (0, _element.useCallback)(node => {
|
|
117
|
+
if (!node && openRef.current) {
|
|
118
|
+
openRef.current = false;
|
|
119
|
+
}
|
|
120
|
+
}, [openRef]);
|
|
112
121
|
const lineVariants = {
|
|
113
122
|
// Initial position starts from the center and invisible.
|
|
114
123
|
start: {
|
|
@@ -189,6 +198,7 @@ function InbetweenInsertionPointPopover({
|
|
|
189
198
|
variants: inserterVariants,
|
|
190
199
|
className: (0, _clsx.default)('block-editor-block-list__insertion-point-inserter'),
|
|
191
200
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_inserter.default, {
|
|
201
|
+
ref: maybeResetOpenRef,
|
|
192
202
|
position: "bottom center",
|
|
193
203
|
clientId: nextClientId,
|
|
194
204
|
rootClientId: rootClientId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_element","_components","_compose","_inserter","_store","_inbetween","_dropZone","_lockUnlock","_jsxRuntime","InsertionPointOpenRef","exports","createContext","displayName","InbetweenInsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","operation","nearestSide","selectBlock","hideInsertionPoint","useDispatch","blockEditorStore","openRef","useContext","ref","useRef","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","isDistractionFree","isZoomOutMode","useSelect","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","getSettings","isZoomOut","unlock","insertionPoint","order","length","_previousClientId","index","_nextClientId","settings","__unstableWithInserter","getBlockEditingMode","disableMotion","useReducedMotion","onClick","event","target","current","maybeHideInserterPoint","onFocus","lineVariants","start","opacity","scale","rest","transition","delay","type","hover","inserterVariants","orientationClassname","className","clsx","jsx","default","children","jsxs","__unstableMotion","div","layout","initial","animate","whileHover","whileTap","exit","tabIndex","onHoverEnd","variants","position","clientId","__experimentalIsQuick","onToggle","isOpen","onSelectOrClose","InsertionPoint","props","isVisible","isBlockListEmpty","isBlockInsertionPointVisible","getBlockCount","blockInsertionPoint"],"sources":["@wordpress/block-editor/src/components/block-tools/insertion-point.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, createContext, useContext } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopoverInbetween from '../block-popover/inbetween';\nimport BlockDropZonePopover from '../block-popover/drop-zone';\nimport { unlock } from '../../lock-unlock';\n\nexport const InsertionPointOpenRef = createContext();\nInsertionPointOpenRef.displayName = 'InsertionPointOpenRefContext';\n\nfunction InbetweenInsertionPointPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\toperation = 'insert',\n\tnearestSide = 'right',\n} ) {\n\tconst { selectBlock, hideInsertionPoint } = useDispatch( blockEditorStore );\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst ref = useRef();\n\tconst {\n\t\torientation,\n\t\tpreviousClientId,\n\t\tnextClientId,\n\t\trootClientId,\n\t\tisInserterShown,\n\t\tisDistractionFree,\n\t\tisZoomOutMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockBeingDragged,\n\t\t\tgetPreviousBlockClientId,\n\t\t\tgetNextBlockClientId,\n\t\t\tgetSettings,\n\t\t\tisZoomOut,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet _previousClientId = order[ insertionPoint.index - 1 ];\n\t\tlet _nextClientId = order[ insertionPoint.index ];\n\n\t\twhile ( isBlockBeingDragged( _previousClientId ) ) {\n\t\t\t_previousClientId = getPreviousBlockClientId( _previousClientId );\n\t\t}\n\n\t\twhile ( isBlockBeingDragged( _nextClientId ) ) {\n\t\t\t_nextClientId = getNextBlockClientId( _nextClientId );\n\t\t}\n\n\t\tconst settings = getSettings();\n\n\t\treturn {\n\t\t\tpreviousClientId: _previousClientId,\n\t\t\tnextClientId: _nextClientId,\n\t\t\torientation:\n\t\t\t\tgetBlockListSettings( insertionPoint.rootClientId )\n\t\t\t\t\t?.orientation || 'vertical',\n\t\t\trootClientId: insertionPoint.rootClientId,\n\t\t\tisDistractionFree: settings.isDistractionFree,\n\t\t\tisInserterShown: insertionPoint?.__unstableWithInserter,\n\t\t\tisZoomOutMode: isZoomOut(),\n\t\t};\n\t}, [] );\n\tconst { getBlockEditingMode } = useSelect( blockEditorStore );\n\n\tconst disableMotion = useReducedMotion();\n\n\tfunction onClick( event ) {\n\t\tif (\n\t\t\tevent.target === ref.current &&\n\t\t\tnextClientId &&\n\t\t\tgetBlockEditingMode( nextClientId ) !== 'disabled'\n\t\t) {\n\t\t\tselectBlock( nextClientId, -1 );\n\t\t}\n\t}\n\n\tfunction maybeHideInserterPoint( event ) {\n\t\t// Only hide the inserter if it's triggered on the wrapper,\n\t\t// and the inserter is not open.\n\t\tif ( event.target === ref.current && ! openRef.current ) {\n\t\t\thideInsertionPoint();\n\t\t}\n\t}\n\n\tfunction onFocus( event ) {\n\t\t// Only handle click on the wrapper specifically, and not an event\n\t\t// bubbled from the inserter itself.\n\t\tif ( event.target !== ref.current ) {\n\t\t\topenRef.current = true;\n\t\t}\n\t}\n\n\tconst lineVariants = {\n\t\t// Initial position starts from the center and invisible.\n\t\tstart: {\n\t\t\topacity: 0,\n\t\t\tscale: 0,\n\t\t},\n\t\t// The line expands to fill the container. If the inserter is visible it\n\t\t// is delayed so it appears orchestrated.\n\t\trest: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: isInserterShown ? 0.5 : 0, type: 'tween' },\n\t\t},\n\t\thover: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.5, type: 'tween' },\n\t\t},\n\t};\n\n\tconst inserterVariants = {\n\t\tstart: {\n\t\t\tscale: disableMotion ? 1 : 0,\n\t\t},\n\t\trest: {\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.4, type: 'tween' },\n\t\t},\n\t};\n\n\tif ( isDistractionFree ) {\n\t\treturn null;\n\t}\n\n\t// Zoom out mode should only show the insertion point for the insert operation.\n\t// Other operations such as \"group\" are when the editor tries to create a row\n\t// block by grouping the block being dragged with the block it's being dropped\n\t// onto.\n\tif ( isZoomOutMode && operation !== 'insert' ) {\n\t\treturn null;\n\t}\n\n\tconst orientationClassname =\n\t\torientation === 'horizontal' || operation === 'group'\n\t\t\t? 'is-horizontal'\n\t\t\t: 'is-vertical';\n\n\tconst className = clsx(\n\t\t'block-editor-block-list__insertion-point',\n\t\torientationClassname\n\t);\n\n\treturn (\n\t\t<BlockPopoverInbetween\n\t\t\tpreviousClientId={ previousClientId }\n\t\t\tnextClientId={ nextClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\toperation={ operation }\n\t\t\tnearestSide={ nearestSide }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tlayout={ ! disableMotion }\n\t\t\t\tinitial={ disableMotion ? 'rest' : 'start' }\n\t\t\t\tanimate=\"rest\"\n\t\t\t\twhileHover=\"hover\"\n\t\t\t\twhileTap=\"pressed\"\n\t\t\t\texit=\"start\"\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tclassName={ clsx( className, {\n\t\t\t\t\t'is-with-inserter': isInserterShown,\n\t\t\t\t} ) }\n\t\t\t\tonHoverEnd={ maybeHideInserterPoint }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ lineVariants }\n\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t\tdata-testid=\"block-list-insertion-point-indicator\"\n\t\t\t\t/>\n\t\t\t\t{ isInserterShown && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ inserterVariants }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'block-editor-block-list__insertion-point-inserter'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tclientId={ nextClientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\tonToggle={ ( isOpen ) => {\n\t\t\t\t\t\t\t\topenRef.current = isOpen;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonSelectOrClose={ () => {\n\t\t\t\t\t\t\t\topenRef.current = false;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</BlockPopoverInbetween>\n\t);\n}\n\nexport default function InsertionPoint( props ) {\n\tconst { insertionPoint, isVisible, isBlockListEmpty } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst blockInsertionPoint = getBlockInsertionPoint();\n\t\t\treturn {\n\t\t\t\tinsertionPoint: blockInsertionPoint,\n\t\t\t\tisVisible: isBlockInsertionPointVisible(),\n\t\t\t\tisBlockListEmpty:\n\t\t\t\t\tgetBlockCount( blockInsertionPoint?.rootClientId ) === 0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif (\n\t\t! isVisible ||\n\t\t// Don't render the insertion point if the block list is empty.\n\t\t// The insertion point will be represented by the appender instead.\n\t\tisBlockListEmpty\n\t) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Render a popover that overlays the block when the desired operation is to replace it.\n\t * Otherwise, render a popover in between blocks for the indication of inserting between them.\n\t */\n\treturn insertionPoint.operation === 'replace' ? (\n\t\t<BlockDropZonePopover\n\t\t\t// Force remount to trigger the animation.\n\t\t\tkey={ `${ insertionPoint.rootClientId }-${ insertionPoint.index }` }\n\t\t\t{ ...props }\n\t\t/>\n\t) : (\n\t\t<InbetweenInsertionPointPopover\n\t\t\toperation={ insertionPoint.operation }\n\t\t\tnearestSide={ insertionPoint.nearestSide }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AApB3C;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;AAOO,MAAMW,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG,IAAAE,sBAAa,EAAC,CAAC;AACpDF,qBAAqB,CAACG,WAAW,GAAG,8BAA8B;AAElE,SAASC,8BAA8BA,CAAE;EACxCC,qBAAqB;EACrBC,oBAAoB;EACpBC,SAAS,GAAG,QAAQ;EACpBC,WAAW,GAAG;AACf,CAAC,EAAG;EACH,MAAM;IAAEC,WAAW;IAAEC;EAAmB,CAAC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,GAAGhE,sBAAsB,CAAC,CAAC;IACpD,OAAO;MACNO,cAAc,EAAEyD,mBAAmB;MACnCJ,SAAS,EAAEE,4BAA4B,CAAC,CAAC;MACzCD,gBAAgB,EACfE,aAAa,CAAEC,mBAAmB,EAAExE,YAAa,CAAC,KAAK;IACzD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,IACC,CAAEoE,SAAS;EACX;EACA;EACAC,gBAAgB,EACf;IACD,OAAO,IAAI;EACZ;;EAEA;AACD;AACA;AACA;EACC,OAAOtD,cAAc,CAAC5B,SAAS,KAAK,SAAS,gBAC5C,IAAAR,WAAA,CAAAkE,GAAA,EAACpE,SAAA,CAAAqE;EACA;EAAA;IAAA,GAEKqB;EAAK,GADJ,GAAIpD,cAAc,CAACf,YAAY,IAAMe,cAAc,CAACI,KAAK,EAE/D,CAAC,gBAEF,IAAAxC,WAAA,CAAAkE,GAAA,EAAC7D,8BAA8B;IAC9BG,SAAS,EAAG4B,cAAc,CAAC5B,SAAW;IACtCC,WAAW,EAAG2B,cAAc,CAAC3B,WAAa;IAAA,GACrC+E;EAAK,CACV,CACD;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_element","_components","_compose","_inserter","_store","_inbetween","_dropZone","_lockUnlock","_jsxRuntime","InsertionPointOpenRef","exports","createContext","displayName","InbetweenInsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","operation","nearestSide","selectBlock","hideInsertionPoint","useDispatch","blockEditorStore","openRef","useContext","ref","useRef","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","isDistractionFree","isZoomOutMode","useSelect","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","getSettings","isZoomOut","unlock","insertionPoint","order","length","_previousClientId","index","_nextClientId","settings","__unstableWithInserter","getBlockEditingMode","disableMotion","useReducedMotion","onClick","event","target","current","maybeHideInserterPoint","onFocus","maybeResetOpenRef","useCallback","node","lineVariants","start","opacity","scale","rest","transition","delay","type","hover","inserterVariants","orientationClassname","className","clsx","jsx","default","children","jsxs","__unstableMotion","div","layout","initial","animate","whileHover","whileTap","exit","tabIndex","onHoverEnd","variants","position","clientId","__experimentalIsQuick","onToggle","isOpen","onSelectOrClose","InsertionPoint","props","isVisible","isBlockListEmpty","isBlockInsertionPointVisible","getBlockCount","blockInsertionPoint"],"sources":["@wordpress/block-editor/src/components/block-tools/insertion-point.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseRef,\n\tcreateContext,\n\tuseContext,\n\tuseCallback,\n} from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopoverInbetween from '../block-popover/inbetween';\nimport BlockDropZonePopover from '../block-popover/drop-zone';\nimport { unlock } from '../../lock-unlock';\n\nexport const InsertionPointOpenRef = createContext();\nInsertionPointOpenRef.displayName = 'InsertionPointOpenRefContext';\n\nfunction InbetweenInsertionPointPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\toperation = 'insert',\n\tnearestSide = 'right',\n} ) {\n\tconst { selectBlock, hideInsertionPoint } = useDispatch( blockEditorStore );\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst ref = useRef();\n\tconst {\n\t\torientation,\n\t\tpreviousClientId,\n\t\tnextClientId,\n\t\trootClientId,\n\t\tisInserterShown,\n\t\tisDistractionFree,\n\t\tisZoomOutMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockBeingDragged,\n\t\t\tgetPreviousBlockClientId,\n\t\t\tgetNextBlockClientId,\n\t\t\tgetSettings,\n\t\t\tisZoomOut,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet _previousClientId = order[ insertionPoint.index - 1 ];\n\t\tlet _nextClientId = order[ insertionPoint.index ];\n\n\t\twhile ( isBlockBeingDragged( _previousClientId ) ) {\n\t\t\t_previousClientId = getPreviousBlockClientId( _previousClientId );\n\t\t}\n\n\t\twhile ( isBlockBeingDragged( _nextClientId ) ) {\n\t\t\t_nextClientId = getNextBlockClientId( _nextClientId );\n\t\t}\n\n\t\tconst settings = getSettings();\n\n\t\treturn {\n\t\t\tpreviousClientId: _previousClientId,\n\t\t\tnextClientId: _nextClientId,\n\t\t\torientation:\n\t\t\t\tgetBlockListSettings( insertionPoint.rootClientId )\n\t\t\t\t\t?.orientation || 'vertical',\n\t\t\trootClientId: insertionPoint.rootClientId,\n\t\t\tisDistractionFree: settings.isDistractionFree,\n\t\t\tisInserterShown: insertionPoint?.__unstableWithInserter,\n\t\t\tisZoomOutMode: isZoomOut(),\n\t\t};\n\t}, [] );\n\tconst { getBlockEditingMode } = useSelect( blockEditorStore );\n\n\tconst disableMotion = useReducedMotion();\n\n\tfunction onClick( event ) {\n\t\tif (\n\t\t\tevent.target === ref.current &&\n\t\t\tnextClientId &&\n\t\t\tgetBlockEditingMode( nextClientId ) !== 'disabled'\n\t\t) {\n\t\t\tselectBlock( nextClientId, -1 );\n\t\t}\n\t}\n\n\tfunction maybeHideInserterPoint( event ) {\n\t\t// Only hide the inserter if it's triggered on the wrapper,\n\t\t// and the inserter is not open.\n\t\tif ( event.target === ref.current && ! openRef.current ) {\n\t\t\thideInsertionPoint();\n\t\t}\n\t}\n\n\tfunction onFocus( event ) {\n\t\t// Only handle click on the wrapper specifically, and not an event\n\t\t// bubbled from the inserter itself.\n\t\tif ( event.target !== ref.current ) {\n\t\t\topenRef.current = true;\n\t\t}\n\t}\n\n\t// Reset the insertion point reference when the Inserter unmounts,\n\t// avoids stale references when `onSelectOrClose` is not called.\n\t// See: https://github.com/WordPress/gutenberg/issues/65598#issuecomment-3249229264.\n\tconst maybeResetOpenRef = useCallback(\n\t\t( node ) => {\n\t\t\tif ( ! node && openRef.current ) {\n\t\t\t\topenRef.current = false;\n\t\t\t}\n\t\t},\n\t\t[ openRef ]\n\t);\n\n\tconst lineVariants = {\n\t\t// Initial position starts from the center and invisible.\n\t\tstart: {\n\t\t\topacity: 0,\n\t\t\tscale: 0,\n\t\t},\n\t\t// The line expands to fill the container. If the inserter is visible it\n\t\t// is delayed so it appears orchestrated.\n\t\trest: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: isInserterShown ? 0.5 : 0, type: 'tween' },\n\t\t},\n\t\thover: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.5, type: 'tween' },\n\t\t},\n\t};\n\n\tconst inserterVariants = {\n\t\tstart: {\n\t\t\tscale: disableMotion ? 1 : 0,\n\t\t},\n\t\trest: {\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.4, type: 'tween' },\n\t\t},\n\t};\n\n\tif ( isDistractionFree ) {\n\t\treturn null;\n\t}\n\n\t// Zoom out mode should only show the insertion point for the insert operation.\n\t// Other operations such as \"group\" are when the editor tries to create a row\n\t// block by grouping the block being dragged with the block it's being dropped\n\t// onto.\n\tif ( isZoomOutMode && operation !== 'insert' ) {\n\t\treturn null;\n\t}\n\n\tconst orientationClassname =\n\t\torientation === 'horizontal' || operation === 'group'\n\t\t\t? 'is-horizontal'\n\t\t\t: 'is-vertical';\n\n\tconst className = clsx(\n\t\t'block-editor-block-list__insertion-point',\n\t\torientationClassname\n\t);\n\n\treturn (\n\t\t<BlockPopoverInbetween\n\t\t\tpreviousClientId={ previousClientId }\n\t\t\tnextClientId={ nextClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\toperation={ operation }\n\t\t\tnearestSide={ nearestSide }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tlayout={ ! disableMotion }\n\t\t\t\tinitial={ disableMotion ? 'rest' : 'start' }\n\t\t\t\tanimate=\"rest\"\n\t\t\t\twhileHover=\"hover\"\n\t\t\t\twhileTap=\"pressed\"\n\t\t\t\texit=\"start\"\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tclassName={ clsx( className, {\n\t\t\t\t\t'is-with-inserter': isInserterShown,\n\t\t\t\t} ) }\n\t\t\t\tonHoverEnd={ maybeHideInserterPoint }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ lineVariants }\n\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t\tdata-testid=\"block-list-insertion-point-indicator\"\n\t\t\t\t/>\n\t\t\t\t{ isInserterShown && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ inserterVariants }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'block-editor-block-list__insertion-point-inserter'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tref={ maybeResetOpenRef }\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tclientId={ nextClientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\tonToggle={ ( isOpen ) => {\n\t\t\t\t\t\t\t\topenRef.current = isOpen;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonSelectOrClose={ () => {\n\t\t\t\t\t\t\t\topenRef.current = false;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</BlockPopoverInbetween>\n\t);\n}\n\nexport default function InsertionPoint( props ) {\n\tconst { insertionPoint, isVisible, isBlockListEmpty } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst blockInsertionPoint = getBlockInsertionPoint();\n\t\t\treturn {\n\t\t\t\tinsertionPoint: blockInsertionPoint,\n\t\t\t\tisVisible: isBlockInsertionPointVisible(),\n\t\t\t\tisBlockListEmpty:\n\t\t\t\t\tgetBlockCount( blockInsertionPoint?.rootClientId ) === 0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif (\n\t\t! isVisible ||\n\t\t// Don't render the insertion point if the block list is empty.\n\t\t// The insertion point will be represented by the appender instead.\n\t\tisBlockListEmpty\n\t) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Render a popover that overlays the block when the desired operation is to replace it.\n\t * Otherwise, render a popover in between blocks for the indication of inserting between them.\n\t */\n\treturn insertionPoint.operation === 'replace' ? (\n\t\t<BlockDropZonePopover\n\t\t\t// Force remount to trigger the animation.\n\t\t\tkey={ `${ insertionPoint.rootClientId }-${ insertionPoint.index }` }\n\t\t\t{ ...props }\n\t\t/>\n\t) : (\n\t\t<InbetweenInsertionPointPopover\n\t\t\toperation={ insertionPoint.operation }\n\t\t\tnearestSide={ insertionPoint.nearestSide }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAMA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAA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