@wordpress/block-editor 15.2.1-next.f34ab90e9.0 → 15.3.1-next.6870dfe5b.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/block-actions/index.js +3 -1
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-context/index.js +1 -0
- package/build/components/block-context/index.js.map +1 -1
- package/build/components/block-edit/context.js +1 -0
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-list/index.js +1 -0
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/layout.js +1 -0
- package/build/components/block-list/layout.js.map +1 -1
- package/build/components/block-list/private-block-context.js +1 -0
- package/build/components/block-list/private-block-context.js.map +1 -1
- package/build/components/block-popover/inbetween.js +1 -2
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/use-popover-scroll.js +11 -2
- package/build/components/block-popover/use-popover-scroll.js.map +1 -1
- package/build/components/block-toolbar/block-name-context.js +1 -0
- package/build/components/block-toolbar/block-name-context.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +1 -0
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +1 -1
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/global-styles/context.js +1 -0
- package/build/components/global-styles/context.js.map +1 -1
- package/build/components/image-editor/context.js +1 -0
- package/build/components/image-editor/context.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +1 -3
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter-listbox/context.js +1 -0
- package/build/components/inserter-listbox/context.js.map +1 -1
- package/build/components/inserter-listbox/index.js +11 -2
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/list-view/appender.js +13 -3
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/context.js +1 -0
- package/build/components/list-view/context.js.map +1 -1
- package/build/components/provider/block-refs-provider.js +1 -0
- package/build/components/provider/block-refs-provider.js.map +1 -1
- package/build/components/recursion-provider/index.js +1 -0
- package/build/components/recursion-provider/index.js.map +1 -1
- package/build/components/rich-text/index.js +2 -0
- package/build/components/rich-text/index.js.map +1 -1
- package/build/store/private-selectors.js +25 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/selectors.js +25 -5
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-actions/index.js +3 -1
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-context/index.js +1 -0
- package/build-module/components/block-context/index.js.map +1 -1
- package/build-module/components/block-edit/context.js +1 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-list/index.js +1 -0
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/layout.js +1 -0
- package/build-module/components/block-list/layout.js.map +1 -1
- package/build-module/components/block-list/private-block-context.js +1 -0
- package/build-module/components/block-list/private-block-context.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +1 -2
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/use-popover-scroll.js +11 -2
- package/build-module/components/block-popover/use-popover-scroll.js.map +1 -1
- package/build-module/components/block-toolbar/block-name-context.js +1 -0
- package/build-module/components/block-toolbar/block-name-context.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +1 -0
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/global-styles/context.js +1 -0
- package/build-module/components/global-styles/context.js.map +1 -1
- package/build-module/components/image-editor/context.js +1 -0
- package/build-module/components/image-editor/context.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +1 -3
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter-listbox/context.js +1 -0
- package/build-module/components/inserter-listbox/context.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +11 -2
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/list-view/appender.js +13 -3
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/context.js +1 -0
- package/build-module/components/list-view/context.js.map +1 -1
- package/build-module/components/provider/block-refs-provider.js +1 -0
- package/build-module/components/provider/block-refs-provider.js.map +1 -1
- package/build-module/components/recursion-provider/index.js +1 -0
- package/build-module/components/recursion-provider/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +2 -0
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/store/private-selectors.js +24 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/selectors.js +26 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/package.json +34 -34
- package/src/components/block-actions/index.js +6 -1
- package/src/components/block-context/index.js +1 -0
- package/src/components/block-draggable/test/helpers.native.js +8 -8
- package/src/components/block-edit/context.js +2 -0
- package/src/components/block-list/index.js +2 -0
- package/src/components/block-list/layout.js +1 -0
- package/src/components/block-list/private-block-context.js +1 -0
- package/src/components/block-popover/inbetween.js +1 -8
- package/src/components/block-popover/use-popover-scroll.js +10 -2
- package/src/components/block-toolbar/block-name-context.js +1 -0
- package/src/components/block-tools/insertion-point.js +1 -0
- package/src/components/block-tools/use-show-block-tools.js +1 -1
- package/src/components/global-styles/context.js +1 -0
- package/src/components/image-editor/context.js +1 -0
- package/src/components/inserter/hooks/use-insertion-point.js +1 -1
- package/src/components/inserter/index.js +1 -3
- package/src/components/inserter-listbox/context.js +1 -0
- package/src/components/inserter-listbox/index.js +10 -1
- package/src/components/list-view/appender.js +13 -6
- package/src/components/list-view/context.js +1 -0
- package/src/components/provider/block-refs-provider.js +1 -0
- package/src/components/recursion-provider/index.js +1 -0
- package/src/components/rich-text/index.js +3 -0
- package/src/store/private-selectors.js +29 -0
- package/src/store/selectors.js +42 -6
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -32,7 +32,9 @@ export default function BlockActions({
|
|
|
32
32
|
const directInsertBlock = rootClientId ? getDirectInsertBlock(rootClientId) : null;
|
|
33
33
|
return {
|
|
34
34
|
canRemove: canRemoveBlocks(clientIds),
|
|
35
|
-
canInsertBlock:
|
|
35
|
+
canInsertBlock: blocks.every(block => {
|
|
36
|
+
return (canInsertDefaultBlock || !!directInsertBlock) && canInsertBlockType(block.name, rootClientId);
|
|
37
|
+
}),
|
|
36
38
|
canCopyStyles: blocks.every(block => {
|
|
37
39
|
return !!block && (hasBlockSupport(block.name, 'color') || hasBlockSupport(block.name, 'typography'));
|
|
38
40
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useSelect","hasBlockSupport","switchToBlockType","store","blocksStore","usePasteStyles","blockEditorStore","BlockActions","clientIds","children","__experimentalUpdateSelection","updateSelection","getDefaultBlockName","getGroupingBlockName","selected","select","canInsertBlockType","getBlockRootClientId","getBlocksByClientId","getDirectInsertBlock","canRemoveBlocks","blocks","rootClientId","canInsertDefaultBlock","directInsertBlock","canRemove","canInsertBlock","
|
|
1
|
+
{"version":3,"names":["useDispatch","useSelect","hasBlockSupport","switchToBlockType","store","blocksStore","usePasteStyles","blockEditorStore","BlockActions","clientIds","children","__experimentalUpdateSelection","updateSelection","getDefaultBlockName","getGroupingBlockName","selected","select","canInsertBlockType","getBlockRootClientId","getBlocksByClientId","getDirectInsertBlock","canRemoveBlocks","blocks","rootClientId","canInsertDefaultBlock","directInsertBlock","canRemove","canInsertBlock","every","block","name","canCopyStyles","canDuplicate","getBlocks","removeBlocks","replaceBlocks","duplicateBlocks","insertAfterBlock","insertBeforeBlock","flashBlock","pasteStyles","onDuplicate","onRemove","onInsertBefore","onInsertAfter","length","onGroup","groupingBlockName","newBlocks","onUngroup","innerBlocks","onCopy","onPasteStyles"],"sources":["@wordpress/block-editor/src/components/block-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\thasBlockSupport,\n\tswitchToBlockType,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport usePasteStyles from '../use-paste-styles';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function BlockActions( {\n\tclientIds,\n\tchildren,\n\t__experimentalUpdateSelection: updateSelection,\n} ) {\n\tconst { getDefaultBlockName, getGroupingBlockName } =\n\t\tuseSelect( blocksStore );\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tgetDirectInsertBlock,\n\t\t\t\tcanRemoveBlocks,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\tconst canInsertDefaultBlock = canInsertBlockType(\n\t\t\t\tgetDefaultBlockName(),\n\t\t\t\trootClientId\n\t\t\t);\n\t\t\tconst directInsertBlock = rootClientId\n\t\t\t\t? getDirectInsertBlock( rootClientId )\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tcanRemove: canRemoveBlocks( clientIds ),\n\t\t\t\tcanInsertBlock: blocks.every( ( block ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t( canInsertDefaultBlock || !! directInsertBlock ) &&\n\t\t\t\t\t\tcanInsertBlockType( block.name, rootClientId )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t\t\tcanCopyStyles: blocks.every( ( block ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\t( hasBlockSupport( block.name, 'color' ) ||\n\t\t\t\t\t\t\thasBlockSupport( block.name, 'typography' ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t\t\tcanDuplicate: blocks.every( ( block ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\thasBlockSupport( block.name, 'multiple', true ) &&\n\t\t\t\t\t\tcanInsertBlockType( block.name, rootClientId )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ clientIds, getDefaultBlockName ]\n\t);\n\tconst { getBlocksByClientId, getBlocks } = useSelect( blockEditorStore );\n\n\tconst { canRemove, canInsertBlock, canCopyStyles, canDuplicate } = selected;\n\n\tconst {\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tduplicateBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tflashBlock,\n\t} = useDispatch( blockEditorStore );\n\n\tconst pasteStyles = usePasteStyles();\n\n\treturn children( {\n\t\tcanCopyStyles,\n\t\tcanDuplicate,\n\t\tcanInsertBlock,\n\t\tcanRemove,\n\t\tonDuplicate() {\n\t\t\treturn duplicateBlocks( clientIds, updateSelection );\n\t\t},\n\t\tonRemove() {\n\t\t\treturn removeBlocks( clientIds, updateSelection );\n\t\t},\n\t\tonInsertBefore() {\n\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t},\n\t\tonInsertAfter() {\n\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t},\n\t\tonGroup() {\n\t\t\tif ( ! clientIds.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst groupingBlockName = getGroupingBlockName();\n\n\t\t\t// Activate the `transform` on `core/group` which does the conversion.\n\t\t\tconst newBlocks = switchToBlockType(\n\t\t\t\tgetBlocksByClientId( clientIds ),\n\t\t\t\tgroupingBlockName\n\t\t\t);\n\n\t\t\tif ( ! newBlocks ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treplaceBlocks( clientIds, newBlocks );\n\t\t},\n\t\tonUngroup() {\n\t\t\tif ( ! clientIds.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst innerBlocks = getBlocks( clientIds[ 0 ] );\n\t\t\tif ( ! innerBlocks.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\treplaceBlocks( clientIds, innerBlocks );\n\t\t},\n\t\tonCopy() {\n\t\t\tif ( clientIds.length === 1 ) {\n\t\t\t\tflashBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t},\n\t\tasync onPasteStyles() {\n\t\t\tawait pasteStyles( getBlocksByClientId( clientIds ) );\n\t\t},\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,eAAe,EACfC,iBAAiB,EACjBC,KAAK,IAAIC,WAAW,QACd,mBAAmB;;AAE1B;AACA;AACA;AACA,OAAOC,cAAc,MAAM,qBAAqB;AAChD,SAASF,KAAK,IAAIG,gBAAgB,QAAQ,aAAa;AAEvD,eAAe,SAASC,YAAYA,CAAE;EACrCC,SAAS;EACTC,QAAQ;EACRC,6BAA6B,EAAEC;AAChC,CAAC,EAAG;EACH,MAAM;IAAEC,mBAAmB;IAAEC;EAAqB,CAAC,GAClDb,SAAS,CAAEI,WAAY,CAAC;EACzB,MAAMU,QAAQ,GAAGd,SAAS,CACvBe,MAAM,IAAM;IACb,MAAM;MACLC,kBAAkB;MAClBC,oBAAoB;MACpBC,mBAAmB;MACnBC,oBAAoB;MACpBC;IACD,CAAC,GAAGL,MAAM,CAAET,gBAAiB,CAAC;IAE9B,MAAMe,MAAM,GAAGH,mBAAmB,CAAEV,SAAU,CAAC;IAC/C,MAAMc,YAAY,GAAGL,oBAAoB,CAAET,SAAS,CAAE,CAAC,CAAG,CAAC;IAC3D,MAAMe,qBAAqB,GAAGP,kBAAkB,CAC/CJ,mBAAmB,CAAC,CAAC,EACrBU,YACD,CAAC;IACD,MAAME,iBAAiB,GAAGF,YAAY,GACnCH,oBAAoB,CAAEG,YAAa,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D;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -16,6 +16,7 @@ import { createContext, useContext, useMemo } from '@wordpress/element';
|
|
|
16
16
|
/** @type {import('react').Context<Record<string,*>>} */
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
const Context = createContext({});
|
|
19
|
+
Context.displayName = 'BlockContext';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Component which merges passed value with current consumed block context.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useContext","useMemo","jsx","_jsx","Context","BlockContextProvider","value","children","context","nextValue","Provider"],"sources":["@wordpress/block-editor/src/components/block-context/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext, useMemo } from '@wordpress/element';\n\n/** @typedef {import('react').ReactNode} ReactNode */\n\n/**\n * @typedef BlockContextProviderProps\n *\n * @property {Record<string,*>} value Context value to merge with current\n * value.\n * @property {ReactNode} children Component children.\n */\n\n/** @type {import('react').Context<Record<string,*>>} */\nconst Context = createContext( {} );\n\n/**\n * Component which merges passed value with current consumed block context.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-context/README.md\n *\n * @param {BlockContextProviderProps} props\n */\nexport function BlockContextProvider( { value, children } ) {\n\tconst context = useContext( Context );\n\tconst nextValue = useMemo(\n\t\t() => ( { ...context, ...value } ),\n\t\t[ context, value ]\n\t);\n\n\treturn <Context.Provider value={ nextValue } children={ children } />;\n}\n\nexport default Context;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;;AAEvE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,MAAMC,OAAO,GAAGL,aAAa,CAAE,CAAC,CAAE,CAAC;;
|
|
1
|
+
{"version":3,"names":["createContext","useContext","useMemo","jsx","_jsx","Context","displayName","BlockContextProvider","value","children","context","nextValue","Provider"],"sources":["@wordpress/block-editor/src/components/block-context/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext, useMemo } from '@wordpress/element';\n\n/** @typedef {import('react').ReactNode} ReactNode */\n\n/**\n * @typedef BlockContextProviderProps\n *\n * @property {Record<string,*>} value Context value to merge with current\n * value.\n * @property {ReactNode} children Component children.\n */\n\n/** @type {import('react').Context<Record<string,*>>} */\nconst Context = createContext( {} );\nContext.displayName = 'BlockContext';\n\n/**\n * Component which merges passed value with current consumed block context.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-context/README.md\n *\n * @param {BlockContextProviderProps} props\n */\nexport function BlockContextProvider( { value, children } ) {\n\tconst context = useContext( Context );\n\tconst nextValue = useMemo(\n\t\t() => ( { ...context, ...value } ),\n\t\t[ context, value ]\n\t);\n\n\treturn <Context.Provider value={ nextValue } children={ children } />;\n}\n\nexport default Context;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;;AAEvE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,MAAMC,OAAO,GAAGL,aAAa,CAAE,CAAC,CAAE,CAAC;AACnCK,OAAO,CAACC,WAAW,GAAG,cAAc;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAE;EAAEC,KAAK;EAAEC;AAAS,CAAC,EAAG;EAC3D,MAAMC,OAAO,GAAGT,UAAU,CAAEI,OAAQ,CAAC;EACrC,MAAMM,SAAS,GAAGT,OAAO,CACxB,OAAQ;IAAE,GAAGQ,OAAO;IAAE,GAAGF;EAAM,CAAC,CAAE,EAClC,CAAEE,OAAO,EAAEF,KAAK,CACjB,CAAC;EAED,oBAAOJ,IAAA,CAACC,OAAO,CAACO,QAAQ;IAACJ,KAAK,EAAGG,SAAW;IAACF,QAAQ,EAAGA;EAAU,CAAE,CAAC;AACtE;AAEA,eAAeJ,OAAO","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useContext","mayDisplayControlsKey","Symbol","mayDisplayParentControlsKey","blockEditingModeKey","blockBindingsKey","isPreviewModeKey","DEFAULT_BLOCK_EDIT_CONTEXT","name","isSelected","Context","Provider","BlockEditContextProvider","useBlockEditContext"],"sources":["@wordpress/block-editor/src/components/block-edit/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nexport const mayDisplayControlsKey = Symbol( 'mayDisplayControls' );\nexport const mayDisplayParentControlsKey = Symbol( 'mayDisplayParentControls' );\nexport const blockEditingModeKey = Symbol( 'blockEditingMode' );\nexport const blockBindingsKey = Symbol( 'blockBindings' );\nexport const isPreviewModeKey = Symbol( 'isPreviewMode' );\n\nexport const DEFAULT_BLOCK_EDIT_CONTEXT = {\n\tname: '',\n\tisSelected: false,\n};\n\nconst Context = createContext( DEFAULT_BLOCK_EDIT_CONTEXT );\nconst { Provider } = Context;\n\nexport { Provider as BlockEditContextProvider };\n\n/**\n * A hook that returns the block edit context.\n *\n * @return {Object} Block edit context\n */\nexport function useBlockEditContext() {\n\treturn useContext( Context );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;AAE9D,OAAO,MAAMC,qBAAqB,GAAGC,MAAM,CAAE,oBAAqB,CAAC;AACnE,OAAO,MAAMC,2BAA2B,GAAGD,MAAM,CAAE,0BAA2B,CAAC;AAC/E,OAAO,MAAME,mBAAmB,GAAGF,MAAM,CAAE,kBAAmB,CAAC;AAC/D,OAAO,MAAMG,gBAAgB,GAAGH,MAAM,CAAE,eAAgB,CAAC;AACzD,OAAO,MAAMI,gBAAgB,GAAGJ,MAAM,CAAE,eAAgB,CAAC;AAEzD,OAAO,MAAMK,0BAA0B,GAAG;EACzCC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACb,CAAC;AAED,MAAMC,OAAO,GAAGX,aAAa,CAAEQ,0BAA2B,CAAC;
|
|
1
|
+
{"version":3,"names":["createContext","useContext","mayDisplayControlsKey","Symbol","mayDisplayParentControlsKey","blockEditingModeKey","blockBindingsKey","isPreviewModeKey","DEFAULT_BLOCK_EDIT_CONTEXT","name","isSelected","Context","displayName","Provider","BlockEditContextProvider","useBlockEditContext"],"sources":["@wordpress/block-editor/src/components/block-edit/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nexport const mayDisplayControlsKey = Symbol( 'mayDisplayControls' );\nexport const mayDisplayParentControlsKey = Symbol( 'mayDisplayParentControls' );\nexport const blockEditingModeKey = Symbol( 'blockEditingMode' );\nexport const blockBindingsKey = Symbol( 'blockBindings' );\nexport const isPreviewModeKey = Symbol( 'isPreviewMode' );\n\nexport const DEFAULT_BLOCK_EDIT_CONTEXT = {\n\tname: '',\n\tisSelected: false,\n};\n\nconst Context = createContext( DEFAULT_BLOCK_EDIT_CONTEXT );\nContext.displayName = 'BlockEditContext';\n\nconst { Provider } = Context;\n\nexport { Provider as BlockEditContextProvider };\n\n/**\n * A hook that returns the block edit context.\n *\n * @return {Object} Block edit context\n */\nexport function useBlockEditContext() {\n\treturn useContext( Context );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;AAE9D,OAAO,MAAMC,qBAAqB,GAAGC,MAAM,CAAE,oBAAqB,CAAC;AACnE,OAAO,MAAMC,2BAA2B,GAAGD,MAAM,CAAE,0BAA2B,CAAC;AAC/E,OAAO,MAAME,mBAAmB,GAAGF,MAAM,CAAE,kBAAmB,CAAC;AAC/D,OAAO,MAAMG,gBAAgB,GAAGH,MAAM,CAAE,eAAgB,CAAC;AACzD,OAAO,MAAMI,gBAAgB,GAAGJ,MAAM,CAAE,eAAgB,CAAC;AAEzD,OAAO,MAAMK,0BAA0B,GAAG;EACzCC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE;AACb,CAAC;AAED,MAAMC,OAAO,GAAGX,aAAa,CAAEQ,0BAA2B,CAAC;AAC3DG,OAAO,CAACC,WAAW,GAAG,kBAAkB;AAExC,MAAM;EAAEC;AAAS,CAAC,GAAGF,OAAO;AAE5B,SAASE,QAAQ,IAAIC,wBAAwB;;AAE7C;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAA,EAAG;EACrC,OAAOd,UAAU,CAAEU,OAAQ,CAAC;AAC7B","ignoreList":[]}
|
|
@@ -27,6 +27,7 @@ import { ZoomOutSeparator } from './zoom-out-separator';
|
|
|
27
27
|
import { unlock } from '../../lock-unlock';
|
|
28
28
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
29
|
export const IntersectionObserver = createContext();
|
|
30
|
+
IntersectionObserver.displayName = 'IntersectionObserverContext';
|
|
30
31
|
const pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();
|
|
31
32
|
function Root({
|
|
32
33
|
className,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","AsyncModeProvider","useSelect","useDispatch","useRegistry","useMergeRefs","useDebounce","createContext","useMemo","useCallback","useEffect","getDefaultBlockName","BlockListBlock","BlockListAppender","useInBetweenInserter","store","blockEditorStore","LayoutProvider","defaultLayout","useBlockSelectionClearer","useInnerBlocksProps","BlockEditContextProvider","DEFAULT_BLOCK_EDIT_CONTEXT","useTypingObserver","ZoomOutSeparator","unlock","jsx","_jsx","jsxs","_jsxs","IntersectionObserver","pendingBlockVisibilityUpdatesPerRegistry","WeakMap","Root","className","settings","isOutlineMode","isFocusMode","temporarilyEditingAsBlocks","select","getSettings","getTemporarilyEditingAsBlocks","isTyping","outlineMode","focusMode","registry","setBlockVisibility","delayedBlockVisibilityUpdates","updates","get","forEach","id","isIntersecting","trailing","intersectionObserver","Observer","window","entries","set","entry","clientId","target","getAttribute","push","innerBlocksProps","ref","Provider","value","children","StopEditingAsBlocksOnOutsideSelect","stopEditingAsBlocks","isBlockOrDescendantSelected","isBlockSelected","hasSelectedInnerBlock","BlockList","EMPTY_ARRAY","EMPTY_SET","Set","Items","placeholder","rootClientId","renderAppender","CustomAppender","__experimentalAppenderTagName","layout","hasAppender","hasCustomAppender","order","isZoomOut","selectedBlocks","visibleBlocks","shouldRenderAppender","getBlockOrder","getSelectedBlockClientIds","__unstableGetVisibleBlocks","getTemplateLock","getBlockEditingMode","isSectionBlock","_isZoomOut","canInsertBlockType","_order","isPreviewMode","selectedBlockClientIds","selectedBlockClientId","showRootAppender","length","hasSelectedRoot","map","has","includes","position","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();\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":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,iBAAiB,EACjBC,SAAS,EACTC,WAAW,EACXC,WAAW,QACL,iBAAiB;AACxB,SAASC,YAAY,EAAEC,WAAW,QAAQ,oBAAoB;AAC9D,SACCC,aAAa,EACbC,OAAO,EACPC,WAAW,EACXC,SAAS,QACH,oBAAoB;AAC3B,SAASC,mBAAmB,QAAQ,mBAAmB;;AAEvD;AACA;AACA;AACA,OAAOC,cAAc,MAAM,SAAS;AACpC,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,cAAc,EAAEC,aAAa,QAAQ,UAAU;AACxD,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SACCC,wBAAwB,EACxBC,0BAA0B,QACpB,uBAAuB;AAC9B,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,OAAO,MAAMC,oBAAoB,GAAGvB,aAAa,CAAC,CAAC;AACnD,MAAMwB,wCAAwC,GAAG,IAAIC,OAAO,CAAC,CAAC;AAE9D,SAASC,IAAIA,CAA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tB/B,KAAA,CAAC5B,iBAAiB;MAEjBkE,KAAK;MACJ;MACA;MACA,CAAEuB,aAAa,CAACkB,GAAG,CAAEhD,QAAS,CAAC,IAC/B,CAAE6B,cAAc,CAACoB,QAAQ,CAAEjD,QAAS,CACpC;MAAAQ,QAAA,GAECoB,SAAS,iBACV7D,IAAA,CAACH,gBAAgB;QAChBoC,QAAQ,EAAGA,QAAU;QACrBoB,YAAY,EAAGA,YAAc;QAC7B8B,QAAQ,EAAC;MAAK,CACd,CACD,eACDnF,IAAA,CAACf,cAAc;QACdoE,YAAY,EAAGA,YAAc;QAC7BpB,QAAQ,EAAGA;MAAU,CACrB,CAAC,EACA4B,SAAS,iBACV7D,IAAA,CAACH,gBAAgB;QAChBoC,QAAQ,EAAGA,QAAU;QACrBoB,YAAY,EAAGA,YAAc;QAC7B8B,QAAQ,EAAC;MAAQ,CACjB,CACD;IAAA,GAzBKlD,QA0BY,CAClB,CAAC,EACD2B,KAAK,CAACkB,MAAM,GAAG,CAAC,IAAI1B,WAAW,EAC/BY,oBAAoB,iBACrBhE,IAAA,CAACd,iBAAiB;MACjBkG,OAAO,EAAG5B,6BAA+B;MACzCH,YAAY,EAAGA,YAAc;MAC7BE,cAAc,EAAGA;IAAgB,CACjC,CACD;EAAA,CACc,CAAC;AAEnB;AAEA,OAAO,SAAS8B,cAAcA,CAAEC,KAAK,EAAG;EACvC;EACA;EACA,oBACCtF,IAAA,CAAC1B,iBAAiB;IAACkE,KAAK,EAAG,KAAO;IAAAC,QAAA,eACjCzC,IAAA,CAACmD,KAAK;MAAA,GAAMmC;IAAK,CAAI;EAAC,CACJ,CAAC;AAEtB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","AsyncModeProvider","useSelect","useDispatch","useRegistry","useMergeRefs","useDebounce","createContext","useMemo","useCallback","useEffect","getDefaultBlockName","BlockListBlock","BlockListAppender","useInBetweenInserter","store","blockEditorStore","LayoutProvider","defaultLayout","useBlockSelectionClearer","useInnerBlocksProps","BlockEditContextProvider","DEFAULT_BLOCK_EDIT_CONTEXT","useTypingObserver","ZoomOutSeparator","unlock","jsx","_jsx","jsxs","_jsxs","IntersectionObserver","displayName","pendingBlockVisibilityUpdatesPerRegistry","WeakMap","Root","className","settings","isOutlineMode","isFocusMode","temporarilyEditingAsBlocks","select","getSettings","getTemporarilyEditingAsBlocks","isTyping","outlineMode","focusMode","registry","setBlockVisibility","delayedBlockVisibilityUpdates","updates","get","forEach","id","isIntersecting","trailing","intersectionObserver","Observer","window","entries","set","entry","clientId","target","getAttribute","push","innerBlocksProps","ref","Provider","value","children","StopEditingAsBlocksOnOutsideSelect","stopEditingAsBlocks","isBlockOrDescendantSelected","isBlockSelected","hasSelectedInnerBlock","BlockList","EMPTY_ARRAY","EMPTY_SET","Set","Items","placeholder","rootClientId","renderAppender","CustomAppender","__experimentalAppenderTagName","layout","hasAppender","hasCustomAppender","order","isZoomOut","selectedBlocks","visibleBlocks","shouldRenderAppender","getBlockOrder","getSelectedBlockClientIds","__unstableGetVisibleBlocks","getTemplateLock","getBlockEditingMode","isSectionBlock","_isZoomOut","canInsertBlockType","_order","isPreviewMode","selectedBlockClientIds","selectedBlockClientId","showRootAppender","length","hasSelectedRoot","map","has","includes","position","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":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,iBAAiB,EACjBC,SAAS,EACTC,WAAW,EACXC,WAAW,QACL,iBAAiB;AACxB,SAASC,YAAY,EAAEC,WAAW,QAAQ,oBAAoB;AAC9D,SACCC,aAAa,EACbC,OAAO,EACPC,WAAW,EACXC,SAAS,QACH,oBAAoB;AAC3B,SAASC,mBAAmB,QAAQ,mBAAmB;;AAEvD;AACA;AACA;AACA,OAAOC,cAAc,MAAM,SAAS;AACpC,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,cAAc,EAAEC,aAAa,QAAQ,UAAU;AACxD,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,mBAAmB,QAAQ,iBAAiB;AACr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AK,EAAG;EACvC;EACA;EACA,oBACCvF,IAAA,CAAC1B,iBAAiB;IAACmE,KAAK,EAAG,KAAO;IAAAC,QAAA,eACjC1C,IAAA,CAACoD,KAAK;MAAA,GAAMmC;IAAK,CAAI;EAAC,CACJ,CAAC;AAEtB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useContext","getLayoutType","useSettings","jsx","_jsx","defaultLayout","type","Layout","LayoutProvider","Provider","useLayout","LayoutStyle","layout","css","props","layoutType","blockGapSupport","hasBlockGapSupport","children","layoutStyle","getLayoutStyle"],"sources":["@wordpress/block-editor/src/components/block-list/layout.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getLayoutType } from '../../layouts';\nimport { useSettings } from '../use-settings';\n\nexport const defaultLayout = { type: 'default' };\n\nconst Layout = createContext( defaultLayout );\n\n/**\n * Allows to define the layout.\n */\nexport const LayoutProvider = Layout.Provider;\n\n/**\n * React hook used to retrieve the layout config.\n */\nexport function useLayout() {\n\treturn useContext( Layout );\n}\n\nexport function LayoutStyle( { layout = {}, css, ...props } ) {\n\tconst layoutType = getLayoutType( layout.type );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\tif ( layoutType ) {\n\t\tif ( css ) {\n\t\t\treturn <style>{ css }</style>;\n\t\t}\n\t\tconst layoutStyle = layoutType.getLayoutStyle?.( {\n\t\t\thasBlockGapSupport,\n\t\t\tlayout,\n\t\t\t...props,\n\t\t} );\n\t\tif ( layoutStyle ) {\n\t\t\treturn <style>{ layoutStyle }</style>;\n\t\t}\n\t}\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;;AAE9D;AACA;AACA;AACA,SAASC,aAAa,QAAQ,eAAe;AAC7C,SAASC,WAAW,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE9C,OAAO,MAAMC,aAAa,GAAG;EAAEC,IAAI,EAAE;AAAU,CAAC;AAEhD,MAAMC,MAAM,GAAGR,aAAa,CAAEM,aAAc,CAAC;;
|
|
1
|
+
{"version":3,"names":["createContext","useContext","getLayoutType","useSettings","jsx","_jsx","defaultLayout","type","Layout","displayName","LayoutProvider","Provider","useLayout","LayoutStyle","layout","css","props","layoutType","blockGapSupport","hasBlockGapSupport","children","layoutStyle","getLayoutStyle"],"sources":["@wordpress/block-editor/src/components/block-list/layout.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getLayoutType } from '../../layouts';\nimport { useSettings } from '../use-settings';\n\nexport const defaultLayout = { type: 'default' };\n\nconst Layout = createContext( defaultLayout );\nLayout.displayName = 'BlockLayoutContext';\n\n/**\n * Allows to define the layout.\n */\nexport const LayoutProvider = Layout.Provider;\n\n/**\n * React hook used to retrieve the layout config.\n */\nexport function useLayout() {\n\treturn useContext( Layout );\n}\n\nexport function LayoutStyle( { layout = {}, css, ...props } ) {\n\tconst layoutType = getLayoutType( layout.type );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\tif ( layoutType ) {\n\t\tif ( css ) {\n\t\t\treturn <style>{ css }</style>;\n\t\t}\n\t\tconst layoutStyle = layoutType.getLayoutStyle?.( {\n\t\t\thasBlockGapSupport,\n\t\t\tlayout,\n\t\t\t...props,\n\t\t} );\n\t\tif ( layoutStyle ) {\n\t\t\treturn <style>{ layoutStyle }</style>;\n\t\t}\n\t}\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;;AAE9D;AACA;AACA;AACA,SAASC,aAAa,QAAQ,eAAe;AAC7C,SAASC,WAAW,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE9C,OAAO,MAAMC,aAAa,GAAG;EAAEC,IAAI,EAAE;AAAU,CAAC;AAEhD,MAAMC,MAAM,GAAGR,aAAa,CAAEM,aAAc,CAAC;AAC7CE,MAAM,CAACC,WAAW,GAAG,oBAAoB;;AAEzC;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAGF,MAAM,CAACG,QAAQ;;AAE7C;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAAA,EAAG;EAC3B,OAAOX,UAAU,CAAEO,MAAO,CAAC;AAC5B;AAEA,OAAO,SAASK,WAAWA,CAAE;EAAEC,MAAM,GAAG,CAAC,CAAC;EAAEC,GAAG;EAAE,GAAGC;AAAM,CAAC,EAAG;EAC7D,MAAMC,UAAU,GAAGf,aAAa,CAAEY,MAAM,CAACP,IAAK,CAAC;EAC/C,MAAM,CAAEW,eAAe,CAAE,GAAGf,WAAW,CAAE,kBAAmB,CAAC;EAC7D,MAAMgB,kBAAkB,GAAGD,eAAe,KAAK,IAAI;EAEnD,IAAKD,UAAU,EAAG;IACjB,IAAKF,GAAG,EAAG;MACV,oBAAOV,IAAA;QAAAe,QAAA,EAASL;MAAG,CAAS,CAAC;IAC9B;IACA,MAAMM,WAAW,GAAGJ,UAAU,CAACK,cAAc,GAAI;MAChDH,kBAAkB;MAClBL,MAAM;MACN,GAAGE;IACJ,CAAE,CAAC;IACH,IAAKK,WAAW,EAAG;MAClB,oBAAOhB,IAAA;QAAAe,QAAA,EAASC;MAAW,CAAS,CAAC;IACtC;EACD;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","PrivateBlockContext"],"sources":["@wordpress/block-editor/src/components/block-list/private-block-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nexport const PrivateBlockContext = createContext( {} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAElD,OAAO,MAAMC,mBAAmB,GAAGD,aAAa,CAAE,CAAC,CAAE,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createContext","PrivateBlockContext","displayName"],"sources":["@wordpress/block-editor/src/components/block-list/private-block-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nexport const PrivateBlockContext = createContext( {} );\nPrivateBlockContext.displayName = 'PrivateBlockContext';\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAElD,OAAO,MAAMC,mBAAmB,GAAGD,aAAa,CAAE,CAAC,CAAE,CAAC;AACtDC,mBAAmB,CAACC,WAAW,GAAG,qBAAqB","ignoreList":[]}
|
|
@@ -7,7 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { useMemo,
|
|
10
|
+
import { useMemo, useReducer, useLayoutEffect } from '@wordpress/element';
|
|
11
11
|
import { Popover } from '@wordpress/components';
|
|
12
12
|
import { isRTL } from '@wordpress/i18n';
|
|
13
13
|
|
|
@@ -19,7 +19,6 @@ import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
|
19
19
|
import usePopoverScroll from './use-popover-scroll';
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
21
|
const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
|
|
22
|
-
export const InsertionPointOpenRef = createContext();
|
|
23
22
|
function BlockPopoverInbetween({
|
|
24
23
|
previousClientId,
|
|
25
24
|
nextClientId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useSelect","useMemo","createContext","useReducer","useLayoutEffect","Popover","isRTL","store","blockEditorStore","useBlockElement","usePopoverScroll","jsx","_jsx","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","InsertionPointOpenRef","BlockPopoverInbetween","previousClientId","nextClientId","children","__unstablePopoverSlot","__unstableContentRef","operation","nearestSide","props","popoverRecomputeCounter","forcePopoverRecompute","s","orientation","rootClientId","isVisible","select","getBlockListSettings","getBlockRootClientId","isBlockVisible","_rootClientId","previousElement","nextElement","isVertical","popoverAnchor","undefined","contextElement","getBoundingClientRect","previousRect","nextRect","left","top","width","height","targetRect","bottom","right","Math","max","window","DOMRect","popoverScrollRef","observer","MutationObserver","observe","attributes","disconnect","ownerDocument","defaultView","addEventListener","removeEventListener","ref","animate","anchor","focusOnMount","__unstableSlotName","inline","className","resize","flip","placement","variant"],"sources":["@wordpress/block-editor/src/components/block-popover/inbetween.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseMemo,\n\tcreateContext,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { Popover } from '@wordpress/components';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction BlockPopoverInbetween( {\n\tpreviousClientId,\n\tnextClientId,\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\toperation = 'insert',\n\tnearestSide = 'right',\n\t...props\n} ) {\n\t// This is a temporary hack to get the inbetween inserter to recompute properly.\n\tconst [ popoverRecomputeCounter, forcePopoverRecompute ] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\tconst { orientation, rootClientId, isVisible } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tisBlockVisible,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _rootClientId = getBlockRootClientId(\n\t\t\t\tpreviousClientId ?? nextClientId\n\t\t\t);\n\t\t\treturn {\n\t\t\t\torientation:\n\t\t\t\t\tgetBlockListSettings( _rootClientId )?.orientation ||\n\t\t\t\t\t'vertical',\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisVisible:\n\t\t\t\t\tisBlockVisible( previousClientId ) &&\n\t\t\t\t\tisBlockVisible( nextClientId ),\n\t\t\t};\n\t\t},\n\t\t[ previousClientId, nextClientId ]\n\t);\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\tconst isVertical = orientation === 'vertical';\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverRecomputeCounter is by definition always equal or greater than 0.\n\t\t\t// This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverRecomputeCounter < 0 ||\n\t\t\t( ! previousElement && ! nextElement ) ||\n\t\t\t! isVisible\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst contextElement =\n\t\t\toperation === 'group'\n\t\t\t\t? nextElement || previousElement\n\t\t\t\t: previousElement || nextElement;\n\n\t\treturn {\n\t\t\tcontextElement,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst previousRect = previousElement\n\t\t\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t\t\t: null;\n\t\t\t\tconst nextRect = nextElement\n\t\t\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t\t\t: null;\n\n\t\t\t\tlet left = 0;\n\t\t\t\tlet top = 0;\n\t\t\t\tlet width = 0;\n\t\t\t\tlet height = 0;\n\n\t\t\t\tif ( operation === 'group' ) {\n\t\t\t\t\tconst targetRect = nextRect || previousRect;\n\t\t\t\t\ttop = targetRect.top;\n\t\t\t\t\t// No spacing is likely around blocks in this operation.\n\t\t\t\t\t// So width of the inserter containing rect is set to 0.\n\t\t\t\t\twidth = 0;\n\t\t\t\t\theight = targetRect.bottom - targetRect.top;\n\t\t\t\t\t// Popover calculates its distance from mid-block so some\n\t\t\t\t\t// adjustments are needed to make it appear in the right place.\n\t\t\t\t\tleft =\n\t\t\t\t\t\tnearestSide === 'left'\n\t\t\t\t\t\t\t? targetRect.left - 2\n\t\t\t\t\t\t\t: targetRect.right - 2;\n\t\t\t\t} else if ( isVertical ) {\n\t\t\t\t\t// vertical\n\t\t\t\t\ttop = previousRect ? previousRect.bottom : nextRect.top;\n\t\t\t\t\twidth = previousRect ? previousRect.width : nextRect.width;\n\t\t\t\t\theight =\n\t\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t\t: 0;\n\t\t\t\t\tleft = previousRect ? previousRect.left : nextRect.left;\n\t\t\t\t} else {\n\t\t\t\t\ttop = previousRect ? previousRect.top : nextRect.top;\n\t\t\t\t\theight = previousRect\n\t\t\t\t\t\t? previousRect.height\n\t\t\t\t\t\t: nextRect.height;\n\n\t\t\t\t\tif ( isRTL() ) {\n\t\t\t\t\t\t// non vertical, rtl\n\t\t\t\t\t\tleft = nextRect ? nextRect.right : previousRect.left;\n\t\t\t\t\t\twidth =\n\t\t\t\t\t\t\tpreviousRect && nextRect\n\t\t\t\t\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// non vertical, ltr\n\t\t\t\t\t\tleft = previousRect\n\t\t\t\t\t\t\t? previousRect.right\n\t\t\t\t\t\t\t: nextRect.left;\n\t\t\t\t\t\twidth =\n\t\t\t\t\t\t\tpreviousRect && nextRect\n\t\t\t\t\t\t\t\t? nextRect.left - previousRect.right\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Avoid a negative width which happens when the next rect\n\t\t\t\t\t// is on the next line.\n\t\t\t\t\twidth = Math.max( width, 0 );\n\t\t\t\t}\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t};\n\t}, [\n\t\tpreviousElement,\n\t\tnextElement,\n\t\tpopoverRecomputeCounter,\n\t\tisVertical,\n\t\tisVisible,\n\t\toperation,\n\t\tnearestSide,\n\t] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\n\t// This is only needed for a smooth transition when moving blocks.\n\t// When blocks are moved up/down, their position can be set by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forcePopoverRecompute );\n\t\tobserver.observe( previousElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ previousElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! nextElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forcePopoverRecompute );\n\t\tobserver.observe( nextElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ nextElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tpreviousElement.ownerDocument.defaultView.addEventListener(\n\t\t\t'resize',\n\t\t\tforcePopoverRecompute\n\t\t);\n\t\treturn () => {\n\t\t\tpreviousElement.ownerDocument.defaultView?.removeEventListener(\n\t\t\t\t'resize',\n\t\t\t\tforcePopoverRecompute\n\t\t\t);\n\t\t};\n\t}, [ previousElement ] );\n\n\t// If there's either a previous or a next element, show the inbetween popover.\n\t// Note that drag and drop uses the inbetween popover to show the drop indicator\n\t// before the first block and after the last block.\n\tif ( ( ! previousElement && ! nextElement ) || ! isVisible ) {\n\t\treturn null;\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tanimate={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tfocusOnMount={ false }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot }\n\t\t\tinline={ ! __unstablePopoverSlot }\n\t\t\t// Forces a remount of the popover when its position changes\n\t\t\t// This makes sure the popover doesn't animate from its previous position.\n\t\t\tkey={ nextClientId + '--' + rootClientId }\n\t\t\t{ ...props }\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\t'block-editor-block-popover__inbetween',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tplacement=\"overlay\"\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"block-editor-block-popover__inbetween-container\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default BlockPopoverInbetween;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,OAAO,EACPC,aA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;EACA;EACA;EACA;EACA;EACA;EACA;EACA,oBACCnB,IAAA,CAACP,OAAO;IACP8D,GAAG,EAAGV,gBAAkB;IACxBW,OAAO,EAAG,KAAO;IACjBC,MAAM,EAAG7B,aAAe;IACxB8B,YAAY,EAAG;IACf;IACA;IAAA;IACAC,kBAAkB,EAAGlD,qBAAuB;IAC5CmD,MAAM,EAAG,CAAEnD;IACX;IACA;IAAA;IAAA,GAEKI,KAAK;IACVgD,SAAS,EAAG1E,IAAI,CACf,4BAA4B,EAC5B,uCAAuC,EACvC0B,KAAK,CAACgD,SACP,CAAG;IACHC,MAAM,EAAG,KAAO;IAChBC,IAAI,EAAG,KAAO;IACdC,SAAS,EAAC,SAAS;IACnBC,OAAO,EAAC,UAAU;IAAAzD,QAAA,eAElBR,IAAA;MAAK6D,SAAS,EAAC,iDAAiD;MAAArD,QAAA,EAC7DA;IAAQ,CACN;EAAC,GAdAD,YAAY,GAAG,IAAI,GAAGW,YAepB,CAAC;EAEX;AACD;AAEA,eAAeb,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useSelect","useMemo","useReducer","useLayoutEffect","Popover","isRTL","store","blockEditorStore","useBlockElement","usePopoverScroll","jsx","_jsx","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","BlockPopoverInbetween","previousClientId","nextClientId","children","__unstablePopoverSlot","__unstableContentRef","operation","nearestSide","props","popoverRecomputeCounter","forcePopoverRecompute","s","orientation","rootClientId","isVisible","select","getBlockListSettings","getBlockRootClientId","isBlockVisible","_rootClientId","previousElement","nextElement","isVertical","popoverAnchor","undefined","contextElement","getBoundingClientRect","previousRect","nextRect","left","top","width","height","targetRect","bottom","right","Math","max","window","DOMRect","popoverScrollRef","observer","MutationObserver","observe","attributes","disconnect","ownerDocument","defaultView","addEventListener","removeEventListener","ref","animate","anchor","focusOnMount","__unstableSlotName","inline","className","resize","flip","placement","variant"],"sources":["@wordpress/block-editor/src/components/block-popover/inbetween.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, useReducer, useLayoutEffect } from '@wordpress/element';\nimport { Popover } from '@wordpress/components';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nfunction BlockPopoverInbetween( {\n\tpreviousClientId,\n\tnextClientId,\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\toperation = 'insert',\n\tnearestSide = 'right',\n\t...props\n} ) {\n\t// This is a temporary hack to get the inbetween inserter to recompute properly.\n\tconst [ popoverRecomputeCounter, forcePopoverRecompute ] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\tconst { orientation, rootClientId, isVisible } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tisBlockVisible,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _rootClientId = getBlockRootClientId(\n\t\t\t\tpreviousClientId ?? nextClientId\n\t\t\t);\n\t\t\treturn {\n\t\t\t\torientation:\n\t\t\t\t\tgetBlockListSettings( _rootClientId )?.orientation ||\n\t\t\t\t\t'vertical',\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisVisible:\n\t\t\t\t\tisBlockVisible( previousClientId ) &&\n\t\t\t\t\tisBlockVisible( nextClientId ),\n\t\t\t};\n\t\t},\n\t\t[ previousClientId, nextClientId ]\n\t);\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\tconst isVertical = orientation === 'vertical';\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverRecomputeCounter is by definition always equal or greater than 0.\n\t\t\t// This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverRecomputeCounter < 0 ||\n\t\t\t( ! previousElement && ! nextElement ) ||\n\t\t\t! isVisible\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst contextElement =\n\t\t\toperation === 'group'\n\t\t\t\t? nextElement || previousElement\n\t\t\t\t: previousElement || nextElement;\n\n\t\treturn {\n\t\t\tcontextElement,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst previousRect = previousElement\n\t\t\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t\t\t: null;\n\t\t\t\tconst nextRect = nextElement\n\t\t\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t\t\t: null;\n\n\t\t\t\tlet left = 0;\n\t\t\t\tlet top = 0;\n\t\t\t\tlet width = 0;\n\t\t\t\tlet height = 0;\n\n\t\t\t\tif ( operation === 'group' ) {\n\t\t\t\t\tconst targetRect = nextRect || previousRect;\n\t\t\t\t\ttop = targetRect.top;\n\t\t\t\t\t// No spacing is likely around blocks in this operation.\n\t\t\t\t\t// So width of the inserter containing rect is set to 0.\n\t\t\t\t\twidth = 0;\n\t\t\t\t\theight = targetRect.bottom - targetRect.top;\n\t\t\t\t\t// Popover calculates its distance from mid-block so some\n\t\t\t\t\t// adjustments are needed to make it appear in the right place.\n\t\t\t\t\tleft =\n\t\t\t\t\t\tnearestSide === 'left'\n\t\t\t\t\t\t\t? targetRect.left - 2\n\t\t\t\t\t\t\t: targetRect.right - 2;\n\t\t\t\t} else if ( isVertical ) {\n\t\t\t\t\t// vertical\n\t\t\t\t\ttop = previousRect ? previousRect.bottom : nextRect.top;\n\t\t\t\t\twidth = previousRect ? previousRect.width : nextRect.width;\n\t\t\t\t\theight =\n\t\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t\t: 0;\n\t\t\t\t\tleft = previousRect ? previousRect.left : nextRect.left;\n\t\t\t\t} else {\n\t\t\t\t\ttop = previousRect ? previousRect.top : nextRect.top;\n\t\t\t\t\theight = previousRect\n\t\t\t\t\t\t? previousRect.height\n\t\t\t\t\t\t: nextRect.height;\n\n\t\t\t\t\tif ( isRTL() ) {\n\t\t\t\t\t\t// non vertical, rtl\n\t\t\t\t\t\tleft = nextRect ? nextRect.right : previousRect.left;\n\t\t\t\t\t\twidth =\n\t\t\t\t\t\t\tpreviousRect && nextRect\n\t\t\t\t\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// non vertical, ltr\n\t\t\t\t\t\tleft = previousRect\n\t\t\t\t\t\t\t? previousRect.right\n\t\t\t\t\t\t\t: nextRect.left;\n\t\t\t\t\t\twidth =\n\t\t\t\t\t\t\tpreviousRect && nextRect\n\t\t\t\t\t\t\t\t? nextRect.left - previousRect.right\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Avoid a negative width which happens when the next rect\n\t\t\t\t\t// is on the next line.\n\t\t\t\t\twidth = Math.max( width, 0 );\n\t\t\t\t}\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t};\n\t}, [\n\t\tpreviousElement,\n\t\tnextElement,\n\t\tpopoverRecomputeCounter,\n\t\tisVertical,\n\t\tisVisible,\n\t\toperation,\n\t\tnearestSide,\n\t] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\n\t// This is only needed for a smooth transition when moving blocks.\n\t// When blocks are moved up/down, their position can be set by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forcePopoverRecompute );\n\t\tobserver.observe( previousElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ previousElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! nextElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forcePopoverRecompute );\n\t\tobserver.observe( nextElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ nextElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tpreviousElement.ownerDocument.defaultView.addEventListener(\n\t\t\t'resize',\n\t\t\tforcePopoverRecompute\n\t\t);\n\t\treturn () => {\n\t\t\tpreviousElement.ownerDocument.defaultView?.removeEventListener(\n\t\t\t\t'resize',\n\t\t\t\tforcePopoverRecompute\n\t\t\t);\n\t\t};\n\t}, [ previousElement ] );\n\n\t// If there's either a previous or a next element, show the inbetween popover.\n\t// Note that drag and drop uses the inbetween popover to show the drop indicator\n\t// before the first block and after the last block.\n\tif ( ( ! previousElement && ! nextElement ) || ! isVisible ) {\n\t\treturn null;\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tanimate={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tfocusOnMount={ false }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot }\n\t\t\tinline={ ! __unstablePopoverSlot }\n\t\t\t// Forces a remount of the popover when its position changes\n\t\t\t// This makes sure the popover doesn't animate from its previous position.\n\t\t\tkey={ nextClientId + '--' + rootClientId }\n\t\t\t{ ...props }\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\t'block-editor-block-popover__inbetween',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tplacement=\"overlay\"\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"block-editor-block-popover__inbetween-container\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default BlockPopoverInbetween;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,EAAEC,UAAU,EAAEC,eAAe,QAAQ,oBAAoB;AACzE,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,OAAOC,gBAAgB,MAAM,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEpD,MAAMC,6BAA6B,GAAGC,MAAM,CAACC,gBAAgB;AAE7D,SAASC,qBAAqBA,CAAE;EAC/BC,gBAAgB;EAChBC,YAAY;EACZC,QAAQ;EACRC,qBAAqB;EACrBC,oBAAoB;EACpBC,SAAS,GAAG,QAAQ;EACpBC,WAAW,GAAG,OAAO;EACrB,GAAGC;AACJ,CAAC,EAAG;EAC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Y,GAAG,IAAI,GAAGW,YAepB,CAAC;EAEX;AACD;AAEA,eAAeb,qBAAqB","ignoreList":[]}
|
|
@@ -17,7 +17,8 @@ function usePopoverScroll(contentRef) {
|
|
|
17
17
|
function onWheel(event) {
|
|
18
18
|
const {
|
|
19
19
|
deltaX,
|
|
20
|
-
deltaY
|
|
20
|
+
deltaY,
|
|
21
|
+
target
|
|
21
22
|
} = event;
|
|
22
23
|
const contentEl = contentRef.current;
|
|
23
24
|
let scrollContainer = scrollContainerCache.get(contentEl);
|
|
@@ -25,7 +26,15 @@ function usePopoverScroll(contentRef) {
|
|
|
25
26
|
scrollContainer = getScrollContainer(contentEl);
|
|
26
27
|
scrollContainerCache.set(contentEl, scrollContainer);
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
// Finds a scrollable ancestor of the event’s target. It's not cached because the
|
|
30
|
+
// it may not remain scrollable due to popover position changes. The cache is also
|
|
31
|
+
// less likely to be utilized because the target may be different every event.
|
|
32
|
+
const eventScrollContainer = getScrollContainer(target);
|
|
33
|
+
// Scrolls “through” the popover only if another contained scrollable area isn’t
|
|
34
|
+
// in front of it. This is to avoid scrolling both containers simultaneously.
|
|
35
|
+
if (!node.contains(eventScrollContainer)) {
|
|
36
|
+
scrollContainer.scrollBy(deltaX, deltaY);
|
|
37
|
+
}
|
|
29
38
|
}
|
|
30
39
|
// Tell the browser that we do not call event.preventDefault
|
|
31
40
|
// See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRefEffect","getScrollContainer","scrollContainerCache","WeakMap","usePopoverScroll","contentRef","effect","node","onWheel","event","deltaX","deltaY","contentEl","current","scrollContainer","get","set","scrollBy","options","passive","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-popover/use-popover-scroll.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { getScrollContainer } from '@wordpress/dom';\n\nconst scrollContainerCache = new WeakMap();\n\n/**\n * Allow scrolling \"through\" popovers over the canvas. This is only called for\n * as long as the pointer is over a popover. Do not use React events because it\n * will bubble through portals.\n *\n * @param {Object} contentRef\n */\nfunction usePopoverScroll( contentRef ) {\n\tconst effect = useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onWheel( event ) {\n\t\t\t\tconst { deltaX, deltaY } = event;\n\t\t\t\tconst contentEl = contentRef.current;\n\t\t\t\tlet scrollContainer = scrollContainerCache.get( contentEl );\n\t\t\t\tif ( ! scrollContainer ) {\n\t\t\t\t\tscrollContainer = getScrollContainer( contentEl );\n\t\t\t\t\tscrollContainerCache.set( contentEl, scrollContainer );\n\t\t\t\t}\n\t\t\t\tscrollContainer.scrollBy( deltaX, deltaY );\n\t\t\t}\n\t\t\t// Tell the browser that we do not call event.preventDefault\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners\n\t\t\tconst options = { passive: true };\n\t\t\tnode.addEventListener( 'wheel', onWheel, options );\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'wheel', onWheel, options );\n\t\t\t};\n\t\t},\n\t\t[ contentRef ]\n\t);\n\treturn contentRef ? effect : null;\n}\n\nexport default usePopoverScroll;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,kBAAkB,QAAQ,gBAAgB;AAEnD,MAAMC,oBAAoB,GAAG,IAAIC,OAAO,CAAC,CAAC;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CAAEC,UAAU,EAAG;EACvC,MAAMC,MAAM,GAAGN,YAAY,CACxBO,IAAI,IAAM;IACX,SAASC,OAAOA,CAAEC,KAAK,EAAG;MACzB,MAAM;QAAEC,MAAM;QAAEC;MAAO,CAAC,
|
|
1
|
+
{"version":3,"names":["useRefEffect","getScrollContainer","scrollContainerCache","WeakMap","usePopoverScroll","contentRef","effect","node","onWheel","event","deltaX","deltaY","target","contentEl","current","scrollContainer","get","set","eventScrollContainer","contains","scrollBy","options","passive","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-popover/use-popover-scroll.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { getScrollContainer } from '@wordpress/dom';\n\nconst scrollContainerCache = new WeakMap();\n\n/**\n * Allow scrolling \"through\" popovers over the canvas. This is only called for\n * as long as the pointer is over a popover. Do not use React events because it\n * will bubble through portals.\n *\n * @param {Object} contentRef\n */\nfunction usePopoverScroll( contentRef ) {\n\tconst effect = useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onWheel( event ) {\n\t\t\t\tconst { deltaX, deltaY, target } = event;\n\t\t\t\tconst contentEl = contentRef.current;\n\t\t\t\tlet scrollContainer = scrollContainerCache.get( contentEl );\n\t\t\t\tif ( ! scrollContainer ) {\n\t\t\t\t\tscrollContainer = getScrollContainer( contentEl );\n\t\t\t\t\tscrollContainerCache.set( contentEl, scrollContainer );\n\t\t\t\t}\n\t\t\t\t// Finds a scrollable ancestor of the event’s target. It's not cached because the\n\t\t\t\t// it may not remain scrollable due to popover position changes. The cache is also\n\t\t\t\t// less likely to be utilized because the target may be different every event.\n\t\t\t\tconst eventScrollContainer = getScrollContainer( target );\n\t\t\t\t// Scrolls “through” the popover only if another contained scrollable area isn’t\n\t\t\t\t// in front of it. This is to avoid scrolling both containers simultaneously.\n\t\t\t\tif ( ! node.contains( eventScrollContainer ) ) {\n\t\t\t\t\tscrollContainer.scrollBy( deltaX, deltaY );\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Tell the browser that we do not call event.preventDefault\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners\n\t\t\tconst options = { passive: true };\n\t\t\tnode.addEventListener( 'wheel', onWheel, options );\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'wheel', onWheel, options );\n\t\t\t};\n\t\t},\n\t\t[ contentRef ]\n\t);\n\treturn contentRef ? effect : null;\n}\n\nexport default usePopoverScroll;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,kBAAkB,QAAQ,gBAAgB;AAEnD,MAAMC,oBAAoB,GAAG,IAAIC,OAAO,CAAC,CAAC;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CAAEC,UAAU,EAAG;EACvC,MAAMC,MAAM,GAAGN,YAAY,CACxBO,IAAI,IAAM;IACX,SAASC,OAAOA,CAAEC,KAAK,EAAG;MACzB,MAAM;QAAEC,MAAM;QAAEC,MAAM;QAAEC;MAAO,CAAC,GAAGH,KAAK;MACxC,MAAMI,SAAS,GAAGR,UAAU,CAACS,OAAO;MACpC,IAAIC,eAAe,GAAGb,oBAAoB,CAACc,GAAG,CAAEH,SAAU,CAAC;MAC3D,IAAK,CAAEE,eAAe,EAAG;QACxBA,eAAe,GAAGd,kBAAkB,CAAEY,SAAU,CAAC;QACjDX,oBAAoB,CAACe,GAAG,CAAEJ,SAAS,EAAEE,eAAgB,CAAC;MACvD;MACA;MACA;MACA;MACA,MAAMG,oBAAoB,GAAGjB,kBAAkB,CAAEW,MAAO,CAAC;MACzD;MACA;MACA,IAAK,CAAEL,IAAI,CAACY,QAAQ,CAAED,oBAAqB,CAAC,EAAG;QAC9CH,eAAe,CAACK,QAAQ,CAAEV,MAAM,EAAEC,MAAO,CAAC;MAC3C;IACD;IACA;IACA;IACA,MAAMU,OAAO,GAAG;MAAEC,OAAO,EAAE;IAAK,CAAC;IACjCf,IAAI,CAACgB,gBAAgB,CAAE,OAAO,EAAEf,OAAO,EAAEa,OAAQ,CAAC;IAClD,OAAO,MAAM;MACZd,IAAI,CAACiB,mBAAmB,CAAE,OAAO,EAAEhB,OAAO,EAAEa,OAAQ,CAAC;IACtD,CAAC;EACF,CAAC,EACD,CAAEhB,UAAU,CACb,CAAC;EACD,OAAOA,UAAU,GAAGC,MAAM,GAAG,IAAI;AAClC;AAEA,eAAeF,gBAAgB","ignoreList":[]}
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { createContext } from '@wordpress/element';
|
|
5
5
|
const __unstableBlockNameContext = createContext('');
|
|
6
|
+
__unstableBlockNameContext.displayName = '__unstableBlockNameContext';
|
|
6
7
|
export default __unstableBlockNameContext;
|
|
7
8
|
//# sourceMappingURL=block-name-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","__unstableBlockNameContext"],"sources":["@wordpress/block-editor/src/components/block-toolbar/block-name-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nconst __unstableBlockNameContext = createContext( '' );\n\nexport default __unstableBlockNameContext;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAElD,MAAMC,0BAA0B,GAAGD,aAAa,CAAE,EAAG,CAAC;
|
|
1
|
+
{"version":3,"names":["createContext","__unstableBlockNameContext","displayName"],"sources":["@wordpress/block-editor/src/components/block-toolbar/block-name-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nconst __unstableBlockNameContext = createContext( '' );\n__unstableBlockNameContext.displayName = '__unstableBlockNameContext';\n\nexport default __unstableBlockNameContext;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAElD,MAAMC,0BAA0B,GAAGD,aAAa,CAAE,EAAG,CAAC;AACtDC,0BAA0B,CAACC,WAAW,GAAG,4BAA4B;AAErE,eAAeD,0BAA0B","ignoreList":[]}
|
|
@@ -21,6 +21,7 @@ import BlockDropZonePopover from '../block-popover/drop-zone';
|
|
|
21
21
|
import { unlock } from '../../lock-unlock';
|
|
22
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
23
|
export const InsertionPointOpenRef = createContext();
|
|
24
|
+
InsertionPointOpenRef.displayName = 'InsertionPointOpenRefContext';
|
|
24
25
|
function InbetweenInsertionPointPopover({
|
|
25
26
|
__unstablePopoverSlot,
|
|
26
27
|
__unstableContentRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useSelect","useDispatch","useRef","createContext","useContext","__unstableMotion","motion","useReducedMotion","Inserter","store","blockEditorStore","BlockPopoverInbetween","BlockDropZonePopover","unlock","jsx","_jsx","jsxs","_jsxs","InsertionPointOpenRef","InbetweenInsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","operation","nearestSide","selectBlock","hideInsertionPoint","openRef","ref","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","isDistractionFree","isZoomOutMode","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","getSettings","isZoomOut","insertionPoint","order","length","_previousClientId","index","_nextClientId","settings","__unstableWithInserter","getBlockEditingMode","disableMotion","onClick","event","target","current","maybeHideInserterPoint","onFocus","lineVariants","start","opacity","scale","rest","transition","delay","type","hover","inserterVariants","orientationClassname","className","children","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();\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={ insertionP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CmE;EAAK,CACV,CACD;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useSelect","useDispatch","useRef","createContext","useContext","__unstableMotion","motion","useReducedMotion","Inserter","store","blockEditorStore","BlockPopoverInbetween","BlockDropZonePopover","unlock","jsx","_jsx","jsxs","_jsxs","InsertionPointOpenRef","displayName","InbetweenInsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","operation","nearestSide","selectBlock","hideInsertionPoint","openRef","ref","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","isDistractionFree","isZoomOutMode","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","getSettings","isZoomOut","insertionPoint","order","length","_previousClientId","index","_nextClientId","settings","__unstableWithInserter","getBlockEditingMode","disableMotion","onClick","event","target","current","maybeHideInserterPoint","onFocus","lineVariants","start","opacity","scale","rest","transition","delay","type","hover","inserterVariants","orientationClassname","className","children","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":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,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|
const block = getBlock(clientId);
|
|
32
32
|
const editorMode = __unstableGetEditorMode();
|
|
33
33
|
const hasSelectedBlock = !!clientId && !!block;
|
|
34
|
-
const isEmptyDefaultBlock = hasSelectedBlock && isUnmodifiedDefaultBlock(block) && getBlockMode(clientId) !== 'html';
|
|
34
|
+
const isEmptyDefaultBlock = hasSelectedBlock && isUnmodifiedDefaultBlock(block, 'content') && getBlockMode(clientId) !== 'html';
|
|
35
35
|
const _showEmptyBlockSideInserter = clientId && !isTyping() &&
|
|
36
36
|
// Hide the block inserter on the navigation mode.
|
|
37
37
|
// See https://github.com/WordPress/gutenberg/pull/66636#discussion_r1824728483.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","isUnmodifiedDefaultBlock","store","blockEditorStore","unlock","useShowBlockTools","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlock","getBlockMode","getSettings","__unstableGetEditorMode","isTyping","isBlockInterfaceHidden","clientId","block","editorMode","hasSelectedBlock","isEmptyDefaultBlock","_showEmptyBlockSideInserter","_showBlockToolbarPopover","hasFixedToolbar","showEmptyBlockSideInserter","showBlockToolbarPopover"],"sources":["@wordpress/block-editor/src/components/block-tools/use-show-block-tools.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Source of truth for which block tools are showing in the block editor.\n *\n * @return {Object} Object of which block tools will be shown.\n */\nexport function useShowBlockTools() {\n\treturn useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetFirstMultiSelectedBlockClientId,\n\t\t\tgetBlock,\n\t\t\tgetBlockMode,\n\t\t\tgetSettings,\n\t\t\t__unstableGetEditorMode,\n\t\t\tisTyping,\n\t\t\tisBlockInterfaceHidden,\n\t\t} = unlock( select( blockEditorStore ) );\n\n\t\tconst clientId =\n\t\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\t\tconst block = getBlock( clientId );\n\t\tconst editorMode = __unstableGetEditorMode();\n\t\tconst hasSelectedBlock = !! clientId && !! block;\n\t\tconst isEmptyDefaultBlock =\n\t\t\thasSelectedBlock &&\n\t\t\tisUnmodifiedDefaultBlock( block ) &&\n\t\t\tgetBlockMode( clientId ) !== 'html';\n\t\tconst _showEmptyBlockSideInserter =\n\t\t\tclientId &&\n\t\t\t! isTyping() &&\n\t\t\t// Hide the block inserter on the navigation mode.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/66636#discussion_r1824728483.\n\t\t\teditorMode !== 'navigation' &&\n\t\t\tisEmptyDefaultBlock;\n\t\tconst _showBlockToolbarPopover =\n\t\t\t! isBlockInterfaceHidden() &&\n\t\t\t! getSettings().hasFixedToolbar &&\n\t\t\t! _showEmptyBlockSideInserter &&\n\t\t\thasSelectedBlock &&\n\t\t\t! isEmptyDefaultBlock;\n\n\t\treturn {\n\t\t\tshowEmptyBlockSideInserter: _showEmptyBlockSideInserter,\n\t\t\tshowBlockToolbarPopover: _showBlockToolbarPopover,\n\t\t};\n\t}, [] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,wBAAwB,QAAQ,mBAAmB;;AAE5D;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAA,EAAG;EACnC,OAAOL,SAAS,CAAIM,MAAM,IAAM;IAC/B,MAAM;MACLC,wBAAwB;MACxBC,kCAAkC;MAClCC,QAAQ;MACRC,YAAY;MACZC,WAAW;MACXC,uBAAuB;MACvBC,QAAQ;MACRC;IACD,CAAC,GAAGV,MAAM,CAAEE,MAAM,CAAEH,gBAAiB,CAAE,CAAC;IAExC,MAAMY,QAAQ,GACbR,wBAAwB,CAAC,CAAC,IAAIC,kCAAkC,CAAC,CAAC;IAEnE,MAAMQ,KAAK,GAAGP,QAAQ,CAAEM,QAAS,CAAC;IAClC,MAAME,UAAU,GAAGL,uBAAuB,CAAC,CAAC;IAC5C,MAAMM,gBAAgB,GAAG,CAAC,CAAEH,QAAQ,IAAI,CAAC,CAAEC,KAAK;IAChD,MAAMG,mBAAmB,GACxBD,gBAAgB,IAChBjB,wBAAwB,CAAEe,
|
|
1
|
+
{"version":3,"names":["useSelect","isUnmodifiedDefaultBlock","store","blockEditorStore","unlock","useShowBlockTools","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlock","getBlockMode","getSettings","__unstableGetEditorMode","isTyping","isBlockInterfaceHidden","clientId","block","editorMode","hasSelectedBlock","isEmptyDefaultBlock","_showEmptyBlockSideInserter","_showBlockToolbarPopover","hasFixedToolbar","showEmptyBlockSideInserter","showBlockToolbarPopover"],"sources":["@wordpress/block-editor/src/components/block-tools/use-show-block-tools.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Source of truth for which block tools are showing in the block editor.\n *\n * @return {Object} Object of which block tools will be shown.\n */\nexport function useShowBlockTools() {\n\treturn useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetFirstMultiSelectedBlockClientId,\n\t\t\tgetBlock,\n\t\t\tgetBlockMode,\n\t\t\tgetSettings,\n\t\t\t__unstableGetEditorMode,\n\t\t\tisTyping,\n\t\t\tisBlockInterfaceHidden,\n\t\t} = unlock( select( blockEditorStore ) );\n\n\t\tconst clientId =\n\t\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\t\tconst block = getBlock( clientId );\n\t\tconst editorMode = __unstableGetEditorMode();\n\t\tconst hasSelectedBlock = !! clientId && !! block;\n\t\tconst isEmptyDefaultBlock =\n\t\t\thasSelectedBlock &&\n\t\t\tisUnmodifiedDefaultBlock( block, 'content' ) &&\n\t\t\tgetBlockMode( clientId ) !== 'html';\n\t\tconst _showEmptyBlockSideInserter =\n\t\t\tclientId &&\n\t\t\t! isTyping() &&\n\t\t\t// Hide the block inserter on the navigation mode.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/66636#discussion_r1824728483.\n\t\t\teditorMode !== 'navigation' &&\n\t\t\tisEmptyDefaultBlock;\n\t\tconst _showBlockToolbarPopover =\n\t\t\t! isBlockInterfaceHidden() &&\n\t\t\t! getSettings().hasFixedToolbar &&\n\t\t\t! _showEmptyBlockSideInserter &&\n\t\t\thasSelectedBlock &&\n\t\t\t! isEmptyDefaultBlock;\n\n\t\treturn {\n\t\t\tshowEmptyBlockSideInserter: _showEmptyBlockSideInserter,\n\t\t\tshowBlockToolbarPopover: _showBlockToolbarPopover,\n\t\t};\n\t}, [] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,wBAAwB,QAAQ,mBAAmB;;AAE5D;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAA,EAAG;EACnC,OAAOL,SAAS,CAAIM,MAAM,IAAM;IAC/B,MAAM;MACLC,wBAAwB;MACxBC,kCAAkC;MAClCC,QAAQ;MACRC,YAAY;MACZC,WAAW;MACXC,uBAAuB;MACvBC,QAAQ;MACRC;IACD,CAAC,GAAGV,MAAM,CAAEE,MAAM,CAAEH,gBAAiB,CAAE,CAAC;IAExC,MAAMY,QAAQ,GACbR,wBAAwB,CAAC,CAAC,IAAIC,kCAAkC,CAAC,CAAC;IAEnE,MAAMQ,KAAK,GAAGP,QAAQ,CAAEM,QAAS,CAAC;IAClC,MAAME,UAAU,GAAGL,uBAAuB,CAAC,CAAC;IAC5C,MAAMM,gBAAgB,GAAG,CAAC,CAAEH,QAAQ,IAAI,CAAC,CAAEC,KAAK;IAChD,MAAMG,mBAAmB,GACxBD,gBAAgB,IAChBjB,wBAAwB,CAAEe,KAAK,EAAE,SAAU,CAAC,IAC5CN,YAAY,CAAEK,QAAS,CAAC,KAAK,MAAM;IACpC,MAAMK,2BAA2B,GAChCL,QAAQ,IACR,CAAEF,QAAQ,CAAC,CAAC;IACZ;IACA;IACAI,UAAU,KAAK,YAAY,IAC3BE,mBAAmB;IACpB,MAAME,wBAAwB,GAC7B,CAAEP,sBAAsB,CAAC,CAAC,IAC1B,CAAEH,WAAW,CAAC,CAAC,CAACW,eAAe,IAC/B,CAAEF,2BAA2B,IAC7BF,gBAAgB,IAChB,CAAEC,mBAAmB;IAEtB,OAAO;MACNI,0BAA0B,EAAEH,2BAA2B;MACvDI,uBAAuB,EAAEH;IAC1B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","DEFAULT_GLOBAL_STYLES_CONTEXT","user","base","merged","setUserConfig","GlobalStylesContext"],"sources":["@wordpress/block-editor/src/components/global-styles/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nexport const DEFAULT_GLOBAL_STYLES_CONTEXT = {\n\tuser: {},\n\tbase: {},\n\tmerged: {},\n\tsetUserConfig: () => {},\n};\n\nexport const GlobalStylesContext = createContext(\n\tDEFAULT_GLOBAL_STYLES_CONTEXT\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAElD,OAAO,MAAMC,6BAA6B,GAAG;EAC5CC,IAAI,EAAE,CAAC,CAAC;EACRC,IAAI,EAAE,CAAC,CAAC;EACRC,MAAM,EAAE,CAAC,CAAC;EACVC,aAAa,EAAEA,CAAA,KAAM,CAAC;AACvB,CAAC;AAED,OAAO,MAAMC,mBAAmB,GAAGN,aAAa,CAC/CC,6BACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createContext","DEFAULT_GLOBAL_STYLES_CONTEXT","user","base","merged","setUserConfig","GlobalStylesContext","displayName"],"sources":["@wordpress/block-editor/src/components/global-styles/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nexport const DEFAULT_GLOBAL_STYLES_CONTEXT = {\n\tuser: {},\n\tbase: {},\n\tmerged: {},\n\tsetUserConfig: () => {},\n};\n\nexport const GlobalStylesContext = createContext(\n\tDEFAULT_GLOBAL_STYLES_CONTEXT\n);\nGlobalStylesContext.displayName = 'GlobalStylesContext';\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAElD,OAAO,MAAMC,6BAA6B,GAAG;EAC5CC,IAAI,EAAE,CAAC,CAAC;EACRC,IAAI,EAAE,CAAC,CAAC;EACRC,MAAM,EAAE,CAAC,CAAC;EACVC,aAAa,EAAEA,CAAA,KAAM,CAAC;AACvB,CAAC;AAED,OAAO,MAAMC,mBAAmB,GAAGN,aAAa,CAC/CC,6BACD,CAAC;AACDK,mBAAmB,CAACC,WAAW,GAAG,qBAAqB","ignoreList":[]}
|
|
@@ -10,6 +10,7 @@ import useSaveImage from './use-save-image';
|
|
|
10
10
|
import useTransformImage from './use-transform-image';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
const ImageEditingContext = createContext({});
|
|
13
|
+
ImageEditingContext.displayName = 'ImageEditingContext';
|
|
13
14
|
export const useImageEditingContext = () => useContext(ImageEditingContext);
|
|
14
15
|
export default function ImageEditingProvider({
|
|
15
16
|
id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useContext","useMemo","useSaveImage","useTransformImage","jsx","_jsx","ImageEditingContext","useImageEditingContext","ImageEditingProvider","id","url","naturalWidth","naturalHeight","onFinishEditing","onSaveImage","children","transformImage","saveImage","providerValue","Provider","value"],"sources":["@wordpress/block-editor/src/components/image-editor/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useSaveImage from './use-save-image';\nimport useTransformImage from './use-transform-image';\n\nconst ImageEditingContext = createContext( {} );\n\nexport const useImageEditingContext = () => useContext( ImageEditingContext );\n\nexport default function ImageEditingProvider( {\n\tid,\n\turl,\n\tnaturalWidth,\n\tnaturalHeight,\n\tonFinishEditing,\n\tonSaveImage,\n\tchildren,\n} ) {\n\tconst transformImage = useTransformImage( {\n\t\turl,\n\t\tnaturalWidth,\n\t\tnaturalHeight,\n\t} );\n\n\tconst saveImage = useSaveImage( {\n\t\tid,\n\t\turl,\n\t\tonSaveImage,\n\t\tonFinishEditing,\n\t\t...transformImage,\n\t} );\n\n\tconst providerValue = useMemo(\n\t\t() => ( {\n\t\t\t...transformImage,\n\t\t\t...saveImage,\n\t\t} ),\n\t\t[ transformImage, saveImage ]\n\t);\n\n\treturn (\n\t\t<ImageEditingContext.Provider value={ providerValue }>\n\t\t\t{ children }\n\t\t</ImageEditingContext.Provider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;;AAEvE;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,iBAAiB,MAAM,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEtD,MAAMC,mBAAmB,GAAGP,aAAa,CAAE,CAAC,CAAE,CAAC;
|
|
1
|
+
{"version":3,"names":["createContext","useContext","useMemo","useSaveImage","useTransformImage","jsx","_jsx","ImageEditingContext","displayName","useImageEditingContext","ImageEditingProvider","id","url","naturalWidth","naturalHeight","onFinishEditing","onSaveImage","children","transformImage","saveImage","providerValue","Provider","value"],"sources":["@wordpress/block-editor/src/components/image-editor/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useSaveImage from './use-save-image';\nimport useTransformImage from './use-transform-image';\n\nconst ImageEditingContext = createContext( {} );\nImageEditingContext.displayName = 'ImageEditingContext';\n\nexport const useImageEditingContext = () => useContext( ImageEditingContext );\n\nexport default function ImageEditingProvider( {\n\tid,\n\turl,\n\tnaturalWidth,\n\tnaturalHeight,\n\tonFinishEditing,\n\tonSaveImage,\n\tchildren,\n} ) {\n\tconst transformImage = useTransformImage( {\n\t\turl,\n\t\tnaturalWidth,\n\t\tnaturalHeight,\n\t} );\n\n\tconst saveImage = useSaveImage( {\n\t\tid,\n\t\turl,\n\t\tonSaveImage,\n\t\tonFinishEditing,\n\t\t...transformImage,\n\t} );\n\n\tconst providerValue = useMemo(\n\t\t() => ( {\n\t\t\t...transformImage,\n\t\t\t...saveImage,\n\t\t} ),\n\t\t[ transformImage, saveImage ]\n\t);\n\n\treturn (\n\t\t<ImageEditingContext.Provider value={ providerValue }>\n\t\t\t{ children }\n\t\t</ImageEditingContext.Provider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;;AAEvE;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,iBAAiB,MAAM,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEtD,MAAMC,mBAAmB,GAAGP,aAAa,CAAE,CAAC,CAAE,CAAC;AAC/CO,mBAAmB,CAACC,WAAW,GAAG,qBAAqB;AAEvD,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAMR,UAAU,CAAEM,mBAAoB,CAAC;AAE7E,eAAe,SAASG,oBAAoBA,CAAE;EAC7CC,EAAE;EACFC,GAAG;EACHC,YAAY;EACZC,aAAa;EACbC,eAAe;EACfC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,MAAMC,cAAc,GAAGd,iBAAiB,CAAE;IACzCQ,GAAG;IACHC,YAAY;IACZC;EACD,CAAE,CAAC;EAEH,MAAMK,SAAS,GAAGhB,YAAY,CAAE;IAC/BQ,EAAE;IACFC,GAAG;IACHI,WAAW;IACXD,eAAe;IACf,GAAGG;EACJ,CAAE,CAAC;EAEH,MAAME,aAAa,GAAGlB,OAAO,CAC5B,OAAQ;IACP,GAAGgB,cAAc;IACjB,GAAGC;EACJ,CAAC,CAAE,EACH,CAAED,cAAc,EAAEC,SAAS,CAC5B,CAAC;EAED,oBACCb,IAAA,CAACC,mBAAmB,CAACc,QAAQ;IAACC,KAAK,EAAGF,aAAe;IAAAH,QAAA,EAClDA;EAAQ,CACmB,CAAC;AAEjC","ignoreList":[]}
|
|
@@ -116,7 +116,7 @@ function useInsertionPoint({
|
|
|
116
116
|
setLastFocus(null);
|
|
117
117
|
}
|
|
118
118
|
const selectedBlock = getSelectedBlock();
|
|
119
|
-
if (!isAppender && selectedBlock && isUnmodifiedDefaultBlock(selectedBlock)) {
|
|
119
|
+
if (!isAppender && selectedBlock && isUnmodifiedDefaultBlock(selectedBlock, 'content')) {
|
|
120
120
|
replaceBlocks(selectedBlock.clientId, blocks, null, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta);
|
|
121
121
|
} else {
|
|
122
122
|
insertBlocks(blocks, isAppender || _rootClientId === undefined ? destinationIndex : getIndex({
|