@wordpress/block-editor 14.7.0 → 14.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/block-controls/slot.js +6 -3
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-inspector/index.js +1 -2
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-lock/modal.js +1 -1
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-manager/category.js +79 -0
- package/build/components/block-manager/category.js.map +1 -0
- package/build/components/block-manager/checklist.js +40 -0
- package/build/components/block-manager/checklist.js.map +1 -0
- package/build/components/block-manager/index.js +108 -0
- package/build/components/block-manager/index.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +16 -4
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/switch-section-style.js +105 -0
- package/build/components/block-toolbar/switch-section-style.js.map +1 -0
- package/build/components/collab/block-comment-icon-slot.js +2 -6
- package/build/components/collab/block-comment-icon-slot.js.map +1 -1
- package/build/components/collab/block-comment-icon-toolbar-slot.js +2 -6
- package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -1
- package/build/components/color-palette/with-color-context.js +4 -2
- package/build/components/color-palette/with-color-context.js.map +1 -1
- package/build/components/font-family/index.js +14 -13
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +1 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/iframe/index.js +13 -100
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-scale-canvas.js +377 -0
- package/build/components/iframe/use-scale-canvas.js.map +1 -0
- package/build/components/image-editor/use-save-image.js +22 -3
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +1 -5
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +7 -8
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +2 -1
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +7 -4
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -4
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build/components/media-placeholder/index.js +29 -21
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/hooks/border.js +3 -3
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/style.js +6 -6
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +1 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +1 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +1 -1
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/flex.js +11 -9
- package/build/layouts/flex.js.map +1 -1
- package/build/private-apis.js +4 -4
- package/build/private-apis.js.map +1 -1
- package/build/store/private-selectors.js +1 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/selectors.js +3 -0
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-controls/slot.js +6 -3
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -2
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-lock/modal.js +1 -1
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-manager/category.js +71 -0
- package/build-module/components/block-manager/category.js.map +1 -0
- package/build-module/components/block-manager/checklist.js +32 -0
- package/build-module/components/block-manager/checklist.js.map +1 -0
- package/build-module/components/block-manager/index.js +102 -0
- package/build-module/components/block-manager/index.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +2 -2
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +16 -4
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/switch-section-style.js +97 -0
- package/build-module/components/block-toolbar/switch-section-style.js.map +1 -0
- package/build-module/components/collab/block-comment-icon-slot.js +2 -6
- package/build-module/components/collab/block-comment-icon-slot.js.map +1 -1
- package/build-module/components/collab/block-comment-icon-toolbar-slot.js +2 -6
- package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -1
- package/build-module/components/color-palette/with-color-context.js +4 -2
- package/build-module/components/color-palette/with-color-context.js.map +1 -1
- package/build-module/components/font-family/index.js +15 -14
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/iframe/index.js +15 -102
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-scale-canvas.js +371 -0
- package/build-module/components/iframe/use-scale-canvas.js.map +1 -0
- package/build-module/components/image-editor/use-save-image.js +22 -3
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +1 -5
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +8 -9
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +2 -1
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +7 -4
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -4
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +29 -21
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/hooks/border.js +3 -3
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +2 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/style.js +6 -6
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +1 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +1 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +1 -1
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/flex.js +11 -9
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/private-apis.js +6 -6
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-selectors.js +1 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/selectors.js +3 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/content-rtl.css +27 -28
- package/build-style/content.css +27 -28
- package/build-style/style-rtl.css +108 -0
- package/build-style/style.css +108 -0
- package/package.json +2 -2
- package/src/components/block-canvas/style.scss +2 -1
- package/src/components/block-controls/slot.js +5 -3
- package/src/components/block-inspector/index.js +0 -2
- package/src/components/block-lock/modal.js +1 -1
- package/src/components/block-manager/category.js +102 -0
- package/src/components/block-manager/checklist.js +34 -0
- package/src/components/block-manager/index.js +127 -0
- package/src/components/block-manager/style.scss +82 -0
- package/src/components/block-mover/README.md +15 -8
- package/src/components/block-mover/stories/index.story.js +73 -71
- package/src/components/block-mover/style.scss +3 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/src/components/block-settings-menu/index.js +2 -2
- package/src/components/block-toolbar/index.js +14 -0
- package/src/components/block-toolbar/switch-section-style.js +115 -0
- package/src/components/block-tools/style.scss +39 -0
- package/src/components/collab/block-comment-icon-slot.js +2 -6
- package/src/components/collab/block-comment-icon-toolbar-slot.js +3 -5
- package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
- package/src/components/color-palette/with-color-context.js +25 -7
- package/src/components/font-family/index.js +13 -13
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +1 -1
- package/src/components/iframe/content.scss +49 -43
- package/src/components/iframe/index.js +14 -171
- package/src/components/iframe/use-scale-canvas.js +468 -0
- package/src/components/image-editor/use-save-image.js +27 -2
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +7 -16
- package/src/components/inserter/category-tabs/index.js +8 -9
- package/src/components/inserter-draggable-blocks/index.js +10 -1
- package/src/components/inspector-controls/README.md +2 -0
- package/src/components/inspector-controls/slot.js +6 -4
- package/src/components/inspector-controls-tabs/position-controls-panel.js +1 -3
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +10 -10
- package/src/components/media-placeholder/index.js +37 -33
- package/src/components/provider/test/use-block-sync.js +3 -1
- package/src/components/rich-text/content.scss +15 -10
- package/src/hooks/border.js +3 -9
- package/src/hooks/color.js +1 -1
- package/src/hooks/dimensions.js +2 -2
- package/src/hooks/style.js +6 -12
- package/src/hooks/supports.js +1 -1
- package/src/hooks/test/style.js +1 -2
- package/src/hooks/typography.js +1 -1
- package/src/hooks/utils.js +1 -1
- package/src/layouts/flex.js +26 -18
- package/src/private-apis.js +6 -6
- package/src/store/private-selectors.js +1 -1
- package/src/store/selectors.js +3 -0
- package/src/store/test/selectors.js +87 -58
- package/src/style.scss +1 -0
- package/build/components/block-info-slot-fill/index.js +0 -39
- package/build/components/block-info-slot-fill/index.js.map +0 -1
- package/build-module/components/block-info-slot-fill/index.js +0 -32
- package/build-module/components/block-info-slot-fill/index.js.map +0 -1
- package/src/components/block-info-slot-fill/index.js +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -35,15 +35,18 @@ function BlockControlsSlot({
|
|
|
35
35
|
value: contextState
|
|
36
36
|
}]]
|
|
37
37
|
}), [toolbarState, contextState]);
|
|
38
|
-
const
|
|
39
|
-
const fills = (0, _components.__experimentalUseSlotFills)(
|
|
40
|
-
if (!
|
|
38
|
+
const slotFill = _groups.default[group];
|
|
39
|
+
const fills = (0, _components.__experimentalUseSlotFills)(slotFill.name);
|
|
40
|
+
if (!slotFill) {
|
|
41
41
|
globalThis.SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown BlockControls group "${group}" provided.`) : void 0;
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
44
|
if (!fills?.length) {
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
|
+
const {
|
|
48
|
+
Slot
|
|
49
|
+
} = slotFill;
|
|
47
50
|
const slot = /*#__PURE__*/(0, _jsxRuntime.jsx)(Slot, {
|
|
48
51
|
...props,
|
|
49
52
|
bubblesVirtually: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_components","_warning","_interopRequireDefault","_groups","_lockUnlock","_jsxRuntime","ComponentsContext","unlock","privateApis","BlockControlsSlot","group","props","toolbarState","useContext","ToolbarContext","contextState","fillProps","useMemo","forwardedContext","Provider","value","
|
|
1
|
+
{"version":3,"names":["_element","require","_components","_warning","_interopRequireDefault","_groups","_lockUnlock","_jsxRuntime","ComponentsContext","unlock","privateApis","BlockControlsSlot","group","props","toolbarState","useContext","ToolbarContext","contextState","fillProps","useMemo","forwardedContext","Provider","value","slotFill","groups","fills","useSlotFills","name","globalThis","SCRIPT_DEBUG","warning","length","Slot","slot","jsx","bubblesVirtually","ToolbarGroup","children"],"sources":["@wordpress/block-editor/src/components/block-controls/slot.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext, useMemo } from '@wordpress/element';\nimport {\n\tprivateApis,\n\t__experimentalToolbarContext as ToolbarContext,\n\tToolbarGroup,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport groups from './groups';\nimport { unlock } from '../../lock-unlock';\n\nconst { ComponentsContext } = unlock( privateApis );\n\nexport default function BlockControlsSlot( { group = 'default', ...props } ) {\n\tconst toolbarState = useContext( ToolbarContext );\n\tconst contextState = useContext( ComponentsContext );\n\tconst fillProps = useMemo(\n\t\t() => ( {\n\t\t\tforwardedContext: [\n\t\t\t\t[ ToolbarContext.Provider, { value: toolbarState } ],\n\t\t\t\t[ ComponentsContext.Provider, { value: contextState } ],\n\t\t\t],\n\t\t} ),\n\t\t[ toolbarState, contextState ]\n\t);\n\n\tconst slotFill = groups[ group ];\n\tconst fills = useSlotFills( slotFill.name );\n\n\tif ( ! slotFill ) {\n\t\twarning( `Unknown BlockControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\n\tif ( ! fills?.length ) {\n\t\treturn null;\n\t}\n\n\tconst { Slot } = slotFill;\n\tconst slot = <Slot { ...props } bubblesVirtually fillProps={ fillProps } />;\n\n\tif ( group === 'default' ) {\n\t\treturn slot;\n\t}\n\n\treturn <ToolbarGroup>{ slot }</ToolbarGroup>;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AAKA,IAAAI,OAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAA2C,IAAAM,WAAA,GAAAN,OAAA;AAhB3C;AACA;AACA;;AAUA;AACA;AACA;;AAIA,MAAM;EAAEO;AAAkB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAY,CAAC;AAEpC,SAASC,iBAAiB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sTabs = _interopRequireDefault(require("../inspector-con
|
|
|
22
22
|
var _advancedControlsPanel = _interopRequireDefault(require("../inspector-controls-tabs/advanced-controls-panel"));
|
|
23
23
|
var _positionControlsPanel = _interopRequireDefault(require("../inspector-controls-tabs/position-controls-panel"));
|
|
24
24
|
var _useBlockInspectorAnimationSettings = _interopRequireDefault(require("./useBlockInspectorAnimationSettings"));
|
|
25
|
-
var _blockInfoSlotFill = _interopRequireDefault(require("../block-info-slot-fill"));
|
|
26
25
|
var _blockQuickNavigation = _interopRequireDefault(require("../block-quick-navigation"));
|
|
27
26
|
var _border = require("../../hooks/border");
|
|
28
27
|
var _lockUnlock = require("../../lock-unlock");
|
|
@@ -210,7 +209,7 @@ const BlockInspectorSingleBlock = ({
|
|
|
210
209
|
className: blockInformation.isSynced && 'is-synced'
|
|
211
210
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockVariationTransforms.default, {
|
|
212
211
|
blockClientId: clientId
|
|
213
|
-
}),
|
|
212
|
+
}), showTabs && /*#__PURE__*/(0, _jsxRuntime.jsx)(_inspectorControlsTabs.default, {
|
|
214
213
|
hasBlockStyles: hasBlockStyles,
|
|
215
214
|
clientId: clientId,
|
|
216
215
|
blockName: blockName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_blocks","_components","_data","_skipToSelectedBlock","_interopRequireDefault","_blockCard","_multiSelectionInspector","_blockVariationTransforms","_useBlockDisplayInformation","_store","_blockStyles","_inspectorControls","_inspectorControlsTabs","_useInspectorControlsTabs","_advancedControlsPanel","_positionControlsPanel","_useBlockInspectorAnimationSettings","_blockInfoSlotFill","_blockQuickNavigation","_border","_lockUnlock","_jsxRuntime","BlockStylesPanel","clientId","jsx","PanelBody","title","__","children","default","BlockInspector","showNoBlockSelectedMessage","count","selectedBlockName","selectedBlockClientId","blockType","isSectionBlock","useSelect","select","getSelectedBlockClientId","getSelectedBlockCount","getBlockName","getParentSectionBlock","_isSectionBlock","unlock","blockEditorStore","_selectedBlockClientId","renderedBlockClientId","_selectedBlockName","_blockType","getBlockType","availableTabs","useInspectorControlsTabs","name","showTabs","length","blockInspectorAnimationSettings","useBlockInspectorAnimationSettings","borderPanelLabel","useBorderPanelLabel","blockName","jsxs","className","tabs","Fragment","Slot","group","label","isSelectedBlockUnregistered","getUnregisteredTypeHandlerName","BlockInspectorSingleBlockWrapper","animate","wrapper","AnimatedContainer","BlockInspectorSingleBlock","animationOrigin","enterDirection","__unstableMotion","div","x","opacity","transition","ease","duration","initial","hasBlockStyles","getBlockStyles","blocksStore","blockStyles","blockInformation","useBlockDisplayInformation","contentClientIds","getClientIdsOfDescendants","getBlockEditingMode","filter","current","isSynced","blockClientId","clientIds","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-inspector/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetBlockType,\n\tgetUnregisteredTypeHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { PanelBody, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SkipToSelectedBlock from '../skip-to-selected-block';\nimport BlockCard from '../block-card';\nimport MultiSelectionInspector from '../multi-selection-inspector';\nimport BlockVariationTransforms from '../block-variation-transforms';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { store as blockEditorStore } from '../../store';\nimport BlockStyles from '../block-styles';\nimport { default as InspectorControls } from '../inspector-controls';\nimport { default as InspectorControlsTabs } from '../inspector-controls-tabs';\nimport useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-controls-tabs';\nimport AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';\nimport PositionControls from '../inspector-controls-tabs/position-controls-panel';\nimport useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';\nimport BlockInfo from '../block-info-slot-fill';\nimport BlockQuickNavigation from '../block-quick-navigation';\nimport { useBorderPanelLabel } from '../../hooks/border';\n\nimport { unlock } from '../../lock-unlock';\n\nfunction BlockStylesPanel( { clientId } ) {\n\treturn (\n\t\t<PanelBody title={ __( 'Styles' ) }>\n\t\t\t<BlockStyles clientId={ clientId } />\n\t\t</PanelBody>\n\t);\n}\n\nconst BlockInspector = ( { showNoBlockSelectedMessage = true } ) => {\n\tconst {\n\t\tcount,\n\t\tselectedBlockName,\n\t\tselectedBlockClientId,\n\t\tblockType,\n\t\tisSectionBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetSelectedBlockCount,\n\t\t\tgetBlockName,\n\t\t\tgetParentSectionBlock,\n\t\t\tisSectionBlock: _isSectionBlock,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst _selectedBlockClientId = getSelectedBlockClientId();\n\t\tconst renderedBlockClientId =\n\t\t\tgetParentSectionBlock( _selectedBlockClientId ) ||\n\t\t\tgetSelectedBlockClientId();\n\t\tconst _selectedBlockName =\n\t\t\trenderedBlockClientId && getBlockName( renderedBlockClientId );\n\t\tconst _blockType =\n\t\t\t_selectedBlockName && getBlockType( _selectedBlockName );\n\n\t\treturn {\n\t\t\tcount: getSelectedBlockCount(),\n\t\t\tselectedBlockClientId: renderedBlockClientId,\n\t\t\tselectedBlockName: _selectedBlockName,\n\t\t\tblockType: _blockType,\n\t\t\tisSectionBlock: _isSectionBlock( renderedBlockClientId ),\n\t\t};\n\t}, [] );\n\n\tconst availableTabs = useInspectorControlsTabs( blockType?.name );\n\tconst showTabs = availableTabs?.length > 1;\n\n\t// The block inspector animation settings will be completely\n\t// removed in the future to create an API which allows the block\n\t// inspector to transition between what it\n\t// displays based on the relationship between the selected block\n\t// and its parent, and only enable it if the parent is controlling\n\t// its children blocks.\n\tconst blockInspectorAnimationSettings =\n\t\tuseBlockInspectorAnimationSettings( blockType );\n\n\tconst borderPanelLabel = useBorderPanelLabel( {\n\t\tblockName: selectedBlockName,\n\t} );\n\n\tif ( count > 1 && ! isSectionBlock ) {\n\t\treturn (\n\t\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t\t<MultiSelectionInspector />\n\t\t\t\t{ showTabs ? (\n\t\t\t\t\t<InspectorControlsTabs tabs={ availableTabs } />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorControls.Slot />\n\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\tgroup=\"color\"\n\t\t\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\tgroup=\"background\"\n\t\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\tgroup=\"typography\"\n\t\t\t\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\tgroup=\"dimensions\"\n\t\t\t\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\tgroup=\"border\"\n\t\t\t\t\t\t\tlabel={ borderPanelLabel }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst isSelectedBlockUnregistered =\n\t\tselectedBlockName === getUnregisteredTypeHandlerName();\n\n\t/*\n\t * If the selected block is of an unregistered type, avoid showing it as an actual selection\n\t * because we want the user to focus on the unregistered block warning, not block settings.\n\t */\n\tif (\n\t\t! blockType ||\n\t\t! selectedBlockClientId ||\n\t\tisSelectedBlockUnregistered\n\t) {\n\t\tif ( showNoBlockSelectedMessage ) {\n\t\t\treturn (\n\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t</span>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockInspectorSingleBlockWrapper\n\t\t\tanimate={ blockInspectorAnimationSettings }\n\t\t\twrapper={ ( children ) => (\n\t\t\t\t<AnimatedContainer\n\t\t\t\t\tblockInspectorAnimationSettings={\n\t\t\t\t\t\tblockInspectorAnimationSettings\n\t\t\t\t\t}\n\t\t\t\t\tselectedBlockClientId={ selectedBlockClientId }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</AnimatedContainer>\n\t\t\t) }\n\t\t>\n\t\t\t<BlockInspectorSingleBlock\n\t\t\t\tclientId={ selectedBlockClientId }\n\t\t\t\tblockName={ blockType.name }\n\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t/>\n\t\t</BlockInspectorSingleBlockWrapper>\n\t);\n};\n\nconst BlockInspectorSingleBlockWrapper = ( { animate, wrapper, children } ) => {\n\treturn animate ? wrapper( children ) : children;\n};\n\nconst AnimatedContainer = ( {\n\tblockInspectorAnimationSettings,\n\tselectedBlockClientId,\n\tchildren,\n} ) => {\n\tconst animationOrigin =\n\t\tblockInspectorAnimationSettings &&\n\t\tblockInspectorAnimationSettings.enterDirection === 'leftToRight'\n\t\t\t? -50\n\t\t\t: 50;\n\n\treturn (\n\t\t<motion.div\n\t\t\tanimate={ {\n\t\t\t\tx: 0,\n\t\t\t\topacity: 1,\n\t\t\t\ttransition: {\n\t\t\t\t\tease: 'easeInOut',\n\t\t\t\t\tduration: 0.14,\n\t\t\t\t},\n\t\t\t} }\n\t\t\tinitial={ {\n\t\t\t\tx: animationOrigin,\n\t\t\t\topacity: 0,\n\t\t\t} }\n\t\t\tkey={ selectedBlockClientId }\n\t\t>\n\t\t\t{ children }\n\t\t</motion.div>\n\t);\n};\n\nconst BlockInspectorSingleBlock = ( {\n\tclientId,\n\tblockName,\n\tisSectionBlock,\n} ) => {\n\tconst availableTabs = useInspectorControlsTabs( blockName );\n\tconst showTabs = ! isSectionBlock && availableTabs?.length > 1;\n\n\tconst hasBlockStyles = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\tconst blockStyles = getBlockStyles( blockName );\n\t\t\treturn blockStyles && blockStyles.length > 0;\n\t\t},\n\t\t[ blockName ]\n\t);\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\tconst contentClientIds = useSelect(\n\t\t( select ) => {\n\t\t\t// Avoid unnecessary subscription.\n\t\t\tif ( ! isSectionBlock ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\treturn getClientIdsOfDescendants( clientId ).filter(\n\t\t\t\t( current ) =>\n\t\t\t\t\tgetBlockName( current ) !== 'core/list-item' &&\n\t\t\t\t\tgetBlockEditingMode( current ) === 'contentOnly'\n\t\t\t);\n\t\t},\n\t\t[ isSectionBlock, clientId ]\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t<BlockCard\n\t\t\t\t{ ...blockInformation }\n\t\t\t\tclassName={ blockInformation.isSynced && 'is-synced' }\n\t\t\t/>\n\t\t\t<BlockVariationTransforms blockClientId={ clientId } />\n\t\t\t<BlockInfo.Slot />\n\t\t\t{ showTabs && (\n\t\t\t\t<InspectorControlsTabs\n\t\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\ttabs={ availableTabs }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! showTabs && (\n\t\t\t\t<>\n\t\t\t\t\t{ hasBlockStyles && (\n\t\t\t\t\t\t<BlockStylesPanel clientId={ clientId } />\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ contentClientIds && contentClientIds?.length > 0 && (\n\t\t\t\t\t\t<PanelBody title={ __( 'Content' ) }>\n\t\t\t\t\t\t\t<BlockQuickNavigation\n\t\t\t\t\t\t\t\tclientIds={ contentClientIds }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isSectionBlock && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InspectorControls.Slot />\n\t\t\t\t\t\t\t<InspectorControls.Slot group=\"list\" />\n\t\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\t\tgroup=\"color\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\t\tgroup=\"background\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\t\tgroup=\"typography\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\t\tgroup=\"dimensions\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\t\tgroup=\"border\"\n\t\t\t\t\t\t\t\tlabel={ borderPanelLabel }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t\t\t\t\t\t<PositionControls />\n\t\t\t\t\t\t\t<InspectorControls.Slot group=\"bindings\" />\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<AdvancedControls />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<SkipToSelectedBlock key=\"back\" />\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-inspector/README.md\n */\nexport default BlockInspector;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,oBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,UAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,wBAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,yBAAA,GAAAH,sBAAA,CAAAL,OAAA;AACA,IAAAS,2BAAA,GAAAJ,sBAAA,CAAAL,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAN,sBAAA,CAAAL,OAAA;AACA,IAAAY,kBAAA,GAAAP,sBAAA,CAAAL,OAAA;AACA,IAAAa,sBAAA,GAAAR,sBAAA,CAAAL,OAAA;AACA,IAAAc,yBAAA,GAAAT,sBAAA,CAAAL,OAAA;AACA,IAAAe,sBAAA,GAAAV,sBAAA,CAAAL,OAAA;AACA,IAAAgB,sBAAA,GAAAX,sBAAA,CAAAL,OAAA;AACA,IAAAiB,mCAAA,GAAAZ,sBAAA,CAAAL,OAAA;AACA,IAAAkB,kBAAA,GAAAb,sBAAA,CAAAL,OAAA;AACA,IAAAmB,qBAAA,GAAAd,sBAAA,CAAAL,OAAA;AACA,IAAAoB,OAAA,GAAApB,OAAA;AAEA,IAAAqB,WAAA,GAAArB,OAAA;AAA2C,IAAAsB,WAAA,GAAAtB,OAAA;AAhC3C;AACA;AACA;;AAUA;AACA;AACA;;AAoBA,SAASuB,gBAAgBA,CAAE;EAA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AACb,kBAAA,CAAAkB,OAAiB,CAACoC,IAAI;UACtBC,KAAK,EAAC,YAAY;UAClBC,KAAK,EAAG,IAAAxC,QAAE,EAAE,YAAa;QAAG,CAC5B,CAAC,eACF,IAAAN,WAAA,CAAAG,GAAA,EAACb,kBAAA,CAAAkB,OAAiB,CAACoC,IAAI;UACtBC,KAAK,EAAC,YAAY;UAClBC,KAAK,EAAG,IAAAxC,QAAE,EAAE,YAAa;QAAG,CAC5B,CAAC,eACF,IAAAN,WAAA,CAAAG,GAAA,EAACb,kBAAA,CAAAkB,OAAiB,CAACoC,IAAI;UACtBC,KAAK,EAAC,QAAQ;UACdC,KAAK,EAAGT;QAAkB,CAC1B,CAAC,eACF,IAAArC,WAAA,CAAAG,GAAA,EAACb,kBAAA,CAAAkB,OAAiB,CAACoC,IAAI;UAACC,KAAK,EAAC;QAAQ,CAAE,CAAC,eACzC,IAAA7C,WAAA,CAAAG,GAAA,EAACT,sBAAA,CAAAc,OAAgB,IAAE,CAAC,eACpB,IAAAR,WAAA,CAAAG,GAAA,EAACb,kBAAA,CAAAkB,OAAiB,CAACoC,IAAI;UAACC,KAAK,EAAC;QAAU,CAAE,CAAC,eAC3C,IAAA7C,WAAA,CAAAG,GAAA;UAAAI,QAAA,eACC,IAAAP,WAAA,CAAAG,GAAA,EAACV,sBAAA,CAAAe,OAAgB,IAAE;QAAC,CAChB,CAAC;MAAA,CACL,CACF;IAAA,CACA,CACF,eACD,IAAAR,WAAA,CAAAG,GAAA,EAACrB,oBAAA,CAAA0B,OAAmB,MAAK,MAAQ,CAAC;EAAA,CAC9B,CAAC;AAER,CAAC;;AAED;AACA;AACA;AAFA,IAAAsE,QAAA,GAAAC,OAAA,CAAAvE,OAAA,GAGeC,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_blocks","_components","_data","_skipToSelectedBlock","_interopRequireDefault","_blockCard","_multiSelectionInspector","_blockVariationTransforms","_useBlockDisplayInformation","_store","_blockStyles","_inspectorControls","_inspectorControlsTabs","_useInspectorControlsTabs","_advancedControlsPanel","_positionControlsPanel","_useBlockInspectorAnimationSettings","_blockQuickNavigation","_border","_lockUnlock","_jsxRuntime","BlockStylesPanel","clientId","jsx","PanelBody","title","__","children","default","BlockInspector","showNoBlockSelectedMessage","count","selectedBlockName","selectedBlockClientId","blockType","isSectionBlock","useSelect","select","getSelectedBlockClientId","getSelectedBlockCount","getBlockName","getParentSectionBlock","_isSectionBlock","unlock","blockEditorStore","_selectedBlockClientId","renderedBlockClientId","_selectedBlockName","_blockType","getBlockType","availableTabs","useInspectorControlsTabs","name","showTabs","length","blockInspectorAnimationSettings","useBlockInspectorAnimationSettings","borderPanelLabel","useBorderPanelLabel","blockName","jsxs","className","tabs","Fragment","Slot","group","label","isSelectedBlockUnregistered","getUnregisteredTypeHandlerName","BlockInspectorSingleBlockWrapper","animate","wrapper","AnimatedContainer","BlockInspectorSingleBlock","animationOrigin","enterDirection","__unstableMotion","div","x","opacity","transition","ease","duration","initial","hasBlockStyles","getBlockStyles","blocksStore","blockStyles","blockInformation","useBlockDisplayInformation","contentClientIds","getClientIdsOfDescendants","getBlockEditingMode","filter","current","isSynced","blockClientId","clientIds","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-inspector/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetBlockType,\n\tgetUnregisteredTypeHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { PanelBody, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SkipToSelectedBlock from '../skip-to-selected-block';\nimport BlockCard from '../block-card';\nimport MultiSelectionInspector from '../multi-selection-inspector';\nimport BlockVariationTransforms from '../block-variation-transforms';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { store as blockEditorStore } from '../../store';\nimport BlockStyles from '../block-styles';\nimport { default as InspectorControls } from '../inspector-controls';\nimport { default as InspectorControlsTabs } from '../inspector-controls-tabs';\nimport useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-controls-tabs';\nimport AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';\nimport PositionControls from '../inspector-controls-tabs/position-controls-panel';\nimport useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';\nimport BlockQuickNavigation from '../block-quick-navigation';\nimport { useBorderPanelLabel } from '../../hooks/border';\n\nimport { unlock } from '../../lock-unlock';\n\nfunction BlockStylesPanel( { clientId } ) {\n\treturn (\n\t\t<PanelBody title={ __( 'Styles' ) }>\n\t\t\t<BlockStyles clientId={ clientId } />\n\t\t</PanelBody>\n\t);\n}\n\nconst BlockInspector = ( { showNoBlockSelectedMessage = true } ) => {\n\tconst {\n\t\tcount,\n\t\tselectedBlockName,\n\t\tselectedBlockClientId,\n\t\tblockType,\n\t\tisSectionBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetSelectedBlockCount,\n\t\t\tgetBlockName,\n\t\t\tgetParentSectionBlock,\n\t\t\tisSectionBlock: _isSectionBlock,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst _selectedBlockClientId = getSelectedBlockClientId();\n\t\tconst renderedBlockClientId =\n\t\t\tgetParentSectionBlock( _selectedBlockClientId ) ||\n\t\t\tgetSelectedBlockClientId();\n\t\tconst _selectedBlockName =\n\t\t\trenderedBlockClientId && getBlockName( renderedBlockClientId );\n\t\tconst _blockType =\n\t\t\t_selectedBlockName && getBlockType( _selectedBlockName );\n\n\t\treturn {\n\t\t\tcount: getSelectedBlockCount(),\n\t\t\tselectedBlockClientId: renderedBlockClientId,\n\t\t\tselectedBlockName: _selectedBlockName,\n\t\t\tblockType: _blockType,\n\t\t\tisSectionBlock: _isSectionBlock( renderedBlockClientId ),\n\t\t};\n\t}, [] );\n\n\tconst availableTabs = useInspectorControlsTabs( blockType?.name );\n\tconst showTabs = availableTabs?.length > 1;\n\n\t// The block inspector animation settings will be completely\n\t// removed in the future to create an API which allows the block\n\t// inspector to transition between what it\n\t// displays based on the relationship between the selected block\n\t// and its parent, and only enable it if the parent is controlling\n\t// its children blocks.\n\tconst blockInspectorAnimationSettings =\n\t\tuseBlockInspectorAnimationSettings( blockType );\n\n\tconst borderPanelLabel = useBorderPanelLabel( {\n\t\tblockName: selectedBlockName,\n\t} );\n\n\tif ( count > 1 && ! isSectionBlock ) {\n\t\treturn (\n\t\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t\t<MultiSelectionInspector />\n\t\t\t\t{ showTabs ? (\n\t\t\t\t\t<InspectorControlsTabs tabs={ availableTabs } />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorControls.Slot />\n\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\tgroup=\"color\"\n\t\t\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\tgroup=\"background\"\n\t\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\tgroup=\"typography\"\n\t\t\t\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\tgroup=\"dimensions\"\n\t\t\t\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\tgroup=\"border\"\n\t\t\t\t\t\t\tlabel={ borderPanelLabel }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst isSelectedBlockUnregistered =\n\t\tselectedBlockName === getUnregisteredTypeHandlerName();\n\n\t/*\n\t * If the selected block is of an unregistered type, avoid showing it as an actual selection\n\t * because we want the user to focus on the unregistered block warning, not block settings.\n\t */\n\tif (\n\t\t! blockType ||\n\t\t! selectedBlockClientId ||\n\t\tisSelectedBlockUnregistered\n\t) {\n\t\tif ( showNoBlockSelectedMessage ) {\n\t\t\treturn (\n\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t</span>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockInspectorSingleBlockWrapper\n\t\t\tanimate={ blockInspectorAnimationSettings }\n\t\t\twrapper={ ( children ) => (\n\t\t\t\t<AnimatedContainer\n\t\t\t\t\tblockInspectorAnimationSettings={\n\t\t\t\t\t\tblockInspectorAnimationSettings\n\t\t\t\t\t}\n\t\t\t\t\tselectedBlockClientId={ selectedBlockClientId }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</AnimatedContainer>\n\t\t\t) }\n\t\t>\n\t\t\t<BlockInspectorSingleBlock\n\t\t\t\tclientId={ selectedBlockClientId }\n\t\t\t\tblockName={ blockType.name }\n\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t/>\n\t\t</BlockInspectorSingleBlockWrapper>\n\t);\n};\n\nconst BlockInspectorSingleBlockWrapper = ( { animate, wrapper, children } ) => {\n\treturn animate ? wrapper( children ) : children;\n};\n\nconst AnimatedContainer = ( {\n\tblockInspectorAnimationSettings,\n\tselectedBlockClientId,\n\tchildren,\n} ) => {\n\tconst animationOrigin =\n\t\tblockInspectorAnimationSettings &&\n\t\tblockInspectorAnimationSettings.enterDirection === 'leftToRight'\n\t\t\t? -50\n\t\t\t: 50;\n\n\treturn (\n\t\t<motion.div\n\t\t\tanimate={ {\n\t\t\t\tx: 0,\n\t\t\t\topacity: 1,\n\t\t\t\ttransition: {\n\t\t\t\t\tease: 'easeInOut',\n\t\t\t\t\tduration: 0.14,\n\t\t\t\t},\n\t\t\t} }\n\t\t\tinitial={ {\n\t\t\t\tx: animationOrigin,\n\t\t\t\topacity: 0,\n\t\t\t} }\n\t\t\tkey={ selectedBlockClientId }\n\t\t>\n\t\t\t{ children }\n\t\t</motion.div>\n\t);\n};\n\nconst BlockInspectorSingleBlock = ( {\n\tclientId,\n\tblockName,\n\tisSectionBlock,\n} ) => {\n\tconst availableTabs = useInspectorControlsTabs( blockName );\n\tconst showTabs = ! isSectionBlock && availableTabs?.length > 1;\n\n\tconst hasBlockStyles = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\tconst blockStyles = getBlockStyles( blockName );\n\t\t\treturn blockStyles && blockStyles.length > 0;\n\t\t},\n\t\t[ blockName ]\n\t);\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\tconst contentClientIds = useSelect(\n\t\t( select ) => {\n\t\t\t// Avoid unnecessary subscription.\n\t\t\tif ( ! isSectionBlock ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\treturn getClientIdsOfDescendants( clientId ).filter(\n\t\t\t\t( current ) =>\n\t\t\t\t\tgetBlockName( current ) !== 'core/list-item' &&\n\t\t\t\t\tgetBlockEditingMode( current ) === 'contentOnly'\n\t\t\t);\n\t\t},\n\t\t[ isSectionBlock, clientId ]\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t<BlockCard\n\t\t\t\t{ ...blockInformation }\n\t\t\t\tclassName={ blockInformation.isSynced && 'is-synced' }\n\t\t\t/>\n\t\t\t<BlockVariationTransforms blockClientId={ clientId } />\n\t\t\t{ showTabs && (\n\t\t\t\t<InspectorControlsTabs\n\t\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\ttabs={ availableTabs }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! showTabs && (\n\t\t\t\t<>\n\t\t\t\t\t{ hasBlockStyles && (\n\t\t\t\t\t\t<BlockStylesPanel clientId={ clientId } />\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ contentClientIds && contentClientIds?.length > 0 && (\n\t\t\t\t\t\t<PanelBody title={ __( 'Content' ) }>\n\t\t\t\t\t\t\t<BlockQuickNavigation\n\t\t\t\t\t\t\t\tclientIds={ contentClientIds }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isSectionBlock && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InspectorControls.Slot />\n\t\t\t\t\t\t\t<InspectorControls.Slot group=\"list\" />\n\t\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\t\tgroup=\"color\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\t\tgroup=\"background\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\t\tgroup=\"typography\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\t\tgroup=\"dimensions\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\t\t\tgroup=\"border\"\n\t\t\t\t\t\t\t\tlabel={ borderPanelLabel }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t\t\t\t\t\t<PositionControls />\n\t\t\t\t\t\t\t<InspectorControls.Slot group=\"bindings\" />\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<AdvancedControls />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<SkipToSelectedBlock key=\"back\" />\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-inspector/README.md\n */\nexport default BlockInspector;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,oBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,UAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,wBAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,yBAAA,GAAAH,sBAAA,CAAAL,OAAA;AACA,IAAAS,2BAAA,GAAAJ,sBAAA,CAAAL,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAN,sBAAA,CAAAL,OAAA;AACA,IAAAY,kBAAA,GAAAP,sBAAA,CAAAL,OAAA;AACA,IAAAa,sBAAA,GAAAR,sBAAA,CAAAL,OAAA;AACA,IAAAc,yBAAA,GAAAT,sBAAA,CAAAL,OAAA;AACA,IAAAe,sBAAA,GAAAV,sBAAA,CAAAL,OAAA;AACA,IAAAgB,sBAAA,GAAAX,sBAAA,CAAAL,OAAA;AACA,IAAAiB,mCAAA,GAAAZ,sBAAA,CAAAL,OAAA;AACA,IAAAkB,qBAAA,GAAAb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 +24,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
// Entity based blocks which allow edit locking
|
|
27
|
-
const ALLOWS_EDIT_LOCKING = ['core/
|
|
27
|
+
const ALLOWS_EDIT_LOCKING = ['core/navigation'];
|
|
28
28
|
function getTemplateLockValue(lock) {
|
|
29
29
|
// Prevents all operations.
|
|
30
30
|
if (lock.remove && lock.move) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_components","_icons","_data","_blocks","_useBlockLock","_interopRequireDefault","_useBlockDisplayInformation","_store","_jsxRuntime","ALLOWS_EDIT_LOCKING","getTemplateLockValue","lock","remove","move","BlockLockModal","clientId","onClose","setLock","useState","canEdit","canMove","canRemove","useBlockLock","allowsEditLocking","templateLock","hasTemplateLock","useSelect","select","getBlockName","getBlockAttributes","blockEditorStore","blockName","blockType","getBlockType","includes","attributes","applyTemplateLock","setApplyTemplateLock","updateBlockAttributes","useDispatch","blockInformation","useBlockDisplayInformation","useEffect","edit","isAllChecked","Object","values","every","Boolean","isMixed","some","jsx","Modal","title","sprintf","__","overlayClassName","onRequestClose","children","jsxs","onSubmit","event","preventDefault","undefined","className","role","CheckboxControl","__nextHasNoMarginBottom","label","checked","indeterminate","onChange","newValue","prevLock","Icon","icon","lockIcon","unlockIcon","ToggleControl","disabled","Flex","justify","expanded","FlexItem","Button","variant","onClick","__next40pxDefaultSize","type"],"sources":["@wordpress/block-editor/src/components/block-lock/modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tCheckboxControl,\n\tFlex,\n\tFlexItem,\n\tIcon,\n\tModal,\n\tToggleControl,\n} from '@wordpress/components';\nimport { lock as lockIcon, unlock as unlockIcon } from '@wordpress/icons';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport useBlockLock from './use-block-lock';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { store as blockEditorStore } from '../../store';\n\n// Entity based blocks which allow edit locking\nconst ALLOWS_EDIT_LOCKING = [ 'core/block', 'core/navigation' ];\n\nfunction getTemplateLockValue( lock ) {\n\t// Prevents all operations.\n\tif ( lock.remove && lock.move ) {\n\t\treturn 'all';\n\t}\n\n\t// Prevents inserting or removing blocks, but allows moving existing blocks.\n\tif ( lock.remove && ! lock.move ) {\n\t\treturn 'insert';\n\t}\n\n\treturn false;\n}\n\nexport default function BlockLockModal( { clientId, onClose } ) {\n\tconst [ lock, setLock ] = useState( { move: false, remove: false } );\n\tconst { canEdit, canMove, canRemove } = useBlockLock( clientId );\n\tconst { allowsEditLocking, templateLock, hasTemplateLock } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\n\t\t\treturn {\n\t\t\t\tallowsEditLocking: ALLOWS_EDIT_LOCKING.includes( blockName ),\n\t\t\t\ttemplateLock: getBlockAttributes( clientId )?.templateLock,\n\t\t\t\thasTemplateLock: !! blockType?.attributes?.templateLock,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst [ applyTemplateLock, setApplyTemplateLock ] = useState(\n\t\t!! templateLock\n\t);\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\tuseEffect( () => {\n\t\tsetLock( {\n\t\t\tmove: ! canMove,\n\t\t\tremove: ! canRemove,\n\t\t\t...( allowsEditLocking ? { edit: ! canEdit } : {} ),\n\t\t} );\n\t}, [ canEdit, canMove, canRemove, allowsEditLocking ] );\n\n\tconst isAllChecked = Object.values( lock ).every( Boolean );\n\tconst isMixed = Object.values( lock ).some( Boolean ) && ! isAllChecked;\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ sprintf(\n\t\t\t\t/* translators: %s: Name of the block. */\n\t\t\t\t__( 'Lock %s' ),\n\t\t\t\tblockInformation.title\n\t\t\t) }\n\t\t\toverlayClassName=\"block-editor-block-lock-modal\"\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tupdateBlockAttributes( [ clientId ], {\n\t\t\t\t\t\tlock,\n\t\t\t\t\t\ttemplateLock: applyTemplateLock\n\t\t\t\t\t\t\t? getTemplateLockValue( lock )\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} );\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<fieldset className=\"block-editor-block-lock-modal__options\">\n\t\t\t\t\t<legend>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Choose specific attributes to restrict or lock all available options.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</legend>\n\t\t\t\t\t{ /*\n\t\t\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t\t\t */\n\t\t\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t<ul\n\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__checklist\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__options-all\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Lock all' ) }\n\t\t\t\t\t\t\t\tchecked={ isAllChecked }\n\t\t\t\t\t\t\t\tindeterminate={ isMixed }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\t\t\t\t\tsetLock( {\n\t\t\t\t\t\t\t\t\t\tmove: newValue,\n\t\t\t\t\t\t\t\t\t\tremove: newValue,\n\t\t\t\t\t\t\t\t\t\t...( allowsEditLocking\n\t\t\t\t\t\t\t\t\t\t\t? { edit: newValue }\n\t\t\t\t\t\t\t\t\t\t\t: {} ),\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__checklist\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ allowsEditLocking && (\n\t\t\t\t\t\t\t\t\t<li className=\"block-editor-block-lock-modal__checklist-item\">\n\t\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Restrict editing' ) }\n\t\t\t\t\t\t\t\t\t\t\tchecked={ !! lock.edit }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( edit ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetLock( ( prevLock ) => ( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t...prevLock,\n\t\t\t\t\t\t\t\t\t\t\t\t\tedit,\n\t\t\t\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__lock-icon\"\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tlock.edit\n\t\t\t\t\t\t\t\t\t\t\t\t\t? lockIcon\n\t\t\t\t\t\t\t\t\t\t\t\t\t: unlockIcon\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<li className=\"block-editor-block-lock-modal__checklist-item\">\n\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Disable movement' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ lock.move }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( move ) =>\n\t\t\t\t\t\t\t\t\t\t\tsetLock( ( prevLock ) => ( {\n\t\t\t\t\t\t\t\t\t\t\t\t...prevLock,\n\t\t\t\t\t\t\t\t\t\t\t\tmove,\n\t\t\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__lock-icon\"\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tlock.move ? lockIcon : unlockIcon\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t<li className=\"block-editor-block-lock-modal__checklist-item\">\n\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Prevent removal' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ lock.remove }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( remove ) =>\n\t\t\t\t\t\t\t\t\t\t\tsetLock( ( prevLock ) => ( {\n\t\t\t\t\t\t\t\t\t\t\t\t...prevLock,\n\t\t\t\t\t\t\t\t\t\t\t\tremove,\n\t\t\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__lock-icon\"\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tlock.remove ? lockIcon : unlockIcon\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t{ hasTemplateLock && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__template-lock\"\n\t\t\t\t\t\t\tlabel={ __( 'Apply to all blocks inside' ) }\n\t\t\t\t\t\t\tchecked={ applyTemplateLock }\n\t\t\t\t\t\t\tdisabled={ lock.move && ! lock.remove }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetApplyTemplateLock( ! applyTemplateLock )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</fieldset>\n\t\t\t\t<Flex\n\t\t\t\t\tclassName=\"block-editor-block-lock-modal__actions\"\n\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\texpanded={ false }\n\t\t\t\t>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit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,CAAAgF,IAAI;QACJhB,SAAS,EAAC,wCAAwC;QAClDiB,OAAO,EAAC,UAAU;QAClBC,QAAQ,EAAG,KAAO;QAAAxB,QAAA,gBAElB,IAAAlD,WAAA,CAAA2C,GAAA,EAACnD,WAAA,CAAAmF,QAAQ;UAAAzB,QAAA,eACR,IAAAlD,WAAA,CAAA2C,GAAA,EAACnD,WAAA,CAAAoF,MAAM;YACNC,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAGtE,OAAS;YACnBuE,qBAAqB;YAAA7B,QAAA,EAEnB,IAAAH,QAAE,EAAE,QAAS;UAAC,CACT;QAAC,CACA,CAAC,eACX,IAAA/C,WAAA,CAAA2C,GAAA,EAACnD,WAAA,CAAAmF,QAAQ;UAAAzB,QAAA,eACR,IAAAlD,WAAA,CAAA2C,GAAA,EAACnD,WAAA,CAAAoF,MAAM;YACNC,OAAO,EAAC,SAAS;YACjBG,IAAI,EAAC,QAAQ;YACbD,qBAAqB;YAAA7B,QAAA,EAEnB,IAAAH,QAAE,EAAE,OAAQ;UAAC,CACR;QAAC,CACA,CAAC;MAAA,CACN,CAAC;IAAA,CACF;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_components","_icons","_data","_blocks","_useBlockLock","_interopRequireDefault","_useBlockDisplayInformation","_store","_jsxRuntime","ALLOWS_EDIT_LOCKING","getTemplateLockValue","lock","remove","move","BlockLockModal","clientId","onClose","setLock","useState","canEdit","canMove","canRemove","useBlockLock","allowsEditLocking","templateLock","hasTemplateLock","useSelect","select","getBlockName","getBlockAttributes","blockEditorStore","blockName","blockType","getBlockType","includes","attributes","applyTemplateLock","setApplyTemplateLock","updateBlockAttributes","useDispatch","blockInformation","useBlockDisplayInformation","useEffect","edit","isAllChecked","Object","values","every","Boolean","isMixed","some","jsx","Modal","title","sprintf","__","overlayClassName","onRequestClose","children","jsxs","onSubmit","event","preventDefault","undefined","className","role","CheckboxControl","__nextHasNoMarginBottom","label","checked","indeterminate","onChange","newValue","prevLock","Icon","icon","lockIcon","unlockIcon","ToggleControl","disabled","Flex","justify","expanded","FlexItem","Button","variant","onClick","__next40pxDefaultSize","type"],"sources":["@wordpress/block-editor/src/components/block-lock/modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tCheckboxControl,\n\tFlex,\n\tFlexItem,\n\tIcon,\n\tModal,\n\tToggleControl,\n} from '@wordpress/components';\nimport { lock as lockIcon, unlock as unlockIcon } from '@wordpress/icons';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport useBlockLock from './use-block-lock';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { store as blockEditorStore } from '../../store';\n\n// Entity based blocks which allow edit locking\nconst ALLOWS_EDIT_LOCKING = [ 'core/navigation' ];\n\nfunction getTemplateLockValue( lock ) {\n\t// Prevents all operations.\n\tif ( lock.remove && lock.move ) {\n\t\treturn 'all';\n\t}\n\n\t// Prevents inserting or removing blocks, but allows moving existing blocks.\n\tif ( lock.remove && ! lock.move ) {\n\t\treturn 'insert';\n\t}\n\n\treturn false;\n}\n\nexport default function BlockLockModal( { clientId, onClose } ) {\n\tconst [ lock, setLock ] = useState( { move: false, remove: false } );\n\tconst { canEdit, canMove, canRemove } = useBlockLock( clientId );\n\tconst { allowsEditLocking, templateLock, hasTemplateLock } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\n\t\t\treturn {\n\t\t\t\tallowsEditLocking: ALLOWS_EDIT_LOCKING.includes( blockName ),\n\t\t\t\ttemplateLock: getBlockAttributes( clientId )?.templateLock,\n\t\t\t\thasTemplateLock: !! blockType?.attributes?.templateLock,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst [ applyTemplateLock, setApplyTemplateLock ] = useState(\n\t\t!! templateLock\n\t);\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\tuseEffect( () => {\n\t\tsetLock( {\n\t\t\tmove: ! canMove,\n\t\t\tremove: ! canRemove,\n\t\t\t...( allowsEditLocking ? { edit: ! canEdit } : {} ),\n\t\t} );\n\t}, [ canEdit, canMove, canRemove, allowsEditLocking ] );\n\n\tconst isAllChecked = Object.values( lock ).every( Boolean );\n\tconst isMixed = Object.values( lock ).some( Boolean ) && ! isAllChecked;\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ sprintf(\n\t\t\t\t/* translators: %s: Name of the block. */\n\t\t\t\t__( 'Lock %s' ),\n\t\t\t\tblockInformation.title\n\t\t\t) }\n\t\t\toverlayClassName=\"block-editor-block-lock-modal\"\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tupdateBlockAttributes( [ clientId ], {\n\t\t\t\t\t\tlock,\n\t\t\t\t\t\ttemplateLock: applyTemplateLock\n\t\t\t\t\t\t\t? getTemplateLockValue( lock )\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} );\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<fieldset className=\"block-editor-block-lock-modal__options\">\n\t\t\t\t\t<legend>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Choose specific attributes to restrict or lock all available options.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</legend>\n\t\t\t\t\t{ /*\n\t\t\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t\t\t */\n\t\t\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t<ul\n\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__checklist\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__options-all\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Lock all' ) }\n\t\t\t\t\t\t\t\tchecked={ isAllChecked }\n\t\t\t\t\t\t\t\tindeterminate={ isMixed }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\t\t\t\t\tsetLock( {\n\t\t\t\t\t\t\t\t\t\tmove: newValue,\n\t\t\t\t\t\t\t\t\t\tremove: newValue,\n\t\t\t\t\t\t\t\t\t\t...( allowsEditLocking\n\t\t\t\t\t\t\t\t\t\t\t? { edit: newValue }\n\t\t\t\t\t\t\t\t\t\t\t: {} ),\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__checklist\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ allowsEditLocking && (\n\t\t\t\t\t\t\t\t\t<li className=\"block-editor-block-lock-modal__checklist-item\">\n\t\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Restrict editing' ) }\n\t\t\t\t\t\t\t\t\t\t\tchecked={ !! lock.edit }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( edit ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetLock( ( prevLock ) => ( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t...prevLock,\n\t\t\t\t\t\t\t\t\t\t\t\t\tedit,\n\t\t\t\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__lock-icon\"\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tlock.edit\n\t\t\t\t\t\t\t\t\t\t\t\t\t? lockIcon\n\t\t\t\t\t\t\t\t\t\t\t\t\t: unlockIcon\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<li className=\"block-editor-block-lock-modal__checklist-item\">\n\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Disable movement' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ lock.move }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( move ) =>\n\t\t\t\t\t\t\t\t\t\t\tsetLock( ( prevLock ) => ( {\n\t\t\t\t\t\t\t\t\t\t\t\t...prevLock,\n\t\t\t\t\t\t\t\t\t\t\t\tmove,\n\t\t\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__lock-icon\"\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tlock.move ? lockIcon : unlockIcon\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t<li className=\"block-editor-block-lock-modal__checklist-item\">\n\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Prevent removal' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ lock.remove }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( remove ) =>\n\t\t\t\t\t\t\t\t\t\t\tsetLock( ( prevLock ) => ( {\n\t\t\t\t\t\t\t\t\t\t\t\t...prevLock,\n\t\t\t\t\t\t\t\t\t\t\t\tremove,\n\t\t\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__lock-icon\"\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tlock.remove ? lockIcon : unlockIcon\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t{ hasTemplateLock && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__template-lock\"\n\t\t\t\t\t\t\tlabel={ __( 'Apply to all blocks inside' ) }\n\t\t\t\t\t\t\tchecked={ applyTemplateLock }\n\t\t\t\t\t\t\tdisabled={ lock.move && ! lock.remove }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetApplyTemplateLock( ! applyTemplateLock )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</fieldset>\n\t\t\t\t<Flex\n\t\t\t\t\tclassName=\"block-editor-block-lock-modal__actions\"\n\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\texpanded={ false }\n\t\t\t\t>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,aAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,2BAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAAwD,IAAAU,WAAA,GAAAV,OAAA;AAvBxD;AACA;AACA;;AAgBA;AACA;AACA;;AAKA;AACA,MAAMW,mBAAmB,GAAG,CAAE,iBAAiB,CAAE;AAEjD,SAASC,oBAAoBA,CAAEC,IAAI,EAAG;EACrC;EACA,IAAKA,IAAI,CAACC,MAAM,IAAID,IAAI,CAACE,IAAI,EAAG;IAC/B,OAAO,KAAK;EACb;;EAEA;EACA,IAAKF,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opRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
var _compose = require("@wordpress/compose");
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
var _checklist = _interopRequireDefault(require("./checklist"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
/**
|
|
14
|
+
* WordPress dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
function BlockManagerCategory({
|
|
22
|
+
title,
|
|
23
|
+
blockTypes,
|
|
24
|
+
selectedBlockTypes,
|
|
25
|
+
onChange
|
|
26
|
+
}) {
|
|
27
|
+
const instanceId = (0, _compose.useInstanceId)(BlockManagerCategory);
|
|
28
|
+
const toggleVisible = (0, _element.useCallback)((blockType, nextIsChecked) => {
|
|
29
|
+
if (nextIsChecked) {
|
|
30
|
+
onChange([...selectedBlockTypes, blockType]);
|
|
31
|
+
} else {
|
|
32
|
+
onChange(selectedBlockTypes.filter(({
|
|
33
|
+
name
|
|
34
|
+
}) => name !== blockType.name));
|
|
35
|
+
}
|
|
36
|
+
}, [selectedBlockTypes, onChange]);
|
|
37
|
+
const toggleAllVisible = (0, _element.useCallback)(nextIsChecked => {
|
|
38
|
+
if (nextIsChecked) {
|
|
39
|
+
onChange([...selectedBlockTypes, ...blockTypes.filter(blockType => !selectedBlockTypes.find(({
|
|
40
|
+
name
|
|
41
|
+
}) => name === blockType.name))]);
|
|
42
|
+
} else {
|
|
43
|
+
onChange(selectedBlockTypes.filter(selectedBlockType => !blockTypes.find(({
|
|
44
|
+
name
|
|
45
|
+
}) => name === selectedBlockType.name)));
|
|
46
|
+
}
|
|
47
|
+
}, [blockTypes, selectedBlockTypes, onChange]);
|
|
48
|
+
if (!blockTypes.length) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const checkedBlockNames = blockTypes.map(({
|
|
52
|
+
name
|
|
53
|
+
}) => name).filter(type => (selectedBlockTypes !== null && selectedBlockTypes !== void 0 ? selectedBlockTypes : []).some(selectedBlockType => selectedBlockType.name === type));
|
|
54
|
+
const titleId = 'block-editor-block-manager__category-title-' + instanceId;
|
|
55
|
+
const isAllChecked = checkedBlockNames.length === blockTypes.length;
|
|
56
|
+
const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0;
|
|
57
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
58
|
+
role: "group",
|
|
59
|
+
"aria-labelledby": titleId,
|
|
60
|
+
className: "block-editor-block-manager__category",
|
|
61
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
|
|
62
|
+
__nextHasNoMarginBottom: true,
|
|
63
|
+
checked: isAllChecked,
|
|
64
|
+
onChange: toggleAllVisible,
|
|
65
|
+
className: "block-editor-block-manager__category-title",
|
|
66
|
+
indeterminate: isIndeterminate,
|
|
67
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
68
|
+
id: titleId,
|
|
69
|
+
children: title
|
|
70
|
+
})
|
|
71
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_checklist.default, {
|
|
72
|
+
blockTypes: blockTypes,
|
|
73
|
+
value: checkedBlockNames,
|
|
74
|
+
onItemChange: toggleVisible
|
|
75
|
+
})]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
var _default = exports.default = BlockManagerCategory;
|
|
79
|
+
//# sourceMappingURL=category.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_element","require","_compose","_components","_checklist","_interopRequireDefault","_jsxRuntime","BlockManagerCategory","title","blockTypes","selectedBlockTypes","onChange","instanceId","useInstanceId","toggleVisible","useCallback","blockType","nextIsChecked","filter","name","toggleAllVisible","find","selectedBlockType","length","checkedBlockNames","map","type","some","titleId","isAllChecked","isIndeterminate","jsxs","role","className","children","jsx","CheckboxControl","__nextHasNoMarginBottom","checked","indeterminate","label","id","default","value","onItemChange","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-manager/category.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\n\nfunction BlockManagerCategory( {\n\ttitle,\n\tblockTypes,\n\tselectedBlockTypes,\n\tonChange,\n} ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\n\tconst toggleVisible = useCallback(\n\t\t( blockType, nextIsChecked ) => {\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tonChange( [ ...selectedBlockTypes, blockType ] );\n\t\t\t} else {\n\t\t\t\tonChange(\n\t\t\t\t\tselectedBlockTypes.filter(\n\t\t\t\t\t\t( { name } ) => name !== blockType.name\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ selectedBlockTypes, onChange ]\n\t);\n\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tonChange( [\n\t\t\t\t\t...selectedBlockTypes,\n\t\t\t\t\t...blockTypes.filter(\n\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t! selectedBlockTypes.find(\n\t\t\t\t\t\t\t\t( { name } ) => name === blockType.name\n\t\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t] );\n\t\t\t} else {\n\t\t\t\tonChange(\n\t\t\t\t\tselectedBlockTypes.filter(\n\t\t\t\t\t\t( selectedBlockType ) =>\n\t\t\t\t\t\t\t! blockTypes.find(\n\t\t\t\t\t\t\t\t( { name } ) => name === selectedBlockType.name\n\t\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ blockTypes, selectedBlockTypes, onChange ]\n\t);\n\n\tif ( ! blockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = blockTypes\n\t\t.map( ( { name } ) => name )\n\t\t.filter( ( type ) =>\n\t\t\t( selectedBlockTypes ?? [] ).some(\n\t\t\t\t( selectedBlockType ) => selectedBlockType.name === type\n\t\t\t)\n\t\t);\n\n\tconst titleId = 'block-editor-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === blockTypes.length;\n\tconst isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"block-editor-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"block-editor-block-manager__category-title\"\n\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ blockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAA8C,IAAAK,WAAA,GAAAL,OAAA;AAV9C;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASM,oBAAoBA,CAAE;EAC9BC,KAAK;EACLC,UAAU;EACVC,kBAAkB;EAClBC;AACD,CAAC,EAAG;EACH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cAAlBA,kBAAkB,GAAI,EAAE,EAAGiB,IAAI,CAC9BL,iBAAiB,IAAMA,iBAAiB,CAACH,IAAI,KAAKO,IACrD,CACD,CAAC;EAEF,MAAME,OAAO,GAAG,6CAA6C,GAAGhB,UAAU;EAE1E,MAAMiB,YAAY,GAAGL,iBAAiB,CAACD,MAAM,KAAKd,UAAU,CAACc,MAAM;EACnE,MAAMO,eAAe,GAAG,CAAED,YAAY,IAAIL,iBAAiB,CAACD,MAAM,GAAG,CAAC;EAEtE,oBACC,IAAAjB,WAAA,CAAAyB,IAAA;IACCC,IAAI,EAAC,OAAO;IACZ,mBAAkBJ,OAAS;IAC3BK,SAAS,EAAC,sCAAsC;IAAAC,QAAA,gBAEhD,IAAA5B,WAAA,CAAA6B,GAAA,EAAChC,WAAA,CAAAiC,eAAe;MACfC,uBAAuB;MACvBC,OAAO,EAAGT,YAAc;MACxBlB,QAAQ,EAAGS,gBAAkB;MAC7Ba,SAAS,EAAC,4CAA4C;MACtDM,aAAa,EAAGT,eAAiB;MACjCU,KAAK,eAAG,IAAAlC,WAAA,CAAA6B,GAAA;QAAMM,EAAE,EAAGb,OAAS;QAAAM,QAAA,EAAG1B;MAAK,CAAQ;IAAG,CAC/C,CAAC,eACF,IAAAF,WAAA,CAAA6B,GAAA,EAAC/B,UAAA,CAAAsC,OAAmB;MACnBjC,UAAU,EAAGA,UAAY;MACzBkC,KAAK,EAAGnB,iBAAmB;MAC3BoB,YAAY,EAAG9B;IAAe,CAC9B,CAAC;EAAA,CACE,CAAC;AAER;AAAC,IAAA+B,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEcnC,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _components = require("@wordpress/components");
|
|
9
|
+
var _blockIcon = _interopRequireDefault(require("../block-icon"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
function BlockTypesChecklist({
|
|
20
|
+
blockTypes,
|
|
21
|
+
value,
|
|
22
|
+
onItemChange
|
|
23
|
+
}) {
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
25
|
+
className: "block-editor-block-manager__checklist",
|
|
26
|
+
children: blockTypes.map(blockType => /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
27
|
+
className: "block-editor-block-manager__checklist-item",
|
|
28
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
|
|
29
|
+
__nextHasNoMarginBottom: true,
|
|
30
|
+
label: blockType.title,
|
|
31
|
+
checked: value.includes(blockType.name),
|
|
32
|
+
onChange: (...args) => onItemChange(blockType, ...args)
|
|
33
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockIcon.default, {
|
|
34
|
+
icon: blockType.icon
|
|
35
|
+
})]
|
|
36
|
+
}, blockType.name))
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
var _default = exports.default = BlockTypesChecklist;
|
|
40
|
+
//# sourceMappingURL=checklist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_components","require","_blockIcon","_interopRequireDefault","_jsxRuntime","BlockTypesChecklist","blockTypes","value","onItemChange","jsx","className","children","map","blockType","jsxs","CheckboxControl","__nextHasNoMarginBottom","label","title","checked","includes","name","onChange","args","default","icon","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-manager/checklist.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CheckboxControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\n\nfunction BlockTypesChecklist( { blockTypes, value, onItemChange } ) {\n\treturn (\n\t\t<ul className=\"block-editor-block-manager__checklist\">\n\t\t\t{ blockTypes.map( ( blockType ) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={ blockType.name }\n\t\t\t\t\tclassName=\"block-editor-block-manager__checklist-item\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ blockType.title }\n\t\t\t\t\t\tchecked={ value.includes( blockType.name ) }\n\t\t\t\t\t\tonChange={ ( ...args ) =>\n\t\t\t\t\t\t\tonItemChange( blockType, ...args )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockIcon icon={ blockType.icon } />\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n\nexport default BlockTypesChecklist;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAsC,IAAAG,WAAA,GAAAH,OAAA;AARtC;AACA;AACA;;AAGA;AACA;AACA;;AAGA,SAASI,mBAAmBA,CAAE;EAAEC,UAAU;EAAEC,KAAK;EAAEC;AAAa,CAAC,EAAG;EACnE,oBACC,IAAAJ,WAAA,CAAAK,GAAA;IAAIC,SAAS,EAAC,uCAAuC;IAAAC,QAAA,EAClDL,UAAU,CAACM,GAAG,CAAIC,SAAS,iBAC5B,IAAAT,WAAA,CAAAU,IAAA;MAECJ,SAAS,EAAC,4CAA4C;MAAAC,QAAA,gBAEtD,IAAAP,WAAA,CAAAK,GAAA,EAACT,WAAA,CAAAe,eAAe;QACfC,uBAAuB;QACvBC,KAAK,EAAGJ,SAAS,CAACK,KAAO;QACzBC,OAAO,EAAGZ,KAAK,CAACa,QAAQ,CAAEP,SAAS,CAACQ,IAAK,CAAG;QAC5CC,QAAQ,EAAGA,CAAE,GAAGC,IAAI,KACnBf,YAAY,CAAEK,SAAS,EAAE,GAAGU,IAAK;MACjC,CACD,CAAC,eACF,IAAAnB,WAAA,CAAAK,GAAA,EAACP,UAAA,CAAAsB,OAAS;QAACC,IAAI,EAAGZ,SAAS,CAACY;MAAM,CAAE,CAAC;IAAA,GAX/BZ,SAAS,CAACQ,IAYb,CACH;EAAC,CACA,CAAC;AAEP;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEcnB,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = BlockManager;
|
|
8
|
+
var _blocks = require("@wordpress/blocks");
|
|
9
|
+
var _data = require("@wordpress/data");
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
var _i18n = require("@wordpress/i18n");
|
|
12
|
+
var _element = require("@wordpress/element");
|
|
13
|
+
var _compose = require("@wordpress/compose");
|
|
14
|
+
var _a11y = require("@wordpress/a11y");
|
|
15
|
+
var _category = _interopRequireDefault(require("./category"));
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
/**
|
|
18
|
+
* WordPress dependencies
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Internal dependencies
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Provides a list of blocks with checkboxes.
|
|
27
|
+
*
|
|
28
|
+
* @param {Object} props Props.
|
|
29
|
+
* @param {Array} props.blockTypes An array of blocks.
|
|
30
|
+
* @param {Array} props.selectedBlockTypes An array of selected blocks.
|
|
31
|
+
* @param {Function} props.onChange Function to be called when the selected blocks change.
|
|
32
|
+
*/function BlockManager({
|
|
33
|
+
blockTypes,
|
|
34
|
+
selectedBlockTypes,
|
|
35
|
+
onChange
|
|
36
|
+
}) {
|
|
37
|
+
const debouncedSpeak = (0, _compose.useDebounce)(_a11y.speak, 500);
|
|
38
|
+
const [search, setSearch] = (0, _element.useState)('');
|
|
39
|
+
const {
|
|
40
|
+
categories,
|
|
41
|
+
isMatchingSearchTerm
|
|
42
|
+
} = (0, _data.useSelect)(select => {
|
|
43
|
+
return {
|
|
44
|
+
categories: select(_blocks.store).getCategories(),
|
|
45
|
+
isMatchingSearchTerm: select(_blocks.store).isMatchingSearchTerm
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
48
|
+
function enableAllBlockTypes() {
|
|
49
|
+
onChange(blockTypes);
|
|
50
|
+
}
|
|
51
|
+
const filteredBlockTypes = blockTypes.filter(blockType => {
|
|
52
|
+
return !search || isMatchingSearchTerm(blockType, search);
|
|
53
|
+
});
|
|
54
|
+
const numberOfHiddenBlocks = blockTypes.length - selectedBlockTypes.length;
|
|
55
|
+
|
|
56
|
+
// Announce search results on change
|
|
57
|
+
(0, _element.useEffect)(() => {
|
|
58
|
+
if (!search) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const count = filteredBlockTypes.length;
|
|
62
|
+
const resultsFoundMessage = (0, _i18n.sprintf)(/* translators: %d: number of results. */
|
|
63
|
+
(0, _i18n._n)('%d result found.', '%d results found.', count), count);
|
|
64
|
+
debouncedSpeak(resultsFoundMessage);
|
|
65
|
+
}, [filteredBlockTypes?.length, search, debouncedSpeak]);
|
|
66
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
67
|
+
className: "block-editor-block-manager__content",
|
|
68
|
+
children: [!!numberOfHiddenBlocks && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
69
|
+
className: "block-editor-block-manager__disabled-blocks-count",
|
|
70
|
+
children: [(0, _i18n.sprintf)(/* translators: %d: number of blocks. */
|
|
71
|
+
(0, _i18n._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
72
|
+
__next40pxDefaultSize: true,
|
|
73
|
+
variant: "link",
|
|
74
|
+
onClick: enableAllBlockTypes,
|
|
75
|
+
children: (0, _i18n.__)('Reset')
|
|
76
|
+
})]
|
|
77
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SearchControl, {
|
|
78
|
+
__nextHasNoMarginBottom: true,
|
|
79
|
+
label: (0, _i18n.__)('Search for a block'),
|
|
80
|
+
placeholder: (0, _i18n.__)('Search for a block'),
|
|
81
|
+
value: search,
|
|
82
|
+
onChange: nextSearch => setSearch(nextSearch),
|
|
83
|
+
className: "block-editor-block-manager__search"
|
|
84
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
85
|
+
tabIndex: "0",
|
|
86
|
+
role: "region",
|
|
87
|
+
"aria-label": (0, _i18n.__)('Available block types'),
|
|
88
|
+
className: "block-editor-block-manager__results",
|
|
89
|
+
children: [filteredBlockTypes.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
90
|
+
className: "block-editor-block-manager__no-results",
|
|
91
|
+
children: (0, _i18n.__)('No blocks found.')
|
|
92
|
+
}), categories.map(category => /*#__PURE__*/(0, _jsxRuntime.jsx)(_category.default, {
|
|
93
|
+
title: category.title,
|
|
94
|
+
blockTypes: filteredBlockTypes.filter(blockType => blockType.category === category.slug),
|
|
95
|
+
selectedBlockTypes: selectedBlockTypes,
|
|
96
|
+
onChange: onChange
|
|
97
|
+
}, category.slug)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_category.default, {
|
|
98
|
+
title: (0, _i18n.__)('Uncategorized'),
|
|
99
|
+
blockTypes: filteredBlockTypes.filter(({
|
|
100
|
+
category
|
|
101
|
+
}) => !category),
|
|
102
|
+
selectedBlockTypes: selectedBlockTypes,
|
|
103
|
+
onChange: onChange
|
|
104
|
+
})]
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_blocks","require","_data","_components","_i18n","_element","_compose","_a11y","_category","_interopRequireDefault","_jsxRuntime","BlockManager","blockTypes","selectedBlockTypes","onChange","debouncedSpeak","useDebounce","speak","search","setSearch","useState","categories","isMatchingSearchTerm","useSelect","select","blocksStore","getCategories","enableAllBlockTypes","filteredBlockTypes","filter","blockType","numberOfHiddenBlocks","length","useEffect","count","resultsFoundMessage","sprintf","_n","jsxs","className","children","jsx","Button","__next40pxDefaultSize","variant","onClick","__","SearchControl","__nextHasNoMarginBottom","label","placeholder","value","nextSearch","tabIndex","role","map","category","default","title","slug"],"sources":["@wordpress/block-editor/src/components/block-manager/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { SearchControl, Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockManagerCategory from './category';\n\n/**\n * Provides a list of blocks with checkboxes.\n *\n * @param {Object} props Props.\n * @param {Array} props.blockTypes An array of blocks.\n * @param {Array} props.selectedBlockTypes An array of selected blocks.\n * @param {Function} props.onChange Function to be called when the selected blocks change.\n */\nexport default function BlockManager( {\n\tblockTypes,\n\tselectedBlockTypes,\n\tonChange,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\tconst { categories, isMatchingSearchTerm } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tcategories: select( blocksStore ).getCategories(),\n\t\t\tisMatchingSearchTerm: select( blocksStore ).isMatchingSearchTerm,\n\t\t};\n\t}, [] );\n\n\tfunction enableAllBlockTypes() {\n\t\tonChange( blockTypes );\n\t}\n\n\tconst filteredBlockTypes = blockTypes.filter( ( blockType ) => {\n\t\treturn ! search || isMatchingSearchTerm( blockType, search );\n\t} );\n\n\tconst numberOfHiddenBlocks = blockTypes.length - selectedBlockTypes.length;\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ filteredBlockTypes?.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"block-editor-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"block-editor-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ enableAllBlockTypes }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"block-editor-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"block-editor-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ filteredBlockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"block-editor-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ filteredBlockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tselectedBlockTypes={ selectedBlockTypes }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ filteredBlockTypes.filter(\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t\tselectedBlockTypes={ selectedBlockTypes }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,SAAA,GAAAC,sBAAA,CAAAR,OAAA;AAA8C,IAAAS,WAAA,GAAAT,O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