@wordpress/block-editor 11.8.0 → 12.0.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 +15 -3
- package/build/components/block-info-slot-fill/index.js +47 -0
- package/build/components/block-info-slot-fill/index.js.map +1 -0
- package/build/components/block-inspector/index.js +4 -2
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block.native.js +3 -4
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-toolbar/index.js +2 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +83 -9
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +11 -28
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/editor-styles/index.js +4 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +21 -14
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -32
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +12 -12
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.native.js +174 -0
- package/build/components/global-styles/color-panel.native.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +6 -6
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +1 -1
- package/build/components/global-styles/effects-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +78 -14
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +9 -9
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +87 -77
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/index.js +7 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +12 -7
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/index.js +2 -1
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +2 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/list-view/block-select-button.js +7 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +12 -21
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +37 -10
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +10 -4
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -1
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +1 -1
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-replace-flow/index.js +5 -5
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +12 -4
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +2 -7
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/hooks/duotone.js +29 -4
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/utils.js +15 -3
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +10 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +7 -0
- package/build/store/actions.js.map +1 -1
- package/build/utils/object.js +5 -5
- package/build/utils/object.js.map +1 -1
- package/build/utils/transform-styles/index.js +2 -2
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build/utils/use-should-contextual-toolbar-show.js +68 -0
- package/build/utils/use-should-contextual-toolbar-show.js.map +1 -0
- package/build-module/components/block-info-slot-fill/index.js +34 -0
- package/build-module/components/block-info-slot-fill/index.js.map +1 -0
- package/build-module/components/block-inspector/index.js +3 -2
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block.native.js +3 -4
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +2 -1
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +79 -9
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +10 -27
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/editor-styles/index.js +4 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +21 -14
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +2 -32
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +13 -13
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.native.js +150 -0
- package/build-module/components/global-styles/color-panel.native.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +7 -7
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +2 -2
- package/build-module/components/global-styles/effects-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +78 -16
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +10 -10
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +87 -77
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +12 -6
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -1
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +7 -2
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +14 -22
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +36 -10
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +11 -5
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -1
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +1 -1
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +5 -5
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +12 -4
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +1 -5
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/hooks/duotone.js +28 -5
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/utils.js +16 -4
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +7 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +7 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/object.js +4 -4
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +2 -2
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-module/utils/use-should-contextual-toolbar-show.js +56 -0
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -0
- package/build-style/content-rtl.css +9 -6
- package/build-style/content.css +9 -6
- package/build-style/style-rtl.css +223 -46
- package/build-style/style.css +223 -46
- package/package.json +32 -32
- package/src/components/block-info-slot-fill/index.js +24 -0
- package/src/components/block-inspector/index.js +3 -0
- package/src/components/block-list/block.native.js +2 -3
- package/src/components/block-list/content.scss +16 -15
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +9 -9
- package/src/components/block-mover/style.scss +10 -4
- package/src/components/block-mover/test/index.native.js +4 -4
- package/src/components/block-toolbar/index.js +4 -3
- package/src/components/block-toolbar/style.scss +56 -33
- package/src/components/block-tools/block-contextual-toolbar.js +94 -11
- package/src/components/block-tools/selected-block-popover.js +11 -44
- package/src/components/block-tools/style.scss +157 -3
- package/src/components/editor-styles/index.js +9 -5
- package/src/components/font-sizes/fluid-utils.js +31 -14
- package/src/components/font-sizes/test/fluid-utils.js +5 -16
- package/src/components/global-styles/border-panel.js +1 -30
- package/src/components/global-styles/color-panel.js +13 -13
- package/src/components/global-styles/color-panel.native.js +207 -0
- package/src/components/global-styles/dimensions-panel.js +17 -7
- package/src/components/global-styles/effects-panel.js +2 -2
- package/src/components/global-styles/filters-panel.js +90 -17
- package/src/components/global-styles/style.scss +2 -1
- package/src/components/global-styles/test/typography-utils.js +63 -22
- package/src/components/global-styles/test/use-global-styles-output.js +126 -4
- package/src/components/global-styles/typography-panel.js +37 -11
- package/src/components/global-styles/use-global-styles-output.js +64 -64
- package/src/components/index.js +1 -0
- package/src/components/inserter/block-types-tab.js +9 -6
- package/src/components/inserter/index.js +1 -1
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
- package/src/components/list-view/block-select-button.js +6 -1
- package/src/components/list-view/block.js +23 -31
- package/src/components/list-view/drop-indicator.js +67 -22
- package/src/components/list-view/index.js +8 -1
- package/src/components/list-view/leaf.js +1 -0
- package/src/components/list-view/style.scss +15 -3
- package/src/components/list-view/use-block-selection.js +1 -1
- package/src/components/media-replace-flow/README.md +3 -2
- package/src/components/media-replace-flow/index.js +4 -5
- package/src/components/navigable-toolbar/index.js +12 -3
- package/src/components/off-canvas-editor/appender.js +1 -4
- package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -3
- package/src/hooks/duotone.js +46 -25
- package/src/hooks/test/anchor.js +113 -0
- package/src/hooks/test/color.js +0 -9
- package/src/hooks/test/use-typography-props.js +2 -2
- package/src/hooks/test/utils.js +20 -101
- package/src/hooks/utils.js +20 -3
- package/src/private-apis.js +6 -0
- package/src/store/actions.js +7 -0
- package/src/utils/object.js +4 -4
- package/src/utils/test/object.js +21 -21
- package/src/utils/transform-styles/index.js +2 -2
- package/src/utils/use-should-contextual-toolbar-show.js +75 -0
- package/tsconfig.json +1 -0
- package/build/hooks/color-panel.native.js +0 -77
- package/build/hooks/color-panel.native.js.map +0 -1
- package/build-module/hooks/color-panel.native.js +0 -62
- package/build-module/hooks/color-panel.native.js.map +0 -1
- package/src/hooks/color-panel.native.js +0 -63
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/inserter/index.js"],"names":["defaultRenderToggle","onToggle","disabled","isOpen","blockTitle","hasSingleBlockType","toggleProps","prioritizePatterns","as","Wrapper","Button","label","labelProp","onClick","rest","handleClick","event","plus","PrivateInserter","Component","constructor","arguments","bind","renderToggle","renderContent","props","directInsertBlock","hasItems","onClose","rootClientId","clientId","isAppender","showInserterHelpPanel","__experimentalIsQuick","isQuick","onSelectOrClose","selectBlockOnInsert","orderInitialBlockItems","blocks","firstBlock","Array","isArray","length","render","position","insertOnlyAllowedBlock","ComposedPrivateInserter","select","shouldDirectInsert","getBlockRootClientId","hasInserterItems","getAllowedBlocks","__experimentalGetDirectInsertBlock","getSettings","blockEditorStore","getBlockVariations","blocksStore","undefined","allowedBlocks","settings","name","allowedBlockType","title","__experimentalPreferPatternsOnRoot","dispatch","ownProps","getAdjacentBlockAttributes","attributesToCopy","getBlock","getPreviousBlockClientId","result","adjacentAttributes","parentBlock","innerBlocks","lastInnerBlock","attributes","currentBlock","previousBlock","forEach","attribute","hasOwnProperty","getInsertionIndex","getBlockIndex","getBlockSelectionEnd","getBlockOrder","end","insertBlock","blockToInsert","newAttributes","message","Inserter","ref"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAEA;;A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aAAGa;AAFiD,SAArC,CAAhB;AAIA,OATD,MASO;AACND,QAAAA,aAAa,GAAG,yBAAa1B,gBAAgB,CAACD,IAA9B,CAAhB;AACA;;AAED0B,MAAAA,WAAW,CACVC,aADU,EAEVN,iBAAiB,EAFP,EAGVpD,YAHU,EAIVO,mBAJU,CAAX;;AAOA,UAAKD,eAAL,EAAuB;AAAA;;AACtBA,QAAAA,eAAe,CAAE;AAChBL,UAAAA,QAAQ,oBAAEyD,aAAF,mDAAE,eAAezD;AADT,SAAF,CAAf;AAGA;;AAED,YAAM2D,OAAO,GAAG,oBACf;AACA,oBAAI,gBAAJ,CAFe,EAGf5B,gBAAgB,CAACC,KAHF,CAAhB;AAKA,uBAAO2B,OAAP;AACA;;AA5IK,GAAP;AA8IA,CA/ID,CA/C+C,EA+L/C;AACA;AACA,0BACC;AAAA,MAAE;AAAE9D,IAAAA,QAAF;AAAYI,IAAAA,UAAZ;AAAwBF,IAAAA,YAAxB;AAAsCC,IAAAA;AAAtC,GAAF;AAAA,SACCH,QAAQ,IAAM,CAAEI,UAAF,IAAgB,CAAEF,YAAlB,IAAkC,CAAEC,QADnD;AAAA,CADD,CAjM+C,CAAT,EAqMlCZ,eArMkC,CAAhC;;AAuMP,MAAMwE,QAAQ,GAAG,yBAAY,CAAEjE,KAAF,EAASkE,GAAT,KAAkB;AAC9C,SACC,4BAAC,uBAAD;AACC,IAAA,GAAG,EAAGA;AADP,KAEMlE,KAFN;AAGC,IAAA,sBAAsB,EAAGgC;AAH1B,KADD;AAOA,CARgB,CAAjB;eAUeiC,Q","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { forwardRef, Component } from '@wordpress/element';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose, ifCondition } from '@wordpress/compose';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport InserterMenu from './menu';\nimport QuickInserter from './quick-inserter';\nimport { store as blockEditorStore } from '../../store';\n\nconst defaultRenderToggle = ( {\n\tonToggle,\n\tdisabled,\n\tisOpen,\n\tblockTitle,\n\thasSingleBlockType,\n\ttoggleProps = {},\n\tprioritizePatterns,\n} ) => {\n\tconst {\n\t\tas: Wrapper = Button,\n\t\tlabel: labelProp,\n\t\tonClick,\n\t\t...rest\n\t} = toggleProps;\n\n\tlet label = labelProp;\n\tif ( ! label && hasSingleBlockType ) {\n\t\tlabel = sprintf(\n\t\t\t// translators: %s: the name of the block when there is only one\n\t\t\t_x( 'Add %s', 'directly add the only allowed block' ),\n\t\t\tblockTitle\n\t\t);\n\t} else if ( ! label && prioritizePatterns ) {\n\t\tlabel = __( 'Add pattern' );\n\t} else if ( ! label ) {\n\t\tlabel = _x( 'Add block', 'Generic label for block inserter button' );\n\t}\n\n\t// Handle both onClick functions from the toggle and the parent component.\n\tfunction handleClick( event ) {\n\t\tif ( onToggle ) {\n\t\t\tonToggle( event );\n\t\t}\n\t\tif ( onClick ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Wrapper\n\t\t\ticon={ plus }\n\t\t\tlabel={ label }\n\t\t\ttooltipPosition=\"bottom\"\n\t\t\tonClick={ handleClick }\n\t\t\tclassName=\"block-editor-inserter__toggle\"\n\t\t\taria-haspopup={ ! hasSingleBlockType ? 'true' : false }\n\t\t\taria-expanded={ ! hasSingleBlockType ? isOpen : false }\n\t\t\tdisabled={ disabled }\n\t\t\t{ ...rest }\n\t\t/>\n\t);\n};\n\nclass PrivateInserter extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.onToggle = this.onToggle.bind( this );\n\t\tthis.renderToggle = this.renderToggle.bind( this );\n\t\tthis.renderContent = this.renderContent.bind( this );\n\t}\n\n\tonToggle( isOpen ) {\n\t\tconst { onToggle } = this.props;\n\n\t\t// Surface toggle callback to parent component.\n\t\tif ( onToggle ) {\n\t\t\tonToggle( isOpen );\n\t\t}\n\t}\n\n\t/**\n\t * Render callback to display Dropdown toggle element.\n\t *\n\t * @param {Object} options\n\t * @param {Function} options.onToggle Callback to invoke when toggle is\n\t * pressed.\n\t * @param {boolean} options.isOpen Whether dropdown is currently open.\n\t *\n\t * @return {WPElement} Dropdown toggle element.\n\t */\n\trenderToggle( { onToggle, isOpen } ) {\n\t\tconst {\n\t\t\tdisabled,\n\t\t\tblockTitle,\n\t\t\thasSingleBlockType,\n\t\t\tdirectInsertBlock,\n\t\t\ttoggleProps,\n\t\t\thasItems,\n\t\t\trenderToggle = defaultRenderToggle,\n\t\t\tprioritizePatterns,\n\t\t} = this.props;\n\n\t\treturn renderToggle( {\n\t\t\tonToggle,\n\t\t\tisOpen,\n\t\t\tdisabled: disabled || ! hasItems,\n\t\t\tblockTitle,\n\t\t\thasSingleBlockType,\n\t\t\tdirectInsertBlock,\n\t\t\ttoggleProps,\n\t\t\tprioritizePatterns,\n\t\t} );\n\t}\n\n\t/**\n\t * Render callback to display Dropdown content element.\n\t *\n\t * @param {Object} options\n\t * @param {Function} options.onClose Callback to invoke when dropdown is\n\t * closed.\n\t *\n\t * @return {WPElement} Dropdown content element.\n\t */\n\trenderContent( { onClose } ) {\n\t\tconst {\n\t\t\trootClientId,\n\t\t\tclientId,\n\t\t\tisAppender,\n\t\t\tshowInserterHelpPanel,\n\n\t\t\t// This prop is experimental to give some time for the quick inserter to mature\n\t\t\t// Feel free to make them stable after a few releases.\n\t\t\t__experimentalIsQuick: isQuick,\n\t\t\tprioritizePatterns,\n\t\t\tonSelectOrClose,\n\t\t\tselectBlockOnInsert,\n\t\t\torderInitialBlockItems,\n\t\t} = this.props;\n\n\t\tif ( isQuick ) {\n\t\t\treturn (\n\t\t\t\t<QuickInserter\n\t\t\t\t\tonSelect={ ( blocks ) => {\n\t\t\t\t\t\tconst firstBlock =\n\t\t\t\t\t\t\tArray.isArray( blocks ) && blocks?.length\n\t\t\t\t\t\t\t\t? blocks[ 0 ]\n\t\t\t\t\t\t\t\t: blocks;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tonSelectOrClose &&\n\t\t\t\t\t\t\ttypeof onSelectOrClose === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonSelectOrClose( firstBlock );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisAppender={ isAppender }\n\t\t\t\t\tprioritizePatterns={ prioritizePatterns }\n\t\t\t\t\tselectBlockOnInsert={ selectBlockOnInsert }\n\t\t\t\t\torderInitialBlockItems={ orderInitialBlockItems }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<InserterMenu\n\t\t\t\tonSelect={ () => {\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisAppender={ isAppender }\n\t\t\t\tshowInserterHelpPanel={ showInserterHelpPanel }\n\t\t\t\tprioritizePatterns={ prioritizePatterns }\n\t\t\t/>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tposition,\n\t\t\thasSingleBlockType,\n\t\t\tdirectInsertBlock,\n\t\t\tinsertOnlyAllowedBlock,\n\t\t\t__experimentalIsQuick: isQuick,\n\t\t\tonSelectOrClose,\n\t\t} = this.props;\n\n\t\tif ( hasSingleBlockType || directInsertBlock ) {\n\t\t\treturn this.renderToggle( { onToggle: insertOnlyAllowedBlock } );\n\t\t}\n\n\t\treturn (\n\t\t\t<Dropdown\n\t\t\t\tclassName=\"block-editor-inserter\"\n\t\t\t\tcontentClassName={ classnames(\n\t\t\t\t\t'block-editor-inserter__popover',\n\t\t\t\t\t{ 'is-quick': isQuick }\n\t\t\t\t) }\n\t\t\t\tpopoverProps={ { position } }\n\t\t\t\tonToggle={ this.onToggle }\n\t\t\t\texpandOnMobile\n\t\t\t\theaderTitle={ __( 'Add a block' ) }\n\t\t\t\trenderToggle={ this.renderToggle }\n\t\t\t\trenderContent={ this.renderContent }\n\t\t\t\tonClose={ onSelectOrClose }\n\t\t\t/>\n\t\t);\n\t}\n}\n\nexport const ComposedPrivateInserter = compose( [\n\twithSelect(\n\t\t( select, { clientId, rootClientId, shouldDirectInsert = true } ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\thasInserterItems,\n\t\t\t\tgetAllowedBlocks,\n\t\t\t\t__experimentalGetDirectInsertBlock,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst { getBlockVariations } = select( blocksStore );\n\n\t\t\trootClientId =\n\t\t\t\trootClientId || getBlockRootClientId( clientId ) || undefined;\n\n\t\t\tconst allowedBlocks = getAllowedBlocks( rootClientId );\n\n\t\t\tconst directInsertBlock =\n\t\t\t\tshouldDirectInsert &&\n\t\t\t\t__experimentalGetDirectInsertBlock( rootClientId );\n\n\t\t\tconst settings = getSettings();\n\n\t\t\tconst hasSingleBlockType =\n\t\t\t\tallowedBlocks?.length === 1 &&\n\t\t\t\tgetBlockVariations( allowedBlocks[ 0 ].name, 'inserter' )\n\t\t\t\t\t?.length === 0;\n\n\t\t\tlet allowedBlockType = false;\n\t\t\tif ( hasSingleBlockType ) {\n\t\t\t\tallowedBlockType = allowedBlocks[ 0 ];\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasItems: hasInserterItems( rootClientId ),\n\t\t\t\thasSingleBlockType,\n\t\t\t\tblockTitle: allowedBlockType ? allowedBlockType.title : '',\n\t\t\t\tallowedBlockType,\n\t\t\t\tdirectInsertBlock,\n\t\t\t\trootClientId,\n\t\t\t\tprioritizePatterns:\n\t\t\t\t\tsettings.__experimentalPreferPatternsOnRoot &&\n\t\t\t\t\t! rootClientId,\n\t\t\t};\n\t\t}\n\t),\n\twithDispatch( ( dispatch, ownProps, { select } ) => {\n\t\treturn {\n\t\t\tinsertOnlyAllowedBlock() {\n\t\t\t\tconst {\n\t\t\t\t\trootClientId,\n\t\t\t\t\tclientId,\n\t\t\t\t\tisAppender,\n\t\t\t\t\thasSingleBlockType,\n\t\t\t\t\tallowedBlockType,\n\t\t\t\t\tdirectInsertBlock,\n\t\t\t\t\tonSelectOrClose,\n\t\t\t\t\tselectBlockOnInsert,\n\t\t\t\t} = ownProps;\n\n\t\t\t\tif ( ! hasSingleBlockType && ! directInsertBlock ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfunction getAdjacentBlockAttributes( attributesToCopy ) {\n\t\t\t\t\tconst { getBlock, getPreviousBlockClientId } =\n\t\t\t\t\t\tselect( blockEditorStore );\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! attributesToCopy ||\n\t\t\t\t\t\t( ! clientId && ! rootClientId )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn {};\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = {};\n\t\t\t\t\tlet adjacentAttributes = {};\n\n\t\t\t\t\t// If there is no clientId, then attempt to get attributes\n\t\t\t\t\t// from the last block within innerBlocks of the root block.\n\t\t\t\t\tif ( ! clientId ) {\n\t\t\t\t\t\tconst parentBlock = getBlock( rootClientId );\n\n\t\t\t\t\t\tif ( parentBlock?.innerBlocks?.length ) {\n\t\t\t\t\t\t\tconst lastInnerBlock =\n\t\t\t\t\t\t\t\tparentBlock.innerBlocks[\n\t\t\t\t\t\t\t\t\tparentBlock.innerBlocks.length - 1\n\t\t\t\t\t\t\t\t];\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tdirectInsertBlock &&\n\t\t\t\t\t\t\t\tdirectInsertBlock?.name === lastInnerBlock.name\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tadjacentAttributes = lastInnerBlock.attributes;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Otherwise, attempt to get attributes from the\n\t\t\t\t\t\t// previous block relative to the current clientId.\n\t\t\t\t\t\tconst currentBlock = getBlock( clientId );\n\t\t\t\t\t\tconst previousBlock = getBlock(\n\t\t\t\t\t\t\tgetPreviousBlockClientId( clientId )\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( currentBlock?.name === previousBlock?.name ) {\n\t\t\t\t\t\t\tadjacentAttributes =\n\t\t\t\t\t\t\t\tpreviousBlock?.attributes || {};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Copy over only those attributes flagged to be copied.\n\t\t\t\t\tattributesToCopy.forEach( ( attribute ) => {\n\t\t\t\t\t\tif ( adjacentAttributes.hasOwnProperty( attribute ) ) {\n\t\t\t\t\t\t\tresult[ attribute ] =\n\t\t\t\t\t\t\t\tadjacentAttributes[ attribute ];\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tfunction getInsertionIndex() {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tgetBlockIndex,\n\t\t\t\t\t\tgetBlockSelectionEnd,\n\t\t\t\t\t\tgetBlockOrder,\n\t\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\t\t// If the clientId is defined, we insert at the position of the block.\n\t\t\t\t\tif ( clientId ) {\n\t\t\t\t\t\treturn getBlockIndex( clientId );\n\t\t\t\t\t}\n\n\t\t\t\t\t// If there a selected block, we insert after the selected block.\n\t\t\t\t\tconst end = getBlockSelectionEnd();\n\t\t\t\t\tif (\n\t\t\t\t\t\t! isAppender &&\n\t\t\t\t\t\tend &&\n\t\t\t\t\t\tgetBlockRootClientId( end ) === rootClientId\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn getBlockIndex( end ) + 1;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Otherwise, we insert at the end of the current rootClientId.\n\t\t\t\t\treturn getBlockOrder( rootClientId ).length;\n\t\t\t\t}\n\n\t\t\t\tconst { insertBlock } = dispatch( blockEditorStore );\n\n\t\t\t\tlet blockToInsert;\n\n\t\t\t\t// Attempt to augment the directInsertBlock with attributes from an adjacent block.\n\t\t\t\t// This ensures styling from nearby blocks is preserved in the newly inserted block.\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/37904\n\t\t\t\tif ( directInsertBlock ) {\n\t\t\t\t\tconst newAttributes = getAdjacentBlockAttributes(\n\t\t\t\t\t\tdirectInsertBlock.attributesToCopy\n\t\t\t\t\t);\n\n\t\t\t\t\tblockToInsert = createBlock( directInsertBlock.name, {\n\t\t\t\t\t\t...( directInsertBlock.attributes || {} ),\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tblockToInsert = createBlock( allowedBlockType.name );\n\t\t\t\t}\n\n\t\t\t\tinsertBlock(\n\t\t\t\t\tblockToInsert,\n\t\t\t\t\tgetInsertionIndex(),\n\t\t\t\t\trootClientId,\n\t\t\t\t\tselectBlockOnInsert\n\t\t\t\t);\n\n\t\t\t\tif ( onSelectOrClose ) {\n\t\t\t\t\tonSelectOrClose( {\n\t\t\t\t\t\tclientId: blockToInsert?.clientId,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tconst message = sprintf(\n\t\t\t\t\t// translators: %s: the name of the block that has been added\n\t\t\t\t\t__( '%s block added' ),\n\t\t\t\t\tallowedBlockType.title\n\t\t\t\t);\n\t\t\t\tspeak( message );\n\t\t\t},\n\t\t};\n\t} ),\n\t// The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as\n\t// a way to detect the global Inserter.\n\tifCondition(\n\t\t( { hasItems, isAppender, rootClientId, clientId } ) =>\n\t\t\thasItems || ( ! isAppender && ! rootClientId && ! clientId )\n\t),\n] )( PrivateInserter );\n\nconst Inserter = forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<ComposedPrivateInserter\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\torderInitialBlockItems={ undefined }\n\t\t/>\n\t);\n} );\n\nexport default Inserter;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inserter/index.js"],"names":["defaultRenderToggle","onToggle","disabled","isOpen","blockTitle","hasSingleBlockType","toggleProps","prioritizePatterns","as","Wrapper","Button","label","labelProp","onClick","rest","handleClick","event","plus","PrivateInserter","Component","constructor","arguments","bind","renderToggle","renderContent","props","directInsertBlock","hasItems","onClose","rootClientId","clientId","isAppender","showInserterHelpPanel","__experimentalIsQuick","isQuick","onSelectOrClose","selectBlockOnInsert","orderInitialBlockItems","blocks","firstBlock","Array","isArray","length","render","position","insertOnlyAllowedBlock","shift","ComposedPrivateInserter","select","shouldDirectInsert","getBlockRootClientId","hasInserterItems","getAllowedBlocks","__experimentalGetDirectInsertBlock","getSettings","blockEditorStore","getBlockVariations","blocksStore","undefined","allowedBlocks","settings","name","allowedBlockType","title","__experimentalPreferPatternsOnRoot","dispatch","ownProps","getAdjacentBlockAttributes","attributesToCopy","getBlock","getPreviousBlockClientId","result","adjacentAttributes","parentBlock","innerBlocks","lastInnerBlock","attributes","currentBlock","previousBlock","forEach","attribute","hasOwnProperty","getInsertionIndex","getBlockIndex","getBlockSelectionEnd","getBlockOrder","end","insertBlock","blockToInsert","newAttributes","message","Inserter","ref"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AAKA,MAAMA,mBAAmB,GAAG,QAQrB;AAAA,MARuB;AAC7BC,IAAAA,QAD6B;AAE7BC,IAAAA,QAF6B;AAG7BC,IAAAA,MAH6B;AAI7BC,IAAAA,UAJ6B;AAK7BC,IAAAA,kBAL6B;AAM7BC,IAAAA,WAAW,GAAG,EANe;AAO7B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E;AAChBL,UAAAA,QAAQ,oBAAE0D,aAAF,mDAAE,eAAe1D;AADT,SAAF,CAAf;AAGA;;AAED,YAAM4D,OAAO,GAAG,oBACf;AACA,oBAAI,gBAAJ,CAFe,EAGf5B,gBAAgB,CAACC,KAHF,CAAhB;AAKA,uBAAO2B,OAAP;AACA;;AA5IK,GAAP;AA8IA,CA/ID,CA/C+C,EA+L/C;AACA;AACA,0BACC;AAAA,MAAE;AAAE/D,IAAAA,QAAF;AAAYI,IAAAA,UAAZ;AAAwBF,IAAAA,YAAxB;AAAsCC,IAAAA;AAAtC,GAAF;AAAA,SACCH,QAAQ,IAAM,CAAEI,UAAF,IAAgB,CAAEF,YAAlB,IAAkC,CAAEC,QADnD;AAAA,CADD,CAjM+C,CAAT,EAqMlCZ,eArMkC,CAAhC;;AAuMP,MAAMyE,QAAQ,GAAG,yBAAY,CAAElE,KAAF,EAASmE,GAAT,KAAkB;AAC9C,SACC,4BAAC,uBAAD;AACC,IAAA,GAAG,EAAGA;AADP,KAEMnE,KAFN;AAGC,IAAA,sBAAsB,EAAGiC;AAH1B,KADD;AAOA,CARgB,CAAjB;eAUeiC,Q","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { forwardRef, Component } from '@wordpress/element';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose, ifCondition } from '@wordpress/compose';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport InserterMenu from './menu';\nimport QuickInserter from './quick-inserter';\nimport { store as blockEditorStore } from '../../store';\n\nconst defaultRenderToggle = ( {\n\tonToggle,\n\tdisabled,\n\tisOpen,\n\tblockTitle,\n\thasSingleBlockType,\n\ttoggleProps = {},\n\tprioritizePatterns,\n} ) => {\n\tconst {\n\t\tas: Wrapper = Button,\n\t\tlabel: labelProp,\n\t\tonClick,\n\t\t...rest\n\t} = toggleProps;\n\n\tlet label = labelProp;\n\tif ( ! label && hasSingleBlockType ) {\n\t\tlabel = sprintf(\n\t\t\t// translators: %s: the name of the block when there is only one\n\t\t\t_x( 'Add %s', 'directly add the only allowed block' ),\n\t\t\tblockTitle\n\t\t);\n\t} else if ( ! label && prioritizePatterns ) {\n\t\tlabel = __( 'Add pattern' );\n\t} else if ( ! label ) {\n\t\tlabel = _x( 'Add block', 'Generic label for block inserter button' );\n\t}\n\n\t// Handle both onClick functions from the toggle and the parent component.\n\tfunction handleClick( event ) {\n\t\tif ( onToggle ) {\n\t\t\tonToggle( event );\n\t\t}\n\t\tif ( onClick ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Wrapper\n\t\t\ticon={ plus }\n\t\t\tlabel={ label }\n\t\t\ttooltipPosition=\"bottom\"\n\t\t\tonClick={ handleClick }\n\t\t\tclassName=\"block-editor-inserter__toggle\"\n\t\t\taria-haspopup={ ! hasSingleBlockType ? 'true' : false }\n\t\t\taria-expanded={ ! hasSingleBlockType ? isOpen : false }\n\t\t\tdisabled={ disabled }\n\t\t\t{ ...rest }\n\t\t/>\n\t);\n};\n\nclass PrivateInserter extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.onToggle = this.onToggle.bind( this );\n\t\tthis.renderToggle = this.renderToggle.bind( this );\n\t\tthis.renderContent = this.renderContent.bind( this );\n\t}\n\n\tonToggle( isOpen ) {\n\t\tconst { onToggle } = this.props;\n\n\t\t// Surface toggle callback to parent component.\n\t\tif ( onToggle ) {\n\t\t\tonToggle( isOpen );\n\t\t}\n\t}\n\n\t/**\n\t * Render callback to display Dropdown toggle element.\n\t *\n\t * @param {Object} options\n\t * @param {Function} options.onToggle Callback to invoke when toggle is\n\t * pressed.\n\t * @param {boolean} options.isOpen Whether dropdown is currently open.\n\t *\n\t * @return {WPElement} Dropdown toggle element.\n\t */\n\trenderToggle( { onToggle, isOpen } ) {\n\t\tconst {\n\t\t\tdisabled,\n\t\t\tblockTitle,\n\t\t\thasSingleBlockType,\n\t\t\tdirectInsertBlock,\n\t\t\ttoggleProps,\n\t\t\thasItems,\n\t\t\trenderToggle = defaultRenderToggle,\n\t\t\tprioritizePatterns,\n\t\t} = this.props;\n\n\t\treturn renderToggle( {\n\t\t\tonToggle,\n\t\t\tisOpen,\n\t\t\tdisabled: disabled || ! hasItems,\n\t\t\tblockTitle,\n\t\t\thasSingleBlockType,\n\t\t\tdirectInsertBlock,\n\t\t\ttoggleProps,\n\t\t\tprioritizePatterns,\n\t\t} );\n\t}\n\n\t/**\n\t * Render callback to display Dropdown content element.\n\t *\n\t * @param {Object} options\n\t * @param {Function} options.onClose Callback to invoke when dropdown is\n\t * closed.\n\t *\n\t * @return {WPElement} Dropdown content element.\n\t */\n\trenderContent( { onClose } ) {\n\t\tconst {\n\t\t\trootClientId,\n\t\t\tclientId,\n\t\t\tisAppender,\n\t\t\tshowInserterHelpPanel,\n\n\t\t\t// This prop is experimental to give some time for the quick inserter to mature\n\t\t\t// Feel free to make them stable after a few releases.\n\t\t\t__experimentalIsQuick: isQuick,\n\t\t\tprioritizePatterns,\n\t\t\tonSelectOrClose,\n\t\t\tselectBlockOnInsert,\n\t\t\torderInitialBlockItems,\n\t\t} = this.props;\n\n\t\tif ( isQuick ) {\n\t\t\treturn (\n\t\t\t\t<QuickInserter\n\t\t\t\t\tonSelect={ ( blocks ) => {\n\t\t\t\t\t\tconst firstBlock =\n\t\t\t\t\t\t\tArray.isArray( blocks ) && blocks?.length\n\t\t\t\t\t\t\t\t? blocks[ 0 ]\n\t\t\t\t\t\t\t\t: blocks;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tonSelectOrClose &&\n\t\t\t\t\t\t\ttypeof onSelectOrClose === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonSelectOrClose( firstBlock );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisAppender={ isAppender }\n\t\t\t\t\tprioritizePatterns={ prioritizePatterns }\n\t\t\t\t\tselectBlockOnInsert={ selectBlockOnInsert }\n\t\t\t\t\torderInitialBlockItems={ orderInitialBlockItems }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<InserterMenu\n\t\t\t\tonSelect={ () => {\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisAppender={ isAppender }\n\t\t\t\tshowInserterHelpPanel={ showInserterHelpPanel }\n\t\t\t\tprioritizePatterns={ prioritizePatterns }\n\t\t\t/>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tposition,\n\t\t\thasSingleBlockType,\n\t\t\tdirectInsertBlock,\n\t\t\tinsertOnlyAllowedBlock,\n\t\t\t__experimentalIsQuick: isQuick,\n\t\t\tonSelectOrClose,\n\t\t} = this.props;\n\n\t\tif ( hasSingleBlockType || directInsertBlock ) {\n\t\t\treturn this.renderToggle( { onToggle: insertOnlyAllowedBlock } );\n\t\t}\n\n\t\treturn (\n\t\t\t<Dropdown\n\t\t\t\tclassName=\"block-editor-inserter\"\n\t\t\t\tcontentClassName={ classnames(\n\t\t\t\t\t'block-editor-inserter__popover',\n\t\t\t\t\t{ 'is-quick': isQuick }\n\t\t\t\t) }\n\t\t\t\tpopoverProps={ { position, shift: true } }\n\t\t\t\tonToggle={ this.onToggle }\n\t\t\t\texpandOnMobile\n\t\t\t\theaderTitle={ __( 'Add a block' ) }\n\t\t\t\trenderToggle={ this.renderToggle }\n\t\t\t\trenderContent={ this.renderContent }\n\t\t\t\tonClose={ onSelectOrClose }\n\t\t\t/>\n\t\t);\n\t}\n}\n\nexport const ComposedPrivateInserter = compose( [\n\twithSelect(\n\t\t( select, { clientId, rootClientId, shouldDirectInsert = true } ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\thasInserterItems,\n\t\t\t\tgetAllowedBlocks,\n\t\t\t\t__experimentalGetDirectInsertBlock,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst { getBlockVariations } = select( blocksStore );\n\n\t\t\trootClientId =\n\t\t\t\trootClientId || getBlockRootClientId( clientId ) || undefined;\n\n\t\t\tconst allowedBlocks = getAllowedBlocks( rootClientId );\n\n\t\t\tconst directInsertBlock =\n\t\t\t\tshouldDirectInsert &&\n\t\t\t\t__experimentalGetDirectInsertBlock( rootClientId );\n\n\t\t\tconst settings = getSettings();\n\n\t\t\tconst hasSingleBlockType =\n\t\t\t\tallowedBlocks?.length === 1 &&\n\t\t\t\tgetBlockVariations( allowedBlocks[ 0 ].name, 'inserter' )\n\t\t\t\t\t?.length === 0;\n\n\t\t\tlet allowedBlockType = false;\n\t\t\tif ( hasSingleBlockType ) {\n\t\t\t\tallowedBlockType = allowedBlocks[ 0 ];\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasItems: hasInserterItems( rootClientId ),\n\t\t\t\thasSingleBlockType,\n\t\t\t\tblockTitle: allowedBlockType ? allowedBlockType.title : '',\n\t\t\t\tallowedBlockType,\n\t\t\t\tdirectInsertBlock,\n\t\t\t\trootClientId,\n\t\t\t\tprioritizePatterns:\n\t\t\t\t\tsettings.__experimentalPreferPatternsOnRoot &&\n\t\t\t\t\t! rootClientId,\n\t\t\t};\n\t\t}\n\t),\n\twithDispatch( ( dispatch, ownProps, { select } ) => {\n\t\treturn {\n\t\t\tinsertOnlyAllowedBlock() {\n\t\t\t\tconst {\n\t\t\t\t\trootClientId,\n\t\t\t\t\tclientId,\n\t\t\t\t\tisAppender,\n\t\t\t\t\thasSingleBlockType,\n\t\t\t\t\tallowedBlockType,\n\t\t\t\t\tdirectInsertBlock,\n\t\t\t\t\tonSelectOrClose,\n\t\t\t\t\tselectBlockOnInsert,\n\t\t\t\t} = ownProps;\n\n\t\t\t\tif ( ! hasSingleBlockType && ! directInsertBlock ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfunction getAdjacentBlockAttributes( attributesToCopy ) {\n\t\t\t\t\tconst { getBlock, getPreviousBlockClientId } =\n\t\t\t\t\t\tselect( blockEditorStore );\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! attributesToCopy ||\n\t\t\t\t\t\t( ! clientId && ! rootClientId )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn {};\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = {};\n\t\t\t\t\tlet adjacentAttributes = {};\n\n\t\t\t\t\t// If there is no clientId, then attempt to get attributes\n\t\t\t\t\t// from the last block within innerBlocks of the root block.\n\t\t\t\t\tif ( ! clientId ) {\n\t\t\t\t\t\tconst parentBlock = getBlock( rootClientId );\n\n\t\t\t\t\t\tif ( parentBlock?.innerBlocks?.length ) {\n\t\t\t\t\t\t\tconst lastInnerBlock =\n\t\t\t\t\t\t\t\tparentBlock.innerBlocks[\n\t\t\t\t\t\t\t\t\tparentBlock.innerBlocks.length - 1\n\t\t\t\t\t\t\t\t];\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tdirectInsertBlock &&\n\t\t\t\t\t\t\t\tdirectInsertBlock?.name === lastInnerBlock.name\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tadjacentAttributes = lastInnerBlock.attributes;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Otherwise, attempt to get attributes from the\n\t\t\t\t\t\t// previous block relative to the current clientId.\n\t\t\t\t\t\tconst currentBlock = getBlock( clientId );\n\t\t\t\t\t\tconst previousBlock = getBlock(\n\t\t\t\t\t\t\tgetPreviousBlockClientId( clientId )\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( currentBlock?.name === previousBlock?.name ) {\n\t\t\t\t\t\t\tadjacentAttributes =\n\t\t\t\t\t\t\t\tpreviousBlock?.attributes || {};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Copy over only those attributes flagged to be copied.\n\t\t\t\t\tattributesToCopy.forEach( ( attribute ) => {\n\t\t\t\t\t\tif ( adjacentAttributes.hasOwnProperty( attribute ) ) {\n\t\t\t\t\t\t\tresult[ attribute ] =\n\t\t\t\t\t\t\t\tadjacentAttributes[ attribute ];\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tfunction getInsertionIndex() {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tgetBlockIndex,\n\t\t\t\t\t\tgetBlockSelectionEnd,\n\t\t\t\t\t\tgetBlockOrder,\n\t\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\t\t// If the clientId is defined, we insert at the position of the block.\n\t\t\t\t\tif ( clientId ) {\n\t\t\t\t\t\treturn getBlockIndex( clientId );\n\t\t\t\t\t}\n\n\t\t\t\t\t// If there a selected block, we insert after the selected block.\n\t\t\t\t\tconst end = getBlockSelectionEnd();\n\t\t\t\t\tif (\n\t\t\t\t\t\t! isAppender &&\n\t\t\t\t\t\tend &&\n\t\t\t\t\t\tgetBlockRootClientId( end ) === rootClientId\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn getBlockIndex( end ) + 1;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Otherwise, we insert at the end of the current rootClientId.\n\t\t\t\t\treturn getBlockOrder( rootClientId ).length;\n\t\t\t\t}\n\n\t\t\t\tconst { insertBlock } = dispatch( blockEditorStore );\n\n\t\t\t\tlet blockToInsert;\n\n\t\t\t\t// Attempt to augment the directInsertBlock with attributes from an adjacent block.\n\t\t\t\t// This ensures styling from nearby blocks is preserved in the newly inserted block.\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/37904\n\t\t\t\tif ( directInsertBlock ) {\n\t\t\t\t\tconst newAttributes = getAdjacentBlockAttributes(\n\t\t\t\t\t\tdirectInsertBlock.attributesToCopy\n\t\t\t\t\t);\n\n\t\t\t\t\tblockToInsert = createBlock( directInsertBlock.name, {\n\t\t\t\t\t\t...( directInsertBlock.attributes || {} ),\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tblockToInsert = createBlock( allowedBlockType.name );\n\t\t\t\t}\n\n\t\t\t\tinsertBlock(\n\t\t\t\t\tblockToInsert,\n\t\t\t\t\tgetInsertionIndex(),\n\t\t\t\t\trootClientId,\n\t\t\t\t\tselectBlockOnInsert\n\t\t\t\t);\n\n\t\t\t\tif ( onSelectOrClose ) {\n\t\t\t\t\tonSelectOrClose( {\n\t\t\t\t\t\tclientId: blockToInsert?.clientId,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tconst message = sprintf(\n\t\t\t\t\t// translators: %s: the name of the block that has been added\n\t\t\t\t\t__( '%s block added' ),\n\t\t\t\t\tallowedBlockType.title\n\t\t\t\t);\n\t\t\t\tspeak( message );\n\t\t\t},\n\t\t};\n\t} ),\n\t// The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as\n\t// a way to detect the global Inserter.\n\tifCondition(\n\t\t( { hasItems, isAppender, rootClientId, clientId } ) =>\n\t\t\thasItems || ( ! isAppender && ! rootClientId && ! clientId )\n\t),\n] )( PrivateInserter );\n\nconst Inserter = forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<ComposedPrivateInserter\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\torderInitialBlockItems={ undefined }\n\t\t/>\n\t);\n} );\n\nexport default Inserter;\n"]}
|
|
@@ -14,6 +14,7 @@ const InspectorControlsDefault = (0, _components.createSlotFill)('InspectorContr
|
|
|
14
14
|
const InspectorControlsAdvanced = (0, _components.createSlotFill)('InspectorAdvancedControls');
|
|
15
15
|
const InspectorControlsBorder = (0, _components.createSlotFill)('InspectorControlsBorder');
|
|
16
16
|
const InspectorControlsColor = (0, _components.createSlotFill)('InspectorControlsColor');
|
|
17
|
+
const InspectorControlsFilter = (0, _components.createSlotFill)('InspectorControlsFilter');
|
|
17
18
|
const InspectorControlsDimensions = (0, _components.createSlotFill)('InspectorControlsDimensions');
|
|
18
19
|
const InspectorControlsPosition = (0, _components.createSlotFill)('InspectorControlsPosition');
|
|
19
20
|
const InspectorControlsTypography = (0, _components.createSlotFill)('InspectorControlsTypography');
|
|
@@ -24,6 +25,7 @@ const groups = {
|
|
|
24
25
|
advanced: InspectorControlsAdvanced,
|
|
25
26
|
border: InspectorControlsBorder,
|
|
26
27
|
color: InspectorControlsColor,
|
|
28
|
+
filter: InspectorControlsFilter,
|
|
27
29
|
dimensions: InspectorControlsDimensions,
|
|
28
30
|
list: InspectorControlsListView,
|
|
29
31
|
settings: InspectorControlsDefault,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/inspector-controls/groups.js"],"names":["InspectorControlsDefault","InspectorControlsAdvanced","InspectorControlsBorder","InspectorControlsColor","InspectorControlsDimensions","InspectorControlsPosition","InspectorControlsTypography","InspectorControlsListView","InspectorControlsStyles","groups","default","advanced","border","color","dimensions","list","settings","styles","typography","position"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,wBAAwB,GAAG,gCAAgB,mBAAhB,CAAjC;AACA,MAAMC,yBAAyB,GAAG,gCAAgB,2BAAhB,CAAlC;AACA,MAAMC,uBAAuB,GAAG,gCAAgB,yBAAhB,CAAhC;AACA,MAAMC,sBAAsB,GAAG,gCAAgB,wBAAhB,CAA/B;AACA,MAAMC,2BAA2B,GAAG,gCACnC,6BADmC,CAApC;AAGA,MAAMC,yBAAyB,GAAG,gCAAgB,2BAAhB,CAAlC;AACA,MAAMC,2BAA2B,GAAG,gCACnC,6BADmC,CAApC;AAGA,MAAMC,yBAAyB,GAAG,gCAAgB,2BAAhB,CAAlC;AACA,MAAMC,uBAAuB,GAAG,gCAAgB,yBAAhB,CAAhC;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,OAAO,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inspector-controls/groups.js"],"names":["InspectorControlsDefault","InspectorControlsAdvanced","InspectorControlsBorder","InspectorControlsColor","InspectorControlsFilter","InspectorControlsDimensions","InspectorControlsPosition","InspectorControlsTypography","InspectorControlsListView","InspectorControlsStyles","groups","default","advanced","border","color","filter","dimensions","list","settings","styles","typography","position"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,wBAAwB,GAAG,gCAAgB,mBAAhB,CAAjC;AACA,MAAMC,yBAAyB,GAAG,gCAAgB,2BAAhB,CAAlC;AACA,MAAMC,uBAAuB,GAAG,gCAAgB,yBAAhB,CAAhC;AACA,MAAMC,sBAAsB,GAAG,gCAAgB,wBAAhB,CAA/B;AACA,MAAMC,uBAAuB,GAAG,gCAAgB,yBAAhB,CAAhC;AACA,MAAMC,2BAA2B,GAAG,gCACnC,6BADmC,CAApC;AAGA,MAAMC,yBAAyB,GAAG,gCAAgB,2BAAhB,CAAlC;AACA,MAAMC,2BAA2B,GAAG,gCACnC,6BADmC,CAApC;AAGA,MAAMC,yBAAyB,GAAG,gCAAgB,2BAAhB,CAAlC;AACA,MAAMC,uBAAuB,GAAG,gCAAgB,yBAAhB,CAAhC;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,OAAO,EAAEX,wBADK;AAEdY,EAAAA,QAAQ,EAAEX,yBAFI;AAGdY,EAAAA,MAAM,EAAEX,uBAHM;AAIdY,EAAAA,KAAK,EAAEX,sBAJO;AAKdY,EAAAA,MAAM,EAAEX,uBALM;AAMdY,EAAAA,UAAU,EAAEX,2BANE;AAOdY,EAAAA,IAAI,EAAET,yBAPQ;AAQdU,EAAAA,QAAQ,EAAElB,wBARI;AAQsB;AACpCmB,EAAAA,MAAM,EAAEV,uBATM;AAUdW,EAAAA,UAAU,EAAEb,2BAVE;AAWdc,EAAAA,QAAQ,EAAEf;AAXI,CAAf;eAceI,M","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst InspectorControlsDefault = createSlotFill( 'InspectorControls' );\nconst InspectorControlsAdvanced = createSlotFill( 'InspectorAdvancedControls' );\nconst InspectorControlsBorder = createSlotFill( 'InspectorControlsBorder' );\nconst InspectorControlsColor = createSlotFill( 'InspectorControlsColor' );\nconst InspectorControlsFilter = createSlotFill( 'InspectorControlsFilter' );\nconst InspectorControlsDimensions = createSlotFill(\n\t'InspectorControlsDimensions'\n);\nconst InspectorControlsPosition = createSlotFill( 'InspectorControlsPosition' );\nconst InspectorControlsTypography = createSlotFill(\n\t'InspectorControlsTypography'\n);\nconst InspectorControlsListView = createSlotFill( 'InspectorControlsListView' );\nconst InspectorControlsStyles = createSlotFill( 'InspectorControlsStyles' );\n\nconst groups = {\n\tdefault: InspectorControlsDefault,\n\tadvanced: InspectorControlsAdvanced,\n\tborder: InspectorControlsBorder,\n\tcolor: InspectorControlsColor,\n\tfilter: InspectorControlsFilter,\n\tdimensions: InspectorControlsDimensions,\n\tlist: InspectorControlsListView,\n\tsettings: InspectorControlsDefault, // Alias for default.\n\tstyles: InspectorControlsStyles,\n\ttypography: InspectorControlsTypography,\n\tposition: InspectorControlsPosition,\n};\n\nexport default groups;\n"]}
|
|
@@ -44,6 +44,8 @@ const StylesTab = _ref => {
|
|
|
44
44
|
group: "color",
|
|
45
45
|
label: (0, _i18n.__)('Color'),
|
|
46
46
|
className: "color-block-support-panel__inner-wrapper"
|
|
47
|
+
}), (0, _element.createElement)(_inspectorControls.default.Slot, {
|
|
48
|
+
group: "filter"
|
|
47
49
|
}), (0, _element.createElement)(_inspectorControls.default.Slot, {
|
|
48
50
|
group: "typography",
|
|
49
51
|
label: (0, _i18n.__)('Typography')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/inspector-controls-tabs/styles-tab.js"],"names":["StylesTab","blockName","clientId","hasBlockStyles"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAZA;AACA;AACA;;AAKA;AACA;AACA;AAKA,MAAMA,SAAS,GAAG,QAA+C;AAAA,MAA7C;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,QAAb;AAAuBC,IAAAA;AAAvB,GAA6C;AAChE,SACC,qDACGA,cAAc,IACf,yCACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,QAAJ;AAAnB,KACC,4BAAC,oBAAD;AAAa,IAAA,QAAQ,EAAGD;AAAxB,IADD,EAEG,6BACDD,SADC,EAED,oBAFC,EAGD,IAHC,KAIG,4BAAC,2BAAD;AAAoB,IAAA,SAAS,EAAGA;AAAhC,IANN,CADD,CAFF,EAaC,4BAAC,0BAAD,CAAmB,IAAnB;AACC,IAAA,KAAK,EAAC,OADP;AAEC,IAAA,KAAK,EAAG,cAAI,OAAJ,CAFT;AAGC,IAAA,SAAS,EAAC;AAHX,IAbD,EAkBC,4BAAC,0BAAD,CAAmB,IAAnB;AACC,IAAA,KAAK,EAAC,YADP;AAEC,IAAA,KAAK,EAAG,cAAI,YAAJ;AAFT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inspector-controls-tabs/styles-tab.js"],"names":["StylesTab","blockName","clientId","hasBlockStyles"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAZA;AACA;AACA;;AAKA;AACA;AACA;AAKA,MAAMA,SAAS,GAAG,QAA+C;AAAA,MAA7C;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,QAAb;AAAuBC,IAAAA;AAAvB,GAA6C;AAChE,SACC,qDACGA,cAAc,IACf,yCACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,QAAJ;AAAnB,KACC,4BAAC,oBAAD;AAAa,IAAA,QAAQ,EAAGD;AAAxB,IADD,EAEG,6BACDD,SADC,EAED,oBAFC,EAGD,IAHC,KAIG,4BAAC,2BAAD;AAAoB,IAAA,SAAS,EAAGA;AAAhC,IANN,CADD,CAFF,EAaC,4BAAC,0BAAD,CAAmB,IAAnB;AACC,IAAA,KAAK,EAAC,OADP;AAEC,IAAA,KAAK,EAAG,cAAI,OAAJ,CAFT;AAGC,IAAA,SAAS,EAAC;AAHX,IAbD,EAkBC,4BAAC,0BAAD,CAAmB,IAAnB;AAAwB,IAAA,KAAK,EAAC;AAA9B,IAlBD,EAmBC,4BAAC,0BAAD,CAAmB,IAAnB;AACC,IAAA,KAAK,EAAC,YADP;AAEC,IAAA,KAAK,EAAG,cAAI,YAAJ;AAFT,IAnBD,EAuBC,4BAAC,0BAAD,CAAmB,IAAnB;AACC,IAAA,KAAK,EAAC,YADP;AAEC,IAAA,KAAK,EAAG,cAAI,YAAJ;AAFT,IAvBD,EA2BC,4BAAC,0BAAD,CAAmB,IAAnB;AAAwB,IAAA,KAAK,EAAC,QAA9B;AAAuC,IAAA,KAAK,EAAG,cAAI,QAAJ;AAA/C,IA3BD,EA4BC,4BAAC,0BAAD,CAAmB,IAAnB;AAAwB,IAAA,KAAK,EAAC;AAA9B,IA5BD,CADD;AAgCA,CAjCD;;eAmCeD,S","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockStyles from '../block-styles';\nimport DefaultStylePicker from '../default-style-picker';\nimport InspectorControls from '../inspector-controls';\n\nconst StylesTab = ( { blockName, clientId, hasBlockStyles } ) => {\n\treturn (\n\t\t<>\n\t\t\t{ hasBlockStyles && (\n\t\t\t\t<div>\n\t\t\t\t\t<PanelBody title={ __( 'Styles' ) }>\n\t\t\t\t\t\t<BlockStyles clientId={ clientId } />\n\t\t\t\t\t\t{ hasBlockSupport(\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\t'defaultStylePicker',\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t) && <DefaultStylePicker blockName={ blockName } /> }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"color\"\n\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"filter\" />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"typography\"\n\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"border\" label={ __( 'Border' ) } />\n\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t</>\n\t);\n};\n\nexport default StylesTab;\n"]}
|
|
@@ -50,7 +50,10 @@ function ListViewBlockSelectButton(_ref, ref) {
|
|
|
50
50
|
onFocus,
|
|
51
51
|
onDragStart,
|
|
52
52
|
onDragEnd,
|
|
53
|
-
draggable
|
|
53
|
+
draggable,
|
|
54
|
+
isExpanded,
|
|
55
|
+
ariaLabel,
|
|
56
|
+
ariaDescribedBy
|
|
54
57
|
} = _ref;
|
|
55
58
|
const blockInformation = (0, _useBlockDisplayInformation.default)(clientId);
|
|
56
59
|
const blockTitle = (0, _useBlockDisplayTitle.default)({
|
|
@@ -86,7 +89,9 @@ function ListViewBlockSelectButton(_ref, ref) {
|
|
|
86
89
|
onDragEnd: onDragEnd,
|
|
87
90
|
draggable: draggable,
|
|
88
91
|
href: `#block-${clientId}`,
|
|
89
|
-
"aria-
|
|
92
|
+
"aria-label": ariaLabel,
|
|
93
|
+
"aria-describedby": ariaDescribedBy,
|
|
94
|
+
"aria-expanded": isExpanded
|
|
90
95
|
}, (0, _element.createElement)(_expander.default, {
|
|
91
96
|
onClick: onToggleExpanded
|
|
92
97
|
}), (0, _element.createElement)(_blockIcon.default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"names":["ListViewBlockSelectButton","ref","className","block","clientId","onClick","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","blockInformation","blockTitle","context","isLocked","onDragStartHandler","event","dataTransfer","clearData","onKeyDownHandler","keyCode","ENTER","SPACE","icon","anchor","lock"],"mappings":";;;;;;;;;AAaA;;AAVA;;AAKA;;AAMA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AAOA,SAASA,yBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"names":["ListViewBlockSelectButton","ref","className","block","clientId","onClick","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaLabel","ariaDescribedBy","blockInformation","blockTitle","context","isLocked","onDragStartHandler","event","dataTransfer","clearData","onKeyDownHandler","keyCode","ENTER","SPACE","icon","anchor","lock"],"mappings":";;;;;;;;;AAaA;;AAVA;;AAKA;;AAMA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AAOA,SAASA,yBAAT,OAeCC,GAfD,EAgBE;AAAA,MAfD;AACCC,IAAAA,SADD;AAECC,IAAAA,KAAK,EAAE;AAAEC,MAAAA;AAAF,KAFR;AAGCC,IAAAA,OAHD;AAICC,IAAAA,gBAJD;AAKCC,IAAAA,QALD;AAMCC,IAAAA,OAND;AAOCC,IAAAA,WAPD;AAQCC,IAAAA,SARD;AASCC,IAAAA,SATD;AAUCC,IAAAA,UAVD;AAWCC,IAAAA,SAXD;AAYCC,IAAAA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A2C,IAAA,UAAU;AAArD,IAnBD,EAoBC,4BAAC,gCAAD;AACC,IAAA,SAAS,EAAC,QADX;AAEC,IAAA,SAAS,EAAC,2DAFX;AAGC,IAAA,OAAO,EAAC,YAHT;AAIC,IAAA,OAAO,EAAG;AAJX,KAMC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,kCAAD;AAAU,IAAA,aAAa,EAAC;AAAxB,KAAiCX,UAAjC,CADD,CAND,EASG,CAAAD,gBAAgB,SAAhB,IAAAA,gBAAgB,WAAhB,YAAAA,gBAAgB,CAAEa,MAAlB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,kCAAD;AACC,IAAA,SAAS,EAAC,oDADX;AAEC,IAAA,aAAa,EAAC;AAFf,KAIGb,gBAAgB,CAACa,MAJpB,CADD,CAVF,EAmBGV,QAAQ,IACT;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAGW;AAAb,IADD,CApBF,CApBD,CADD,CADD;AAkDA;;eAEc,yBAAY7B,yBAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, lockSmall as lock } from '@wordpress/icons';\nimport { SPACE, ENTER } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\n\nfunction ListViewBlockSelectButton(\n\t{\n\t\tclassName,\n\t\tblock: { clientId },\n\t\tonClick,\n\t\tonToggleExpanded,\n\t\ttabIndex,\n\t\tonFocus,\n\t\tonDragStart,\n\t\tonDragEnd,\n\t\tdraggable,\n\t\tisExpanded,\n\t\tariaLabel,\n\t\tariaDescribedBy,\n\t},\n\tref\n) {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst { isLocked } = useBlockLock( clientId );\n\n\t// The `href` attribute triggers the browser's native HTML drag operations.\n\t// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.\n\t// We need to clear any HTML drag data to prevent `pasteHandler` from firing\n\t// inside the `useOnBlockDrop` hook.\n\tconst onDragStartHandler = ( event ) => {\n\t\tevent.dataTransfer.clearData();\n\t\tonDragStart?.( event );\n\t};\n\n\tfunction onKeyDownHandler( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-block-select-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonKeyDown={ onKeyDownHandler }\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tonDragStart={ onDragStartHandler }\n\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\tdraggable={ draggable }\n\t\t\t\thref={ `#block-${ clientId }` }\n\t\t\t\taria-label={ ariaLabel }\n\t\t\t\taria-describedby={ ariaDescribedBy }\n\t\t\t\taria-expanded={ isExpanded }\n\t\t\t>\n\t\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t\t<BlockIcon icon={ blockInformation?.icon } showColors />\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__label-wrapper\"\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tspacing={ 1 }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__title\">\n\t\t\t\t\t\t<Truncate ellipsizeMode=\"auto\">{ blockTitle }</Truncate>\n\t\t\t\t\t</span>\n\t\t\t\t\t{ blockInformation?.anchor && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__anchor-wrapper\">\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__anchor\"\n\t\t\t\t\t\t\t\tellipsizeMode=\"auto\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ blockInformation.anchor }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isLocked && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__lock\">\n\t\t\t\t\t\t\t<Icon icon={ lock } />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSelectButton );\n"]}
|
|
@@ -67,7 +67,6 @@ function ListViewBlock(_ref) {
|
|
|
67
67
|
path,
|
|
68
68
|
isExpanded,
|
|
69
69
|
selectedClientIds,
|
|
70
|
-
preventAnnouncement,
|
|
71
70
|
isSyncedBranch
|
|
72
71
|
} = _ref;
|
|
73
72
|
const cellRef = (0, _element.useRef)(null);
|
|
@@ -99,6 +98,7 @@ function ListViewBlock(_ref) {
|
|
|
99
98
|
toggleBlockHighlight
|
|
100
99
|
} = (0, _data.useDispatch)(_store.store);
|
|
101
100
|
const blockInformation = (0, _useBlockDisplayInformation.default)(clientId);
|
|
101
|
+
const blockTitle = (blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.title) || (0, _i18n.__)('Untitled');
|
|
102
102
|
const blockName = (0, _data.useSelect)(select => select(_store.store).getBlockName(clientId), [clientId]); // When a block hides its toolbar it also hides the block settings menu,
|
|
103
103
|
// since that menu is part of the toolbar in the editor canvas.
|
|
104
104
|
// List View respects this by also hiding the block settings menu.
|
|
@@ -107,21 +107,16 @@ function ListViewBlock(_ref) {
|
|
|
107
107
|
const instanceId = (0, _compose.useInstanceId)(ListViewBlock);
|
|
108
108
|
const descriptionId = `list-view-block-select-button__${instanceId}`;
|
|
109
109
|
const blockPositionDescription = (0, _utils.getBlockPositionDescription)(position, siblingBlockCount, level);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
(0, _i18n.__)('%s link (locked)'), blockInformation.title) : (0, _i18n.sprintf)( // translators: %s: The title of the block. This string indicates a link to select the block.
|
|
115
|
-
(0, _i18n.__)('%s link'), blockInformation.title);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const settingsAriaLabel = blockInformation ? (0, _i18n.sprintf)( // translators: %s: The title of the block.
|
|
119
|
-
(0, _i18n.__)('Options for %s block'), blockInformation.title) : (0, _i18n.__)('Options');
|
|
110
|
+
const blockAriaLabel = isLocked ? (0, _i18n.sprintf)( // translators: %s: The title of the block. This string indicates a link to select the locked block.
|
|
111
|
+
(0, _i18n.__)('%s (locked)'), blockTitle) : blockTitle;
|
|
112
|
+
const settingsAriaLabel = (0, _i18n.sprintf)( // translators: %s: The title of the block.
|
|
113
|
+
(0, _i18n.__)('Options for %s'), blockTitle);
|
|
120
114
|
const {
|
|
121
115
|
isTreeGridMounted,
|
|
122
116
|
expand,
|
|
123
117
|
collapse,
|
|
124
|
-
BlockSettingsMenu
|
|
118
|
+
BlockSettingsMenu,
|
|
119
|
+
listViewInstanceId
|
|
125
120
|
} = (0, _context.useListViewContext)();
|
|
126
121
|
const hasSiblings = siblingBlockCount > 0;
|
|
127
122
|
const hasRenderedMovers = showBlockMovers && hasSiblings;
|
|
@@ -208,20 +203,15 @@ function ListViewBlock(_ref) {
|
|
|
208
203
|
position: position,
|
|
209
204
|
rowCount: rowCount,
|
|
210
205
|
path: path,
|
|
211
|
-
id: `list-view-block-${clientId}`,
|
|
206
|
+
id: `list-view-${listViewInstanceId}-block-${clientId}`,
|
|
212
207
|
"data-block": clientId,
|
|
213
208
|
"data-expanded": canExpand ? isExpanded : undefined,
|
|
214
|
-
isExpanded: canExpand ? isExpanded : undefined,
|
|
215
|
-
"aria-selected": !!isSelected || forceSelectionContentLock,
|
|
216
209
|
ref: rowRef
|
|
217
210
|
}, (0, _element.createElement)(_components.__experimentalTreeGridCell, {
|
|
218
211
|
className: "block-editor-list-view-block__contents-cell",
|
|
219
212
|
colSpan: colSpan,
|
|
220
213
|
ref: cellRef,
|
|
221
|
-
"aria-
|
|
222
|
-
"aria-selected": !!isSelected || forceSelectionContentLock,
|
|
223
|
-
"aria-expanded": canExpand ? isExpanded : undefined,
|
|
224
|
-
"aria-describedby": descriptionId
|
|
214
|
+
"aria-selected": !!isSelected || forceSelectionContentLock
|
|
225
215
|
}, _ref2 => {
|
|
226
216
|
let {
|
|
227
217
|
ref,
|
|
@@ -241,9 +231,10 @@ function ListViewBlock(_ref) {
|
|
|
241
231
|
ref: ref,
|
|
242
232
|
tabIndex: currentlyEditingBlockInCanvas ? 0 : tabIndex,
|
|
243
233
|
onFocus: onFocus,
|
|
244
|
-
isExpanded: isExpanded,
|
|
234
|
+
isExpanded: canExpand ? isExpanded : undefined,
|
|
245
235
|
selectedClientIds: selectedClientIds,
|
|
246
|
-
|
|
236
|
+
ariaLabel: blockAriaLabel,
|
|
237
|
+
ariaDescribedBy: descriptionId
|
|
247
238
|
}), (0, _element.createElement)("div", {
|
|
248
239
|
className: "block-editor-list-view-block-select-button__description",
|
|
249
240
|
id: descriptionId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"names":["ListViewBlock","block","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","preventAnnouncement","isSyncedBranch","cellRef","rowRef","isHovered","setIsHovered","clientId","isLocked","isContentLocked","canEdit","forceSelectionContentLock","select","blockEditorStore","hasSelectedInnerBlock","canExpand","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","blockInformation","blockName","getBlockName","showBlockActions","instanceId","descriptionId","blockPositionDescription","blockAriaLabel","title","settingsAriaLabel","isTreeGridMounted","expand","collapse","BlockSettingsMenu","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","current","focus","onMouseEnter","onMouseLeave","selectEditorBlock","event","preventDefault","updateSelection","newClientId","undefined","toggleExpanded","stopPropagation","colSpan","classes","isSynced","dropdownClientIds","includes","rowItemRef","currentlyEditingBlockInCanvas","ref","tabIndex","onFocus","moreVertical","className"],"mappings":";;;;;;;;;AAeA;;AAZA;;AAKA;;AACA;;AAIA;;AACA;;AAQA;;AACA;;AAKA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvCA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;AAcA,SAASA,aAAT,OAgBI;AAAA,MAhBoB;AACvBC,IAAAA,KADuB;AAEvBC,IAAAA,SAFuB;AAGvBC,IAAAA,UAHuB;AAIvBC,IAAAA,gBAJuB;AAKvBC,IAAAA,WALuB;AAMvBC,IAAAA,QANuB;AAOvBC,IAAAA,KAPuB;AAQvBC,IAAAA,QARuB;AASvBC,IAAAA,iBATuB;AAUvBC,IAAAA,eAVuB;AAWvBC,IAAAA,IAXuB;AAYvBC,IAAAA,UAZuB;AAavBC,IAAAA,iBAbuB;AAcvBC,IAAAA,mBAduB;AAevBC,IAAAA;AAfuB,GAgBpB;AACH,QAAMC,OAAO,GAAG,qBAAQ,IAAR,CAAhB;AACA,QAAMC,MAAM,GAAG,qBAAQ,IAAR,CAAf;AACA,QAAM,CAAEC,SAAF,EAAaC,YAAb,IAA8B,uBAAU,KAAV,CAApC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAenB,KAArB;AAEA,QAAM;AAAEoB,IAAAA,QAAF;AAAYC,IAAAA,eAAZ;AAA6BC,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AC,sCAAD,QACG;AAAA,QAAE;AAAEF,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,4BAAC,4BAAD;AACC,MAAA,WAAW,EAAC,UADb;AAEC,MAAA,SAAS,EAAG,CAAEpD,QAAF,CAFb;AAGC,MAAA,GAAG,EAAGkD,GAHP;AAIC,MAAA,QAAQ,EAAGC,QAJZ;AAKC,MAAA,OAAO,EAAGC;AALX,MADC;AAAA,GADH,CAfD,CADD,CAvDF,EAsFGpC,gBAAgB,IAAIU,iBAApB,IACD,4BAAC,sCAAD;AACC,IAAA,SAAS,EAAGI,8BADb;AAEC,qBAAgB,CAAC,CAAE/C,UAAH,IAAiBqB;AAFlC,KAIG;AAAA,QAAE;AAAE8C,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,4BAAC,iBAAD;AACC,MAAA,SAAS,EAAGN,iBADb;AAEC,MAAA,KAAK,EAAGjE,KAFT;AAGC,MAAA,IAAI,EAAGwE,mBAHR;AAIC,MAAA,KAAK,EAAG/B,iBAJT;AAKC,MAAA,WAAW,EAAG;AACb4B,QAAAA,GADa;AAEbI,QAAAA,SAAS,EAAE,oCAFE;AAGbH,QAAAA,QAHa;AAIbC,QAAAA;AAJa,OALf;AAWC,MAAA,sBAAsB,MAXvB;AAYC,MAAA,yBAAyB,EAAGd;AAZ7B,MADC;AAAA,GAJH,CAvFF,CADD;AAgHA;;eAEc,mBAAM1D,aAAN,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport useListViewScrollIntoView from './use-list-view-scroll-into-view';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport { useListViewContext } from './context';\nimport { getBlockPositionDescription } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { useBlockLock } from '../block-lock';\n\nfunction ListViewBlock( {\n\tblock,\n\tisDragged,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n\tselectedClientIds,\n\tpreventAnnouncement,\n\tisSyncedBranch,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst rowRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst { clientId } = block;\n\n\tconst { isLocked, isContentLocked, canEdit } = useBlockLock( clientId );\n\tconst forceSelectionContentLock = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isSelected ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif ( ! isContentLocked ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( blockEditorStore ).hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\ttrue\n\t\t\t);\n\t\t},\n\t\t[ isContentLocked, clientId, isSelected ]\n\t);\n\n\tconst canExpand = isContentLocked ? false : canEdit;\n\tconst isFirstSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected && selectedClientIds[ 0 ] === clientId );\n\tconst isLastSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected &&\n\t\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId );\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockName = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockName( clientId ),\n\t\t[ clientId ]\n\t);\n\n\t// When a block hides its toolbar it also hides the block settings menu,\n\t// since that menu is part of the toolbar in the editor canvas.\n\t// List View respects this by also hiding the block settings menu.\n\tconst showBlockActions = hasBlockSupport(\n\t\tblockName,\n\t\t'__experimentalToolbar',\n\t\ttrue\n\t);\n\tconst instanceId = useInstanceId( ListViewBlock );\n\tconst descriptionId = `list-view-block-select-button__${ instanceId }`;\n\tconst blockPositionDescription = getBlockPositionDescription(\n\t\tposition,\n\t\tsiblingBlockCount,\n\t\tlevel\n\t);\n\n\tlet blockAriaLabel = __( 'Link' );\n\tif ( blockInformation ) {\n\t\tblockAriaLabel = isLocked\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the locked block.\n\t\t\t\t\t__( '%s link (locked)' ),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the block.\n\t\t\t\t\t__( '%s link' ),\n\t\t\t\t\tblockInformation.title\n\t\t\t );\n\t}\n\n\tconst settingsAriaLabel = blockInformation\n\t\t? sprintf(\n\t\t\t\t// translators: %s: The title of the block.\n\t\t\t\t__( 'Options for %s block' ),\n\t\t\t\tblockInformation.title\n\t\t )\n\t\t: __( 'Options' );\n\n\tconst { isTreeGridMounted, expand, collapse, BlockSettingsMenu } =\n\t\tuseListViewContext();\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isFirstSelectedBlock }\n\t);\n\n\t// If ListView has experimental features related to the Persistent List View,\n\t// only focus the selected list item on mount; otherwise the list would always\n\t// try to steal the focus from the editor canvas.\n\tuseEffect( () => {\n\t\tif ( ! isTreeGridMounted && isSelected ) {\n\t\t\tcellRef.current.focus();\n\t\t}\n\t}, [] );\n\n\tconst onMouseEnter = useCallback( () => {\n\t\tsetIsHovered( true );\n\t\ttoggleBlockHighlight( clientId, true );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\tconst onMouseLeave = useCallback( () => {\n\t\tsetIsHovered( false );\n\t\ttoggleBlockHighlight( clientId, false );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\n\tconst selectEditorBlock = useCallback(\n\t\t( event ) => {\n\t\t\tselectBlock( event, clientId );\n\t\t\tevent.preventDefault();\n\t\t},\n\t\t[ clientId, selectBlock ]\n\t);\n\n\tconst updateSelection = useCallback(\n\t\t( newClientId ) => {\n\t\t\tselectBlock( undefined, newClientId );\n\t\t},\n\t\t[ selectBlock ]\n\t);\n\n\tconst toggleExpanded = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent shift+click from opening link in a new window when toggling.\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tif ( isExpanded === true ) {\n\t\t\t\tcollapse( clientId );\n\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\texpand( clientId );\n\t\t\t}\n\t\t},\n\t\t[ clientId, expand, collapse, isExpanded ]\n\t);\n\n\tlet colSpan;\n\tif ( hasRenderedMovers ) {\n\t\tcolSpan = 2;\n\t} else if ( ! showBlockActions ) {\n\t\tcolSpan = 3;\n\t}\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected || forceSelectionContentLock,\n\t\t'is-first-selected': isFirstSelectedBlock,\n\t\t'is-last-selected': isLastSelectedBlock,\n\t\t'is-branch-selected': isBranchSelected,\n\t\t'is-synced-branch': isSyncedBranch,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\n\t\t'is-synced': blockInformation?.isSynced,\n\t} );\n\n\t// Only include all selected blocks if the currently clicked on block\n\t// is one of the selected blocks. This ensures that if a user attempts\n\t// to alter a block that isn't part of the selection, they're still able\n\t// to do so.\n\tconst dropdownClientIds = selectedClientIds.includes( clientId )\n\t\t? selectedClientIds\n\t\t: [ clientId ];\n\n\t// Pass in a ref to the row, so that it can be scrolled\n\t// into view when selected. For long lists, the placeholder for the\n\t// selected block is also observed, within ListViewLeafPlaceholder.\n\tuseListViewScrollIntoView( {\n\t\tisSelected,\n\t\trowItemRef: rowRef,\n\t\tselectedClientIds,\n\t} );\n\n\t// Detect if there is a block in the canvas currently being edited and multi-selection is not happening.\n\tconst currentlyEditingBlockInCanvas =\n\t\tisSelected && selectedClientIds.length === 1;\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tdata-expanded={ canExpand ? isExpanded : undefined }\n\t\t\tisExpanded={ canExpand ? isExpanded : undefined }\n\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\tref={ rowRef }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ colSpan }\n\t\t\t\tref={ cellRef }\n\t\t\t\taria-label={ blockAriaLabel }\n\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t\taria-expanded={ canExpand ? isExpanded : undefined }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={\n\t\t\t\t\t\t\t\tcurrentlyEditingBlockInCanvas ? 0 : tabIndex\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tpreventAnnouncement={ preventAnnouncement }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__description\"\n\t\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ showBlockActions && BlockSettingsMenu && (\n\t\t\t\t<TreeGridCell\n\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t\t>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsMenu\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ settingsAriaLabel }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\tclassName: 'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\t__experimentalSelectBlock={ updateSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"names":["ListViewBlock","block","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","isSyncedBranch","cellRef","rowRef","isHovered","setIsHovered","clientId","isLocked","isContentLocked","canEdit","forceSelectionContentLock","select","blockEditorStore","hasSelectedInnerBlock","canExpand","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","blockInformation","blockTitle","title","blockName","getBlockName","showBlockActions","instanceId","descriptionId","blockPositionDescription","blockAriaLabel","settingsAriaLabel","isTreeGridMounted","expand","collapse","BlockSettingsMenu","listViewInstanceId","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","current","focus","onMouseEnter","onMouseLeave","selectEditorBlock","event","preventDefault","updateSelection","newClientId","undefined","toggleExpanded","stopPropagation","colSpan","classes","isSynced","dropdownClientIds","includes","rowItemRef","currentlyEditingBlockInCanvas","ref","tabIndex","onFocus","moreVertical","className"],"mappings":";;;;;;;;;AAeA;;AAZA;;AAKA;;AACA;;AAIA;;AACA;;AAQA;;AACA;;AAKA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvCA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;AAcA,SAASA,aAAT,OAeI;AAAA,MAfoB;AACvBC,IAAAA,KADuB;AAEvBC,IAAAA,SAFuB;AAGvBC,IAAAA,UAHuB;AAIvBC,IAAAA,gBAJuB;AAKvBC,IAAAA,WALuB;AAMvBC,IAAAA,QANuB;AAOvBC,IAAAA,KAPuB;AAQvBC,IAAAA,QARuB;AASvBC,IAAAA,iBATuB;AAUvBC,IAAAA,eAVuB;AAWvBC,IAAAA,IAXuB;AAYvBC,IAAAA,UAZuB;AAavBC,IAAAA,iBAbuB;AAcvBC,IAAAA;AAduB,GAepB;AACH,QAAMC,OAAO,GAAG,qBAAQ,IAAR,CAAhB;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,CAJD,EAeC,4BAAC,sCAAD,QACG;AAAA,QAAE;AAAEF,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,4BAAC,4BAAD;AACC,MAAA,WAAW,EAAC,UADb;AAEC,MAAA,SAAS,EAAG,CAAEtD,QAAF,CAFb;AAGC,MAAA,GAAG,EAAGoD,GAHP;AAIC,MAAA,QAAQ,EAAGC,QAJZ;AAKC,MAAA,OAAO,EAAGC;AALX,MADC;AAAA,GADH,CAfD,CADD,CAnDF,EAkFGpC,gBAAgB,IAAIS,iBAApB,IACD,4BAAC,sCAAD;AACC,IAAA,SAAS,EAAGK,8BADb;AAEC,qBAAgB,CAAC,CAAEhD,UAAH,IAAiBoB;AAFlC,KAIG;AAAA,QAAE;AAAEgD,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,4BAAC,iBAAD;AACC,MAAA,SAAS,EAAGN,iBADb;AAEC,MAAA,KAAK,EAAGlE,KAFT;AAGC,MAAA,IAAI,EAAGyE,mBAHR;AAIC,MAAA,KAAK,EAAGhC,iBAJT;AAKC,MAAA,WAAW,EAAG;AACb6B,QAAAA,GADa;AAEbI,QAAAA,SAAS,EAAE,oCAFE;AAGbH,QAAAA,QAHa;AAIbC,QAAAA;AAJa,OALf;AAWC,MAAA,sBAAsB,MAXvB;AAYC,MAAA,yBAAyB,EAAGd;AAZ7B,MADC;AAAA,GAJH,CAnFF,CADD;AA4GA;;eAEc,mBAAM3D,aAAN,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport useListViewScrollIntoView from './use-list-view-scroll-into-view';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport { useListViewContext } from './context';\nimport { getBlockPositionDescription } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { useBlockLock } from '../block-lock';\n\nfunction ListViewBlock( {\n\tblock,\n\tisDragged,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n\tselectedClientIds,\n\tisSyncedBranch,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst rowRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst { clientId } = block;\n\n\tconst { isLocked, isContentLocked, canEdit } = useBlockLock( clientId );\n\tconst forceSelectionContentLock = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isSelected ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif ( ! isContentLocked ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( blockEditorStore ).hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\ttrue\n\t\t\t);\n\t\t},\n\t\t[ isContentLocked, clientId, isSelected ]\n\t);\n\n\tconst canExpand = isContentLocked ? false : canEdit;\n\tconst isFirstSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected && selectedClientIds[ 0 ] === clientId );\n\tconst isLastSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected &&\n\t\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId );\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = blockInformation?.title || __( 'Untitled' );\n\tconst blockName = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockName( clientId ),\n\t\t[ clientId ]\n\t);\n\n\t// When a block hides its toolbar it also hides the block settings menu,\n\t// since that menu is part of the toolbar in the editor canvas.\n\t// List View respects this by also hiding the block settings menu.\n\tconst showBlockActions = hasBlockSupport(\n\t\tblockName,\n\t\t'__experimentalToolbar',\n\t\ttrue\n\t);\n\tconst instanceId = useInstanceId( ListViewBlock );\n\tconst descriptionId = `list-view-block-select-button__${ instanceId }`;\n\tconst blockPositionDescription = getBlockPositionDescription(\n\t\tposition,\n\t\tsiblingBlockCount,\n\t\tlevel\n\t);\n\n\tconst blockAriaLabel = isLocked\n\t\t? sprintf(\n\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the locked block.\n\t\t\t\t__( '%s (locked)' ),\n\t\t\t\tblockTitle\n\t\t )\n\t\t: blockTitle;\n\n\tconst settingsAriaLabel = sprintf(\n\t\t// translators: %s: The title of the block.\n\t\t__( 'Options for %s' ),\n\t\tblockTitle\n\t);\n\n\tconst {\n\t\tisTreeGridMounted,\n\t\texpand,\n\t\tcollapse,\n\t\tBlockSettingsMenu,\n\t\tlistViewInstanceId,\n\t} = useListViewContext();\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isFirstSelectedBlock }\n\t);\n\n\t// If ListView has experimental features related to the Persistent List View,\n\t// only focus the selected list item on mount; otherwise the list would always\n\t// try to steal the focus from the editor canvas.\n\tuseEffect( () => {\n\t\tif ( ! isTreeGridMounted && isSelected ) {\n\t\t\tcellRef.current.focus();\n\t\t}\n\t}, [] );\n\n\tconst onMouseEnter = useCallback( () => {\n\t\tsetIsHovered( true );\n\t\ttoggleBlockHighlight( clientId, true );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\tconst onMouseLeave = useCallback( () => {\n\t\tsetIsHovered( false );\n\t\ttoggleBlockHighlight( clientId, false );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\n\tconst selectEditorBlock = useCallback(\n\t\t( event ) => {\n\t\t\tselectBlock( event, clientId );\n\t\t\tevent.preventDefault();\n\t\t},\n\t\t[ clientId, selectBlock ]\n\t);\n\n\tconst updateSelection = useCallback(\n\t\t( newClientId ) => {\n\t\t\tselectBlock( undefined, newClientId );\n\t\t},\n\t\t[ selectBlock ]\n\t);\n\n\tconst toggleExpanded = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent shift+click from opening link in a new window when toggling.\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tif ( isExpanded === true ) {\n\t\t\t\tcollapse( clientId );\n\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\texpand( clientId );\n\t\t\t}\n\t\t},\n\t\t[ clientId, expand, collapse, isExpanded ]\n\t);\n\n\tlet colSpan;\n\tif ( hasRenderedMovers ) {\n\t\tcolSpan = 2;\n\t} else if ( ! showBlockActions ) {\n\t\tcolSpan = 3;\n\t}\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected || forceSelectionContentLock,\n\t\t'is-first-selected': isFirstSelectedBlock,\n\t\t'is-last-selected': isLastSelectedBlock,\n\t\t'is-branch-selected': isBranchSelected,\n\t\t'is-synced-branch': isSyncedBranch,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\n\t\t'is-synced': blockInformation?.isSynced,\n\t} );\n\n\t// Only include all selected blocks if the currently clicked on block\n\t// is one of the selected blocks. This ensures that if a user attempts\n\t// to alter a block that isn't part of the selection, they're still able\n\t// to do so.\n\tconst dropdownClientIds = selectedClientIds.includes( clientId )\n\t\t? selectedClientIds\n\t\t: [ clientId ];\n\n\t// Pass in a ref to the row, so that it can be scrolled\n\t// into view when selected. For long lists, the placeholder for the\n\t// selected block is also observed, within ListViewLeafPlaceholder.\n\tuseListViewScrollIntoView( {\n\t\tisSelected,\n\t\trowItemRef: rowRef,\n\t\tselectedClientIds,\n\t} );\n\n\t// Detect if there is a block in the canvas currently being edited and multi-selection is not happening.\n\tconst currentlyEditingBlockInCanvas =\n\t\tisSelected && selectedClientIds.length === 1;\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-${ listViewInstanceId }-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tdata-expanded={ canExpand ? isExpanded : undefined }\n\t\t\tref={ rowRef }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ colSpan }\n\t\t\t\tref={ cellRef }\n\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={\n\t\t\t\t\t\t\t\tcurrentlyEditingBlockInCanvas ? 0 : tabIndex\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ canExpand ? isExpanded : undefined }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tariaLabel={ blockAriaLabel }\n\t\t\t\t\t\t\tariaDescribedBy={ descriptionId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__description\"\n\t\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ showBlockActions && BlockSettingsMenu && (\n\t\t\t\t<TreeGridCell\n\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t\t>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsMenu\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ settingsAriaLabel }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\tclassName: 'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\t__experimentalSelectBlock={ updateSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"]}
|
|
@@ -9,6 +9,8 @@ var _element = require("@wordpress/element");
|
|
|
9
9
|
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
11
|
|
|
12
|
+
var _dom = require("@wordpress/dom");
|
|
13
|
+
|
|
12
14
|
/**
|
|
13
15
|
* WordPress dependencies
|
|
14
16
|
*/
|
|
@@ -42,7 +44,7 @@ function ListViewDropIndicator(_ref) {
|
|
|
42
44
|
// is undefined, so the indicator will appear after the rootBlockElement.
|
|
43
45
|
|
|
44
46
|
const targetElement = blockElement || rootBlockElement;
|
|
45
|
-
const getDropIndicatorIndent = (0, _element.useCallback)(
|
|
47
|
+
const getDropIndicatorIndent = (0, _element.useCallback)(targetElementRect => {
|
|
46
48
|
if (!rootBlockElement) {
|
|
47
49
|
return 0;
|
|
48
50
|
} // Calculate the indent using the block icon of the root block.
|
|
@@ -50,21 +52,47 @@ function ListViewDropIndicator(_ref) {
|
|
|
50
52
|
// improved.
|
|
51
53
|
|
|
52
54
|
|
|
53
|
-
const targetElementRect = targetElement.getBoundingClientRect();
|
|
54
55
|
const rootBlockIconElement = rootBlockElement.querySelector('.block-editor-block-icon');
|
|
55
56
|
const rootBlockIconRect = rootBlockIconElement.getBoundingClientRect();
|
|
56
57
|
return rootBlockIconRect.right - targetElementRect.left;
|
|
57
|
-
}, [rootBlockElement
|
|
58
|
+
}, [rootBlockElement]);
|
|
59
|
+
const getDropIndicatorWidth = (0, _element.useCallback)((targetElementRect, indent) => {
|
|
60
|
+
if (!targetElement) {
|
|
61
|
+
return 0;
|
|
62
|
+
} // Default to assuming that the width of the drop indicator
|
|
63
|
+
// should be the same as the target element.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
let width = targetElement.offsetWidth; // In deeply nested lists, where a scrollbar is present,
|
|
67
|
+
// the width of the drop indicator should be the width of
|
|
68
|
+
// the scroll container, minus the distance from the left
|
|
69
|
+
// edge of the scroll container to the left edge of the
|
|
70
|
+
// target element.
|
|
71
|
+
|
|
72
|
+
const scrollContainer = (0, _dom.getScrollContainer)(targetElement, 'horizontal');
|
|
73
|
+
|
|
74
|
+
if (scrollContainer) {
|
|
75
|
+
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
|
76
|
+
|
|
77
|
+
if (scrollContainer.clientWidth < width) {
|
|
78
|
+
width = scrollContainer.clientWidth - (targetElementRect.left - scrollContainerRect.left);
|
|
79
|
+
}
|
|
80
|
+
} // Subtract the indent from the final width of the indicator.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
return width - indent;
|
|
84
|
+
}, [targetElement]);
|
|
58
85
|
const style = (0, _element.useMemo)(() => {
|
|
59
86
|
if (!targetElement) {
|
|
60
87
|
return {};
|
|
61
88
|
}
|
|
62
89
|
|
|
63
|
-
const
|
|
90
|
+
const targetElementRect = targetElement.getBoundingClientRect();
|
|
91
|
+
const indent = getDropIndicatorIndent(targetElementRect);
|
|
64
92
|
return {
|
|
65
|
-
width:
|
|
93
|
+
width: getDropIndicatorWidth(targetElementRect, indent)
|
|
66
94
|
};
|
|
67
|
-
}, [getDropIndicatorIndent, targetElement]);
|
|
95
|
+
}, [getDropIndicatorIndent, getDropIndicatorWidth, targetElement]);
|
|
68
96
|
const popoverAnchor = (0, _element.useMemo)(() => {
|
|
69
97
|
const isValidDropPosition = dropPosition === 'top' || dropPosition === 'bottom' || dropPosition === 'inside';
|
|
70
98
|
|
|
@@ -77,9 +105,8 @@ function ListViewDropIndicator(_ref) {
|
|
|
77
105
|
|
|
78
106
|
getBoundingClientRect() {
|
|
79
107
|
const rect = targetElement.getBoundingClientRect();
|
|
80
|
-
const indent = getDropIndicatorIndent();
|
|
108
|
+
const indent = getDropIndicatorIndent(rect);
|
|
81
109
|
const left = rect.left + indent;
|
|
82
|
-
const right = rect.right;
|
|
83
110
|
let top = 0;
|
|
84
111
|
let bottom = 0;
|
|
85
112
|
|
|
@@ -92,13 +119,13 @@ function ListViewDropIndicator(_ref) {
|
|
|
92
119
|
bottom = rect.bottom;
|
|
93
120
|
}
|
|
94
121
|
|
|
95
|
-
const width =
|
|
122
|
+
const width = getDropIndicatorWidth(rect, indent);
|
|
96
123
|
const height = bottom - top;
|
|
97
124
|
return new window.DOMRect(left, top, width, height);
|
|
98
125
|
}
|
|
99
126
|
|
|
100
127
|
};
|
|
101
|
-
}, [targetElement, dropPosition, getDropIndicatorIndent]);
|
|
128
|
+
}, [targetElement, dropPosition, getDropIndicatorIndent, getDropIndicatorWidth]);
|
|
102
129
|
|
|
103
130
|
if (!targetElement) {
|
|
104
131
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/drop-indicator.js"],"names":["ListViewDropIndicator","listViewRef","blockDropTarget","rootClientId","clientId","dropPosition","rootBlockElement","blockElement","current","_rootBlockElement","querySelector","undefined","_blockElement","targetElement","getDropIndicatorIndent","targetElementRect","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/drop-indicator.js"],"names":["ListViewDropIndicator","listViewRef","blockDropTarget","rootClientId","clientId","dropPosition","rootBlockElement","blockElement","current","_rootBlockElement","querySelector","undefined","_blockElement","targetElement","getDropIndicatorIndent","targetElementRect","rootBlockIconElement","rootBlockIconRect","getBoundingClientRect","right","left","getDropIndicatorWidth","indent","width","offsetWidth","scrollContainer","scrollContainerRect","clientWidth","style","popoverAnchor","isValidDropPosition","ownerDocument","rect","top","bottom","height","window","DOMRect"],"mappings":";;;;;;;AAKA;;AAFA;;AACA;;AAJA;AACA;AACA;AAKe,SAASA,qBAAT,OAGX;AAAA,MAH2C;AAC9CC,IAAAA,WAD8C;AAE9CC,IAAAA;AAF8C,GAG3C;AACH,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,QAAhB;AAA0BC,IAAAA;AAA1B,MAA2CH,eAAe,IAAI,EAApE;AAEA,QAAM,CAAEI,gBAAF,EAAoBC,YAApB,IAAqC,sBAAS,MAAM;AACzD,QAAK,CAAEN,WAAW,CAACO,OAAnB,EAA6B;AAC5B,aAAO,EAAP;AACA,KAHwD,CAKzD;AACA;;;AACA,UAAMC,iBAAiB,GAAGN,YAAY,GACnCF,WAAW,CAACO,OAAZ,CAAoBE,aAApB,CACC,gBAAgBP,YAAc,IAD/B,CADmC,GAInCQ,SAJH,CAPyD,CAazD;AACA;AACA;;;AACA,UAAMC,aAAa,GAAGR,QAAQ,GAC3BH,WAAW,CAACO,OAAZ,C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AqB,CAAEW,IAAF,EAAQV,MAAR,CAAnC;AACA,cAAMa,MAAM,GAAGD,MAAM,GAAGD,GAAxB;AAEA,eAAO,IAAIG,MAAM,CAACC,OAAX,CAAoBjB,IAApB,EAA0Ba,GAA1B,EAA+BV,KAA/B,EAAsCY,MAAtC,CAAP;AACA;;AAtBK,KAAP;AAwBA,GAjCqB,EAiCnB,CACFtB,aADE,EAEFR,YAFE,EAGFS,sBAHE,EAIFO,qBAJE,CAjCmB,CAAtB;;AAwCA,MAAK,CAAER,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,mBAAD;AACC,IAAA,OAAO,EAAG,KADX;AAEC,IAAA,MAAM,EAAGgB,aAFV;AAGC,IAAA,YAAY,EAAG,KAHhB;AAIC,IAAA,SAAS,EAAC,uCAJX;AAKC,IAAA,OAAO,EAAC;AALT,KAOC;AACC,IAAA,KAAK,EAAGD,KADT;AAEC,IAAA,SAAS,EAAC;AAFX,IAPD,CADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Popover } from '@wordpress/components';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useCallback, useMemo } from '@wordpress/element';\n\nexport default function ListViewDropIndicator( {\n\tlistViewRef,\n\tblockDropTarget,\n} ) {\n\tconst { rootClientId, clientId, dropPosition } = blockDropTarget || {};\n\n\tconst [ rootBlockElement, blockElement ] = useMemo( () => {\n\t\tif ( ! listViewRef.current ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// The rootClientId will be defined whenever dropping into inner\n\t\t// block lists, but is undefined when dropping at the root level.\n\t\tconst _rootBlockElement = rootClientId\n\t\t\t? listViewRef.current.querySelector(\n\t\t\t\t\t`[data-block=\"${ rootClientId }\"]`\n\t\t\t )\n\t\t\t: undefined;\n\n\t\t// The clientId represents the sibling block, the dragged block will\n\t\t// usually be inserted adjacent to it. It will be undefined when\n\t\t// dropping a block into an empty block list.\n\t\tconst _blockElement = clientId\n\t\t\t? listViewRef.current.querySelector(\n\t\t\t\t\t`[data-block=\"${ clientId }\"]`\n\t\t\t )\n\t\t\t: undefined;\n\n\t\treturn [ _rootBlockElement, _blockElement ];\n\t}, [ rootClientId, clientId ] );\n\n\t// The targetElement is the element that the drop indicator will appear\n\t// before or after. When dropping into an empty block list, blockElement\n\t// is undefined, so the indicator will appear after the rootBlockElement.\n\tconst targetElement = blockElement || rootBlockElement;\n\n\tconst getDropIndicatorIndent = useCallback(\n\t\t( targetElementRect ) => {\n\t\t\tif ( ! rootBlockElement ) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\t// Calculate the indent using the block icon of the root block.\n\t\t\t// Using a classname selector here might be flaky and could be\n\t\t\t// improved.\n\t\t\tconst rootBlockIconElement = rootBlockElement.querySelector(\n\t\t\t\t'.block-editor-block-icon'\n\t\t\t);\n\t\t\tconst rootBlockIconRect =\n\t\t\t\trootBlockIconElement.getBoundingClientRect();\n\t\t\treturn rootBlockIconRect.right - targetElementRect.left;\n\t\t},\n\t\t[ rootBlockElement ]\n\t);\n\n\tconst getDropIndicatorWidth = useCallback(\n\t\t( targetElementRect, indent ) => {\n\t\t\tif ( ! targetElement ) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\t// Default to assuming that the width of the drop indicator\n\t\t\t// should be the same as the target element.\n\t\t\tlet width = targetElement.offsetWidth;\n\n\t\t\t// In deeply nested lists, where a scrollbar is present,\n\t\t\t// the width of the drop indicator should be the width of\n\t\t\t// the scroll container, minus the distance from the left\n\t\t\t// edge of the scroll container to the left edge of the\n\t\t\t// target element.\n\t\t\tconst scrollContainer = getScrollContainer(\n\t\t\t\ttargetElement,\n\t\t\t\t'horizontal'\n\t\t\t);\n\n\t\t\tif ( scrollContainer ) {\n\t\t\t\tconst scrollContainerRect =\n\t\t\t\t\tscrollContainer.getBoundingClientRect();\n\n\t\t\t\tif ( scrollContainer.clientWidth < width ) {\n\t\t\t\t\twidth =\n\t\t\t\t\t\tscrollContainer.clientWidth -\n\t\t\t\t\t\t( targetElementRect.left - scrollContainerRect.left );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Subtract the indent from the final width of the indicator.\n\t\t\treturn width - indent;\n\t\t},\n\t\t[ targetElement ]\n\t);\n\n\tconst style = useMemo( () => {\n\t\tif ( ! targetElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst targetElementRect = targetElement.getBoundingClientRect();\n\t\tconst indent = getDropIndicatorIndent( targetElementRect );\n\n\t\treturn {\n\t\t\twidth: getDropIndicatorWidth( targetElementRect, indent ),\n\t\t};\n\t}, [ getDropIndicatorIndent, getDropIndicatorWidth, targetElement ] );\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tconst isValidDropPosition =\n\t\t\tdropPosition === 'top' ||\n\t\t\tdropPosition === 'bottom' ||\n\t\t\tdropPosition === 'inside';\n\t\tif ( ! targetElement || ! isValidDropPosition ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\townerDocument: targetElement.ownerDocument,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst rect = targetElement.getBoundingClientRect();\n\t\t\t\tconst indent = getDropIndicatorIndent( rect );\n\t\t\t\tconst left = rect.left + indent;\n\t\t\t\tlet top = 0;\n\t\t\t\tlet bottom = 0;\n\n\t\t\t\tif ( dropPosition === 'top' ) {\n\t\t\t\t\ttop = rect.top;\n\t\t\t\t\tbottom = rect.top;\n\t\t\t\t} else {\n\t\t\t\t\t// `dropPosition` is either `bottom` or `inside`\n\t\t\t\t\ttop = rect.bottom;\n\t\t\t\t\tbottom = rect.bottom;\n\t\t\t\t}\n\n\t\t\t\tconst width = getDropIndicatorWidth( rect, indent );\n\t\t\t\tconst height = bottom - top;\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t};\n\t}, [\n\t\ttargetElement,\n\t\tdropPosition,\n\t\tgetDropIndicatorIndent,\n\t\tgetDropIndicatorWidth,\n\t] );\n\n\tif ( ! targetElement ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tanimate={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tfocusOnMount={ false }\n\t\t\tclassName=\"block-editor-list-view-drop-indicator\"\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div\n\t\t\t\tstyle={ style }\n\t\t\t\tclassName=\"block-editor-list-view-drop-indicator__line\"\n\t\t\t/>\n\t\t</Popover>\n\t);\n}\n"]}
|
|
@@ -74,6 +74,7 @@ const BLOCK_LIST_ITEM_HEIGHT = 36;
|
|
|
74
74
|
* @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.
|
|
75
75
|
* @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.
|
|
76
76
|
* @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.
|
|
77
|
+
* @param {string} props.description Optional accessible description for the tree grid component.
|
|
77
78
|
* @param {Ref} ref Forwarded ref
|
|
78
79
|
*/
|
|
79
80
|
|
|
@@ -87,7 +88,8 @@ function ListViewComponent(_ref, ref) {
|
|
|
87
88
|
isExpanded = false,
|
|
88
89
|
showAppender = false,
|
|
89
90
|
blockSettingsMenu: BlockSettingsMenu = _blockSettingsDropdown.BlockSettingsDropdown,
|
|
90
|
-
rootClientId
|
|
91
|
+
rootClientId,
|
|
92
|
+
description
|
|
91
93
|
} = _ref;
|
|
92
94
|
|
|
93
95
|
// This can be removed once we no longer need to support the blocks prop.
|
|
@@ -98,6 +100,7 @@ function ListViewComponent(_ref, ref) {
|
|
|
98
100
|
});
|
|
99
101
|
}
|
|
100
102
|
|
|
103
|
+
const instanceId = (0, _compose.useInstanceId)(ListViewComponent);
|
|
101
104
|
const {
|
|
102
105
|
clientIdsTree,
|
|
103
106
|
draggedClientIds,
|
|
@@ -195,8 +198,9 @@ function ListViewComponent(_ref, ref) {
|
|
|
195
198
|
expandedState,
|
|
196
199
|
expand,
|
|
197
200
|
collapse,
|
|
198
|
-
BlockSettingsMenu
|
|
199
|
-
|
|
201
|
+
BlockSettingsMenu,
|
|
202
|
+
listViewInstanceId: instanceId
|
|
203
|
+
}), [draggedClientIds, expandedState, expand, collapse, BlockSettingsMenu, instanceId]); // If there are no blocks to show, do not render the list view.
|
|
200
204
|
|
|
201
205
|
if (!clientIdsTree.length) {
|
|
202
206
|
return null;
|
|
@@ -215,7 +219,9 @@ function ListViewComponent(_ref, ref) {
|
|
|
215
219
|
onCollapseRow: collapseRow,
|
|
216
220
|
onExpandRow: expandRow,
|
|
217
221
|
onFocusRow: focusRow,
|
|
218
|
-
applicationAriaLabel: (0, _i18n.__)('Block navigation structure')
|
|
222
|
+
applicationAriaLabel: (0, _i18n.__)('Block navigation structure') // eslint-disable-next-line jsx-a11y/aria-props
|
|
223
|
+
,
|
|
224
|
+
"aria-description": description
|
|
219
225
|
}, (0, _element.createElement)(_context.ListViewContext.Provider, {
|
|
220
226
|
value: contextValue
|
|
221
227
|
}, (0, _element.createElement)(_branch.default, {
|