@wordpress/block-editor 14.7.0 → 14.7.1-next.082ed6819.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/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 +7 -2
- 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 +140 -23
- package/build/components/iframe/index.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 +7 -2
- 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 +141 -24
- package/build-module/components/iframe/index.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 +23 -9
- package/build-style/content.css +23 -9
- package/build-style/style-rtl.css +78 -0
- package/build-style/style.css +78 -0
- package/package.json +31 -31
- 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 +6 -0
- package/src/components/block-toolbar/switch-section-style.js +115 -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/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 +16 -3
- package/src/components/iframe/index.js +187 -44
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_blocks","_data","_draggableChip","_interopRequireDefault","_utils","_store","_lockUnlock","_jsxRuntime","InserterDraggableBlocks","isEnabled","blocks","icon","children","pattern","transferData","type","
|
|
1
|
+
{"version":3,"names":["_components","require","_blocks","_data","_draggableChip","_interopRequireDefault","_utils","_store","_lockUnlock","_jsxRuntime","InserterDraggableBlocks","isEnabled","blocks","icon","children","pattern","transferData","type","blocksContainMedia","filter","block","name","attributes","url","src","length","blockTypeIcon","useSelect","select","getBlockType","blocksStore","startDragging","stopDragging","unlock","useDispatch","blockEditorStore","draggable","onDragStart","undefined","onDragEnd","jsx","Draggable","__experimentalTransferDataType","event","parsedBlocks","INSERTER_PATTERN_TYPES","user","syncStatus","createBlock","ref","id","dataTransfer","setData","serialize","__experimentalDragComponent","default","count","isPattern","onDraggableStart","onDraggableEnd","_default","exports"],"sources":["@wordpress/block-editor/src/components/inserter-draggable-blocks/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Draggable } from '@wordpress/components';\nimport {\n\tcreateBlock,\n\tserialize,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockDraggableChip from '../block-draggable/draggable-chip';\nimport { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst InserterDraggableBlocks = ( {\n\tisEnabled,\n\tblocks,\n\ticon,\n\tchildren,\n\tpattern,\n} ) => {\n\tconst transferData = {\n\t\ttype: 'inserter',\n\t\tblocks,\n\t};\n\n\tconst blocksContainMedia =\n\t\tblocks.filter(\n\t\t\t( block ) =>\n\t\t\t\t( block.name === 'core/image' ||\n\t\t\t\t\tblock.name === 'core/audio' ||\n\t\t\t\t\tblock.name === 'core/video' ) &&\n\t\t\t\t( block.attributes.url || block.attributes.src )\n\t\t).length > 0;\n\n\tconst blockTypeIcon = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockType } = select( blocksStore );\n\t\t\treturn (\n\t\t\t\tblocks.length === 1 && getBlockType( blocks[ 0 ].name )?.icon\n\t\t\t);\n\t\t},\n\t\t[ blocks ]\n\t);\n\n\tconst { startDragging, stopDragging } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tif ( ! isEnabled ) {\n\t\treturn children( {\n\t\t\tdraggable: false,\n\t\t\tonDragStart: undefined,\n\t\t\tonDragEnd: undefined,\n\t\t} );\n\t}\n\n\treturn (\n\t\t<Draggable\n\t\t\t__experimentalTransferDataType=\"wp-blocks\"\n\t\t\ttransferData={ transferData }\n\t\t\tonDragStart={ ( event ) => {\n\t\t\t\tstartDragging();\n\t\t\t\tconst parsedBlocks =\n\t\t\t\t\tpattern?.type === INSERTER_PATTERN_TYPES.user &&\n\t\t\t\t\tpattern?.syncStatus !== 'unsynced'\n\t\t\t\t\t\t? [ createBlock( 'core/block', { ref: pattern.id } ) ]\n\t\t\t\t\t\t: blocks;\n\t\t\t\tevent.dataTransfer.setData(\n\t\t\t\t\tblocksContainMedia ? 'default' : 'text/html',\n\t\t\t\t\tserialize( parsedBlocks )\n\t\t\t\t);\n\t\t\t} }\n\t\t\tonDragEnd={ () => {\n\t\t\t\tstopDragging();\n\t\t\t} }\n\t\t\t__experimentalDragComponent={\n\t\t\t\t<BlockDraggableChip\n\t\t\t\t\tcount={ blocks.length }\n\t\t\t\t\ticon={ icon || ( ! pattern && blockTypeIcon ) }\n\t\t\t\t\tisPattern={ !! pattern }\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t{ ( { onDraggableStart, onDraggableEnd } ) => {\n\t\t\t\treturn children( {\n\t\t\t\t\tdraggable: true,\n\t\t\t\t\tonDragStart: onDraggableStart,\n\t\t\t\t\tonDragEnd: onDraggableEnd,\n\t\t\t\t} );\n\t\t\t} }\n\t\t</Draggable>\n\t);\n};\n\nexport default InserterDraggableBlocks;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,cAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAA2C,IAAAQ,WAAA,GAAAR,OAAA;AAjB3C;AACA;AACA;;AASA;AACA;AACA;;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AAEE,IAAI,KAAK4B,6BAAsB,CAACC,IAAI,IAC7C/B,OAAO,EAAEgC,UAAU,KAAK,UAAU,GAC/B,CAAE,IAAAC,mBAAW,EAAE,YAAY,EAAE;QAAEC,GAAG,EAAElC,OAAO,CAACmC;MAAG,CAAE,CAAC,CAAE,GACpDtC,MAAM;MACV+B,KAAK,CAACQ,YAAY,CAACC,OAAO,CACzBlC,kBAAkB,GAAG,SAAS,GAAG,WAAW,EAC5C,IAAAmC,iBAAS,EAAET,YAAa,CACzB,CAAC;IACF,CAAG;IACHL,SAAS,EAAGA,CAAA,KAAM;MACjBP,YAAY,CAAC,CAAC;IACf,CAAG;IACHsB,2BAA2B,eAC1B,IAAA7C,WAAA,CAAA+B,GAAA,EAACpC,cAAA,CAAAmD,OAAkB;MAClBC,KAAK,EAAG5C,MAAM,CAACa,MAAQ;MACvBZ,IAAI,EAAGA,IAAI,IAAM,CAAEE,OAAO,IAAIW,aAAiB;MAC/C+B,SAAS,EAAG,CAAC,CAAE1C;IAAS,CACxB,CACD;IAAAD,QAAA,EAECA,CAAE;MAAE4C,gBAAgB;MAAEC;IAAe,CAAC,KAAM;MAC7C,OAAO7C,QAAQ,CAAE;QAChBsB,SAAS,EAAE,IAAI;QACfC,WAAW,EAAEqB,gBAAgB;QAC7BnB,SAAS,EAAEoB;MACZ,CAAE,CAAC;IACJ;EAAC,CACS,CAAC;AAEd,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEa7C,uBAAuB","ignoreList":[]}
|
|
@@ -36,25 +36,28 @@ function InspectorControlsSlot({
|
|
|
36
36
|
});
|
|
37
37
|
group = __experimentalGroup;
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
const fills = (0, _components.__experimentalUseSlotFills)(
|
|
39
|
+
const slotFill = _groups.default[group];
|
|
40
|
+
const fills = (0, _components.__experimentalUseSlotFills)(slotFill?.name);
|
|
41
41
|
const motionContextValue = (0, _element.useContext)(_components.__unstableMotionContext);
|
|
42
42
|
const computedFillProps = (0, _element.useMemo)(() => {
|
|
43
43
|
var _fillProps$forwardedC;
|
|
44
44
|
return {
|
|
45
|
-
...
|
|
45
|
+
...fillProps,
|
|
46
46
|
forwardedContext: [...((_fillProps$forwardedC = fillProps?.forwardedContext) !== null && _fillProps$forwardedC !== void 0 ? _fillProps$forwardedC : []), [_components.__unstableMotionContext.Provider, {
|
|
47
47
|
value: motionContextValue
|
|
48
48
|
}]]
|
|
49
49
|
};
|
|
50
50
|
}, [motionContextValue, fillProps]);
|
|
51
|
-
if (!
|
|
51
|
+
if (!slotFill) {
|
|
52
52
|
globalThis.SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
|
|
53
53
|
return null;
|
|
54
54
|
}
|
|
55
55
|
if (!fills?.length) {
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
58
|
+
const {
|
|
59
|
+
Slot
|
|
60
|
+
} = slotFill;
|
|
58
61
|
if (label) {
|
|
59
62
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockSupportToolsPanel.default, {
|
|
60
63
|
group: group,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","_warning","_interopRequireDefault","_deprecated","_blockSupportToolsPanel","_blockSupportSlotContainer","_groups","_jsxRuntime","InspectorControlsSlot","__experimentalGroup","group","label","fillProps","props","deprecated","since","version","alternative","
|
|
1
|
+
{"version":3,"names":["_components","require","_element","_warning","_interopRequireDefault","_deprecated","_blockSupportToolsPanel","_blockSupportSlotContainer","_groups","_jsxRuntime","InspectorControlsSlot","__experimentalGroup","group","label","fillProps","props","deprecated","since","version","alternative","slotFill","groups","fills","useSlotFills","name","motionContextValue","useContext","MotionContext","computedFillProps","useMemo","_fillProps$forwardedC","forwardedContext","Provider","value","globalThis","SCRIPT_DEBUG","warning","length","Slot","jsx","default","children","bubblesVirtually"],"sources":["@wordpress/block-editor/src/components/inspector-controls/slot.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseSlotFills as useSlotFills,\n\t__unstableMotionContext as MotionContext,\n} from '@wordpress/components';\nimport { useContext, useMemo } from '@wordpress/element';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport BlockSupportToolsPanel from './block-support-tools-panel';\nimport BlockSupportSlotContainer from './block-support-slot-container';\nimport groups from './groups';\n\nexport default function InspectorControlsSlot( {\n\t__experimentalGroup,\n\tgroup = 'default',\n\tlabel,\n\tfillProps,\n\t...props\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsSlot`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\tconst slotFill = groups[ group ];\n\tconst fills = useSlotFills( slotFill?.name );\n\n\tconst motionContextValue = useContext( MotionContext );\n\n\tconst computedFillProps = useMemo(\n\t\t() => ( {\n\t\t\t...fillProps,\n\t\t\tforwardedContext: [\n\t\t\t\t...( fillProps?.forwardedContext ?? [] ),\n\t\t\t\t[ MotionContext.Provider, { value: motionContextValue } ],\n\t\t\t],\n\t\t} ),\n\t\t[ motionContextValue, fillProps ]\n\t);\n\n\tif ( ! slotFill ) {\n\t\twarning( `Unknown InspectorControls 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\n\tif ( label ) {\n\t\treturn (\n\t\t\t<BlockSupportToolsPanel group={ group } label={ label }>\n\t\t\t\t<BlockSupportSlotContainer\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tfillProps={ computedFillProps }\n\t\t\t\t\tSlot={ Slot }\n\t\t\t\t/>\n\t\t\t</BlockSupportToolsPanel>\n\t\t);\n\t}\n\n\treturn (\n\t\t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E;IAE3D,CAAC;EAAA,CAAE,EACH,CAAEA,kBAAkB,EAAEX,SAAS,CAChC,CAAC;EAED,IAAK,CAAEM,QAAQ,EAAG;IACjBc,UAAA,CAAAC,YAAA,gBAAAC,gBAAO,EAAE,oCAAqCxB,KAAK,aAAe,CAAC;IACnE,OAAO,IAAI;EACZ;EAEA,IAAK,CAAEU,KAAK,EAAEe,MAAM,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC;EAAK,CAAC,GAAGlB,QAAQ;EAEzB,IAAKP,KAAK,EAAG;IACZ,oBACC,IAAAJ,WAAA,CAAA8B,GAAA,EAACjC,uBAAA,CAAAkC,OAAsB;MAAC5B,KAAK,EAAGA,KAAO;MAACC,KAAK,EAAGA,KAAO;MAAA4B,QAAA,eACtD,IAAAhC,WAAA,CAAA8B,GAAA,EAAChC,0BAAA,CAAAiC,OAAyB;QAAA,GACpBzB,KAAK;QACVD,SAAS,EAAGc,iBAAmB;QAC/BU,IAAI,EAAGA;MAAM,CACb;IAAC,CACqB,CAAC;EAE3B;EAEA,oBACC,IAAA7B,WAAA,CAAA8B,GAAA,EAACD,IAAI;IAAA,GAAMvB,KAAK;IAAGD,SAAS,EAAGc,iBAAmB;IAACc,gBAAgB;EAAA,CAAE,CAAC;AAExE","ignoreList":[]}
|
|
@@ -56,7 +56,7 @@ const PositionControlsPanel = () => {
|
|
|
56
56
|
});
|
|
57
57
|
};
|
|
58
58
|
const PositionControls = () => {
|
|
59
|
-
const fills = (0, _components.__experimentalUseSlotFills)(_groups.default.position.
|
|
59
|
+
const fills = (0, _components.__experimentalUseSlotFills)(_groups.default.position.name);
|
|
60
60
|
const hasFills = Boolean(fills && fills.length);
|
|
61
61
|
if (!hasFills) {
|
|
62
62
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_element","_i18n","_groups","_interopRequireDefault","_inspectorControls","_store","_jsxRuntime","PositionControlsPanel","initialOpen","setInitialOpen","useState","multiSelectedBlocks","useSelect","select","getBlocksByClientId","getSelectedBlockClientIds","blockEditorStore","clientIds","useLayoutEffect","undefined","some","attributes","style","position","type","jsx","PanelBody","className","title","__","children","default","Slot","group","PositionControls","fills","useSlotFills","InspectorControlsGroups","
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_element","_i18n","_groups","_interopRequireDefault","_inspectorControls","_store","_jsxRuntime","PositionControlsPanel","initialOpen","setInitialOpen","useState","multiSelectedBlocks","useSelect","select","getBlocksByClientId","getSelectedBlockClientIds","blockEditorStore","clientIds","useLayoutEffect","undefined","some","attributes","style","position","type","jsx","PanelBody","className","title","__","children","default","Slot","group","PositionControls","fills","useSlotFills","InspectorControlsGroups","name","hasFills","Boolean","length","_default","exports"],"sources":["@wordpress/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useLayoutEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport InspectorControlsGroups from '../inspector-controls/groups';\nimport { default as InspectorControls } from '../inspector-controls';\nimport { store as blockEditorStore } from '../../store';\n\nconst PositionControlsPanel = () => {\n\tconst [ initialOpen, setInitialOpen ] = useState();\n\n\t// Determine whether the panel should be expanded.\n\tconst { multiSelectedBlocks } = useSelect( ( select ) => {\n\t\tconst { getBlocksByClientId, getSelectedBlockClientIds } =\n\t\t\tselect( blockEditorStore );\n\t\tconst clientIds = getSelectedBlockClientIds();\n\t\treturn {\n\t\t\tmultiSelectedBlocks: getBlocksByClientId( clientIds ),\n\t\t};\n\t}, [] );\n\n\tuseLayoutEffect( () => {\n\t\t// If any selected block has a position set, open the panel by default.\n\t\t// The first block's value will still be used within the control though.\n\t\tif ( initialOpen === undefined ) {\n\t\t\tsetInitialOpen(\n\t\t\t\tmultiSelectedBlocks.some(\n\t\t\t\t\t( { attributes } ) => !! attributes?.style?.position?.type\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}, [ initialOpen, multiSelectedBlocks, setInitialOpen ] );\n\n\treturn (\n\t\t<PanelBody\n\t\t\tclassName=\"block-editor-block-inspector__position\"\n\t\t\ttitle={ __( 'Position' ) }\n\t\t\tinitialOpen={ initialOpen ?? false }\n\t\t>\n\t\t\t<InspectorControls.Slot group=\"position\" />\n\t\t</PanelBody>\n\t);\n};\n\nconst PositionControls = () => {\n\tconst fills = useSlotFills( InspectorControlsGroups.position.name );\n\tconst hasFills = Boolean( fills && fills.length );\n\n\tif ( ! hasFills ) {\n\t\treturn null;\n\t}\n\n\treturn <PositionControlsPanel />;\n};\n\nexport default PositionControls;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAwD,IAAAQ,WAAA,GAAAR,OAAA;AAhBxD;AACA;AACA;;AASA;AACA;AACA;;AAKA,MAAMS,qBAAqB,GAAGA,CAAA,KAAM;EACnC,MAAM,CAAEC,WAAW,EAAEC,cAAc,CAAE,GAAG,IAAAC,iBAAQ,EAAC,CAAC;;EAElD;EACA,MAAM;IAAEC;EAAoB,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACxD,MAAM;MAAEC,mBAAmB;MAAEC;IAA0B,CAAC,GACvDF,MAAM,CAAEG,YAAiB,CAAC;IAC3B,MAAMC,SAAS,GAAGF,yBAAyB,CAAC,CAAC;IAC7C,OAAO;MACNJ,mBAAmB,EAAEG,mBAAmB,CAAEG,SAAU;IACrD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAAC,wBAAe,EAAE,MAAM;IACtB;IACA;IACA,IAAKV,WAAW,KAAKW,SAAS,EAAG;MAChCV,cAAc,CACbE,mBAAmB,CAACS,IAAI,CACvB,CAAE;QAAEC;MAAW,CAAC,KAAM,CAAC,CAAEA,UAAU,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,IACvD,CACD,CAAC;IACF;EACD,CAAC,EAAE,CAAEhB,WAAW,EAAEG,mBAAmB,EAAEF,cAAc,CAAG,CAAC;EAEzD,oBACC,IAAAH,WAAA,CAAAmB,GAAA,EAAC5B,WAAA,CAAA6B,SAAS;IACTC,SAAS,EAAC,wCAAwC;IAClDC,KAAK,EAAG,IAAAC,QAAE,EAAE,UAAW,CAAG;IAC1BrB,WAAW,EAAGA,WAAW,aAAXA,WAAW,cAAXA,WAAW,GAAI,KAAO;IAAAsB,QAAA,eAEpC,IAAAxB,WAAA,CAAAmB,GAAA,EAACrB,kBAAA,CAAA2B,OAAiB,CAACC,IAAI;MAACC,KAAK,EAAC;IAAU,CAAE;EAAC,CACjC,CAAC;AAEd,CAAC;AAED,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EAC9B,MAAMC,KAAK,GAAG,IAAAC,sCAAY,EAAEC,eAAuB,CAACd,QAAQ,CAACe,IAAK,CAAC;EACnE,MAAMC,QAAQ,GAAGC,OAAO,CAAEL,KAAK,IAAIA,KAAK,CAACM,MAAO,CAAC;EAEjD,IAAK,CAAEF,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,oBAAO,IAAAjC,WAAA,CAAAmB,GAAA,EAAClB,qBAAqB,IAAE,CAAC;AACjC,CAAC;AAAC,IAAAmC,QAAA,GAAAC,OAAA,CAAAZ,OAAA,GAEaG,gBAAgB","ignoreList":[]}
|
|
@@ -50,20 +50,20 @@ function useInspectorControlsTabs(blockName) {
|
|
|
50
50
|
|
|
51
51
|
// List View Tab: If there are any fills for the list group add that tab.
|
|
52
52
|
const listViewDisabled = (0, _useIsListViewTabDisabled.default)(blockName);
|
|
53
|
-
const listFills = (0, _components.__experimentalUseSlotFills)(listGroup.
|
|
53
|
+
const listFills = (0, _components.__experimentalUseSlotFills)(listGroup.name);
|
|
54
54
|
const hasListFills = !listViewDisabled && !!listFills && listFills.length;
|
|
55
55
|
|
|
56
56
|
// Styles Tab: Add this tab if there are any fills for block supports
|
|
57
57
|
// e.g. border, color, spacing, typography, etc.
|
|
58
|
-
const styleFills = [...((0, _components.__experimentalUseSlotFills)(borderGroup.
|
|
58
|
+
const styleFills = [...((0, _components.__experimentalUseSlotFills)(borderGroup.name) || []), ...((0, _components.__experimentalUseSlotFills)(colorGroup.name) || []), ...((0, _components.__experimentalUseSlotFills)(dimensionsGroup.name) || []), ...((0, _components.__experimentalUseSlotFills)(stylesGroup.name) || []), ...((0, _components.__experimentalUseSlotFills)(typographyGroup.name) || []), ...((0, _components.__experimentalUseSlotFills)(effectsGroup.name) || [])];
|
|
59
59
|
const hasStyleFills = styleFills.length;
|
|
60
60
|
|
|
61
61
|
// Settings Tab: If we don't have multiple tabs to display
|
|
62
62
|
// (i.e. both list view and styles), check only the default and position
|
|
63
63
|
// InspectorControls slots. If we have multiple tabs, we'll need to check
|
|
64
64
|
// the advanced controls slot as well to ensure they are rendered.
|
|
65
|
-
const advancedFills = [...((0, _components.__experimentalUseSlotFills)(_inspectorControls.InspectorAdvancedControls.slotName) || []), ...((0, _components.__experimentalUseSlotFills)(bindingsGroup.
|
|
66
|
-
const settingsFills = [...((0, _components.__experimentalUseSlotFills)(defaultGroup.
|
|
65
|
+
const advancedFills = [...((0, _components.__experimentalUseSlotFills)(_inspectorControls.InspectorAdvancedControls.slotName) || []), ...((0, _components.__experimentalUseSlotFills)(bindingsGroup.name) || [])];
|
|
66
|
+
const settingsFills = [...((0, _components.__experimentalUseSlotFills)(defaultGroup.name) || []), ...((0, _components.__experimentalUseSlotFills)(positionGroup.name) || []), ...(hasListFills && hasStyleFills > 1 ? advancedFills : [])];
|
|
67
67
|
|
|
68
68
|
// Add the tabs in the order that they will default to if available.
|
|
69
69
|
// List View > Settings > Styles.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_groups","_interopRequireDefault","_useIsListViewTabDisabled","_inspectorControls","_utils","_store","EMPTY_ARRAY","getShowTabs","blockName","tabSettings","undefined","default","useInspectorControlsTabs","tabs","bindings","bindingsGroup","border","borderGroup","color","colorGroup","defaultGroup","dimensions","dimensionsGroup","list","listGroup","position","positionGroup","styles","stylesGroup","typography","typographyGroup","effects","effectsGroup","InspectorControlsGroups","listViewDisabled","useIsListViewTabDisabled","listFills","useSlotFills","
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_groups","_interopRequireDefault","_useIsListViewTabDisabled","_inspectorControls","_utils","_store","EMPTY_ARRAY","getShowTabs","blockName","tabSettings","undefined","default","useInspectorControlsTabs","tabs","bindings","bindingsGroup","border","borderGroup","color","colorGroup","defaultGroup","dimensions","dimensionsGroup","list","listGroup","position","positionGroup","styles","stylesGroup","typography","typographyGroup","effects","effectsGroup","InspectorControlsGroups","listViewDisabled","useIsListViewTabDisabled","listFills","useSlotFills","name","hasListFills","length","styleFills","hasStyleFills","advancedFills","InspectorAdvancedControls","slotName","settingsFills","push","TAB_LIST_VIEW","TAB_SETTINGS","TAB_STYLES","useSelect","select","blockEditorStore","getSettings","blockInspectorTabs","showTabs"],"sources":["@wordpress/block-editor/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport InspectorControlsGroups from '../inspector-controls/groups';\nimport useIsListViewTabDisabled from './use-is-list-view-tab-disabled';\nimport { InspectorAdvancedControls } from '../inspector-controls';\nimport { TAB_LIST_VIEW, TAB_SETTINGS, TAB_STYLES } from './utils';\nimport { store as blockEditorStore } from '../../store';\n\nconst EMPTY_ARRAY = [];\n\nfunction getShowTabs( blockName, tabSettings = {} ) {\n\t// Block specific setting takes precedence over generic default.\n\tif ( tabSettings[ blockName ] !== undefined ) {\n\t\treturn tabSettings[ blockName ];\n\t}\n\n\t// Use generic default if set over the Gutenberg experiment option.\n\tif ( tabSettings.default !== undefined ) {\n\t\treturn tabSettings.default;\n\t}\n\n\treturn true;\n}\n\nexport default function useInspectorControlsTabs( blockName ) {\n\tconst tabs = [];\n\tconst {\n\t\tbindings: bindingsGroup,\n\t\tborder: borderGroup,\n\t\tcolor: colorGroup,\n\t\tdefault: defaultGroup,\n\t\tdimensions: dimensionsGroup,\n\t\tlist: listGroup,\n\t\tposition: positionGroup,\n\t\tstyles: stylesGroup,\n\t\ttypography: typographyGroup,\n\t\teffects: effectsGroup,\n\t} = InspectorControlsGroups;\n\n\t// List View Tab: If there are any fills for the list group add that tab.\n\tconst listViewDisabled = useIsListViewTabDisabled( blockName );\n\tconst listFills = useSlotFills( listGroup.name );\n\tconst hasListFills = ! listViewDisabled && !! listFills && listFills.length;\n\n\t// Styles Tab: Add this tab if there are any fills for block supports\n\t// e.g. border, color, spacing, typography, etc.\n\tconst styleFills = [\n\t\t...( useSlotFills( borderGroup.name ) || [] ),\n\t\t...( useSlotFills( colorGroup.name ) || [] ),\n\t\t...( useSlotFills( dimensionsGroup.name ) || [] ),\n\t\t...( useSlotFills( stylesGroup.name ) || [] ),\n\t\t...( useSlotFills( typographyGroup.name ) || [] ),\n\t\t...( useSlotFills( effectsGroup.name ) || [] ),\n\t];\n\tconst hasStyleFills = styleFills.length;\n\n\t// Settings Tab: If we don't have multiple tabs to display\n\t// (i.e. both list view and styles), check only the default and position\n\t// InspectorControls slots. If we have multiple tabs, we'll need to check\n\t// the advanced controls slot as well to ensure they are rendered.\n\tconst advancedFills = [\n\t\t...( useSlotFills( InspectorAdvancedControls.slotName ) || [] ),\n\t\t...( useSlotFills( bindingsGroup.name ) || [] ),\n\t];\n\n\tconst settingsFills = [\n\t\t...( useSlotFills( defaultGroup.name ) || [] ),\n\t\t...( useSlotFills( positionGroup.name ) || [] ),\n\t\t...( hasListFills && hasStyleFills > 1 ? advancedFills : [] ),\n\t];\n\n\t// Add the tabs in the order that they will default to if available.\n\t// List View > Settings > Styles.\n\tif ( hasListFills ) {\n\t\ttabs.push( TAB_LIST_VIEW );\n\t}\n\n\tif ( settingsFills.length ) {\n\t\ttabs.push( TAB_SETTINGS );\n\t}\n\n\tif ( hasStyleFills ) {\n\t\ttabs.push( TAB_STYLES );\n\t}\n\n\tconst tabSettings = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).getSettings().blockInspectorTabs;\n\t}, [] );\n\n\tconst showTabs = getShowTabs( blockName, tabSettings );\n\treturn showTabs ? tabs : EMPTY_ARRAY;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,yBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAbA;AACA;AACA;;AAIA;AACA;AACA;;AAOA,MAAMQ,WAAW,GAAG,EAAE;AAEtB,SAASC,WAAWA,CAAEC,SAAS,EAAEC,WAAW,GAAG,CAAC,CAAC,EAAG;EACnD;EACA,IAAKA,WAAW,CAAED,SAAS,CAAE,KAAKE,SAAS,EAAG;IAC7C,OAAOD,WAAW,CAAED,SAAS,CAAE;EAChC;;EAEA;EACA,IAAKC,WAAW,CAACE,OAAO,KAAKD,SAAS,EAAG;IACxC,OAAOD,WAAW,CAACE,OAAO;EAC3B;EAEA,OAAO,IAAI;AACZ;AAEe,SAASC,wBAAwBA,CAAEJ,SAAS,EAAG;EAC7D,MAAMK,IAAI,GAAG,EAAE;EACf,MAAM;IACLC,QAAQ,EAAEC,aAAa;IACvBC,MAAM,EAAEC,WA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/C;EAED,MAAMQ,aAAa,GAAG,CACrB,IAAK,IAAAT,sCAAY,EAAEjB,YAAY,CAACkB,IAAK,CAAC,IAAI,EAAE,CAAE,EAC9C,IAAK,IAAAD,sCAAY,EAAEX,aAAa,CAACY,IAAK,CAAC,IAAI,EAAE,CAAE,EAC/C,IAAKC,YAAY,IAAIG,aAAa,GAAG,CAAC,GAAGC,aAAa,GAAG,EAAE,CAAE,CAC7D;;EAED;EACA;EACA,IAAKJ,YAAY,EAAG;IACnB1B,IAAI,CAACkC,IAAI,CAAEC,oBAAc,CAAC;EAC3B;EAEA,IAAKF,aAAa,CAACN,MAAM,EAAG;IAC3B3B,IAAI,CAACkC,IAAI,CAAEE,mBAAa,CAAC;EAC1B;EAEA,IAAKP,aAAa,EAAG;IACpB7B,IAAI,CAACkC,IAAI,CAAEG,iBAAW,CAAC;EACxB;EAEA,MAAMzC,WAAW,GAAG,IAAA0C,eAAS,EAAIC,MAAM,IAAM;IAC5C,OAAOA,MAAM,CAAEC,YAAiB,CAAC,CAACC,WAAW,CAAC,CAAC,CAACC,kBAAkB;EACnE,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,QAAQ,GAAGjD,WAAW,CAAEC,SAAS,EAAEC,WAAY,CAAC;EACtD,OAAO+C,QAAQ,GAAG3C,IAAI,GAAGP,WAAW;AACrC","ignoreList":[]}
|
|
@@ -221,38 +221,46 @@ function MediaPlaceholder({
|
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
223
223
|
function recursivelyFindMediaFromBlocks(_blocks) {
|
|
224
|
-
return _blocks.flatMap(block => (block.name === 'core/image' || block.name === 'core/audio' || block.name === 'core/video') && block.attributes.url ? [block] : recursivelyFindMediaFromBlocks(block.innerBlocks));
|
|
224
|
+
return _blocks.flatMap(block => (block.name === 'core/image' || block.name === 'core/audio' || block.name === 'core/video') && (block.attributes.url || block.attributes.src) ? [block] : recursivelyFindMediaFromBlocks(block.innerBlocks));
|
|
225
225
|
}
|
|
226
226
|
const mediaBlocks = recursivelyFindMediaFromBlocks(blocks);
|
|
227
227
|
if (!mediaBlocks.length) {
|
|
228
228
|
return;
|
|
229
229
|
}
|
|
230
|
-
const uploadedMediaList = await Promise.all(mediaBlocks.map(block =>
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
230
|
+
const uploadedMediaList = await Promise.all(mediaBlocks.map(block => {
|
|
231
|
+
const blockType = block.name.split('/')[1];
|
|
232
|
+
if (block.attributes.id) {
|
|
233
|
+
block.attributes.type = blockType;
|
|
234
|
+
return block.attributes;
|
|
235
|
+
}
|
|
236
|
+
return new Promise((resolve, reject) => {
|
|
237
|
+
window.fetch(block.attributes.url).then(response => response.blob()).then(blob => mediaUpload({
|
|
238
|
+
filesList: [blob],
|
|
239
|
+
additionalData: {
|
|
240
|
+
title: block.attributes.title,
|
|
241
|
+
alt_text: block.attributes.alt,
|
|
242
|
+
caption: block.attributes.caption,
|
|
243
|
+
type: blockType
|
|
244
|
+
},
|
|
245
|
+
onFileChange: ([media]) => {
|
|
246
|
+
if (media.id) {
|
|
247
|
+
resolve(media);
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
allowedTypes,
|
|
251
|
+
onError: reject
|
|
252
|
+
})).catch(() => resolve(block.attributes.url));
|
|
253
|
+
});
|
|
254
|
+
})).catch(err => onError(err));
|
|
247
255
|
if (multiple) {
|
|
248
256
|
onSelect(uploadedMediaList);
|
|
249
257
|
} else {
|
|
250
258
|
onSelect(uploadedMediaList[0]);
|
|
251
259
|
}
|
|
252
260
|
}
|
|
253
|
-
async function
|
|
261
|
+
async function onDrop(event) {
|
|
254
262
|
const blocks = (0, _blocks2.pasteHandler)({
|
|
255
|
-
HTML
|
|
263
|
+
HTML: event.dataTransfer?.getData('default')
|
|
256
264
|
});
|
|
257
265
|
return await handleBlocksDrop(blocks);
|
|
258
266
|
}
|
|
@@ -317,7 +325,7 @@ function MediaPlaceholder({
|
|
|
317
325
|
}
|
|
318
326
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropZone, {
|
|
319
327
|
onFilesDrop: onFilesUpload,
|
|
320
|
-
|
|
328
|
+
onDrop: onDrop
|
|
321
329
|
});
|
|
322
330
|
};
|
|
323
331
|
const renderCancelLink = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_i18n","_element","_data","_icons","_blocks2","_deprecated","_mediaUpload","_check","_urlPopover","_store","_jsxRuntime","noop","InsertFromURLPopover","src","onChange","onSubmit","onClose","popoverAnchor","jsx","default","anchor","children","className","__experimentalInputControl","__next40pxDefaultSize","label","__","hideLabelFromVision","placeholder","value","suffix","__experimentalInputControlSuffixWrapper","variant","Button","size","icon","keyboardReturn","type","URLSelectionUI","onChangeSrc","onSelectURL","setPopoverAnchor","useState","isURLInputVisible","setIsURLInputVisible","openURLInput","closeURLInput","focus","onSubmitSrc","event","preventDefault","jsxs","onClick","isPressed","ref","MediaPlaceholder","allowedTypes","labels","mediaPreview","notices","isAppender","accept","addToGallery","multiple","handleUpload","disableDropZone","disableMediaButtons","onError","onSelect","onCancel","onToggleFeaturedImage","onDoubleClick","onFilesPreUpload","onHTMLDrop","deprecatedOnHTMLDrop","mediaLibraryButton","style","deprecated","since","version","mediaUpload","useSelect","select","getSettings","blockEditorStore","setSrc","useEffect","_value$src","onlyAllowsImages","length","every","allowedType","startsWith","onFilesUpload","files","setMedia","lastMediaPassed","newMedia","filteredMedia","filter","item","id","some","Number","urlSlug","url","includes","concat","map","media","cutOffIndex","lastIndexOf","slice","filesList","onFileChange","handleBlocksDrop","blocks","Array","isArray","recursivelyFindMediaFromBlocks","_blocks","flatMap","block","name","attributes","innerBlocks","mediaBlocks","uploadedMediaList","Promise","all","resolve","reject","window","fetch","then","response","blob","additionalData","title","alt_text","alt","caption","catch","err","HTML","pasteHandler","onUpload","target","defaultRenderPlaceholder","content","instructions","undefined","typesAllowed","firstAllowedType","isOneType","isAudio","isImage","isVideo","placeholderClassName","clsx","Placeholder","preview","renderPlaceholder","renderDropZone","DropZone","onFilesDrop","renderCancelLink","renderUrlSelectionUI","renderFeaturedImageToggle","renderMediaUploadChecked","defaultButton","open","libraryButton","uploadMediaLibraryButton","gallery","mode","render","Fragment","FormFileUpload","openFileDialog","fallback","_default","exports","withFilters"],"sources":["@wordpress/block-editor/src/components/media-placeholder/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tFormFileUpload,\n\tPlaceholder,\n\tDropZone,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n\twithFilters,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { keyboardReturn } from '@wordpress/icons';\nimport { pasteHandler } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport MediaUpload from '../media-upload';\nimport MediaUploadCheck from '../media-upload/check';\nimport URLPopover from '../url-popover';\nimport { store as blockEditorStore } from '../../store';\n\nconst noop = () => {};\n\nconst InsertFromURLPopover = ( {\n\tsrc,\n\tonChange,\n\tonSubmit,\n\tonClose,\n\tpopoverAnchor,\n} ) => (\n\t<URLPopover anchor={ popoverAnchor } onClose={ onClose }>\n\t\t<form\n\t\t\tclassName=\"block-editor-media-placeholder__url-input-form\"\n\t\t\tonSubmit={ onSubmit }\n\t\t>\n\t\t\t<InputControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'URL' ) }\n\t\t\t\thideLabelFromVision\n\t\t\t\tplaceholder={ __( 'Paste or type URL' ) }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tvalue={ src }\n\t\t\t\tsuffix={\n\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</form>\n\t</URLPopover>\n);\n\nconst URLSelectionUI = ( { src, onChangeSrc, onSelectURL } ) => {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst [ isURLInputVisible, setIsURLInputVisible ] = useState( false );\n\n\tconst openURLInput = () => {\n\t\tsetIsURLInputVisible( true );\n\t};\n\tconst closeURLInput = () => {\n\t\tsetIsURLInputVisible( false );\n\t\tpopoverAnchor?.focus();\n\t};\n\n\tconst onSubmitSrc = ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( src && onSelectURL ) {\n\t\t\tonSelectURL( src );\n\t\t\tcloseURLInput();\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-media-placeholder__url-input-container\">\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"block-editor-media-placeholder__button\"\n\t\t\t\tonClick={ openURLInput }\n\t\t\t\tisPressed={ isURLInputVisible }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t>\n\t\t\t\t{ __( 'Insert from URL' ) }\n\t\t\t</Button>\n\t\t\t{ isURLInputVisible && (\n\t\t\t\t<InsertFromURLPopover\n\t\t\t\t\tsrc={ src }\n\t\t\t\t\tonChange={ onChangeSrc }\n\t\t\t\t\tonSubmit={ onSubmitSrc }\n\t\t\t\t\tonClose={ closeURLInput }\n\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\nexport function MediaPlaceholder( {\n\tvalue = {},\n\tallowedTypes,\n\tclassName,\n\ticon,\n\tlabels = {},\n\tmediaPreview,\n\tnotices,\n\tisAppender,\n\taccept,\n\taddToGallery,\n\tmultiple = false,\n\thandleUpload = true,\n\tdisableDropZone,\n\tdisableMediaButtons,\n\tonError,\n\tonSelect,\n\tonCancel,\n\tonSelectURL,\n\tonToggleFeaturedImage,\n\tonDoubleClick,\n\tonFilesPreUpload = noop,\n\tonHTMLDrop: deprecatedOnHTMLDrop,\n\tchildren,\n\tmediaLibraryButton,\n\tplaceholder,\n\tstyle,\n} ) {\n\tif ( deprecatedOnHTMLDrop ) {\n\t\tdeprecated( 'wp.blockEditor.MediaPlaceholder onHTMLDrop prop', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t} );\n\t}\n\n\tconst mediaUpload = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().mediaUpload;\n\t}, [] );\n\tconst [ src, setSrc ] = useState( '' );\n\n\tuseEffect( () => {\n\t\tsetSrc( value?.src ?? '' );\n\t}, [ value?.src ] );\n\n\tconst onlyAllowsImages = () => {\n\t\tif ( ! allowedTypes || allowedTypes.length === 0 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn allowedTypes.every(\n\t\t\t( allowedType ) =>\n\t\t\t\tallowedType === 'image' || allowedType.startsWith( 'image/' )\n\t\t);\n\t};\n\n\tconst onFilesUpload = ( files ) => {\n\t\tif (\n\t\t\t! handleUpload ||\n\t\t\t( typeof handleUpload === 'function' && ! handleUpload( files ) )\n\t\t) {\n\t\t\treturn onSelect( files );\n\t\t}\n\t\tonFilesPreUpload( files );\n\t\tlet setMedia;\n\t\tif ( multiple ) {\n\t\t\tif ( addToGallery ) {\n\t\t\t\t// Since the setMedia function runs multiple times per upload group\n\t\t\t\t// and is passed newMedia containing every item in its group each time, we must\n\t\t\t\t// filter out whatever this upload group had previously returned to the\n\t\t\t\t// gallery before adding and returning the image array with replacement newMedia\n\t\t\t\t// values.\n\n\t\t\t\t// Define an array to store urls from newMedia between subsequent function calls.\n\t\t\t\tlet lastMediaPassed = [];\n\t\t\t\tsetMedia = ( newMedia ) => {\n\t\t\t\t\t// Remove any images this upload group is responsible for (lastMediaPassed).\n\t\t\t\t\t// Their replacements are contained in newMedia.\n\t\t\t\t\tconst filteredMedia = ( value ?? [] ).filter( ( item ) => {\n\t\t\t\t\t\t// If Item has id, only remove it if lastMediaPassed has an item with that id.\n\t\t\t\t\t\tif ( item.id ) {\n\t\t\t\t\t\t\treturn ! lastMediaPassed.some(\n\t\t\t\t\t\t\t\t// Be sure to convert to number for comparison.\n\t\t\t\t\t\t\t\t( { id } ) => Number( id ) === Number( item.id )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Compare transient images via .includes since gallery may append extra info onto the url.\n\t\t\t\t\t\treturn ! lastMediaPassed.some( ( { urlSlug } ) =>\n\t\t\t\t\t\t\titem.url.includes( urlSlug )\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t\t\t// Return the filtered media array along with newMedia.\n\t\t\t\t\tonSelect( filteredMedia.concat( newMedia ) );\n\t\t\t\t\t// Reset lastMediaPassed and set it with ids and urls from newMedia.\n\t\t\t\t\tlastMediaPassed = newMedia.map( ( media ) => {\n\t\t\t\t\t\t// Add everything up to '.fileType' to compare via .includes.\n\t\t\t\t\t\tconst cutOffIndex = media.url.lastIndexOf( '.' );\n\t\t\t\t\t\tconst urlSlug = media.url.slice( 0, cutOffIndex );\n\t\t\t\t\t\treturn { id: media.id, urlSlug };\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tsetMedia = onSelect;\n\t\t\t}\n\t\t} else {\n\t\t\tsetMedia = ( [ media ] ) => onSelect( media );\n\t\t}\n\t\tmediaUpload( {\n\t\t\tallowedTypes,\n\t\t\tfilesList: files,\n\t\t\tonFileChange: setMedia,\n\t\t\tonError,\n\t\t} );\n\t};\n\n\tasync function handleBlocksDrop( blocks ) {\n\t\tif ( ! blocks || ! Array.isArray( blocks ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfunction recursivelyFindMediaFromBlocks( _blocks ) {\n\t\t\treturn _blocks.flatMap( ( block ) =>\n\t\t\t\t( block.name === 'core/image' ||\n\t\t\t\t\tblock.name === 'core/audio' ||\n\t\t\t\t\tblock.name === 'core/video' ) &&\n\t\t\t\tblock.attributes.url\n\t\t\t\t\t? [ block ]\n\t\t\t\t\t: recursivelyFindMediaFromBlocks( block.innerBlocks )\n\t\t\t);\n\t\t}\n\n\t\tconst mediaBlocks = recursivelyFindMediaFromBlocks( blocks );\n\n\t\tif ( ! mediaBlocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst uploadedMediaList = await Promise.all(\n\t\t\tmediaBlocks.map( ( block ) =>\n\t\t\t\tblock.attributes.id\n\t\t\t\t\t? block.attributes\n\t\t\t\t\t: new Promise( ( resolve, reject ) => {\n\t\t\t\t\t\t\twindow\n\t\t\t\t\t\t\t\t.fetch( block.attributes.url )\n\t\t\t\t\t\t\t\t.then( ( response ) => response.blob() )\n\t\t\t\t\t\t\t\t.then( ( blob ) =>\n\t\t\t\t\t\t\t\t\tmediaUpload( {\n\t\t\t\t\t\t\t\t\t\tfilesList: [ blob ],\n\t\t\t\t\t\t\t\t\t\tadditionalData: {\n\t\t\t\t\t\t\t\t\t\t\ttitle: block.attributes.title,\n\t\t\t\t\t\t\t\t\t\t\talt_text: block.attributes.alt,\n\t\t\t\t\t\t\t\t\t\t\tcaption: block.attributes.caption,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tonFileChange: ( [ media ] ) => {\n\t\t\t\t\t\t\t\t\t\t\tif ( media.id ) {\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( media );\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\tallowedTypes,\n\t\t\t\t\t\t\t\t\t\tonError: reject,\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\t.catch( () => resolve( block.attributes.url ) );\n\t\t\t\t\t } )\n\t\t\t)\n\t\t).catch( ( err ) => onError( err ) );\n\n\t\tif ( multiple ) {\n\t\t\tonSelect( uploadedMediaList );\n\t\t} else {\n\t\t\tonSelect( uploadedMediaList[ 0 ] );\n\t\t}\n\t}\n\n\tasync function onHTMLDrop( HTML ) {\n\t\tconst blocks = pasteHandler( { HTML } );\n\t\treturn await handleBlocksDrop( blocks );\n\t}\n\n\tconst onUpload = ( event ) => {\n\t\tonFilesUpload( event.target.files );\n\t};\n\n\tconst defaultRenderPlaceholder = ( content ) => {\n\t\tlet { instructions, title } = labels;\n\n\t\tif ( ! mediaUpload && ! onSelectURL ) {\n\t\t\tinstructions = __(\n\t\t\t\t'To edit this block, you need permission to upload media.'\n\t\t\t);\n\t\t}\n\n\t\tif ( instructions === undefined || title === undefined ) {\n\t\t\tconst typesAllowed = allowedTypes ?? [];\n\n\t\t\tconst [ firstAllowedType ] = typesAllowed;\n\t\t\tconst isOneType = 1 === typesAllowed.length;\n\t\t\tconst isAudio = isOneType && 'audio' === firstAllowedType;\n\t\t\tconst isImage = isOneType && 'image' === firstAllowedType;\n\t\t\tconst isVideo = isOneType && 'video' === firstAllowedType;\n\n\t\t\tif ( instructions === undefined && mediaUpload ) {\n\t\t\t\tinstructions = __(\n\t\t\t\t\t'Drag and drop an image or video, upload, or choose from your library.'\n\t\t\t\t);\n\n\t\t\t\tif ( isAudio ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Drag and drop an audio file, upload, or choose from your library.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( isImage ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Drag and drop an image, upload, or choose from your library.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( isVideo ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Drag and drop a video, upload, or choose from your library.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( title === undefined ) {\n\t\t\t\ttitle = __( 'Media' );\n\n\t\t\t\tif ( isAudio ) {\n\t\t\t\t\ttitle = __( 'Audio' );\n\t\t\t\t} else if ( isImage ) {\n\t\t\t\t\ttitle = __( 'Image' );\n\t\t\t\t} else if ( isVideo ) {\n\t\t\t\t\ttitle = __( 'Video' );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst placeholderClassName = clsx(\n\t\t\t'block-editor-media-placeholder',\n\t\t\tclassName,\n\t\t\t{\n\t\t\t\t'is-appender': isAppender,\n\t\t\t}\n\t\t);\n\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ title }\n\t\t\t\tinstructions={ instructions }\n\t\t\t\tclassName={ placeholderClassName }\n\t\t\t\tnotices={ notices }\n\t\t\t\tonDoubleClick={ onDoubleClick }\n\t\t\t\tpreview={ mediaPreview }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t\t{ children }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\tconst renderPlaceholder = placeholder ?? defaultRenderPlaceholder;\n\n\tconst renderDropZone = () => {\n\t\tif ( disableDropZone ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<DropZone onFilesDrop={ onFilesUpload } onHTMLDrop={ onHTMLDrop } />\n\t\t);\n\t};\n\n\tconst renderCancelLink = () => {\n\t\treturn (\n\t\t\tonCancel && (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"block-editor-media-placeholder__cancel-button\"\n\t\t\t\t\ttitle={ __( 'Cancel' ) }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Button>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderUrlSelectionUI = () => {\n\t\treturn (\n\t\t\tonSelectURL && (\n\t\t\t\t<URLSelectionUI\n\t\t\t\t\tsrc={ src }\n\t\t\t\t\tonChangeSrc={ setSrc }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t/>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderFeaturedImageToggle = () => {\n\t\treturn (\n\t\t\tonToggleFeaturedImage && (\n\t\t\t\t<div className=\"block-editor-media-placeholder__url-input-container\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tclassName=\"block-editor-media-placeholder__button\"\n\t\t\t\t\t\tonClick={ onToggleFeaturedImage }\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Use featured image' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderMediaUploadChecked = () => {\n\t\tconst defaultButton = ( { open } ) => {\n\t\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\topen();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Media Library' ) }\n\t\t\t\t</Button>\n\t\t\t);\n\t\t};\n\t\tconst libraryButton = mediaLibraryButton ?? defaultButton;\n\t\tconst uploadMediaLibraryButton = (\n\t\t\t<MediaUpload\n\t\t\t\taddToGallery={ addToGallery }\n\t\t\t\tgallery={ multiple && onlyAllowsImages() }\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\tmode=\"browse\"\n\t\t\t\tvalue={\n\t\t\t\t\tArray.isArray( value )\n\t\t\t\t\t\t? value.map( ( { id } ) => id )\n\t\t\t\t\t\t: value.id\n\t\t\t\t}\n\t\t\t\trender={ libraryButton }\n\t\t\t/>\n\t\t);\n\n\t\tif ( mediaUpload && isAppender ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{ renderDropZone() }\n\t\t\t\t\t<FormFileUpload\n\t\t\t\t\t\tonChange={ onUpload }\n\t\t\t\t\t\taccept={ accept }\n\t\t\t\t\t\tmultiple={ !! multiple }\n\t\t\t\t\t\trender={ ( { openFileDialog } ) => {\n\t\t\t\t\t\t\tconst content = (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__button',\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__upload-button'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tonClick={ openFileDialog }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Upload' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t{ uploadMediaLibraryButton }\n\t\t\t\t\t\t\t\t\t{ renderUrlSelectionUI() }\n\t\t\t\t\t\t\t\t\t{ renderFeaturedImageToggle() }\n\t\t\t\t\t\t\t\t\t{ renderCancelLink() }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn renderPlaceholder( content );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\tif ( mediaUpload ) {\n\t\t\tconst content = (\n\t\t\t\t<>\n\t\t\t\t\t{ renderDropZone() }\n\t\t\t\t\t<FormFileUpload\n\t\t\t\t\t\trender={ ( { openFileDialog } ) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tonClick={ openFileDialog }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__button',\n\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__upload-button'\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\t{ __( 'Upload' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ onUpload }\n\t\t\t\t\t\taccept={ accept }\n\t\t\t\t\t\tmultiple={ !! multiple }\n\t\t\t\t\t/>\n\t\t\t\t\t{ uploadMediaLibraryButton }\n\t\t\t\t\t{ renderUrlSelectionUI() }\n\t\t\t\t\t{ renderFeaturedImageToggle() }\n\t\t\t\t\t{ renderCancelLink() }\n\t\t\t\t</>\n\t\t\t);\n\t\t\treturn renderPlaceholder( content );\n\t\t}\n\n\t\treturn renderPlaceholder( uploadMediaLibraryButton );\n\t};\n\n\tif ( disableMediaButtons ) {\n\t\treturn <MediaUploadCheck>{ renderDropZone() }</MediaUploadCheck>;\n\t}\n\n\treturn (\n\t\t<MediaUploadCheck\n\t\t\tfallback={ renderPlaceholder( renderUrlSelectionUI() ) }\n\t\t>\n\t\t\t{ renderMediaUploadChecked() }\n\t\t</MediaUploadCheck>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-placeholder/README.md\n */\nexport default withFilters( 'editor.MediaPlaceholder' )( MediaPlaceholder );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;A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AAEW,wBAAyB,CAAC;EACrD,CAAC;EAED,IAAK3G,mBAAmB,EAAG;IAC1B,oBAAO,IAAAxD,WAAA,CAAAQ,GAAA,EAACX,MAAA,CAAAY,OAAgB;MAAAE,QAAA,EAAG8I,cAAc,CAAC;IAAC,CAAoB,CAAC;EACjE;EAEA,oBACC,IAAAzJ,WAAA,CAAAQ,GAAA,EAACX,MAAA,CAAAY,OAAgB;IAChBiK,QAAQ,EAAGlB,iBAAiB,CAAEK,oBAAoB,CAAC,CAAE,CAAG;IAAAlJ,QAAA,EAEtDoJ,wBAAwB,CAAC;EAAC,CACX,CAAC;AAErB;;AAEA;AACA;AACA;AAFA,IAAAY,QAAA,GAAAC,OAAA,CAAAnK,OAAA,GAGe,IAAAoK,uBAAW,EAAE,yBAA0B,CAAC,CAAEhI,gBAAiB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_i18n","_element","_data","_icons","_blocks2","_deprecated","_mediaUpload","_check","_urlPopover","_store","_jsxRuntime","noop","InsertFromURLPopover","src","onChange","onSubmit","onClose","popoverAnchor","jsx","default","anchor","children","className","__experimentalInputControl","__next40pxDefaultSize","label","__","hideLabelFromVision","placeholder","value","suffix","__experimentalInputControlSuffixWrapper","variant","Button","size","icon","keyboardReturn","type","URLSelectionUI","onChangeSrc","onSelectURL","setPopoverAnchor","useState","isURLInputVisible","setIsURLInputVisible","openURLInput","closeURLInput","focus","onSubmitSrc","event","preventDefault","jsxs","onClick","isPressed","ref","MediaPlaceholder","allowedTypes","labels","mediaPreview","notices","isAppender","accept","addToGallery","multiple","handleUpload","disableDropZone","disableMediaButtons","onError","onSelect","onCancel","onToggleFeaturedImage","onDoubleClick","onFilesPreUpload","onHTMLDrop","deprecatedOnHTMLDrop","mediaLibraryButton","style","deprecated","since","version","mediaUpload","useSelect","select","getSettings","blockEditorStore","setSrc","useEffect","_value$src","onlyAllowsImages","length","every","allowedType","startsWith","onFilesUpload","files","setMedia","lastMediaPassed","newMedia","filteredMedia","filter","item","id","some","Number","urlSlug","url","includes","concat","map","media","cutOffIndex","lastIndexOf","slice","filesList","onFileChange","handleBlocksDrop","blocks","Array","isArray","recursivelyFindMediaFromBlocks","_blocks","flatMap","block","name","attributes","innerBlocks","mediaBlocks","uploadedMediaList","Promise","all","blockType","split","resolve","reject","window","fetch","then","response","blob","additionalData","title","alt_text","alt","caption","catch","err","onDrop","pasteHandler","HTML","dataTransfer","getData","onUpload","target","defaultRenderPlaceholder","content","instructions","undefined","typesAllowed","firstAllowedType","isOneType","isAudio","isImage","isVideo","placeholderClassName","clsx","Placeholder","preview","renderPlaceholder","renderDropZone","DropZone","onFilesDrop","renderCancelLink","renderUrlSelectionUI","renderFeaturedImageToggle","renderMediaUploadChecked","defaultButton","open","libraryButton","uploadMediaLibraryButton","gallery","mode","render","Fragment","FormFileUpload","openFileDialog","fallback","_default","exports","withFilters"],"sources":["@wordpress/block-editor/src/components/media-placeholder/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tFormFileUpload,\n\tPlaceholder,\n\tDropZone,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n\twithFilters,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { keyboardReturn } from '@wordpress/icons';\nimport { pasteHandler } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport MediaUpload from '../media-upload';\nimport MediaUploadCheck from '../media-upload/check';\nimport URLPopover from '../url-popover';\nimport { store as blockEditorStore } from '../../store';\n\nconst noop = () => {};\n\nconst InsertFromURLPopover = ( {\n\tsrc,\n\tonChange,\n\tonSubmit,\n\tonClose,\n\tpopoverAnchor,\n} ) => (\n\t<URLPopover anchor={ popoverAnchor } onClose={ onClose }>\n\t\t<form\n\t\t\tclassName=\"block-editor-media-placeholder__url-input-form\"\n\t\t\tonSubmit={ onSubmit }\n\t\t>\n\t\t\t<InputControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'URL' ) }\n\t\t\t\thideLabelFromVision\n\t\t\t\tplaceholder={ __( 'Paste or type URL' ) }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tvalue={ src }\n\t\t\t\tsuffix={\n\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</form>\n\t</URLPopover>\n);\n\nconst URLSelectionUI = ( { src, onChangeSrc, onSelectURL } ) => {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst [ isURLInputVisible, setIsURLInputVisible ] = useState( false );\n\n\tconst openURLInput = () => {\n\t\tsetIsURLInputVisible( true );\n\t};\n\tconst closeURLInput = () => {\n\t\tsetIsURLInputVisible( false );\n\t\tpopoverAnchor?.focus();\n\t};\n\n\tconst onSubmitSrc = ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( src && onSelectURL ) {\n\t\t\tonSelectURL( src );\n\t\t\tcloseURLInput();\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-media-placeholder__url-input-container\">\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"block-editor-media-placeholder__button\"\n\t\t\t\tonClick={ openURLInput }\n\t\t\t\tisPressed={ isURLInputVisible }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t>\n\t\t\t\t{ __( 'Insert from URL' ) }\n\t\t\t</Button>\n\t\t\t{ isURLInputVisible && (\n\t\t\t\t<InsertFromURLPopover\n\t\t\t\t\tsrc={ src }\n\t\t\t\t\tonChange={ onChangeSrc }\n\t\t\t\t\tonSubmit={ onSubmitSrc }\n\t\t\t\t\tonClose={ closeURLInput }\n\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\nexport function MediaPlaceholder( {\n\tvalue = {},\n\tallowedTypes,\n\tclassName,\n\ticon,\n\tlabels = {},\n\tmediaPreview,\n\tnotices,\n\tisAppender,\n\taccept,\n\taddToGallery,\n\tmultiple = false,\n\thandleUpload = true,\n\tdisableDropZone,\n\tdisableMediaButtons,\n\tonError,\n\tonSelect,\n\tonCancel,\n\tonSelectURL,\n\tonToggleFeaturedImage,\n\tonDoubleClick,\n\tonFilesPreUpload = noop,\n\tonHTMLDrop: deprecatedOnHTMLDrop,\n\tchildren,\n\tmediaLibraryButton,\n\tplaceholder,\n\tstyle,\n} ) {\n\tif ( deprecatedOnHTMLDrop ) {\n\t\tdeprecated( 'wp.blockEditor.MediaPlaceholder onHTMLDrop prop', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t} );\n\t}\n\n\tconst mediaUpload = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().mediaUpload;\n\t}, [] );\n\tconst [ src, setSrc ] = useState( '' );\n\n\tuseEffect( () => {\n\t\tsetSrc( value?.src ?? '' );\n\t}, [ value?.src ] );\n\n\tconst onlyAllowsImages = () => {\n\t\tif ( ! allowedTypes || allowedTypes.length === 0 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn allowedTypes.every(\n\t\t\t( allowedType ) =>\n\t\t\t\tallowedType === 'image' || allowedType.startsWith( 'image/' )\n\t\t);\n\t};\n\n\tconst onFilesUpload = ( files ) => {\n\t\tif (\n\t\t\t! handleUpload ||\n\t\t\t( typeof handleUpload === 'function' && ! handleUpload( files ) )\n\t\t) {\n\t\t\treturn onSelect( files );\n\t\t}\n\t\tonFilesPreUpload( files );\n\t\tlet setMedia;\n\t\tif ( multiple ) {\n\t\t\tif ( addToGallery ) {\n\t\t\t\t// Since the setMedia function runs multiple times per upload group\n\t\t\t\t// and is passed newMedia containing every item in its group each time, we must\n\t\t\t\t// filter out whatever this upload group had previously returned to the\n\t\t\t\t// gallery before adding and returning the image array with replacement newMedia\n\t\t\t\t// values.\n\n\t\t\t\t// Define an array to store urls from newMedia between subsequent function calls.\n\t\t\t\tlet lastMediaPassed = [];\n\t\t\t\tsetMedia = ( newMedia ) => {\n\t\t\t\t\t// Remove any images this upload group is responsible for (lastMediaPassed).\n\t\t\t\t\t// Their replacements are contained in newMedia.\n\t\t\t\t\tconst filteredMedia = ( value ?? [] ).filter( ( item ) => {\n\t\t\t\t\t\t// If Item has id, only remove it if lastMediaPassed has an item with that id.\n\t\t\t\t\t\tif ( item.id ) {\n\t\t\t\t\t\t\treturn ! lastMediaPassed.some(\n\t\t\t\t\t\t\t\t// Be sure to convert to number for comparison.\n\t\t\t\t\t\t\t\t( { id } ) => Number( id ) === Number( item.id )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Compare transient images via .includes since gallery may append extra info onto the url.\n\t\t\t\t\t\treturn ! lastMediaPassed.some( ( { urlSlug } ) =>\n\t\t\t\t\t\t\titem.url.includes( urlSlug )\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t\t\t// Return the filtered media array along with newMedia.\n\t\t\t\t\tonSelect( filteredMedia.concat( newMedia ) );\n\t\t\t\t\t// Reset lastMediaPassed and set it with ids and urls from newMedia.\n\t\t\t\t\tlastMediaPassed = newMedia.map( ( media ) => {\n\t\t\t\t\t\t// Add everything up to '.fileType' to compare via .includes.\n\t\t\t\t\t\tconst cutOffIndex = media.url.lastIndexOf( '.' );\n\t\t\t\t\t\tconst urlSlug = media.url.slice( 0, cutOffIndex );\n\t\t\t\t\t\treturn { id: media.id, urlSlug };\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tsetMedia = onSelect;\n\t\t\t}\n\t\t} else {\n\t\t\tsetMedia = ( [ media ] ) => onSelect( media );\n\t\t}\n\t\tmediaUpload( {\n\t\t\tallowedTypes,\n\t\t\tfilesList: files,\n\t\t\tonFileChange: setMedia,\n\t\t\tonError,\n\t\t} );\n\t};\n\n\tasync function handleBlocksDrop( blocks ) {\n\t\tif ( ! blocks || ! Array.isArray( blocks ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfunction recursivelyFindMediaFromBlocks( _blocks ) {\n\t\t\treturn _blocks.flatMap( ( block ) =>\n\t\t\t\t( block.name === 'core/image' ||\n\t\t\t\t\tblock.name === 'core/audio' ||\n\t\t\t\t\tblock.name === 'core/video' ) &&\n\t\t\t\t( block.attributes.url || block.attributes.src )\n\t\t\t\t\t? [ block ]\n\t\t\t\t\t: recursivelyFindMediaFromBlocks( block.innerBlocks )\n\t\t\t);\n\t\t}\n\n\t\tconst mediaBlocks = recursivelyFindMediaFromBlocks( blocks );\n\n\t\tif ( ! mediaBlocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst uploadedMediaList = await Promise.all(\n\t\t\tmediaBlocks.map( ( block ) => {\n\t\t\t\tconst blockType = block.name.split( '/' )[ 1 ];\n\t\t\t\tif ( block.attributes.id ) {\n\t\t\t\t\tblock.attributes.type = blockType;\n\t\t\t\t\treturn block.attributes;\n\t\t\t\t}\n\t\t\t\treturn new Promise( ( resolve, reject ) => {\n\t\t\t\t\twindow\n\t\t\t\t\t\t.fetch( block.attributes.url )\n\t\t\t\t\t\t.then( ( response ) => response.blob() )\n\t\t\t\t\t\t.then( ( blob ) =>\n\t\t\t\t\t\t\tmediaUpload( {\n\t\t\t\t\t\t\t\tfilesList: [ blob ],\n\t\t\t\t\t\t\t\tadditionalData: {\n\t\t\t\t\t\t\t\t\ttitle: block.attributes.title,\n\t\t\t\t\t\t\t\t\talt_text: block.attributes.alt,\n\t\t\t\t\t\t\t\t\tcaption: block.attributes.caption,\n\t\t\t\t\t\t\t\t\ttype: blockType,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonFileChange: ( [ media ] ) => {\n\t\t\t\t\t\t\t\t\tif ( media.id ) {\n\t\t\t\t\t\t\t\t\t\tresolve( media );\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\tallowedTypes,\n\t\t\t\t\t\t\t\tonError: reject,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.catch( () => resolve( block.attributes.url ) );\n\t\t\t\t} );\n\t\t\t} )\n\t\t).catch( ( err ) => onError( err ) );\n\n\t\tif ( multiple ) {\n\t\t\tonSelect( uploadedMediaList );\n\t\t} else {\n\t\t\tonSelect( uploadedMediaList[ 0 ] );\n\t\t}\n\t}\n\n\tasync function onDrop( event ) {\n\t\tconst blocks = pasteHandler( {\n\t\t\tHTML: event.dataTransfer?.getData( 'default' ),\n\t\t} );\n\t\treturn await handleBlocksDrop( blocks );\n\t}\n\n\tconst onUpload = ( event ) => {\n\t\tonFilesUpload( event.target.files );\n\t};\n\n\tconst defaultRenderPlaceholder = ( content ) => {\n\t\tlet { instructions, title } = labels;\n\n\t\tif ( ! mediaUpload && ! onSelectURL ) {\n\t\t\tinstructions = __(\n\t\t\t\t'To edit this block, you need permission to upload media.'\n\t\t\t);\n\t\t}\n\n\t\tif ( instructions === undefined || title === undefined ) {\n\t\t\tconst typesAllowed = allowedTypes ?? [];\n\n\t\t\tconst [ firstAllowedType ] = typesAllowed;\n\t\t\tconst isOneType = 1 === typesAllowed.length;\n\t\t\tconst isAudio = isOneType && 'audio' === firstAllowedType;\n\t\t\tconst isImage = isOneType && 'image' === firstAllowedType;\n\t\t\tconst isVideo = isOneType && 'video' === firstAllowedType;\n\n\t\t\tif ( instructions === undefined && mediaUpload ) {\n\t\t\t\tinstructions = __(\n\t\t\t\t\t'Drag and drop an image or video, upload, or choose from your library.'\n\t\t\t\t);\n\n\t\t\t\tif ( isAudio ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Drag and drop an audio file, upload, or choose from your library.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( isImage ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Drag and drop an image, upload, or choose from your library.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( isVideo ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Drag and drop a video, upload, or choose from your library.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( title === undefined ) {\n\t\t\t\ttitle = __( 'Media' );\n\n\t\t\t\tif ( isAudio ) {\n\t\t\t\t\ttitle = __( 'Audio' );\n\t\t\t\t} else if ( isImage ) {\n\t\t\t\t\ttitle = __( 'Image' );\n\t\t\t\t} else if ( isVideo ) {\n\t\t\t\t\ttitle = __( 'Video' );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst placeholderClassName = clsx(\n\t\t\t'block-editor-media-placeholder',\n\t\t\tclassName,\n\t\t\t{\n\t\t\t\t'is-appender': isAppender,\n\t\t\t}\n\t\t);\n\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ title }\n\t\t\t\tinstructions={ instructions }\n\t\t\t\tclassName={ placeholderClassName }\n\t\t\t\tnotices={ notices }\n\t\t\t\tonDoubleClick={ onDoubleClick }\n\t\t\t\tpreview={ mediaPreview }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t\t{ children }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\tconst renderPlaceholder = placeholder ?? defaultRenderPlaceholder;\n\n\tconst renderDropZone = () => {\n\t\tif ( disableDropZone ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn <DropZone onFilesDrop={ onFilesUpload } onDrop={ onDrop } />;\n\t};\n\n\tconst renderCancelLink = () => {\n\t\treturn (\n\t\t\tonCancel && (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"block-editor-media-placeholder__cancel-button\"\n\t\t\t\t\ttitle={ __( 'Cancel' ) }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Button>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderUrlSelectionUI = () => {\n\t\treturn (\n\t\t\tonSelectURL && (\n\t\t\t\t<URLSelectionUI\n\t\t\t\t\tsrc={ src }\n\t\t\t\t\tonChangeSrc={ setSrc }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t/>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderFeaturedImageToggle = () => {\n\t\treturn (\n\t\t\tonToggleFeaturedImage && (\n\t\t\t\t<div className=\"block-editor-media-placeholder__url-input-container\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tclassName=\"block-editor-media-placeholder__button\"\n\t\t\t\t\t\tonClick={ onToggleFeaturedImage }\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Use featured image' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderMediaUploadChecked = () => {\n\t\tconst defaultButton = ( { open } ) => {\n\t\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\topen();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Media Library' ) }\n\t\t\t\t</Button>\n\t\t\t);\n\t\t};\n\t\tconst libraryButton = mediaLibraryButton ?? defaultButton;\n\t\tconst uploadMediaLibraryButton = (\n\t\t\t<MediaUpload\n\t\t\t\taddToGallery={ addToGallery }\n\t\t\t\tgallery={ multiple && onlyAllowsImages() }\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\tmode=\"browse\"\n\t\t\t\tvalue={\n\t\t\t\t\tArray.isArray( value )\n\t\t\t\t\t\t? value.map( ( { id } ) => id )\n\t\t\t\t\t\t: value.id\n\t\t\t\t}\n\t\t\t\trender={ libraryButton }\n\t\t\t/>\n\t\t);\n\n\t\tif ( mediaUpload && isAppender ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{ renderDropZone() }\n\t\t\t\t\t<FormFileUpload\n\t\t\t\t\t\tonChange={ onUpload }\n\t\t\t\t\t\taccept={ accept }\n\t\t\t\t\t\tmultiple={ !! multiple }\n\t\t\t\t\t\trender={ ( { openFileDialog } ) => {\n\t\t\t\t\t\t\tconst content = (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__button',\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__upload-button'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tonClick={ openFileDialog }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Upload' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t{ uploadMediaLibraryButton }\n\t\t\t\t\t\t\t\t\t{ renderUrlSelectionUI() }\n\t\t\t\t\t\t\t\t\t{ renderFeaturedImageToggle() }\n\t\t\t\t\t\t\t\t\t{ renderCancelLink() }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn renderPlaceholder( content );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\tif ( mediaUpload ) {\n\t\t\tconst content = (\n\t\t\t\t<>\n\t\t\t\t\t{ renderDropZone() }\n\t\t\t\t\t<FormFileUpload\n\t\t\t\t\t\trender={ ( { openFileDialog } ) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tonClick={ openFileDialog }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__button',\n\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__upload-button'\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\t{ __( 'Upload' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ onUpload }\n\t\t\t\t\t\taccept={ accept }\n\t\t\t\t\t\tmultiple={ !! multiple }\n\t\t\t\t\t/>\n\t\t\t\t\t{ uploadMediaLibraryButton }\n\t\t\t\t\t{ renderUrlSelectionUI() }\n\t\t\t\t\t{ renderFeaturedImageToggle() }\n\t\t\t\t\t{ renderCancelLink() }\n\t\t\t\t</>\n\t\t\t);\n\t\t\treturn renderPlaceholder( content );\n\t\t}\n\n\t\treturn renderPlaceholder( uploadMediaLibraryButton );\n\t};\n\n\tif ( disableMediaButtons ) {\n\t\treturn <MediaUploadCheck>{ renderDropZone() }</MediaUploadCheck>;\n\t}\n\n\treturn (\n\t\t<MediaUploadCheck\n\t\t\tfallback={ renderPlaceholder( renderUrlSelectionUI() ) }\n\t\t>\n\t\t\t{ renderMediaUploadChecked() }\n\t\t</MediaUploadCheck>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-placeholder/README.md\n */\nexport default withFilters( 'editor.MediaPlaceholder' )( MediaPlaceholder );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AASA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AAKA,IAAAQ,YAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,MAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,WAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAAwD,IAAAY,WAAA,GAAAZ,OAAA;AA9BxD;AACA;AACA;;AAGA;AACA;AACA;;AAiBA;AACA;AACA;;AAMA,MAAMa,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,MAAMC,oBAAoB,GAAGA,CAAE;EAC9BC,GAAG;EACHC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC;AACD,CAAC,kBACA,IAAAP,WAAA,CAAAQ,GAAA,EAACV,WAAA,CAAAW,OAAU;EAACC,MAAM,EAAGH,aAAe;EAACD,OAAO,EAAGA,OAAS;EAAAK,QAAA,eACvD,IAAAX,WAAA,CAAAQ,GAAA;IACCI,SAAS,EAAC,gDAAgD;IAC1DP,QAAQ,EAAGA,QAAU;IAAAM,QAAA,eAErB,IAAAX,WAAA,CAAAQ,GAAA,EAACnB,WAAA,CAAAwB,0BAAY;MACZC,qBAAqB;MACrBC,KAAK,EAAG,IAAAC,QAAE,EAAE,KAAM,CA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* Internal dependencies
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
|
-
const BORDER_SUPPORT_KEY = exports.BORDER_SUPPORT_KEY = '
|
|
42
|
+
const BORDER_SUPPORT_KEY = exports.BORDER_SUPPORT_KEY = 'border';
|
|
43
43
|
const SHADOW_SUPPORT_KEY = exports.SHADOW_SUPPORT_KEY = 'shadow';
|
|
44
44
|
const getColorByProperty = (colors, property, value) => {
|
|
45
45
|
let matchedColor;
|
|
@@ -173,8 +173,8 @@ function BorderPanel({
|
|
|
173
173
|
return null;
|
|
174
174
|
}
|
|
175
175
|
const defaultControls = {
|
|
176
|
-
...(0, _blocks.getBlockSupport)(name, [BORDER_SUPPORT_KEY, '
|
|
177
|
-
...(0, _blocks.getBlockSupport)(name, [SHADOW_SUPPORT_KEY, '
|
|
176
|
+
...(0, _blocks.getBlockSupport)(name, [BORDER_SUPPORT_KEY, 'defaultControls']),
|
|
177
|
+
...(0, _blocks.getBlockSupport)(name, [SHADOW_SUPPORT_KEY, 'defaultControls'])
|
|
178
178
|
};
|
|
179
179
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_globalStyles.BorderPanel, {
|
|
180
180
|
as: BordersInspectorControl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blocks","_components","_element","_hooks","_data","_colors","_inspectorControls","_useMultipleOriginColorsAndGradients","_utils","_globalStyles","_store","_i18n","_jsxRuntime","BORDER_SUPPORT_KEY","exports","SHADOW_SUPPORT_KEY","getColorByProperty","colors","property","value","matchedColor","some","origin","color","getMultiOriginColor","namedColor","customColor","colorObject","undefined","getColorSlugFromVariable","exec","styleToAttributes","style","hasSplitBorders","border","borderColor","borderColorValue","borderColorSlug","startsWith","substring","length","updatedStyle","cleanEmptyObject","attributesToStyle","attributes","BordersInspectorControl","label","children","resetAllFilter","attributesResetAllFilter","useCallback","existingStyle","jsx","default","group","BorderPanel","clientId","name","setAttributes","settings","isEnabled","useHasBorderPanel","selector","select","blockEditorStore","getBlockAttributes","useSelect","useMemo","onChange","newStyle","defaultControls","getBlockSupport","as","panelId","hasBorderSupport","blockName","feature","Platform","OS","support","radius","width","hasShadowSupport","hasBlockSupport","useBorderPanelLabel","hasBorderControl","hasShadowControl","useBlockSettings","controls","useHasBorderPanelControls","hasBorderColor","hasBorderStyle","hasBorderWidth","hasBorderRadius","hasShadow","__","removeBorderAttribute","attribute","addAttributes","type","addSaveProps","props","blockNameOrType","shouldSkipSerialization","borderClasses","getBorderClasses","newClassName","clsx","className","borderColorClass","getColorClassName","useBlockProps","useMultipleOriginColorsAndGradients","borderTopColor","top","borderRightColor","right","borderBottomColor","bottom","borderLeftColor","left","extraStyles","_default","attributeKeys","hasSupport","addFilter"],"sources":["@wordpress/block-editor/src/hooks/border.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport, getBlockSupport } from '@wordpress/blocks';\nimport { __experimentalHasSplitBorders as hasSplitBorders } from '@wordpress/components';\nimport { Platform, useCallback, useMemo } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getColorClassName } from '../components/colors';\nimport InspectorControls from '../components/inspector-controls';\nimport useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';\nimport {\n\tcleanEmptyObject,\n\tshouldSkipSerialization,\n\tuseBlockSettings,\n} from './utils';\nimport {\n\tuseHasBorderPanel,\n\tuseHasBorderPanelControls,\n\tBorderPanel as StylesBorderPanel,\n} from '../components/global-styles';\nimport { store as blockEditorStore } from '../store';\nimport { __ } from '@wordpress/i18n';\n\nexport const BORDER_SUPPORT_KEY = '__experimentalBorder';\nexport const SHADOW_SUPPORT_KEY = 'shadow';\n\nconst getColorByProperty = ( colors, property, value ) => {\n\tlet matchedColor;\n\n\tcolors.some( ( origin ) =>\n\t\torigin.colors.some( ( color ) => {\n\t\t\tif ( color[ property ] === value ) {\n\t\t\t\tmatchedColor = color;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t} )\n\t);\n\n\treturn matchedColor;\n};\n\nexport const getMultiOriginColor = ( { colors, namedColor, customColor } ) => {\n\t// Search each origin (default, theme, or user) for matching color by name.\n\tif ( namedColor ) {\n\t\tconst colorObject = getColorByProperty( colors, 'slug', namedColor );\n\t\tif ( colorObject ) {\n\t\t\treturn colorObject;\n\t\t}\n\t}\n\n\t// Skip if no custom color or matching named color.\n\tif ( ! customColor ) {\n\t\treturn { color: undefined };\n\t}\n\n\t// Attempt to find color via custom color value or build new object.\n\tconst colorObject = getColorByProperty( colors, 'color', customColor );\n\treturn colorObject ? colorObject : { color: customColor };\n};\n\nfunction getColorSlugFromVariable( value ) {\n\tconst namedColor = /var:preset\\|color\\|(.+)/.exec( value );\n\tif ( namedColor && namedColor[ 1 ] ) {\n\t\treturn namedColor[ 1 ];\n\t}\n\treturn null;\n}\n\nfunction styleToAttributes( style ) {\n\tif ( hasSplitBorders( style?.border ) ) {\n\t\treturn {\n\t\t\tstyle,\n\t\t\tborderColor: undefined,\n\t\t};\n\t}\n\n\tconst borderColorValue = style?.border?.color;\n\tconst borderColorSlug = borderColorValue?.startsWith( 'var:preset|color|' )\n\t\t? borderColorValue.substring( 'var:preset|color|'.length )\n\t\t: undefined;\n\tconst updatedStyle = { ...style };\n\tupdatedStyle.border = {\n\t\t...updatedStyle.border,\n\t\tcolor: borderColorSlug ? undefined : borderColorValue,\n\t};\n\treturn {\n\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\tborderColor: borderColorSlug,\n\t};\n}\n\nfunction attributesToStyle( attributes ) {\n\tif ( hasSplitBorders( attributes.style?.border ) ) {\n\t\treturn attributes.style;\n\t}\n\treturn {\n\t\t...attributes.style,\n\t\tborder: {\n\t\t\t...attributes.style?.border,\n\t\t\tcolor: attributes.borderColor\n\t\t\t\t? 'var:preset|color|' + attributes.borderColor\n\t\t\t\t: attributes.style?.border?.color,\n\t\t},\n\t};\n}\n\nfunction BordersInspectorControl( { label, children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributesToStyle( attributes );\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...styleToAttributes( updatedStyle ),\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"border\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t\tlabel={ label }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function BorderPanel( { clientId, name, setAttributes, settings } ) {\n\tconst isEnabled = useHasBorderPanel( settings );\n\tfunction selector( select ) {\n\t\tconst { style, borderColor } =\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId ) || {};\n\t\treturn { style, borderColor };\n\t}\n\tconst { style, borderColor } = useSelect( selector, [ clientId ] );\n\tconst value = useMemo( () => {\n\t\treturn attributesToStyle( { style, borderColor } );\n\t}, [ style, borderColor ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( styleToAttributes( newStyle ) );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = {\n\t\t...getBlockSupport( name, [\n\t\t\tBORDER_SUPPORT_KEY,\n\t\t\t'__experimentalDefaultControls',\n\t\t] ),\n\t\t...getBlockSupport( name, [\n\t\t\tSHADOW_SUPPORT_KEY,\n\t\t\t'__experimentalDefaultControls',\n\t\t] ),\n\t};\n\n\treturn (\n\t\t<StylesBorderPanel\n\t\t\tas={ BordersInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tsettings={ settings }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t/>\n\t);\n}\n\n/**\n * Determine whether there is block support for border properties.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Border feature to check support for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBorderSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, BORDER_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn !! (\n\t\t\tsupport?.color ||\n\t\t\tsupport?.radius ||\n\t\t\tsupport?.width ||\n\t\t\tsupport?.style\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\n/**\n * Determine whether there is block support for shadow properties.\n *\n * @param {string} blockName Block name.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasShadowSupport( blockName ) {\n\treturn hasBlockSupport( blockName, SHADOW_SUPPORT_KEY );\n}\n\nexport function useBorderPanelLabel( {\n\tblockName,\n\thasBorderControl,\n\thasShadowControl,\n} = {} ) {\n\tconst settings = useBlockSettings( blockName );\n\tconst controls = useHasBorderPanelControls( settings );\n\n\tif ( ! hasBorderControl && ! hasShadowControl && blockName ) {\n\t\thasBorderControl =\n\t\t\tcontrols?.hasBorderColor ||\n\t\t\tcontrols?.hasBorderStyle ||\n\t\t\tcontrols?.hasBorderWidth ||\n\t\t\tcontrols?.hasBorderRadius;\n\t\thasShadowControl = controls?.hasShadow;\n\t}\n\n\tif ( hasBorderControl && hasShadowControl ) {\n\t\treturn __( 'Border & Shadow' );\n\t}\n\n\tif ( hasShadowControl ) {\n\t\treturn __( 'Shadow' );\n\t}\n\n\treturn __( 'Border' );\n}\n\n/**\n * Returns a new style object where the specified border attribute has been\n * removed.\n *\n * @param {Object} style Styles from block attributes.\n * @param {string} attribute The border style attribute to clear.\n *\n * @return {Object} Style object with the specified attribute removed.\n */\nexport function removeBorderAttribute( style, attribute ) {\n\treturn cleanEmptyObject( {\n\t\t...style,\n\t\tborder: {\n\t\t\t...style?.border,\n\t\t\t[ attribute ]: undefined,\n\t\t},\n\t} );\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * `borderColor` if needed.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Updated block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBorderSupport( settings, 'color' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify default value if needed.\n\tif ( settings.attributes.borderColor ) {\n\t\treturn settings;\n\t}\n\n\t// Add new borderColor attribute to block settings.\n\treturn {\n\t\t...settings,\n\t\tattributes: {\n\t\t\t...settings.attributes,\n\t\t\tborderColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * Override props assigned to save component to inject border color.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object|string} blockNameOrType Block type definition.\n * @param {Object} attributes Block's attributes.\n *\n * @return {Object} Filtered props to apply to save element.\n */\nfunction addSaveProps( props, blockNameOrType, attributes ) {\n\tif (\n\t\t! hasBorderSupport( blockNameOrType, 'color' ) ||\n\t\tshouldSkipSerialization( blockNameOrType, BORDER_SUPPORT_KEY, 'color' )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst borderClasses = getBorderClasses( attributes );\n\tconst newClassName = clsx( props.className, borderClasses );\n\n\t// If we are clearing the last of the previous classes in `className`\n\t// set it to `undefined` to avoid rendering empty DOM attributes.\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Generates a CSS class name consisting of all the applicable border color\n * classes given the current block attributes.\n *\n * @param {Object} attributes Block's attributes.\n *\n * @return {string} CSS class name.\n */\nexport function getBorderClasses( attributes ) {\n\tconst { borderColor, style } = attributes;\n\tconst borderColorClass = getColorClassName( 'border-color', borderColor );\n\n\treturn clsx( {\n\t\t'has-border-color': borderColor || style?.border?.color,\n\t\t[ borderColorClass ]: !! borderColorClass,\n\t} );\n}\n\nfunction useBlockProps( { name, borderColor, style } ) {\n\tconst { colors } = useMultipleOriginColorsAndGradients();\n\n\tif (\n\t\t! hasBorderSupport( name, 'color' ) ||\n\t\tshouldSkipSerialization( name, BORDER_SUPPORT_KEY, 'color' )\n\t) {\n\t\treturn {};\n\t}\n\n\tconst { color: borderColorValue } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: borderColor,\n\t} );\n\tconst { color: borderTopColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.top?.color ),\n\t} );\n\tconst { color: borderRightColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.right?.color ),\n\t} );\n\n\tconst { color: borderBottomColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.bottom?.color ),\n\t} );\n\tconst { color: borderLeftColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.left?.color ),\n\t} );\n\n\tconst extraStyles = {\n\t\tborderTopColor: borderTopColor || borderColorValue,\n\t\tborderRightColor: borderRightColor || borderColorValue,\n\t\tborderBottomColor: borderBottomColor || borderColorValue,\n\t\tborderLeftColor: borderLeftColor || borderColorValue,\n\t};\n\n\treturn addSaveProps(\n\t\t{ style: cleanEmptyObject( extraStyles ) || {} },\n\t\tname,\n\t\t{ borderColor, style }\n\t);\n}\n\nexport default {\n\tuseBlockProps,\n\taddSaveProps,\n\tattributeKeys: [ 'borderColor', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBorderSupport( name, 'color' );\n\t},\n};\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/border/addAttributes',\n\taddAttributes\n);\n"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,O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ACvDP,MAAM;IACNQ,UAAU,EAAEI,wBAAwB,CAAEG,KAAK,EAAEE,MAAM,EAAEsF,IAAI,EAAEjG,KAAM;EAClE,CAAE,CAAC;EAEH,MAAMkG,WAAW,GAAG;IACnBR,cAAc,EAAEA,cAAc,IAAI7E,gBAAgB;IAClD+E,gBAAgB,EAAEA,gBAAgB,IAAI/E,gBAAgB;IACtDiF,iBAAiB,EAAEA,iBAAiB,IAAIjF,gBAAgB;IACxDmF,eAAe,EAAEA,eAAe,IAAInF;EACrC,CAAC;EAED,OAAOgE,YAAY,CAClB;IAAEpE,KAAK,EAAE,IAAAU,uBAAgB,EAAE+E,WAAY,CAAC,IAAI,CAAC;EAAE,CAAC,EAChDhE,IAAI,EACJ;IAAEtB,WAAW;IAAEH;EAAM,CACtB,CAAC;AACF;AAAC,IAAA0F,QAAA,GAAA5G,OAAA,CAAAuC,OAAA,GAEc;EACd0D,aAAa;EACbX,YAAY;EACZuB,aAAa,EAAE,CAAE,aAAa,EAAE,OAAO,CAAE;EACzCC,UAAUA,CAAEnE,IAAI,EAAG;IAClB,OAAOiB,gBAAgB,CAAEjB,IAAI,EAAE,OAAQ,CAAC;EACzC;AACD,CAAC;AAED,IAAAoE,gBAAS,EACR,0BAA0B,EAC1B,2BAA2B,EAC3B3B,aACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blocks","_components","_element","_hooks","_data","_colors","_inspectorControls","_useMultipleOriginColorsAndGradients","_utils","_globalStyles","_store","_i18n","_jsxRuntime","BORDER_SUPPORT_KEY","exports","SHADOW_SUPPORT_KEY","getColorByProperty","colors","property","value","matchedColor","some","origin","color","getMultiOriginColor","namedColor","customColor","colorObject","undefined","getColorSlugFromVariable","exec","styleToAttributes","style","hasSplitBorders","border","borderColor","borderColorValue","borderColorSlug","startsWith","substring","length","updatedStyle","cleanEmptyObject","attributesToStyle","attributes","BordersInspectorControl","label","children","resetAllFilter","attributesResetAllFilter","useCallback","existingStyle","jsx","default","group","BorderPanel","clientId","name","setAttributes","settings","isEnabled","useHasBorderPanel","selector","select","blockEditorStore","getBlockAttributes","useSelect","useMemo","onChange","newStyle","defaultControls","getBlockSupport","as","panelId","hasBorderSupport","blockName","feature","Platform","OS","support","radius","width","hasShadowSupport","hasBlockSupport","useBorderPanelLabel","hasBorderControl","hasShadowControl","useBlockSettings","controls","useHasBorderPanelControls","hasBorderColor","hasBorderStyle","hasBorderWidth","hasBorderRadius","hasShadow","__","removeBorderAttribute","attribute","addAttributes","type","addSaveProps","props","blockNameOrType","shouldSkipSerialization","borderClasses","getBorderClasses","newClassName","clsx","className","borderColorClass","getColorClassName","useBlockProps","useMultipleOriginColorsAndGradients","borderTopColor","top","borderRightColor","right","borderBottomColor","bottom","borderLeftColor","left","extraStyles","_default","attributeKeys","hasSupport","addFilter"],"sources":["@wordpress/block-editor/src/hooks/border.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport, getBlockSupport } from '@wordpress/blocks';\nimport { __experimentalHasSplitBorders as hasSplitBorders } from '@wordpress/components';\nimport { Platform, useCallback, useMemo } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getColorClassName } from '../components/colors';\nimport InspectorControls from '../components/inspector-controls';\nimport useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';\nimport {\n\tcleanEmptyObject,\n\tshouldSkipSerialization,\n\tuseBlockSettings,\n} from './utils';\nimport {\n\tuseHasBorderPanel,\n\tuseHasBorderPanelControls,\n\tBorderPanel as StylesBorderPanel,\n} from '../components/global-styles';\nimport { store as blockEditorStore } from '../store';\nimport { __ } from '@wordpress/i18n';\n\nexport const BORDER_SUPPORT_KEY = 'border';\nexport const SHADOW_SUPPORT_KEY = 'shadow';\n\nconst getColorByProperty = ( colors, property, value ) => {\n\tlet matchedColor;\n\n\tcolors.some( ( origin ) =>\n\t\torigin.colors.some( ( color ) => {\n\t\t\tif ( color[ property ] === value ) {\n\t\t\t\tmatchedColor = color;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t} )\n\t);\n\n\treturn matchedColor;\n};\n\nexport const getMultiOriginColor = ( { colors, namedColor, customColor } ) => {\n\t// Search each origin (default, theme, or user) for matching color by name.\n\tif ( namedColor ) {\n\t\tconst colorObject = getColorByProperty( colors, 'slug', namedColor );\n\t\tif ( colorObject ) {\n\t\t\treturn colorObject;\n\t\t}\n\t}\n\n\t// Skip if no custom color or matching named color.\n\tif ( ! customColor ) {\n\t\treturn { color: undefined };\n\t}\n\n\t// Attempt to find color via custom color value or build new object.\n\tconst colorObject = getColorByProperty( colors, 'color', customColor );\n\treturn colorObject ? colorObject : { color: customColor };\n};\n\nfunction getColorSlugFromVariable( value ) {\n\tconst namedColor = /var:preset\\|color\\|(.+)/.exec( value );\n\tif ( namedColor && namedColor[ 1 ] ) {\n\t\treturn namedColor[ 1 ];\n\t}\n\treturn null;\n}\n\nfunction styleToAttributes( style ) {\n\tif ( hasSplitBorders( style?.border ) ) {\n\t\treturn {\n\t\t\tstyle,\n\t\t\tborderColor: undefined,\n\t\t};\n\t}\n\n\tconst borderColorValue = style?.border?.color;\n\tconst borderColorSlug = borderColorValue?.startsWith( 'var:preset|color|' )\n\t\t? borderColorValue.substring( 'var:preset|color|'.length )\n\t\t: undefined;\n\tconst updatedStyle = { ...style };\n\tupdatedStyle.border = {\n\t\t...updatedStyle.border,\n\t\tcolor: borderColorSlug ? undefined : borderColorValue,\n\t};\n\treturn {\n\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\tborderColor: borderColorSlug,\n\t};\n}\n\nfunction attributesToStyle( attributes ) {\n\tif ( hasSplitBorders( attributes.style?.border ) ) {\n\t\treturn attributes.style;\n\t}\n\treturn {\n\t\t...attributes.style,\n\t\tborder: {\n\t\t\t...attributes.style?.border,\n\t\t\tcolor: attributes.borderColor\n\t\t\t\t? 'var:preset|color|' + attributes.borderColor\n\t\t\t\t: attributes.style?.border?.color,\n\t\t},\n\t};\n}\n\nfunction BordersInspectorControl( { label, children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributesToStyle( attributes );\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...styleToAttributes( updatedStyle ),\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"border\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t\tlabel={ label }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function BorderPanel( { clientId, name, setAttributes, settings } ) {\n\tconst isEnabled = useHasBorderPanel( settings );\n\tfunction selector( select ) {\n\t\tconst { style, borderColor } =\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId ) || {};\n\t\treturn { style, borderColor };\n\t}\n\tconst { style, borderColor } = useSelect( selector, [ clientId ] );\n\tconst value = useMemo( () => {\n\t\treturn attributesToStyle( { style, borderColor } );\n\t}, [ style, borderColor ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( styleToAttributes( newStyle ) );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = {\n\t\t...getBlockSupport( name, [ BORDER_SUPPORT_KEY, 'defaultControls' ] ),\n\t\t...getBlockSupport( name, [ SHADOW_SUPPORT_KEY, 'defaultControls' ] ),\n\t};\n\n\treturn (\n\t\t<StylesBorderPanel\n\t\t\tas={ BordersInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tsettings={ settings }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t/>\n\t);\n}\n\n/**\n * Determine whether there is block support for border properties.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Border feature to check support for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBorderSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, BORDER_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn !! (\n\t\t\tsupport?.color ||\n\t\t\tsupport?.radius ||\n\t\t\tsupport?.width ||\n\t\t\tsupport?.style\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\n/**\n * Determine whether there is block support for shadow properties.\n *\n * @param {string} blockName Block name.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasShadowSupport( blockName ) {\n\treturn hasBlockSupport( blockName, SHADOW_SUPPORT_KEY );\n}\n\nexport function useBorderPanelLabel( {\n\tblockName,\n\thasBorderControl,\n\thasShadowControl,\n} = {} ) {\n\tconst settings = useBlockSettings( blockName );\n\tconst controls = useHasBorderPanelControls( settings );\n\n\tif ( ! hasBorderControl && ! hasShadowControl && blockName ) {\n\t\thasBorderControl =\n\t\t\tcontrols?.hasBorderColor ||\n\t\t\tcontrols?.hasBorderStyle ||\n\t\t\tcontrols?.hasBorderWidth ||\n\t\t\tcontrols?.hasBorderRadius;\n\t\thasShadowControl = controls?.hasShadow;\n\t}\n\n\tif ( hasBorderControl && hasShadowControl ) {\n\t\treturn __( 'Border & Shadow' );\n\t}\n\n\tif ( hasShadowControl ) {\n\t\treturn __( 'Shadow' );\n\t}\n\n\treturn __( 'Border' );\n}\n\n/**\n * Returns a new style object where the specified border attribute has been\n * removed.\n *\n * @param {Object} style Styles from block attributes.\n * @param {string} attribute The border style attribute to clear.\n *\n * @return {Object} Style object with the specified attribute removed.\n */\nexport function removeBorderAttribute( style, attribute ) {\n\treturn cleanEmptyObject( {\n\t\t...style,\n\t\tborder: {\n\t\t\t...style?.border,\n\t\t\t[ attribute ]: undefined,\n\t\t},\n\t} );\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * `borderColor` if needed.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Updated block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBorderSupport( settings, 'color' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify default value if needed.\n\tif ( settings.attributes.borderColor ) {\n\t\treturn settings;\n\t}\n\n\t// Add new borderColor attribute to block settings.\n\treturn {\n\t\t...settings,\n\t\tattributes: {\n\t\t\t...settings.attributes,\n\t\t\tborderColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * Override props assigned to save component to inject border color.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object|string} blockNameOrType Block type definition.\n * @param {Object} attributes Block's attributes.\n *\n * @return {Object} Filtered props to apply to save element.\n */\nfunction addSaveProps( props, blockNameOrType, attributes ) {\n\tif (\n\t\t! hasBorderSupport( blockNameOrType, 'color' ) ||\n\t\tshouldSkipSerialization( blockNameOrType, BORDER_SUPPORT_KEY, 'color' )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst borderClasses = getBorderClasses( attributes );\n\tconst newClassName = clsx( props.className, borderClasses );\n\n\t// If we are clearing the last of the previous classes in `className`\n\t// set it to `undefined` to avoid rendering empty DOM attributes.\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Generates a CSS class name consisting of all the applicable border color\n * classes given the current block attributes.\n *\n * @param {Object} attributes Block's attributes.\n *\n * @return {string} CSS class name.\n */\nexport function getBorderClasses( attributes ) {\n\tconst { borderColor, style } = attributes;\n\tconst borderColorClass = getColorClassName( 'border-color', borderColor );\n\n\treturn clsx( {\n\t\t'has-border-color': borderColor || style?.border?.color,\n\t\t[ borderColorClass ]: !! borderColorClass,\n\t} );\n}\n\nfunction useBlockProps( { name, borderColor, style } ) {\n\tconst { colors } = useMultipleOriginColorsAndGradients();\n\n\tif (\n\t\t! hasBorderSupport( name, 'color' ) ||\n\t\tshouldSkipSerialization( name, BORDER_SUPPORT_KEY, 'color' )\n\t) {\n\t\treturn {};\n\t}\n\n\tconst { color: borderColorValue } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: borderColor,\n\t} );\n\tconst { color: borderTopColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.top?.color ),\n\t} );\n\tconst { color: borderRightColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.right?.color ),\n\t} );\n\n\tconst { color: borderBottomColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.bottom?.color ),\n\t} );\n\tconst { color: borderLeftColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.left?.color ),\n\t} );\n\n\tconst extraStyles = {\n\t\tborderTopColor: borderTopColor || borderColorValue,\n\t\tborderRightColor: borderRightColor || borderColorValue,\n\t\tborderBottomColor: borderBottomColor || borderColorValue,\n\t\tborderLeftColor: borderLeftColor || borderColorValue,\n\t};\n\n\treturn addSaveProps(\n\t\t{ style: cleanEmptyObject( extraStyles ) || {} },\n\t\tname,\n\t\t{ borderColor, style }\n\t);\n}\n\nexport default {\n\tuseBlockProps,\n\taddSaveProps,\n\tattributeKeys: [ 'borderColor', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBorderSupport( name, 'color' );\n\t},\n};\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/border/addAttributes',\n\taddAttributes\n);\n"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;A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AAM;IACNQ,UAAU,EAAEI,wBAAwB,CAAEG,KAAK,EAAEE,MAAM,EAAEsF,IAAI,EAAEjG,KAAM;EAClE,CAAE,CAAC;EAEH,MAAMkG,WAAW,GAAG;IACnBR,cAAc,EAAEA,cAAc,IAAI7E,gBAAgB;IAClD+E,gBAAgB,EAAEA,gBAAgB,IAAI/E,gBAAgB;IACtDiF,iBAAiB,EAAEA,iBAAiB,IAAIjF,gBAAgB;IACxDmF,eAAe,EAAEA,eAAe,IAAInF;EACrC,CAAC;EAED,OAAOgE,YAAY,CAClB;IAAEpE,KAAK,EAAE,IAAAU,uBAAgB,EAAE+E,WAAY,CAAC,IAAI,CAAC;EAAE,CAAC,EAChDhE,IAAI,EACJ;IAAEtB,WAAW;IAAEH;EAAM,CACtB,CAAC;AACF;AAAC,IAAA0F,QAAA,GAAA5G,OAAA,CAAAuC,OAAA,GAEc;EACd0D,aAAa;EACbX,YAAY;EACZuB,aAAa,EAAE,CAAE,aAAa,EAAE,OAAO,CAAE;EACzCC,UAAUA,CAAEnE,IAAI,EAAG;IAClB,OAAOiB,gBAAgB,CAAEjB,IAAI,EAAE,OAAQ,CAAC;EACzC;AACD,CAAC;AAED,IAAAoE,gBAAS,EACR,0BAA0B,EAC1B,2BAA2B,EAC3B3B,aACD,CAAC","ignoreList":[]}
|
package/build/hooks/color.js
CHANGED
|
@@ -236,7 +236,7 @@ function ColorEdit({
|
|
|
236
236
|
if (!isEnabled) {
|
|
237
237
|
return null;
|
|
238
238
|
}
|
|
239
|
-
const defaultControls = (0, _blocks.getBlockSupport)(name, [COLOR_SUPPORT_KEY, '
|
|
239
|
+
const defaultControls = (0, _blocks.getBlockSupport)(name, [COLOR_SUPPORT_KEY, 'defaultControls']);
|
|
240
240
|
const enableContrastChecking = _element.Platform.OS === 'web' && !value?.color?.gradient && (settings?.color?.text || settings?.color?.link) &&
|
|
241
241
|
// Contrast checking is enabled by default.
|
|
242
242
|
// Deactivating it requires `enableContrastChecker` to have
|