@wordpress/block-editor 12.8.1 → 12.9.1-next.5a1d1283.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +5 -12
- package/build/components/block-list/block-outline.native.js +4 -3
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/index.js +4 -3
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-popover/inbetween.js +4 -5
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +3 -2
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/color-style-selector/index.js +1 -1
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +7 -4
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +10 -8
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/link-control/index.js +2 -7
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings.js +2 -1
- package/build/components/link-control/settings.js.map +1 -1
- package/build/components/list-view/block-select-button.js +48 -7
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +3 -3
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +14 -8
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-images.js +5 -4
- package/build/components/list-view/use-list-view-images.js.map +1 -1
- package/build/components/preview-options/index.js +3 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +74 -63
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/warning/index.js +1 -1
- package/build/components/warning/index.js.map +1 -1
- package/build/hooks/auto-inserting-blocks.js +174 -0
- package/build/hooks/auto-inserting-blocks.js.map +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/style.js +64 -22
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +4 -0
- package/build/hooks/utils.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +4 -3
- package/build-module/components/block-list/block-outline.native.js.map +1 -1
- package/build-module/components/block-list/index.js +4 -3
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +4 -5
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +3 -2
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/color-style-selector/index.js +1 -1
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +8 -4
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +11 -8
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/link-control/index.js +2 -7
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings.js +2 -1
- package/build-module/components/link-control/settings.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +48 -7
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +3 -3
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +14 -8
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-images.js +5 -4
- package/build-module/components/list-view/use-list-view-images.js.map +1 -1
- package/build-module/components/preview-options/index.js +3 -1
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +74 -63
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/warning/index.js +2 -2
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/hooks/auto-inserting-blocks.js +167 -0
- package/build-module/hooks/auto-inserting-blocks.js.map +1 -0
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/style.js +63 -21
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +4 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-style/content-rtl.css +8 -7
- package/build-style/content.css +8 -7
- package/build-style/style-rtl.css +4 -4
- package/build-style/style.css +4 -4
- package/package.json +32 -32
- package/src/components/block-list/block-outline.native.js +5 -2
- package/src/components/block-list/content.scss +2 -3
- package/src/components/block-list/index.js +4 -3
- package/src/components/block-popover/inbetween.js +4 -3
- package/src/components/block-popover/index.js +3 -2
- package/src/components/button-block-appender/content.scss +8 -0
- package/src/components/color-style-selector/index.js +1 -1
- package/src/components/inserter/reusable-blocks-tab.native.js +7 -2
- package/src/components/inserter/search-results.native.js +13 -9
- package/src/components/link-control/index.js +2 -5
- package/src/components/link-control/settings.js +1 -0
- package/src/components/link-control/style.scss +5 -5
- package/src/components/link-control/test/index.js +1 -0
- package/src/components/list-view/block-select-button.js +67 -15
- package/src/components/list-view/drop-indicator.js +4 -5
- package/src/components/list-view/index.js +19 -13
- package/src/components/list-view/use-list-view-images.js +8 -4
- package/src/components/observe-typing/README.md +2 -2
- package/src/components/preview-options/index.js +2 -0
- package/src/components/provider/index.js +8 -1
- package/src/components/use-block-commands/index.js +92 -88
- package/src/components/warning/index.js +2 -2
- package/src/hooks/auto-inserting-blocks.js +232 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/style.js +85 -35
- package/src/hooks/utils.js +4 -0
- package/build/utils/pre-parse-patterns.js +0 -68
- package/build/utils/pre-parse-patterns.js.map +0 -1
- package/build-module/utils/pre-parse-patterns.js +0 -61
- package/build-module/utils/pre-parse-patterns.js.map +0 -1
- package/src/components/url-popover/test/__snapshots__/index.js.snap +0 -133
- package/src/components/url-popover/test/index.js +0 -75
- package/src/utils/pre-parse-patterns.js +0 -69
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_hooks","_components","_compose","_blocks","_data","_components2","_store","AutoInsertingBlocksControl","props","autoInsertedBlocksForCurrentBlock","groupedAutoInsertedBlocks","useSelect","select","getBlockTypes","blocksStore","_autoInsertedBlocksForCurrentBlock","filter","autoInsert","blockName","_groupedAutoInsertedBlocks","reduce","groups","block","namespace","name","split","push","autoInsertedBlockClientIds","blockIndex","rootClientId","innerBlocksLength","getBlock","getBlockIndex","getBlockRootClientId","blockEditorStore","_rootClientId","clientId","_autoInsertedBlockClientIds","clientIds","relativePosition","candidates","innerBlocks","autoInsertedBlock","find","length","insertBlock","removeBlock","useDispatch","insertBlockIntoDesignatedLocation","createElement","InspectorControls","PanelBody","title","__","initialOpen","Object","keys","map","vendor","Fragment","key","checked","ToggleControl","label","onChange","createBlock","withAutoInsertingBlocks","createHigherOrderComponent","BlockEdit","blockEdit","exports","window","__experimentalAutoInsertingBlocks","addFilter"],"sources":["@wordpress/block-editor/src/hooks/auto-inserting-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { addFilter } from '@wordpress/hooks';\nimport { Fragment } from '@wordpress/element';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { store as blockEditorStore } from '../store';\n\nfunction AutoInsertingBlocksControl( props ) {\n\tconst { autoInsertedBlocksForCurrentBlock, groupedAutoInsertedBlocks } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\t\tconst _autoInsertedBlocksForCurrentBlock =\n\t\t\t\t\tgetBlockTypes()?.filter(\n\t\t\t\t\t\t( { autoInsert } ) =>\n\t\t\t\t\t\t\tautoInsert && props.blockName in autoInsert\n\t\t\t\t\t);\n\n\t\t\t\t// Group by block namespace (i.e. prefix before the slash).\n\t\t\t\tconst _groupedAutoInsertedBlocks =\n\t\t\t\t\t_autoInsertedBlocksForCurrentBlock?.reduce(\n\t\t\t\t\t\t( groups, block ) => {\n\t\t\t\t\t\t\tconst [ namespace ] = block.name.split( '/' );\n\t\t\t\t\t\t\tif ( ! groups[ namespace ] ) {\n\t\t\t\t\t\t\t\tgroups[ namespace ] = [];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgroups[ namespace ].push( block );\n\t\t\t\t\t\t\treturn groups;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{}\n\t\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\tautoInsertedBlocksForCurrentBlock:\n\t\t\t\t\t\t_autoInsertedBlocksForCurrentBlock,\n\t\t\t\t\tgroupedAutoInsertedBlocks: _groupedAutoInsertedBlocks,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ props.blockName ]\n\t\t);\n\n\tconst {\n\t\tautoInsertedBlockClientIds,\n\t\tblockIndex,\n\t\trootClientId,\n\t\tinnerBlocksLength,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getBlockIndex, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst _rootClientId = getBlockRootClientId( props.clientId );\n\n\t\t\tconst _autoInsertedBlockClientIds =\n\t\t\t\tautoInsertedBlocksForCurrentBlock.reduce(\n\t\t\t\t\t( clientIds, block ) => {\n\t\t\t\t\t\tconst relativePosition =\n\t\t\t\t\t\t\tblock?.autoInsert?.[ props.blockName ];\n\t\t\t\t\t\tlet candidates;\n\n\t\t\t\t\t\tswitch ( relativePosition ) {\n\t\t\t\t\t\t\tcase 'before':\n\t\t\t\t\t\t\tcase 'after':\n\t\t\t\t\t\t\t\t// Any of the current block's siblings (with the right block type) qualifies\n\t\t\t\t\t\t\t\t// as an auto-inserted block (inserted `before` or `after` the current one),\n\t\t\t\t\t\t\t\t// as the block might've been auto-inserted and then moved around a bit by the user.\n\t\t\t\t\t\t\t\tcandidates =\n\t\t\t\t\t\t\t\t\tgetBlock( _rootClientId )?.innerBlocks;\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'first_child':\n\t\t\t\t\t\t\tcase 'last_child':\n\t\t\t\t\t\t\t\t// Any of the current block's child blocks (with the right block type) qualifies\n\t\t\t\t\t\t\t\t// as an auto-inserted first or last child block, as the block might've been\n\t\t\t\t\t\t\t\t// auto-inserted and then moved around a bit by the user.\n\t\t\t\t\t\t\t\tcandidates = getBlock(\n\t\t\t\t\t\t\t\t\tprops.clientId\n\t\t\t\t\t\t\t\t).innerBlocks;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst autoInsertedBlock = candidates?.find(\n\t\t\t\t\t\t\t( { name } ) => name === block.name\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( autoInsertedBlock ) {\n\t\t\t\t\t\t\tclientIds[ block.name ] =\n\t\t\t\t\t\t\t\tautoInsertedBlock.clientId;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// TOOD: If no auto-inserted block was found in any of its designated locations,\n\t\t\t\t\t\t// we want to check if it's present elsewhere in the block tree.\n\t\t\t\t\t\t// If it is, we'd consider it manually inserted and would want to remove the\n\t\t\t\t\t\t// corresponding toggle from the block inspector panel.\n\n\t\t\t\t\t\treturn clientIds;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( props.clientId ),\n\t\t\t\tinnerBlocksLength: getBlock( props.clientId )?.innerBlocks\n\t\t\t\t\t?.length,\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tautoInsertedBlockClientIds: _autoInsertedBlockClientIds,\n\t\t\t};\n\t\t},\n\t\t[ autoInsertedBlocksForCurrentBlock, props.blockName, props.clientId ]\n\t);\n\n\tconst { insertBlock, removeBlock } = useDispatch( blockEditorStore );\n\n\tif ( ! autoInsertedBlocksForCurrentBlock.length ) {\n\t\treturn null;\n\t}\n\n\tconst insertBlockIntoDesignatedLocation = ( block, relativePosition ) => {\n\t\tswitch ( relativePosition ) {\n\t\t\tcase 'before':\n\t\t\tcase 'after':\n\t\t\t\tinsertBlock(\n\t\t\t\t\tblock,\n\t\t\t\t\trelativePosition === 'after' ? blockIndex + 1 : blockIndex,\n\t\t\t\t\trootClientId, // Insert as a child of the current block's parent\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase 'first_child':\n\t\t\tcase 'last_child':\n\t\t\t\tinsertBlock(\n\t\t\t\t\tblock,\n\t\t\t\t\t// TODO: It'd be great if insertBlock() would accept negative indices for insertion.\n\t\t\t\t\trelativePosition === 'first_child' ? 0 : innerBlocksLength,\n\t\t\t\t\tprops.clientId, // Insert as a child of the current block.\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Plugins' ) } initialOpen={ true }>\n\t\t\t\t{ Object.keys( groupedAutoInsertedBlocks ).map( ( vendor ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Fragment key={ vendor }>\n\t\t\t\t\t\t\t<h3>{ vendor }</h3>\n\t\t\t\t\t\t\t{ groupedAutoInsertedBlocks[ vendor ].map(\n\t\t\t\t\t\t\t\t( block ) => {\n\t\t\t\t\t\t\t\t\t// TODO: Display block icon.\n\t\t\t\t\t\t\t\t\t// <BlockIcon icon={ block.icon } />\n\n\t\t\t\t\t\t\t\t\tconst checked =\n\t\t\t\t\t\t\t\t\t\tblock.name in\n\t\t\t\t\t\t\t\t\t\tautoInsertedBlockClientIds;\n\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\t\tchecked={ checked }\n\t\t\t\t\t\t\t\t\t\t\tkey={ block.title }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ block.title }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tif ( ! checked ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t// Create and insert block.\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst relativePosition =\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tblock.autoInsert[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tprops.blockName\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t\t\t\t\tinsertBlockIntoDesignatedLocation(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tblock.name\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trelativePosition\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t// Remove block.\n\t\t\t\t\t\t\t\t\t\t\t\tconst clientId =\n\t\t\t\t\t\t\t\t\t\t\t\t\tautoInsertedBlockClientIds[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tblock.name\n\t\t\t\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t\t\t\tremoveBlock( clientId, false );\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n}\n\nexport const withAutoInsertingBlocks = createHigherOrderComponent(\n\t( BlockEdit ) => {\n\t\treturn ( props ) => {\n\t\t\tconst blockEdit = <BlockEdit key=\"edit\" { ...props } />;\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{ blockEdit }\n\t\t\t\t\t<AutoInsertingBlocksControl\n\t\t\t\t\t\tblockName={ props.name }\n\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t);\n\t\t};\n\t},\n\t'withAutoInsertingBlocks'\n);\n\nif ( window?.__experimentalAutoInsertingBlocks ) {\n\taddFilter(\n\t\t'editor.BlockEdit',\n\t\t'core/auto-inserting-blocks/with-inspector-control',\n\t\twithAutoInsertingBlocks\n\t);\n}\n"],"mappings":";;;;;;AAKA,IAAAA,QAAA,GAAAC,OAAA;AAFA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAfA;AACA;AACA;;AASA;AACA;AACA;;AAIA,SAASS,0BAA0BA,CAAEC,KAAK,EAAG;EAC5C,MAAM;IAAEC,iCAAiC;IAAEC;EAA0B,CAAC,GACrE,IAAAC,eAAS,EACNC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAc,CAAC,GAAGD,MAAM,CAAEE,aAAY,CAAC;IAC/C,MAAMC,kCAAkC,GACvCF,aAAa,CAAC,CAAC,EAAEG,MAAM,CACtB,CAAE;MAAEC;IAAW,CAAC,KACfA,UAAU,IAAIT,KAAK,CAACU,SAAS,IAAID,UACnC,CAAC;;IAEF;IACA,MAAME,0BAA0B,GAC/BJ,kCAAkC,EAAEK,MAAM,CACzC,CAAEC,MAAM,EAAEC,KAAK,KAAM;MACpB,MAAM,CAAEC,SAAS,CAAE,GAAGD,KAAK,CAACE,IAAI,CAACC,KAAK,CAAE,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mB,SAAS;MAACR,GAAG,EAAC,MAAM;MAAA,GAAMpD;IAAK,CAAI,CAAC;IACvD,OACC,IAAAX,QAAA,CAAAoD,aAAA,EAAApD,QAAA,CAAA8D,QAAA,QACGU,SAAS,EACX,IAAAxE,QAAA,CAAAoD,aAAA,EAAC1C,0BAA0B;MAC1BW,SAAS,EAAGV,KAAK,CAACgB,IAAM;MACxBY,QAAQ,EAAG5B,KAAK,CAAC4B;IAAU,CAC3B,CACA,CAAC;EAEL,CAAC;AACF,CAAC,EACD,yBACD,CAAC;AAACkC,OAAA,CAAAJ,uBAAA,GAAAA,uBAAA;AAEF,IAAKK,MAAM,EAAEC,iCAAiC,EAAG;EAChD,IAAAC,gBAAS,EACR,kBAAkB,EAClB,mDAAmD,EACnDP,uBACD,CAAC;AACF"}
|
package/build/hooks/index.js
CHANGED
|
@@ -90,6 +90,7 @@ require("./metadata");
|
|
|
90
90
|
require("./metadata-name");
|
|
91
91
|
require("./behaviors");
|
|
92
92
|
require("./custom-fields");
|
|
93
|
+
require("./auto-inserting-blocks");
|
|
93
94
|
var _dimensions = require("./dimensions");
|
|
94
95
|
var _useBorderProps = require("./use-border-props");
|
|
95
96
|
var _useColorProps = require("./use-color-props");
|
package/build/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["require","_layout","_dimensions","_useBorderProps","_useColorProps","_useSpacingProps","_useTypographyProps","_gap","_useCachedTruthy"],"sources":["@wordpress/block-editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './aria-label';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './settings';\nimport './color';\nimport './duotone';\nimport './font-family';\nimport './font-size';\nimport './border';\nimport './position';\nimport './layout';\nimport './content-lock-ui';\nimport './metadata';\nimport './metadata-name';\nimport './behaviors';\nimport './custom-fields';\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA"}
|
|
1
|
+
{"version":3,"names":["require","_layout","_dimensions","_useBorderProps","_useColorProps","_useSpacingProps","_useTypographyProps","_gap","_useCachedTruthy"],"sources":["@wordpress/block-editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './aria-label';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './settings';\nimport './color';\nimport './duotone';\nimport './font-family';\nimport './font-size';\nimport './border';\nimport './position';\nimport './layout';\nimport './content-lock-ui';\nimport './metadata';\nimport './metadata-name';\nimport './behaviors';\nimport './custom-fields';\nimport './auto-inserting-blocks';\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA"}
|
package/build/hooks/style.js
CHANGED
|
@@ -22,6 +22,7 @@ var _typography = require("./typography");
|
|
|
22
22
|
var _dimensions = require("./dimensions");
|
|
23
23
|
var _useDisplayBlockControls = _interopRequireDefault(require("../components/use-display-block-controls"));
|
|
24
24
|
var _utils = require("./utils");
|
|
25
|
+
var _utils2 = require("../components/global-styles/utils");
|
|
25
26
|
var _blockEditingMode = require("../components/block-editing-mode");
|
|
26
27
|
/**
|
|
27
28
|
* External dependencies
|
|
@@ -330,41 +331,82 @@ const withBlockControls = (0, _compose.createHigherOrderComponent)(BlockEdit =>
|
|
|
330
331
|
}));
|
|
331
332
|
}, 'withToolbarControls');
|
|
332
333
|
|
|
334
|
+
// Defines which element types are supported, including their hover styles or
|
|
335
|
+
// any other elements that have been included under a single element type
|
|
336
|
+
// e.g. heading and h1-h6.
|
|
337
|
+
exports.withBlockControls = withBlockControls;
|
|
338
|
+
const elementTypes = [{
|
|
339
|
+
elementType: 'button'
|
|
340
|
+
}, {
|
|
341
|
+
elementType: 'link',
|
|
342
|
+
pseudo: [':hover']
|
|
343
|
+
}, {
|
|
344
|
+
elementType: 'heading',
|
|
345
|
+
elements: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
|
|
346
|
+
}];
|
|
347
|
+
|
|
333
348
|
/**
|
|
334
349
|
* Override the default block element to include elements styles.
|
|
335
350
|
*
|
|
336
351
|
* @param {Function} BlockListBlock Original component
|
|
337
352
|
* @return {Function} Wrapped component
|
|
338
353
|
*/
|
|
339
|
-
exports.withBlockControls = withBlockControls;
|
|
340
354
|
const withElementsStyles = (0, _compose.createHigherOrderComponent)(BlockListBlock => props => {
|
|
341
355
|
const blockElementsContainerIdentifier = `wp-elements-${(0, _compose.useInstanceId)(BlockListBlock)}`;
|
|
342
|
-
|
|
356
|
+
|
|
357
|
+
// The .editor-styles-wrapper selector is required on elements styles. As it is
|
|
358
|
+
// added to all other editor styles, not providing it causes reset and global
|
|
359
|
+
// styles to override element styles because of higher specificity.
|
|
360
|
+
const baseElementSelector = `.editor-styles-wrapper .${blockElementsContainerIdentifier}`;
|
|
361
|
+
const blockElementStyles = props.attributes.style?.elements;
|
|
343
362
|
const styles = (0, _element.useMemo)(() => {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
363
|
+
if (!blockElementStyles) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const elementCSSRules = [];
|
|
367
|
+
elementTypes.forEach(({
|
|
368
|
+
elementType,
|
|
369
|
+
pseudo,
|
|
370
|
+
elements
|
|
371
|
+
}) => {
|
|
372
|
+
const skipSerialization = (0, _utils.shouldSkipSerialization)(props.name, _color.COLOR_SUPPORT_KEY, elementType);
|
|
373
|
+
if (skipSerialization) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
const elementStyles = blockElementStyles?.[elementType];
|
|
377
|
+
|
|
378
|
+
// Process primary element type styles.
|
|
359
379
|
if (elementStyles) {
|
|
360
|
-
const
|
|
380
|
+
const selector = (0, _utils2.scopeSelector)(baseElementSelector, _blocks.__EXPERIMENTAL_ELEMENTS[elementType]);
|
|
381
|
+
elementCSSRules.push((0, _styleEngine.compileCSS)(elementStyles, {
|
|
361
382
|
selector
|
|
383
|
+
}));
|
|
384
|
+
|
|
385
|
+
// Process any interactive states for the element type.
|
|
386
|
+
if (pseudo) {
|
|
387
|
+
pseudo.forEach(pseudoSelector => {
|
|
388
|
+
if (elementStyles[pseudoSelector]) {
|
|
389
|
+
elementCSSRules.push((0, _styleEngine.compileCSS)(elementStyles[pseudoSelector], {
|
|
390
|
+
selector: (0, _utils2.scopeSelector)(baseElementSelector, `${_blocks.__EXPERIMENTAL_ELEMENTS[elementType]}${pseudoSelector}`)
|
|
391
|
+
}));
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Process related elements e.g. h1-h6 for headings
|
|
398
|
+
if (elements) {
|
|
399
|
+
elements.forEach(element => {
|
|
400
|
+
if (blockElementStyles[element]) {
|
|
401
|
+
elementCSSRules.push((0, _styleEngine.compileCSS)(blockElementStyles[element], {
|
|
402
|
+
selector: (0, _utils2.scopeSelector)(baseElementSelector, _blocks.__EXPERIMENTAL_ELEMENTS[element])
|
|
403
|
+
}));
|
|
404
|
+
}
|
|
362
405
|
});
|
|
363
|
-
elementCssRules.push(cssRule);
|
|
364
406
|
}
|
|
365
|
-
}
|
|
366
|
-
return
|
|
367
|
-
}, [
|
|
407
|
+
});
|
|
408
|
+
return elementCSSRules.length > 0 ? elementCSSRules.join('') : undefined;
|
|
409
|
+
}, [baseElementSelector, blockElementStyles, props.name]);
|
|
368
410
|
const element = (0, _element.useContext)(_blockList.default.__unstableElementContext);
|
|
369
411
|
return (0, _element.createElement)(_element.Fragment, null, styles && element && (0, _element.createPortal)((0, _element.createElement)("style", {
|
|
370
412
|
dangerouslySetInnerHTML: {
|
package/build/hooks/style.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_hooks","_blocks","_compose","_styleEngine","_blockList","_border","_color","_typography","_dimensions","_useDisplayBlockControls","_utils","_blockEditingMode","styleSupportKeys","TYPOGRAPHY_SUPPORT_KEYS","BORDER_SUPPORT_KEY","COLOR_SUPPORT_KEY","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","hasStyleSupport","nameOrType","some","key","hasBlockSupport","getInlineStyles","styles","output","getCSSRules","forEach","rule","value","addAttribute","settings","attributes","style","Object","assign","type","skipSerializationPathsEdit","TYPOGRAPHY_SUPPORT_KEY","skipSerializationPathsSave","renamedFeatures","gradients","omitStyle","paths","preserveReference","newStyle","JSON","parse","stringify","Array","isArray","path","split","length","firstSubpath","restPath","addSaveProps","props","blockType","skipPaths","entries","indicator","skipSerialization","getBlockSupport","featureName","feature","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBlockControls","createHigherOrderComponent","BlockEdit","name","createElement","shouldDisplayControls","useDisplayBlockControls","blockEditingMode","useBlockEditingMode","Fragment","ColorEdit","TypographyPanel","BorderPanel","DimensionsPanel","exports","withElementsStyles","BlockListBlock","blockElementsContainerIdentifier","useInstanceId","skipLinkColorSerialization","shouldSkipSerialization","useMemo","elements","link","undefined","selector","ELEMENTS","elementCssRules","elementStyles","cssRule","compileCSS","push","join","element","useContext","BlockList","__unstableElementContext","createPortal","dangerouslySetInnerHTML","__html","className","classnames","addFilter"],"sources":["@wordpress/block-editor/src/hooks/style.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo, createPortal } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { getCSSRules, compileCSS } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { BORDER_SUPPORT_KEY, BorderPanel } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport {\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tDimensionsPanel,\n} from './dimensions';\nimport useDisplayBlockControls from '../components/use-display-block-controls';\nimport { shouldSkipSerialization } from './utils';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( nameOrType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( nameOrType, key ) );\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst output = {};\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tgetCSSRules( styles ).forEach( ( rule ) => {\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSPACING_SUPPORT_KEY,\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ SPACING_SUPPORT_KEY }` ]: [ 'spacing.blockGap' ],\n};\n\n/**\n * A dictionary used to normalize feature names between support flags, style\n * object properties and __experimentSkipSerialization configuration arrays.\n *\n * This allows not having to provide a migration for a support flag and possible\n * backwards compatibility bridges, while still achieving consistency between\n * the support flag and the skip serialization array.\n *\n * @constant\n * @type {Record<string, string>}\n */\nconst renamedFeatures = { gradients: 'gradient' };\n\n/**\n * A utility function used to remove one or more paths from a style object.\n * Works in a way similar to Lodash's `omit()`. See unit tests and examples below.\n *\n * It supports a single string path:\n *\n * ```\n * omitStyle( { color: 'red' }, 'color' ); // {}\n * ```\n *\n * or an array of paths:\n *\n * ```\n * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}\n * ```\n *\n * It also allows you to specify paths at multiple levels in a string.\n *\n * ```\n * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}\n * ```\n *\n * You can remove multiple paths at the same time:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t'typography.textDecoration',\n * \t\t\t'typography.textTransform',\n *\t\t]\n * );\n * // {}\n * ```\n *\n * You can also specify nested paths as arrays:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'typography', 'textDecoration' ],\n * \t\t\t[ 'typography', 'textTransform' ],\n *\t\t]\n * );\n * // {}\n * ```\n *\n * With regards to nesting of styles, infinite depth is supported:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\tborder: {\n * \t\t\t\tradius: {\n * \t\t\t\t\ttopLeft: '10px',\n * \t\t\t\t\ttopRight: '0.5rem',\n * \t\t\t\t}\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'border', 'radius', 'topRight' ],\n *\t\t]\n * );\n * // { border: { radius: { topLeft: '10px' } } }\n * ```\n *\n * The third argument, `preserveReference`, defines how to treat the input style object.\n * It is mostly necessary to properly handle mutation when recursively handling the style object.\n * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.\n * However, when recursing, we change that value to `true` in order to work with a single copy\n * of the original style object.\n *\n * @see https://lodash.com/docs/4.17.15#omit\n *\n * @param {Object} style Styles object.\n * @param {Array|string} paths Paths to remove.\n * @param {boolean} preserveReference True to mutate the `style` object, false otherwise.\n * @return {Object} Styles object with the specified paths removed.\n */\nexport function omitStyle( style, paths, preserveReference = false ) {\n\tif ( ! style ) {\n\t\treturn style;\n\t}\n\n\tlet newStyle = style;\n\tif ( ! preserveReference ) {\n\t\tnewStyle = JSON.parse( JSON.stringify( style ) );\n\t}\n\n\tif ( ! Array.isArray( paths ) ) {\n\t\tpaths = [ paths ];\n\t}\n\n\tpaths.forEach( ( path ) => {\n\t\tif ( ! Array.isArray( path ) ) {\n\t\t\tpath = path.split( '.' );\n\t\t}\n\n\t\tif ( path.length > 1 ) {\n\t\t\tconst [ firstSubpath, ...restPath ] = path;\n\t\t\tomitStyle( newStyle[ firstSubpath ], [ restPath ], true );\n\t\t} else if ( path.length === 1 ) {\n\t\t\tdelete newStyle[ path[ 0 ] ];\n\t\t}\n\t} );\n\n\treturn newStyle;\n}\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\tObject.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {\n\t\tconst skipSerialization = getBlockSupport( blockType, indicator );\n\n\t\tif ( skipSerialization === true ) {\n\t\t\tstyle = omitStyle( style, path );\n\t\t}\n\n\t\tif ( Array.isArray( skipSerialization ) ) {\n\t\t\tskipSerialization.forEach( ( featureName ) => {\n\t\t\t\tconst feature = renamedFeatures[ featureName ] || featureName;\n\t\t\t\tstyle = omitStyle( style, [ [ ...path, feature ] ] );\n\t\t\t} );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object}.Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps(\n\t\t\tprops,\n\t\t\tsettings,\n\t\t\tattributes,\n\t\t\tskipSerializationPathsEdit\n\t\t);\n\t};\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new inspector controls for\n * all the custom styles configs.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tif ( ! hasStyleSupport( props.name ) ) {\n\t\t\treturn <BlockEdit key=\"edit\" { ...props } />;\n\t\t}\n\n\t\tconst shouldDisplayControls = useDisplayBlockControls();\n\t\tconst blockEditingMode = useBlockEditingMode();\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldDisplayControls && blockEditingMode === 'default' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ColorEdit { ...props } />\n\t\t\t\t\t\t<TypographyPanel { ...props } />\n\t\t\t\t\t\t<BorderPanel { ...props } />\n\t\t\t\t\t\t<DimensionsPanel { ...props } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to include elements styles.\n *\n * @param {Function} BlockListBlock Original component\n * @return {Function} Wrapped component\n */\nconst withElementsStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\t\tBlockListBlock\n\t\t) }`;\n\n\t\tconst skipLinkColorSerialization = shouldSkipSerialization(\n\t\t\tprops.name,\n\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t'link'\n\t\t);\n\n\t\tconst styles = useMemo( () => {\n\t\t\t// The .editor-styles-wrapper selector is required on elements styles. As it is\n\t\t\t// added to all other editor styles, not providing it causes reset and global\n\t\t\t// styles to override element styles because of higher specificity.\n\t\t\tconst elements = [\n\t\t\t\t{\n\t\t\t\t\tstyles: ! skipLinkColorSerialization\n\t\t\t\t\t\t? props.attributes.style?.elements?.link\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstyles: ! skipLinkColorSerialization\n\t\t\t\t\t\t? props.attributes.style?.elements?.link?.[ ':hover' ]\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }:hover`,\n\t\t\t\t},\n\t\t\t];\n\t\t\tconst elementCssRules = [];\n\t\t\tfor ( const { styles: elementStyles, selector } of elements ) {\n\t\t\t\tif ( elementStyles ) {\n\t\t\t\t\tconst cssRule = compileCSS( elementStyles, {\n\t\t\t\t\t\tselector,\n\t\t\t\t\t} );\n\t\t\t\t\telementCssRules.push( cssRule );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn elementCssRules.length > 0\n\t\t\t\t? elementCssRules.join( '' )\n\t\t\t\t: undefined;\n\t\t}, [\n\t\t\tprops.attributes.style?.elements,\n\t\t\tblockElementsContainerIdentifier,\n\t\t\tskipLinkColorSerialization,\n\t\t] );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ styles &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: styles,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tprops.attributes.style?.elements\n\t\t\t\t\t\t\t? classnames(\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\tblockElementsContainerIdentifier\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: props.className\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withElementsStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/style/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/with-elements-styles',\n\twithElementsStyles\n);\n"],"mappings":";;;;;;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AALA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAMA,IAAAG,MAAA,GAAAH,OAAA;AACA,IA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CAACC,MAAM,CAAEJ,QAAQ,CAACC,UAAU,EAAE;MACnCC,KAAK,EAAE;QACNG,IAAI,EAAE;MACP;IACD,CAAE,CAAC;EACJ;EAEA,OAAOL,QAAQ;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,0BAA0B,GAAG;EAClC,CAAG,GAAGvB,0BAAoB,kCAAiC,GAAI,CAAE,QAAQ,CAAE;EAC3E,CAAG,GAAGC,wBAAmB,kCAAiC,GAAI,CAC7DA,wBAAiB,CACjB;EACD,CAAG,GAAGuB,kCAAwB,kCAAiC,GAAI,CAClEA,kCAAsB,CACtB;EACD,CAAG,GAAGtB,kCAAwB,kCAAiC,GAAI,CAClEA,kCAAsB,CACtB;EACD,CAAG,GAAGC,+BAAqB,kCAAiC,GAAI,CAC/DA,+BAAmB;AAErB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMsB,0BAA0B,GAAG;EAClC,GAAGF,0BAA0B;EAC7B,CAAG,GAAGpB,+BAAqB,EAAC,GAAI,CAAE,kBAAkB;AACrD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMuB,eAAe,GAAG;EAAEC,SAAS,EAAE;AAAW,CAAC;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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E,0BAA0B,CACzB,CAAC;EAEH,MAAMc,OAAO,GAAG,IAAAC,mBAAU,EAAEC,kBAAS,CAACC,wBAAyB,CAAC;EAEhE,OACC,IAAA7G,QAAA,CAAA6E,aAAA,EAAA7E,QAAA,CAAAkF,QAAA,QACGtD,MAAM,IACP8E,OAAO,IACP,IAAAI,qBAAY,EACX,IAAA9G,QAAA,CAAA6E,aAAA;IACCkC,uBAAuB,EAAG;MACzBC,MAAM,EAAEpF;IACT;EAAG,CACH,CAAC,EACF8E,OACD,CAAC,EAEF,IAAA1G,QAAA,CAAA6E,aAAA,EAACY,cAAc;IAAA,GACT5B,KAAK;IACVoD,SAAS,EACRpD,KAAK,CAACzB,UAAU,CAACC,KAAK,EAAE0D,QAAQ,GAC7B,IAAAmB,mBAAU,EACVrD,KAAK,CAACoD,SAAS,EACfvB,gCACA,CAAC,GACD7B,KAAK,CAACoD;EACT,CACD,CACA,CAAC;AAEL,CAAC,EACD,oBACD,CAAC;AAED,IAAAE,gBAAS,EACR,0BAA0B,EAC1B,yBAAyB,EACzBjF,YACD,CAAC;AAED,IAAAiF,gBAAS,EACR,kCAAkC,EAClC,yBAAyB,EACzBvD,YACD,CAAC;AAED,IAAAuD,gBAAS,EACR,0BAA0B,EAC1B,yBAAyB,EACzB7C,YACD,CAAC;AAED,IAAA6C,gBAAS,EACR,kBAAkB,EAClB,gCAAgC,EAChC1C,iBACD,CAAC;AAED,IAAA0C,gBAAS,EACR,uBAAuB,EACvB,kCAAkC,EAClC3B,kBACD,CAAC"}
|
|
1
|
+
{"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_hooks","_blocks","_compose","_styleEngine","_blockList","_border","_color","_typography","_dimensions","_useDisplayBlockControls","_utils","_utils2","_blockEditingMode","styleSupportKeys","TYPOGRAPHY_SUPPORT_KEYS","BORDER_SUPPORT_KEY","COLOR_SUPPORT_KEY","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","hasStyleSupport","nameOrType","some","key","hasBlockSupport","getInlineStyles","styles","output","getCSSRules","forEach","rule","value","addAttribute","settings","attributes","style","Object","assign","type","skipSerializationPathsEdit","TYPOGRAPHY_SUPPORT_KEY","skipSerializationPathsSave","renamedFeatures","gradients","omitStyle","paths","preserveReference","newStyle","JSON","parse","stringify","Array","isArray","path","split","length","firstSubpath","restPath","addSaveProps","props","blockType","skipPaths","entries","indicator","skipSerialization","getBlockSupport","featureName","feature","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBlockControls","createHigherOrderComponent","BlockEdit","name","createElement","shouldDisplayControls","useDisplayBlockControls","blockEditingMode","useBlockEditingMode","Fragment","ColorEdit","TypographyPanel","BorderPanel","DimensionsPanel","exports","elementTypes","elementType","pseudo","elements","withElementsStyles","BlockListBlock","blockElementsContainerIdentifier","useInstanceId","baseElementSelector","blockElementStyles","useMemo","elementCSSRules","shouldSkipSerialization","elementStyles","selector","scopeSelector","ELEMENTS","push","compileCSS","pseudoSelector","element","join","undefined","useContext","BlockList","__unstableElementContext","createPortal","dangerouslySetInnerHTML","__html","className","classnames","addFilter"],"sources":["@wordpress/block-editor/src/hooks/style.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo, createPortal } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { getCSSRules, compileCSS } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { BORDER_SUPPORT_KEY, BorderPanel } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport {\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tDimensionsPanel,\n} from './dimensions';\nimport useDisplayBlockControls from '../components/use-display-block-controls';\nimport { shouldSkipSerialization } from './utils';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( nameOrType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( nameOrType, key ) );\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst output = {};\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tgetCSSRules( styles ).forEach( ( rule ) => {\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSPACING_SUPPORT_KEY,\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ SPACING_SUPPORT_KEY }` ]: [ 'spacing.blockGap' ],\n};\n\n/**\n * A dictionary used to normalize feature names between support flags, style\n * object properties and __experimentSkipSerialization configuration arrays.\n *\n * This allows not having to provide a migration for a support flag and possible\n * backwards compatibility bridges, while still achieving consistency between\n * the support flag and the skip serialization array.\n *\n * @constant\n * @type {Record<string, string>}\n */\nconst renamedFeatures = { gradients: 'gradient' };\n\n/**\n * A utility function used to remove one or more paths from a style object.\n * Works in a way similar to Lodash's `omit()`. See unit tests and examples below.\n *\n * It supports a single string path:\n *\n * ```\n * omitStyle( { color: 'red' }, 'color' ); // {}\n * ```\n *\n * or an array of paths:\n *\n * ```\n * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}\n * ```\n *\n * It also allows you to specify paths at multiple levels in a string.\n *\n * ```\n * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}\n * ```\n *\n * You can remove multiple paths at the same time:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t'typography.textDecoration',\n * \t\t\t'typography.textTransform',\n *\t\t]\n * );\n * // {}\n * ```\n *\n * You can also specify nested paths as arrays:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'typography', 'textDecoration' ],\n * \t\t\t[ 'typography', 'textTransform' ],\n *\t\t]\n * );\n * // {}\n * ```\n *\n * With regards to nesting of styles, infinite depth is supported:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\tborder: {\n * \t\t\t\tradius: {\n * \t\t\t\t\ttopLeft: '10px',\n * \t\t\t\t\ttopRight: '0.5rem',\n * \t\t\t\t}\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'border', 'radius', 'topRight' ],\n *\t\t]\n * );\n * // { border: { radius: { topLeft: '10px' } } }\n * ```\n *\n * The third argument, `preserveReference`, defines how to treat the input style object.\n * It is mostly necessary to properly handle mutation when recursively handling the style object.\n * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.\n * However, when recursing, we change that value to `true` in order to work with a single copy\n * of the original style object.\n *\n * @see https://lodash.com/docs/4.17.15#omit\n *\n * @param {Object} style Styles object.\n * @param {Array|string} paths Paths to remove.\n * @param {boolean} preserveReference True to mutate the `style` object, false otherwise.\n * @return {Object} Styles object with the specified paths removed.\n */\nexport function omitStyle( style, paths, preserveReference = false ) {\n\tif ( ! style ) {\n\t\treturn style;\n\t}\n\n\tlet newStyle = style;\n\tif ( ! preserveReference ) {\n\t\tnewStyle = JSON.parse( JSON.stringify( style ) );\n\t}\n\n\tif ( ! Array.isArray( paths ) ) {\n\t\tpaths = [ paths ];\n\t}\n\n\tpaths.forEach( ( path ) => {\n\t\tif ( ! Array.isArray( path ) ) {\n\t\t\tpath = path.split( '.' );\n\t\t}\n\n\t\tif ( path.length > 1 ) {\n\t\t\tconst [ firstSubpath, ...restPath ] = path;\n\t\t\tomitStyle( newStyle[ firstSubpath ], [ restPath ], true );\n\t\t} else if ( path.length === 1 ) {\n\t\t\tdelete newStyle[ path[ 0 ] ];\n\t\t}\n\t} );\n\n\treturn newStyle;\n}\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\tObject.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {\n\t\tconst skipSerialization = getBlockSupport( blockType, indicator );\n\n\t\tif ( skipSerialization === true ) {\n\t\t\tstyle = omitStyle( style, path );\n\t\t}\n\n\t\tif ( Array.isArray( skipSerialization ) ) {\n\t\t\tskipSerialization.forEach( ( featureName ) => {\n\t\t\t\tconst feature = renamedFeatures[ featureName ] || featureName;\n\t\t\t\tstyle = omitStyle( style, [ [ ...path, feature ] ] );\n\t\t\t} );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object}.Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps(\n\t\t\tprops,\n\t\t\tsettings,\n\t\t\tattributes,\n\t\t\tskipSerializationPathsEdit\n\t\t);\n\t};\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new inspector controls for\n * all the custom styles configs.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tif ( ! hasStyleSupport( props.name ) ) {\n\t\t\treturn <BlockEdit key=\"edit\" { ...props } />;\n\t\t}\n\n\t\tconst shouldDisplayControls = useDisplayBlockControls();\n\t\tconst blockEditingMode = useBlockEditingMode();\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldDisplayControls && blockEditingMode === 'default' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ColorEdit { ...props } />\n\t\t\t\t\t\t<TypographyPanel { ...props } />\n\t\t\t\t\t\t<BorderPanel { ...props } />\n\t\t\t\t\t\t<DimensionsPanel { ...props } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n// Defines which element types are supported, including their hover styles or\n// any other elements that have been included under a single element type\n// e.g. heading and h1-h6.\nconst elementTypes = [\n\t{ elementType: 'button' },\n\t{ elementType: 'link', pseudo: [ ':hover' ] },\n\t{\n\t\telementType: 'heading',\n\t\telements: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],\n\t},\n];\n\n/**\n * Override the default block element to include elements styles.\n *\n * @param {Function} BlockListBlock Original component\n * @return {Function} Wrapped component\n */\nconst withElementsStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\t\tBlockListBlock\n\t\t) }`;\n\n\t\t// The .editor-styles-wrapper selector is required on elements styles. As it is\n\t\t// added to all other editor styles, not providing it causes reset and global\n\t\t// styles to override element styles because of higher specificity.\n\t\tconst baseElementSelector = `.editor-styles-wrapper .${ blockElementsContainerIdentifier }`;\n\t\tconst blockElementStyles = props.attributes.style?.elements;\n\n\t\tconst styles = useMemo( () => {\n\t\t\tif ( ! blockElementStyles ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst elementCSSRules = [];\n\n\t\t\telementTypes.forEach( ( { elementType, pseudo, elements } ) => {\n\t\t\t\tconst skipSerialization = shouldSkipSerialization(\n\t\t\t\t\tprops.name,\n\t\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\t\telementType\n\t\t\t\t);\n\n\t\t\t\tif ( skipSerialization ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst elementStyles = blockElementStyles?.[ elementType ];\n\n\t\t\t\t// Process primary element type styles.\n\t\t\t\tif ( elementStyles ) {\n\t\t\t\t\tconst selector = scopeSelector(\n\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\tELEMENTS[ elementType ]\n\t\t\t\t\t);\n\n\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\tcompileCSS( elementStyles, { selector } )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Process any interactive states for the element type.\n\t\t\t\t\tif ( pseudo ) {\n\t\t\t\t\t\tpseudo.forEach( ( pseudoSelector ) => {\n\t\t\t\t\t\t\tif ( elementStyles[ pseudoSelector ] ) {\n\t\t\t\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\t\t\t\tcompileCSS(\n\t\t\t\t\t\t\t\t\t\telementStyles[ pseudoSelector ],\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t`${ ELEMENTS[ elementType ] }${ pseudoSelector }`\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Process related elements e.g. h1-h6 for headings\n\t\t\t\tif ( elements ) {\n\t\t\t\t\telements.forEach( ( element ) => {\n\t\t\t\t\t\tif ( blockElementStyles[ element ] ) {\n\t\t\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\t\t\tcompileCSS( blockElementStyles[ element ], {\n\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ element ]\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn elementCSSRules.length > 0\n\t\t\t\t? elementCSSRules.join( '' )\n\t\t\t\t: undefined;\n\t\t}, [ baseElementSelector, blockElementStyles, props.name ] );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ styles &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: styles,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tprops.attributes.style?.elements\n\t\t\t\t\t\t\t? classnames(\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\tblockElementsContainerIdentifier\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: props.className\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withElementsStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/style/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/with-elements-styles',\n\twithElementsStyles\n);\n"],"mappings":";;;;;;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AALA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAMA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAKA,IAAAW,WAAA,GAAAX,OAAA;AAKA,IAAAY,wBAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,OAAA,GAAAd,OAAA;AACA,IAAAe,iBAAA,GAAAf,OAAA;AArCA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAmBA,MAAMgB,gBAAgB,GAAG,CACxB,GAAGC,mCAAuB,EAC1BC,0BAAkB,EAClBC,wBAAiB,EACjBC,kCAAsB,EACtBC,+BAAmB,CACnB;AAED,MAAMC,eAAe,GAAKC,UAAU,IACnCP,gBAAgB,CAACQ,IAAI,CAAIC,GAAG,IAAM,IAAAC,uBAAe,EAA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AG,GAAGpB,+BAAqB,EAAC,GAAI,CAAE,kBAAkB;AACrD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMuB,eAAe,GAAG;EAAEC,SAAS,EAAE;AAAW,CAAC;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,SAASA,CAAET,KAAK,EAAEU,KAAK,EAAEC,iBAAiB,GAAG,KAAK,EAAG;EACpE,IAAK,CAAEX,KAAK,EAAG;IACd,OAAOA,KAAK;EACb;EAEA,IAAIY,QAAQ,GAAGZ,KAAK;EACpB,IAAK,CAAEW,iBAAiB,EAAG;IAC1BC,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAAED,IAAI,CAACE,SAAS,CAAEf,KAAM,CAAE,CAAC;EACjD;EAEA,IAAK,CAAEgB,KAAK,CAACC,OAAO,CAAEP,KAAM,CAAC,EAAG;IAC/BA,KAAK,GAAG,CAAEA,KAAK,CAAE;EAClB;EAEAA,KAAK,CAAChB,OAAO,CAAIwB,IAAI,IAAM;IAC1B,IAAK,CAAEF,KAAK,CAACC,OAAO,CAAEC,IAAK,CAAC,EAAG;MAC9BA,IAAI,GAAGA,IAAI,CAACC,KAAK,CAAE,GAAI,CAAC;IACzB;IAEA,IAAKD,IAAI,CAACE,MAAM,GAAG,CAAC,EAA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ED
|
@@ -146,6 +146,8 @@ function useBlockSettings(name, parentLayout) {
|
|
|
146
146
|
const isBackgroundEnabled = (0, _components.useSetting)('color.background');
|
|
147
147
|
const isLinkEnabled = (0, _components.useSetting)('color.link');
|
|
148
148
|
const isTextEnabled = (0, _components.useSetting)('color.text');
|
|
149
|
+
const isHeadingEnabled = (0, _components.useSetting)('color.heading');
|
|
150
|
+
const isButtonEnabled = (0, _components.useSetting)('color.button');
|
|
149
151
|
const rawSettings = (0, _element.useMemo)(() => {
|
|
150
152
|
return {
|
|
151
153
|
color: {
|
|
@@ -172,6 +174,8 @@ function useBlockSettings(name, parentLayout) {
|
|
|
172
174
|
customDuotone,
|
|
173
175
|
background: isBackgroundEnabled,
|
|
174
176
|
link: isLinkEnabled,
|
|
177
|
+
heading: isHeadingEnabled,
|
|
178
|
+
button: isButtonEnabled,
|
|
175
179
|
text: isTextEnabled
|
|
176
180
|
},
|
|
177
181
|
typography: {
|
package/build/hooks/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_element","_components","_hooks","_object","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","entries","map","key","value","filter","undefined","length","fromEntries","exports","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","path","styleValue","getValueFromObjectPath","setImmutably","shouldSkipSerialization","blockType","featureSet","feature","getBlockSupport","skipSerialization","__experimentalSkipSerialization","includes","useBlockSettings","name","parentLayout","fontFamilies","useSetting","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textColumns","textDecoration","writingMode","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","customDuotone","themeColors","defaultColors","defaultPalette","defaultDuotone","userDuotonePalette","themeDuotonePalette","defaultDuotonePalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","rawSettings","useMemo","color","palette","custom","theme","default","gradients","duotone","customGradient","background","link","text","typography","spacing","border","radius","style","width","dimensions","useSettingsForBlockElement"],"sources":["@wordpress/block-editor/src/hooks/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { getValueFromObjectPath, setImmutably } from '../utils/object';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\n\tconst cleanedNestedObjects = Object.entries( object )\n\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t.filter( ( [ , value ] ) => value !== undefined );\n\treturn ! cleanedNestedObjects.length\n\t\t? undefined\n\t\t: Object.fromEntries( cleanedNestedObjects );\n};\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\t\treferenceBlockAttributes,\n\t\t\t\t\tpath\n\t\t\t\t);\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: setImmutably(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization( blockType, featureSet, feature ) {\n\tconst support = getBlockSupport( blockType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst customFontSize = useSetting( 'typography.customFontSize' );\n\tconst fontStyle = useSetting( 'typography.fontStyle' );\n\tconst fontWeight = useSetting( 'typography.fontWeight' );\n\tconst lineHeight = useSetting( 'typography.lineHeight' );\n\tconst textColumns = useSetting( 'typography.textColumns' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst writingMode = useSetting( 'typography.writingMode' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst padding = useSetting( 'spacing.padding' );\n\tconst margin = useSetting( 'spacing.margin' );\n\tconst blockGap = useSetting( 'spacing.blockGap' );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst units = useSetting( 'spacing.units' );\n\tconst minHeight = useSetting( 'dimensions.minHeight' );\n\tconst layout = useSetting( 'layout' );\n\tconst borderColor = useSetting( 'border.color' );\n\tconst borderRadius = useSetting( 'border.radius' );\n\tconst borderStyle = useSetting( 'border.style' );\n\tconst borderWidth = useSetting( 'border.width' );\n\tconst customColorsEnabled = useSetting( 'color.custom' );\n\tconst customColors = useSetting( 'color.palette.custom' );\n\tconst customDuotone = useSetting( 'color.customDuotone' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst defaultPalette = useSetting( 'color.defaultPalette' );\n\tconst defaultDuotone = useSetting( 'color.defaultDuotone' );\n\tconst userDuotonePalette = useSetting( 'color.duotone.custom' );\n\tconst themeDuotonePalette = useSetting( 'color.duotone.theme' );\n\tconst defaultDuotonePalette = useSetting( 'color.duotone.default' );\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst defaultGradients = useSetting( 'color.defaultGradients' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tduotone: {\n\t\t\t\t\tcustom: userDuotonePalette,\n\t\t\t\t\ttheme: themeDuotonePalette,\n\t\t\t\t\tdefault: defaultDuotonePalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tdefaultDuotone,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tcustomDuotone,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t\twritingMode,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t};\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\twritingMode,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,gBAAgB,GAAKC,MAAM,IAAM;EAC7C,IACCA,MAAM,KAAK,IAAI,IACf,OAAOA,MAAM,KAAK,QAAQ,IAC1BC,KAAK,CA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M,EACNnB,YAAY,EACZoB,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,WAAW,EACXC,mBAAmB,EACnBC,YAAY,EACZC,aAAa,EACbC,WAAW,EACXC,aAAa,EACbC,cAAc,EACdC,cAAc,EACdC,kBAAkB,EAClBC,mBAAmB,EACnBC,qBAAqB,EACrBC,mBAAmB,EACnBC,oBAAoB,EACpBC,sBAAsB,EACtBC,gBAAgB,EAChBC,yBAAyB,EACzBC,mBAAmB,EACnBC,aAAa,EACbC,aAAa,CACZ,CAAC;EAEH,OAAO,IAAAqB,iCAA0B,EAAEpB,WAAW,EAAE3C,IAAK,CAAC;AACvD"}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_element","_components","_hooks","_object","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","entries","map","key","value","filter","undefined","length","fromEntries","exports","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","path","styleValue","getValueFromObjectPath","setImmutably","shouldSkipSerialization","blockType","featureSet","feature","getBlockSupport","skipSerialization","__experimentalSkipSerialization","includes","useBlockSettings","name","parentLayout","fontFamilies","useSetting","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textColumns","textDecoration","writingMode","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","customDuotone","themeColors","defaultColors","defaultPalette","defaultDuotone","userDuotonePalette","themeDuotonePalette","defaultDuotonePalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","isHeadingEnabled","isButtonEnabled","rawSettings","useMemo","color","palette","custom","theme","default","gradients","duotone","customGradient","background","link","heading","button","text","typography","spacing","border","radius","style","width","dimensions","useSettingsForBlockElement"],"sources":["@wordpress/block-editor/src/hooks/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { getValueFromObjectPath, setImmutably } from '../utils/object';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\n\tconst cleanedNestedObjects = Object.entries( object )\n\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t.filter( ( [ , value ] ) => value !== undefined );\n\treturn ! cleanedNestedObjects.length\n\t\t? undefined\n\t\t: Object.fromEntries( cleanedNestedObjects );\n};\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\t\treferenceBlockAttributes,\n\t\t\t\t\tpath\n\t\t\t\t);\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: setImmutably(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization( blockType, featureSet, feature ) {\n\tconst support = getBlockSupport( blockType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst customFontSize = useSetting( 'typography.customFontSize' );\n\tconst fontStyle = useSetting( 'typography.fontStyle' );\n\tconst fontWeight = useSetting( 'typography.fontWeight' );\n\tconst lineHeight = useSetting( 'typography.lineHeight' );\n\tconst textColumns = useSetting( 'typography.textColumns' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst writingMode = useSetting( 'typography.writingMode' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst padding = useSetting( 'spacing.padding' );\n\tconst margin = useSetting( 'spacing.margin' );\n\tconst blockGap = useSetting( 'spacing.blockGap' );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst units = useSetting( 'spacing.units' );\n\tconst minHeight = useSetting( 'dimensions.minHeight' );\n\tconst layout = useSetting( 'layout' );\n\tconst borderColor = useSetting( 'border.color' );\n\tconst borderRadius = useSetting( 'border.radius' );\n\tconst borderStyle = useSetting( 'border.style' );\n\tconst borderWidth = useSetting( 'border.width' );\n\tconst customColorsEnabled = useSetting( 'color.custom' );\n\tconst customColors = useSetting( 'color.palette.custom' );\n\tconst customDuotone = useSetting( 'color.customDuotone' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst defaultPalette = useSetting( 'color.defaultPalette' );\n\tconst defaultDuotone = useSetting( 'color.defaultDuotone' );\n\tconst userDuotonePalette = useSetting( 'color.duotone.custom' );\n\tconst themeDuotonePalette = useSetting( 'color.duotone.theme' );\n\tconst defaultDuotonePalette = useSetting( 'color.duotone.default' );\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst defaultGradients = useSetting( 'color.defaultGradients' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\tconst isHeadingEnabled = useSetting( 'color.heading' );\n\tconst isButtonEnabled = useSetting( 'color.button' );\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tduotone: {\n\t\t\t\t\tcustom: userDuotonePalette,\n\t\t\t\t\ttheme: themeDuotonePalette,\n\t\t\t\t\tdefault: defaultDuotonePalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tdefaultDuotone,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tcustomDuotone,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\theading: isHeadingEnabled,\n\t\t\t\tbutton: isButtonEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t\twritingMode,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t};\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\twritingMode,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,gBAAgB,GAAKC,MAAM,IAAM;EAC7C,IACCA,MAAM,KAAK,IAAI,IACf,OAAOA,MAAM,KAAK,QAAQ,IAC1BC,KAAK,CAACC,OAAO,CAAEF,MAAO,CAAC,EACtB;IACD,OAAOA,MAAM;EACd;EAEA,MAAMG,oBAAoB,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EACbC,aAAa,EACbF,WAAW,EACXG,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,YAAY,EACZC,KAAK,EACLC,SAAS,EACTC,MAAM,EACNnB,YAAY,EACZoB,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,WAAW,EACXC,mBAAmB,EACnBC,YAAY,EACZC,aAAa,EACbC,WAAW,EACXC,aAAa,EACbC,cAAc,EACdC,cAAc,EACdC,kBAAkB,EAClBC,mBAAmB,EACnBC,qBAAqB,EACrBC,mBAAmB,EACnBC,oBAAoB,EACpBC,sBAAsB,EACtBC,gBAAgB,EAChBC,yBAAyB,EACzBC,mBAAmB,EACnBC,aAAa,EACbC,aAAa,CACZ,CAAC;EAEH,OAAO,IAAAyB,iCAA0B,EAAEtB,WAAW,EAAE7C,IAAK,CAAC;AACvD"}
|
|
@@ -13,7 +13,7 @@ import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import styles from './block.scss';
|
|
16
|
-
const
|
|
16
|
+
const TEXT_BLOCKS_WITH_OUTLINE = ['core/missing'];
|
|
17
17
|
function BlockOutline({
|
|
18
18
|
blockCategory,
|
|
19
19
|
hasInnerBlocks,
|
|
@@ -21,12 +21,13 @@ function BlockOutline({
|
|
|
21
21
|
isSelected,
|
|
22
22
|
name
|
|
23
23
|
}) {
|
|
24
|
-
const textBlockWithOutline =
|
|
24
|
+
const textBlockWithOutline = TEXT_BLOCKS_WITH_OUTLINE.includes(name);
|
|
25
|
+
const socialBlockWithOutline = name.includes('core/social-link');
|
|
25
26
|
const hasBlockTextCategory = blockCategory === 'text' && !textBlockWithOutline;
|
|
26
27
|
const hasBlockMediaCategory = blockCategory === 'media' || blockCategory === 'embed' || !blockCategory;
|
|
27
28
|
const shouldShowCompactOutline = hasBlockMediaCategory && !hasInnerBlocks || textBlockWithOutline;
|
|
28
29
|
const styleSolidBorder = [styles.solidBorder, usePreferredColorSchemeStyle(styles.solidBorderColor, styles.solidBorderColorDark), shouldShowCompactOutline && styles.solidBorderCompact, hasBlockTextCategory && styles.solidBorderTextContent];
|
|
29
|
-
const shoudlShowOutline = isSelected && (hasBlockTextCategory && hasInnerBlocks || !hasBlockTextCategory && hasInnerBlocks || !hasBlockTextCategory && isRootList || textBlockWithOutline);
|
|
30
|
+
const shoudlShowOutline = isSelected && (hasBlockTextCategory && hasInnerBlocks || !hasBlockTextCategory && hasInnerBlocks || !hasBlockTextCategory && isRootList || socialBlockWithOutline || textBlockWithOutline);
|
|
30
31
|
return shoudlShowOutline && createElement(View, {
|
|
31
32
|
pointerEvents: "box-none",
|
|
32
33
|
style: styleSolidBorder
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","usePreferredColorSchemeStyle","styles","
|
|
1
|
+
{"version":3,"names":["View","usePreferredColorSchemeStyle","styles","TEXT_BLOCKS_WITH_OUTLINE","BlockOutline","blockCategory","hasInnerBlocks","isRootList","isSelected","name","textBlockWithOutline","includes","socialBlockWithOutline","hasBlockTextCategory","hasBlockMediaCategory","shouldShowCompactOutline","styleSolidBorder","solidBorder","solidBorderColor","solidBorderColorDark","solidBorderCompact","solidBorderTextContent","shoudlShowOutline","createElement","pointerEvents","style"],"sources":["@wordpress/block-editor/src/components/block-list/block-outline.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './block.scss';\n\nconst TEXT_BLOCKS_WITH_OUTLINE = [ 'core/missing' ];\n\nfunction BlockOutline( {\n\tblockCategory,\n\thasInnerBlocks,\n\tisRootList,\n\tisSelected,\n\tname,\n} ) {\n\tconst textBlockWithOutline = TEXT_BLOCKS_WITH_OUTLINE.includes( name );\n\tconst socialBlockWithOutline = name.includes( 'core/social-link' );\n\n\tconst hasBlockTextCategory =\n\t\tblockCategory === 'text' && ! textBlockWithOutline;\n\tconst hasBlockMediaCategory =\n\t\tblockCategory === 'media' ||\n\t\tblockCategory === 'embed' ||\n\t\t! blockCategory;\n\tconst shouldShowCompactOutline =\n\t\t( hasBlockMediaCategory && ! hasInnerBlocks ) || textBlockWithOutline;\n\n\tconst styleSolidBorder = [\n\t\tstyles.solidBorder,\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.solidBorderColor,\n\t\t\tstyles.solidBorderColorDark\n\t\t),\n\t\tshouldShowCompactOutline && styles.solidBorderCompact,\n\t\thasBlockTextCategory && styles.solidBorderTextContent,\n\t];\n\n\tconst shoudlShowOutline =\n\t\tisSelected &&\n\t\t( ( hasBlockTextCategory && hasInnerBlocks ) ||\n\t\t\t( ! hasBlockTextCategory && hasInnerBlocks ) ||\n\t\t\t( ! hasBlockTextCategory && isRootList ) ||\n\t\t\tsocialBlockWithOutline ||\n\t\t\ttextBlockWithOutline );\n\n\treturn (\n\t\tshoudlShowOutline && (\n\t\t\t<View pointerEvents=\"box-none\" style={ styleSolidBorder } />\n\t\t)\n\t);\n}\n\nexport default BlockOutline;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,cAAc;;AAEnC;AACA;AACA;AACA,SAASC,4BAA4B,QAAQ,oBAAoB;;AAEjE;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AAEjC,MAAMC,wBAAwB,GAAG,CAAE,cAAc,CAAE;AAEnD,SAASC,YAAYA,CAAE;EACtBC,aAAa;EACbC,cAAc;EACdC,UAAU;EACVC,UAAU;EACVC;AACD,CAAC,EAAG;EACH,MAAMC,oBAAoB,GAAGP,wBAAwB,CAACQ,QAAQ,CAAEF,IAAK,CAAC;EACtE,MAAMG,sBAAsB,GAAGH,IAAI,CAACE,QAAQ,CAAE,kBAAmB,CAAC;EAElE,MAAME,oBAAoB,GACzBR,aAAa,KAAK,MAAM,IAAI,CAAEK,oBAAoB;EACnD,MAAMI,qBAAqB,GAC1BT,aAAa,KAAK,OAAO,IACzBA,aAAa,KAAK,OAAO,IACzB,CAAEA,aAAa;EAChB,MAAMU,wBAAwB,GAC3BD,qBAAqB,IAAI,CAAER,cAAc,IAAMI,oBAAoB;EAEtE,MAAMM,gBAAgB,GAAG,CACxBd,MAAM,CAACe,WAAW,EAClBhB,4BAA4B,CAC3BC,MAAM,CAACgB,gBAAgB,EACvBhB,MAAM,CAACiB,oBACR,CAAC,EACDJ,wBAAwB,IAAIb,MAAM,CAACkB,kBAAkB,EACrDP,oBAAoB,IAAIX,MAAM,CAACmB,sBAAsB,CACrD;EAED,MAAMC,iBAAiB,GACtBd,UAAU,KACNK,oBAAoB,IAAIP,cAAc,IACvC,CAAEO,oBAAoB,IAAIP,cAAgB,IAC1C,CAAEO,oBAAoB,IAAIN,UAAY,IACxCK,sBAAsB,IACtBF,oBAAoB,CAAE;EAExB,OACCY,iBAAiB,IAChBC,aAAA,CAACvB,IAAI;IAACwB,aAAa,EAAC,UAAU;IAACC,KAAK,EAAGT;EAAkB,CAAE,CAC3D;AAEH;AAEA,eAAeZ,YAAY"}
|
|
@@ -18,11 +18,11 @@ import BlockListBlock from './block';
|
|
|
18
18
|
import BlockListAppender from '../block-list-appender';
|
|
19
19
|
import { useInBetweenInserter } from './use-in-between-inserter';
|
|
20
20
|
import { store as blockEditorStore } from '../../store';
|
|
21
|
-
import { usePreParsePatterns } from '../../utils/pre-parse-patterns';
|
|
22
21
|
import { LayoutProvider, defaultLayout } from './layout';
|
|
23
22
|
import { useBlockSelectionClearer } from '../block-selection-clearer';
|
|
24
23
|
import { useInnerBlocksProps } from '../inner-blocks';
|
|
25
24
|
import { BlockEditContextProvider, DEFAULT_BLOCK_EDIT_CONTEXT } from '../block-edit/context';
|
|
25
|
+
import { useTypingObserver } from '../observe-typing';
|
|
26
26
|
const elementContext = createContext();
|
|
27
27
|
export const IntersectionObserver = createContext();
|
|
28
28
|
const pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();
|
|
@@ -83,7 +83,7 @@ function Root({
|
|
|
83
83
|
});
|
|
84
84
|
}, []);
|
|
85
85
|
const innerBlocksProps = useInnerBlocksProps({
|
|
86
|
-
ref: useMergeRefs([useBlockSelectionClearer(), useInBetweenInserter(),
|
|
86
|
+
ref: useMergeRefs([useBlockSelectionClearer(), useInBetweenInserter(), useTypingObserver()]),
|
|
87
87
|
className: classnames('is-root-container', className, {
|
|
88
88
|
'is-outline-mode': isOutlineMode,
|
|
89
89
|
'is-focus-mode': isFocusMode && isLargeViewport,
|
|
@@ -96,10 +96,11 @@ function Root({
|
|
|
96
96
|
value: intersectionObserver
|
|
97
97
|
}, createElement("div", {
|
|
98
98
|
...innerBlocksProps
|
|
99
|
+
}), createElement("div", {
|
|
100
|
+
ref: setElement
|
|
99
101
|
})));
|
|
100
102
|
}
|
|
101
103
|
export default function BlockList(settings) {
|
|
102
|
-
usePreParsePatterns();
|
|
103
104
|
return createElement(BlockEditContextProvider, {
|
|
104
105
|
value: DEFAULT_BLOCK_EDIT_CONTEXT
|
|
105
106
|
}, createElement(Root, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","AsyncModeProvider","useSelect","useDispatch","useRegistry","useViewportMatch","useMergeRefs","useDebounce","createContext","useState","useMemo","useCallback","BlockListBlock","BlockListAppender","useInBetweenInserter","store","blockEditorStore","usePreParsePatterns","LayoutProvider","defaultLayout","useBlockSelectionClearer","useInnerBlocksProps","BlockEditContextProvider","DEFAULT_BLOCK_EDIT_CONTEXT","elementContext","IntersectionObserver","pendingBlockVisibilityUpdatesPerRegistry","WeakMap","Root","className","settings","element","setElement","isLargeViewport","isOutlineMode","isFocusMode","editorMode","select","getSettings","__unstableGetEditorMode","outlineMode","focusMode","registry","setBlockVisibility","delayedBlockVisibilityUpdates","updates","get","forEach","id","isIntersecting","trailing","intersectionObserver","Observer","window","entries","set","entry","clientId","target","getAttribute","push","innerBlocksProps","ref","createElement","Provider","value","BlockList","__unstableElementContext","Items","placeholder","rootClientId","renderAppender","__experimentalAppenderTagName","layout","order","selectedBlocks","visibleBlocks","getBlockOrder","getSelectedBlockClientIds","__unstableGetVisibleBlocks","map","key","has","includes","length","tagName","BlockListItems","props"],"sources":["@wordpress/block-editor/src/components/block-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAsyncModeProvider,\n\tuseSelect,\n\tuseDispatch,\n\tuseRegistry,\n} from '@wordpress/data';\nimport {\n\tuseViewportMatch,\n\tuseMergeRefs,\n\tuseDebounce,\n} from '@wordpress/compose';\nimport {\n\tcreateContext,\n\tuseState,\n\tuseMemo,\n\tuseCallback,\n} from '@wordpress/element';\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 { usePreParsePatterns } from '../../utils/pre-parse-patterns';\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';\n\nconst elementContext = createContext();\n\nexport const IntersectionObserver = createContext();\nconst pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();\n\nfunction Root( { className, ...settings } ) {\n\tconst [ element, setElement ] = useState();\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { isOutlineMode, isFocusMode, editorMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, __unstableGetEditorMode } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { outlineMode, focusMode } = getSettings();\n\t\t\treturn {\n\t\t\t\tisOutlineMode: outlineMode,\n\t\t\t\tisFocusMode: focusMode,\n\t\t\t\teditorMode: __unstableGetEditorMode(),\n\t\t\t};\n\t\t},\n\t\t[]\n\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\tsetElement,\n\t\t\t] ),\n\t\t\tclassName: classnames( 'is-root-container', className, {\n\t\t\t\t'is-outline-mode': isOutlineMode,\n\t\t\t\t'is-focus-mode': isFocusMode && isLargeViewport,\n\t\t\t\t'is-navigate-mode': editorMode === 'navigation',\n\t\t\t} ),\n\t\t},\n\t\tsettings\n\t);\n\treturn (\n\t\t<elementContext.Provider value={ element }>\n\t\t\t<IntersectionObserver.Provider value={ intersectionObserver }>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</IntersectionObserver.Provider>\n\t\t</elementContext.Provider>\n\t);\n}\n\nexport default function BlockList( settings ) {\n\tusePreParsePatterns();\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\nBlockList.__unstableElementContext = elementContext;\n\nfunction Items( {\n\tplaceholder,\n\trootClientId,\n\trenderAppender,\n\t__experimentalAppenderTagName,\n\tlayout = defaultLayout,\n} ) {\n\tconst { order, selectedBlocks, visibleBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\t__unstableGetVisibleBlocks,\n\t\t\t} = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\torder: getBlockOrder( rootClientId ),\n\t\t\t\tselectedBlocks: getSelectedBlockClientIds(),\n\t\t\t\tvisibleBlocks: __unstableGetVisibleBlocks(),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\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<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</AsyncModeProvider>\n\t\t\t) ) }\n\t\t\t{ order.length < 1 && placeholder }\n\t\t\t<BlockListAppender\n\t\t\t\ttagName={ __experimentalAppenderTagName }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\trenderAppender={ renderAppender }\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,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,iBAAiB,EACjBC,SAAS,EACTC,WAAW,EACXC,WAAW,QACL,iBAAiB;AACxB,SACCC,gBAAgB,EAChBC,YAAY,EACZC,WAAW,QACL,oBAAoB;AAC3B,SACCC,aAAa,EACbC,QAAQ,EACRC,OAAO,EACPC,WAAW,QACL,oBAAoB;;AAE3B;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,mBAAmB,QAAQ,gCAAgC;AACpE,SAASC,cAAc,EAAEC,aAAa,QAAQ,UAAU;AACxD,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SACCC,wBAAwB,EACxBC,0BAA0B,QACpB,uBAAuB;AAE9B,MAAMC,cAAc,GAAGhB,aAAa,CAAC,CAAC;AAEtC,OAAO,MAAMiB,oBAAoB,GAAGjB,aAAa,CAAC,CAAC;AACnD,MAAMkB,wCAAwC,GAAG,IAAIC,OAAO,CAAC,CAAC;AAE9D,SAASC,IAAIA,CAAE;EAAEC,SAAS;EAAE,GAAGC;AAAS,CAAC,EAAG;EAC3C,MAAM,CAAEC,OAAO,EAAEC,UAAU,CAAE,GAAGvB,QAAQ,CAAC,CAAC;EAC1C,MAAMwB,eAAe,GAAG5B,gBAAgB,CAAE,QAAS,CAAC;EACpD,MAAM;IAAE6B,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ider","useSelect","useDispatch","useRegistry","useViewportMatch","useMergeRefs","useDebounce","createContext","useState","useMemo","useCallback","BlockListBlock","BlockListAppender","useInBetweenInserter","store","blockEditorStore","LayoutProvider","defaultLayout","useBlockSelectionClearer","useInnerBlocksProps","BlockEditContextProvider","DEFAULT_BLOCK_EDIT_CONTEXT","useTypingObserver","elementContext","IntersectionObserver","pendingBlockVisibilityUpdatesPerRegistry","WeakMap","Root","className","settings","element","setElement","isLargeViewport","isOutlineMode","isFocusMode","editorMode","select","getSettings","__unstableGetEditorMode","outlineMode","focusMode","registry","setBlockVisibility","delayedBlockVisibilityUpdates","updates","get","forEach","id","isIntersecting","trailing","intersectionObserver","Observer","window","entries","set","entry","clientId","target","getAttribute","push","innerBlocksProps","ref","createElement","Provider","value","BlockList","__unstableElementContext","Items","placeholder","rootClientId","renderAppender","__experimentalAppenderTagName","layout","order","selectedBlocks","visibleBlocks","getBlockOrder","getSelectedBlockClientIds","__unstableGetVisibleBlocks","map","key","has","includes","length","tagName","BlockListItems","props"],"sources":["@wordpress/block-editor/src/components/block-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAsyncModeProvider,\n\tuseSelect,\n\tuseDispatch,\n\tuseRegistry,\n} from '@wordpress/data';\nimport {\n\tuseViewportMatch,\n\tuseMergeRefs,\n\tuseDebounce,\n} from '@wordpress/compose';\nimport {\n\tcreateContext,\n\tuseState,\n\tuseMemo,\n\tuseCallback,\n} from '@wordpress/element';\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';\n\nconst elementContext = createContext();\n\nexport const IntersectionObserver = createContext();\nconst pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();\n\nfunction Root( { className, ...settings } ) {\n\tconst [ element, setElement ] = useState();\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { isOutlineMode, isFocusMode, editorMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, __unstableGetEditorMode } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { outlineMode, focusMode } = getSettings();\n\t\t\treturn {\n\t\t\t\tisOutlineMode: outlineMode,\n\t\t\t\tisFocusMode: focusMode,\n\t\t\t\teditorMode: __unstableGetEditorMode(),\n\t\t\t};\n\t\t},\n\t\t[]\n\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: classnames( 'is-root-container', className, {\n\t\t\t\t'is-outline-mode': isOutlineMode,\n\t\t\t\t'is-focus-mode': isFocusMode && isLargeViewport,\n\t\t\t\t'is-navigate-mode': editorMode === 'navigation',\n\t\t\t} ),\n\t\t},\n\t\tsettings\n\t);\n\treturn (\n\t\t<elementContext.Provider value={ element }>\n\t\t\t<IntersectionObserver.Provider value={ intersectionObserver }>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t{ /* Ensure element and layout styles are always at the end of the document */ }\n\t\t\t\t<div ref={ setElement } />\n\t\t\t</IntersectionObserver.Provider>\n\t\t</elementContext.Provider>\n\t);\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\nBlockList.__unstableElementContext = elementContext;\n\nfunction Items( {\n\tplaceholder,\n\trootClientId,\n\trenderAppender,\n\t__experimentalAppenderTagName,\n\tlayout = defaultLayout,\n} ) {\n\tconst { order, selectedBlocks, visibleBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\t__unstableGetVisibleBlocks,\n\t\t\t} = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\torder: getBlockOrder( rootClientId ),\n\t\t\t\tselectedBlocks: getSelectedBlockClientIds(),\n\t\t\t\tvisibleBlocks: __unstableGetVisibleBlocks(),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\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<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</AsyncModeProvider>\n\t\t\t) ) }\n\t\t\t{ order.length < 1 && placeholder }\n\t\t\t<BlockListAppender\n\t\t\t\ttagName={ __experimentalAppenderTagName }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\trenderAppender={ renderAppender }\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,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,iBAAiB,EACjBC,SAAS,EACTC,WAAW,EACXC,WAAW,QACL,iBAAiB;AACxB,SACCC,gBAAgB,EAChBC,YAAY,EACZC,WAAW,QACL,oBAAoB;AAC3B,SACCC,aAAa,EACbC,QAAQ,EACRC,OAAO,EACPC,WAAW,QACL,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAOC,cAAc,MAAM,SAAS;AACpC,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;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AAEW,aAAa,CAACM,GAAG,CAAEzB,QAAS,CAAC,IAC/B,CAAEkB,cAAc,CAACQ,QAAQ,CAAE1B,QAAS;EACpC,GAEDM,aAAA,CAACnD,cAAc;IACd0D,YAAY,EAAGA,YAAc;IAC7Bb,QAAQ,EAAGA;EAAU,CACrB,CACiB,CAClB,CAAC,EACDiB,KAAK,CAACU,MAAM,GAAG,CAAC,IAAIf,WAAW,EACjCN,aAAA,CAAClD,iBAAiB;IACjBwE,OAAO,EAAGb,6BAA+B;IACzCF,YAAY,EAAGA,YAAc;IAC7BC,cAAc,EAAGA;EAAgB,CACjC,CACc,CAAC;AAEnB;AAEA,OAAO,SAASe,cAAcA,CAAEC,KAAK,EAAG;EACvC;EACA;EACA,OACCxB,aAAA,CAAC9D,iBAAiB;IAACgE,KAAK,EAAG;EAAO,GACjCF,aAAA,CAACK,KAAK;IAAA,GAAMmB;EAAK,CAAI,CACH,CAAC;AAEtB"}
|
|
@@ -60,11 +60,9 @@ function BlockPopoverInbetween({
|
|
|
60
60
|
popoverRecomputeCounter < 0 || !previousElement && !nextElement || !isVisible) {
|
|
61
61
|
return undefined;
|
|
62
62
|
}
|
|
63
|
-
const
|
|
64
|
-
ownerDocument
|
|
65
|
-
} = previousElement || nextElement;
|
|
63
|
+
const contextElement = previousElement || nextElement;
|
|
66
64
|
return {
|
|
67
|
-
|
|
65
|
+
contextElement,
|
|
68
66
|
getBoundingClientRect() {
|
|
69
67
|
const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
|
|
70
68
|
const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
|
|
@@ -161,7 +159,8 @@ function BlockPopoverInbetween({
|
|
|
161
159
|
// Render in the old slot if needed for backward compatibility,
|
|
162
160
|
// otherwise render in place (not in the default popover slot).
|
|
163
161
|
,
|
|
164
|
-
__unstableSlotName: __unstablePopoverSlot
|
|
162
|
+
__unstableSlotName: __unstablePopoverSlot,
|
|
163
|
+
inline: !__unstablePopoverSlot
|
|
165
164
|
// Forces a remount of the popover when its position changes
|
|
166
165
|
// This makes sure the popover doesn't animate from its previous position.
|
|
167
166
|
,
|