@wordpress/block-editor 14.2.0 → 14.2.1-next.5368f64a9.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-breadcrumb/index.js +4 -10
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-compare/block-view.js +2 -4
- package/build/components/block-compare/block-view.js.map +1 -1
- package/build/components/block-edit/multiple-usage-warning.js +4 -8
- package/build/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build/components/block-inspector/index.js +0 -2
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.js +2 -4
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-list/index.js +14 -3
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +7 -0
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +98 -0
- package/build/components/block-list/zoom-out-separator.js.map +1 -0
- package/build/components/block-mover/button.js +2 -4
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +2 -4
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +2 -7
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +2 -7
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-switcher/index.js +8 -2
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +2 -7
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +10 -4
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/index.js +1 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +3 -12
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +13 -3
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/button-block-appender/index.js +7 -21
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +2 -11
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/iframe/get-compatibility-styles.js +1 -1
- package/build/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +23 -13
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/index.js +4 -11
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +1 -5
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +1 -5
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +0 -4
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter-listbox/index.js +2 -8
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +2 -10
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inserter-listbox/row.js +1 -9
- package/build/components/inserter-listbox/row.js.map +1 -1
- package/build/components/list-view/index.js +3 -7
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +4 -4
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +27 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/hooks/layout.js +0 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/layouts/constrained.js +5 -6
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +19 -16
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/private-selectors.js +3 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +0 -2
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +4 -10
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-compare/block-view.js +2 -4
- package/build-module/components/block-compare/block-view.js.map +1 -1
- package/build-module/components/block-edit/multiple-usage-warning.js +4 -8
- package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build-module/components/block-inspector/index.js +0 -2
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +2 -4
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/index.js +14 -3
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +8 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +90 -0
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -0
- package/build-module/components/block-mover/button.js +2 -4
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -4
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +2 -7
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +2 -7
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +8 -2
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +2 -7
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +10 -4
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/index.js +1 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +3 -13
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +13 -3
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +8 -23
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +2 -11
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +23 -13
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/index.js +4 -11
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +1 -5
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +2 -6
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +1 -5
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +1 -5
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +3 -11
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inserter-listbox/row.js +2 -10
- package/build-module/components/inserter-listbox/row.js.map +1 -1
- package/build-module/components/list-view/index.js +3 -7
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +4 -4
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +27 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/hooks/layout.js +0 -1
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/layouts/constrained.js +7 -8
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +21 -18
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-selectors.js +3 -3
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +0 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/content-rtl.css +17 -0
- package/build-style/content.css +17 -0
- package/build-style/style-rtl.css +13 -73
- package/build-style/style.css +13 -73
- package/package.json +32 -32
- package/src/components/block-breadcrumb/index.js +2 -6
- package/src/components/block-breadcrumb/style.scss +1 -30
- package/src/components/block-compare/block-view.js +1 -2
- package/src/components/block-compare/test/__snapshots__/block-view.js.snap +1 -1
- package/src/components/block-edit/multiple-usage-warning.js +2 -4
- package/src/components/block-inspector/index.js +0 -1
- package/src/components/block-inspector/style.scss +2 -4
- package/src/components/block-list/block-invalid-warning.js +1 -2
- package/src/components/block-list/content.scss +21 -0
- package/src/components/block-list/index.js +59 -38
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +13 -1
- package/src/components/block-list/zoom-out-separator.js +110 -0
- package/src/components/block-mover/button.js +1 -2
- package/src/components/block-mover/index.js +1 -2
- package/src/components/block-pattern-setup/index.js +3 -11
- package/src/components/block-patterns-list/index.js +3 -8
- package/src/components/block-switcher/index.js +19 -3
- package/src/components/block-switcher/pattern-transformations-menu.js +3 -8
- package/src/components/block-switcher/style.scss +0 -24
- package/src/components/block-toolbar/index.js +10 -3
- package/src/components/block-toolbar/style.scss +4 -1
- package/src/components/block-tools/index.js +1 -1
- package/src/components/block-tools/zoom-out-mode-inserters.js +0 -12
- package/src/components/block-tools/zoom-out-toolbar.js +11 -0
- package/src/components/button-block-appender/index.js +16 -25
- package/src/components/global-styles/shadow-panel-components.js +2 -10
- package/src/components/iframe/get-compatibility-styles.js +6 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +32 -15
- package/src/components/inserter/index.js +4 -10
- package/src/components/inserter/media-tab/media-list.js +1 -4
- package/src/components/inserter/media-tab/media-preview.js +3 -6
- package/src/components/inserter/quick-inserter.js +1 -4
- package/src/components/inserter/style.scss +4 -0
- package/src/components/inserter-listbox/index.js +1 -4
- package/src/components/inserter-listbox/item.js +3 -13
- package/src/components/inserter-listbox/row.js +2 -9
- package/src/components/list-view/index.js +3 -8
- package/src/components/media-placeholder/README.md +2 -2
- package/src/components/media-placeholder/index.js +7 -4
- package/src/components/use-block-drop-zone/index.js +33 -1
- package/src/hooks/layout.js +0 -1
- package/src/hooks/layout.scss +6 -20
- package/src/layouts/constrained.js +9 -7
- package/src/layouts/grid.js +29 -22
- package/src/private-apis.js +0 -2
- package/src/store/private-selectors.js +6 -3
- package/src/store/reducer.js +0 -2
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { Button,
|
|
4
|
+
import { Button, Composite } from '@wordpress/components';
|
|
5
5
|
import { forwardRef } from '@wordpress/element';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { unlock } from '../../lock-unlock';
|
|
11
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
const {
|
|
13
|
-
CompositeItemV2: CompositeItem
|
|
14
|
-
} = unlock(componentsPrivateApis);
|
|
15
7
|
function InserterListboxItem({
|
|
16
8
|
isFirst,
|
|
17
9
|
as: Component,
|
|
18
10
|
children,
|
|
19
11
|
...props
|
|
20
12
|
}, ref) {
|
|
21
|
-
return /*#__PURE__*/_jsx(
|
|
13
|
+
return /*#__PURE__*/_jsx(Composite.Item, {
|
|
22
14
|
ref: ref,
|
|
23
15
|
role: "option"
|
|
24
|
-
// Use the
|
|
16
|
+
// Use the Composite.Item `accessibleWhenDisabled` prop
|
|
25
17
|
// over Button's `isFocusable`. The latter was shown to
|
|
26
18
|
// cause an issue with tab order in the inserter list.
|
|
27
19
|
,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","
|
|
1
|
+
{"version":3,"names":["Button","Composite","forwardRef","jsx","_jsx","InserterListboxItem","isFirst","as","Component","children","props","ref","Item","role","accessibleWhenDisabled","render","htmlProps","propsWithTabIndex","tabIndex","__next40pxDefaultSize"],"sources":["@wordpress/block-editor/src/components/inserter-listbox/item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Composite } from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\n\nfunction InserterListboxItem(\n\t{ isFirst, as: Component, children, ...props },\n\tref\n) {\n\treturn (\n\t\t<Composite.Item\n\t\t\tref={ ref }\n\t\t\trole=\"option\"\n\t\t\t// Use the Composite.Item `accessibleWhenDisabled` prop\n\t\t\t// over Button's `isFocusable`. The latter was shown to\n\t\t\t// cause an issue with tab order in the inserter list.\n\t\t\taccessibleWhenDisabled\n\t\t\t{ ...props }\n\t\t\trender={ ( htmlProps ) => {\n\t\t\t\tconst propsWithTabIndex = {\n\t\t\t\t\t...htmlProps,\n\t\t\t\t\ttabIndex: isFirst ? 0 : htmlProps.tabIndex,\n\t\t\t\t};\n\t\t\t\tif ( Component ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Component { ...propsWithTabIndex }>\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t</Component>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif ( typeof children === 'function' ) {\n\t\t\t\t\treturn children( propsWithTabIndex );\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\t\t{ ...propsWithTabIndex }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( InserterListboxItem );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,SAAS,QAAQ,uBAAuB;AACzD,SAASC,UAAU,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEhD,SAASC,mBAAmBA,CAC3B;EAAEC,OAAO;EAAEC,EAAE,EAAEC,SAAS;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAC9CC,GAAG,EACF;EACD,oBACCP,IAAA,CAACH,SAAS,CAACW,IAAI;IACdD,GAAG,EAAGA,GAAK;IACXE,IAAI,EAAC;IACL;IACA;IACA;IAAA;IACAC,sBAAsB;IAAA,GACjBJ,KAAK;IACVK,MAAM,EAAKC,SAAS,IAAM;MACzB,MAAMC,iBAAiB,GAAG;QACzB,GAAGD,SAAS;QACZE,QAAQ,EAAEZ,OAAO,GAAG,CAAC,GAAGU,SAAS,CAACE;MACnC,CAAC;MACD,IAAKV,SAAS,EAAG;QAChB,oBACCJ,IAAA,CAACI,SAAS;UAAA,GAAMS,iBAAiB;UAAAR,QAAA,EAC9BA;QAAQ,CACA,CAAC;MAEd;MACA,IAAK,OAAOA,QAAQ,KAAK,UAAU,EAAG;QACrC,OAAOA,QAAQ,CAAEQ,iBAAkB,CAAC;MACrC;MACA,oBACCb,IAAA,CAACJ;MACA;MAAA;QACAmB,qBAAqB,EAAG,KAAO;QAAA,GAC1BF,iBAAiB;QAAAR,QAAA,EAEpBA;MAAQ,CACH,CAAC;IAEX;EAAG,CACH,CAAC;AAEJ;AAEA,eAAeP,UAAU,CAAEG,mBAAoB,CAAC","ignoreList":[]}
|
|
@@ -2,18 +2,10 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { forwardRef } from '@wordpress/element';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { unlock } from '../../lock-unlock';
|
|
5
|
+
import { Composite } from '@wordpress/components';
|
|
11
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
const {
|
|
13
|
-
CompositeGroupV2: CompositeGroup
|
|
14
|
-
} = unlock(componentsPrivateApis);
|
|
15
7
|
function InserterListboxRow(props, ref) {
|
|
16
|
-
return /*#__PURE__*/_jsx(
|
|
8
|
+
return /*#__PURE__*/_jsx(Composite.Group, {
|
|
17
9
|
role: "presentation",
|
|
18
10
|
ref: ref,
|
|
19
11
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","
|
|
1
|
+
{"version":3,"names":["forwardRef","Composite","jsx","_jsx","InserterListboxRow","props","ref","Group","role"],"sources":["@wordpress/block-editor/src/components/inserter-listbox/row.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { Composite } from '@wordpress/components';\n\nfunction InserterListboxRow( props, ref ) {\n\treturn <Composite.Group role=\"presentation\" ref={ ref } { ...props } />;\n}\n\nexport default forwardRef( InserterListboxRow );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,SAAS,QAAQ,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElD,SAASC,kBAAkBA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACzC,oBAAOH,IAAA,CAACF,SAAS,CAACM,KAAK;IAACC,IAAI,EAAC,cAAc;IAACF,GAAG,EAAGA,GAAK;IAAA,GAAMD;EAAK,CAAI,CAAC;AACxE;AAEA,eAAeL,UAAU,CAAEI,kBAAmB,CAAC","ignoreList":[]}
|
|
@@ -102,18 +102,15 @@ function ListViewComponent({
|
|
|
102
102
|
getBlock
|
|
103
103
|
} = useSelect(blockEditorStore);
|
|
104
104
|
const {
|
|
105
|
-
visibleBlockCount
|
|
106
|
-
shouldShowInnerBlocks
|
|
105
|
+
visibleBlockCount
|
|
107
106
|
} = useSelect(select => {
|
|
108
107
|
const {
|
|
109
108
|
getGlobalBlockCount,
|
|
110
|
-
getClientIdsOfDescendants
|
|
111
|
-
__unstableGetEditorMode
|
|
109
|
+
getClientIdsOfDescendants
|
|
112
110
|
} = select(blockEditorStore);
|
|
113
111
|
const draggedBlockCount = draggedClientIds?.length > 0 ? getClientIdsOfDescendants(draggedClientIds).length + 1 : 0;
|
|
114
112
|
return {
|
|
115
|
-
visibleBlockCount: getGlobalBlockCount() - draggedBlockCount
|
|
116
|
-
shouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out'
|
|
113
|
+
visibleBlockCount: getGlobalBlockCount() - draggedBlockCount
|
|
117
114
|
};
|
|
118
115
|
}, [draggedClientIds]);
|
|
119
116
|
const {
|
|
@@ -304,7 +301,6 @@ function ListViewComponent({
|
|
|
304
301
|
fixedListWindow: fixedListWindow,
|
|
305
302
|
selectedClientIds: selectedClientIds,
|
|
306
303
|
isExpanded: isExpanded,
|
|
307
|
-
shouldShowInnerBlocks: shouldShowInnerBlocks,
|
|
308
304
|
showAppender: showAppender
|
|
309
305
|
})
|
|
310
306
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useInstanceId","useMergeRefs","__experimentalUseFixedWindowList","useFixedWindowList","__experimentalTreeGrid","TreeGrid","VisuallyHidden","AsyncModeProvider","useSelect","deprecated","useCallback","useEffect","useMemo","useRef","useReducer","forwardRef","useState","__","ListViewBranch","ListViewContext","ListViewDropIndicatorPreview","useBlockSelection","useListViewBlockIndexes","useListViewClientIds","useListViewCollapseItems","useListViewDropZone","useListViewExpandSelectedItem","store","blockEditorStore","BlockSettingsDropdown","focusListItem","useClipboardHandler","jsx","_jsx","jsxs","_jsxs","expanded","state","action","type","Array","isArray","clientIds","reduce","newState","id","BLOCK_LIST_ITEM_HEIGHT","ListViewComponent","blocks","dropZoneElement","showBlockMovers","isExpanded","showAppender","blockSettingsMenu","BlockSettingsMenu","rootClientId","description","onSelect","additionalBlockContent","AdditionalBlockContent","ref","since","alternative","instanceId","clientIdsTree","draggedClientIds","selectedClientIds","blockIndexes","getBlock","visibleBlockCount","shouldShowInnerBlocks","select","getGlobalBlockCount","getClientIdsOfDescendants","__unstableGetEditorMode","draggedBlockCount","length","updateBlockSelection","expandedState","setExpandedState","insertedBlock","setInsertedBlock","setSelectedTreeId","firstSelectedBlockClientId","selectEditorBlock","event","blockClientId","focusPosition","dropZoneRef","target","blockDropTarget","elementRef","clipBoardRef","selectBlock","treeGridRef","current","expand","clientId","collapse","collapseAll","expandRow","row","dataset","block","collapseRow","focusRow","startRow","endRow","shiftKey","firstDraggedBlockClientId","blockDropTargetIndex","blockDropPosition","firstDraggedBlockIndex","_blockDropTargetIndex","_firstDraggedBlockIndex","foundBlockIndex","undefined","dropPosition","contextValue","listViewInstanceId","treeGridElementRef","fixedListWindow","useWindowing","windowOverscan","describedById","value","children","draggedBlockClientId","listViewRef","className","onCollapseRow","onExpandRow","onFocusRow","applicationAriaLabel","style","Provider","parentId","PrivateListView","props"],"sources":["@wordpress/block-editor/src/components/list-view/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseInstanceId,\n\tuseMergeRefs,\n\t__experimentalUseFixedWindowList as useFixedWindowList,\n} from '@wordpress/compose';\nimport {\n\t__experimentalTreeGrid as TreeGrid,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseReducer,\n\tforwardRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewBranch from './branch';\nimport { ListViewContext } from './context';\nimport ListViewDropIndicatorPreview from './drop-indicator';\nimport useBlockSelection from './use-block-selection';\nimport useListViewBlockIndexes from './use-list-view-block-indexes';\nimport useListViewClientIds from './use-list-view-client-ids';\nimport useListViewCollapseItems from './use-list-view-collapse-items';\nimport useListViewDropZone from './use-list-view-drop-zone';\nimport useListViewExpandSelectedItem from './use-list-view-expand-selected-item';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockSettingsDropdown } from '../block-settings-menu/block-settings-dropdown';\nimport { focusListItem } from './utils';\nimport useClipboardHandler from './use-clipboard-handler';\n\nconst expanded = ( state, action ) => {\n\tif ( action.type === 'clear' ) {\n\t\treturn {};\n\t}\n\tif ( Array.isArray( action.clientIds ) ) {\n\t\treturn {\n\t\t\t...state,\n\t\t\t...action.clientIds.reduce(\n\t\t\t\t( newState, id ) => ( {\n\t\t\t\t\t...newState,\n\t\t\t\t\t[ id ]: action.type === 'expand',\n\t\t\t\t} ),\n\t\t\t\t{}\n\t\t\t),\n\t\t};\n\t}\n\treturn state;\n};\n\nexport const BLOCK_LIST_ITEM_HEIGHT = 32;\n\n/** @typedef {import('react').ComponentType} ComponentType */\n/** @typedef {import('react').Ref<HTMLElement>} Ref */\n\n/**\n * Show a hierarchical list of blocks.\n *\n * @param {Object} props Components props.\n * @param {string} props.id An HTML element id for the root element of ListView.\n * @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.\n * @param {?HTMLElement} props.dropZoneElement Optional element to be used as the drop zone.\n * @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.\n * @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.\n * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.\n * @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.\n * @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.\n * @param {string} props.description Optional accessible description for the tree grid component.\n * @param {?Function} props.onSelect Optional callback to be invoked when a block is selected. Receives the block object that was selected.\n * @param {?ComponentType} props.additionalBlockContent Component that renders additional block content UI.\n * @param {Ref} ref Forwarded ref\n */\nfunction ListViewComponent(\n\t{\n\t\tid,\n\t\tblocks,\n\t\tdropZoneElement,\n\t\tshowBlockMovers = false,\n\t\tisExpanded = false,\n\t\tshowAppender = false,\n\t\tblockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,\n\t\trootClientId,\n\t\tdescription,\n\t\tonSelect,\n\t\tadditionalBlockContent: AdditionalBlockContent,\n\t},\n\tref\n) {\n\t// This can be removed once we no longer need to support the blocks prop.\n\tif ( blocks ) {\n\t\tdeprecated(\n\t\t\t'`blocks` property in `wp.blockEditor.__experimentalListView`',\n\t\t\t{\n\t\t\t\tsince: '6.3',\n\t\t\t\talternative: '`rootClientId` property',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst instanceId = useInstanceId( ListViewComponent );\n\tconst { clientIdsTree, draggedClientIds, selectedClientIds } =\n\t\tuseListViewClientIds( { blocks, rootClientId } );\n\tconst blockIndexes = useListViewBlockIndexes( clientIdsTree );\n\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst { visibleBlockCount, shouldShowInnerBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst draggedBlockCount =\n\t\t\t\tdraggedClientIds?.length > 0\n\t\t\t\t\t? getClientIdsOfDescendants( draggedClientIds ).length + 1\n\t\t\t\t\t: 0;\n\t\t\treturn {\n\t\t\t\tvisibleBlockCount: getGlobalBlockCount() - draggedBlockCount,\n\t\t\t\tshouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out',\n\t\t\t};\n\t\t},\n\t\t[ draggedClientIds ]\n\t);\n\n\tconst { updateBlockSelection } = useBlockSelection();\n\n\tconst [ expandedState, setExpandedState ] = useReducer( expanded, {} );\n\n\tconst [ insertedBlock, setInsertedBlock ] = useState( null );\n\n\tconst { setSelectedTreeId } = useListViewExpandSelectedItem( {\n\t\tfirstSelectedBlockClientId: selectedClientIds[ 0 ],\n\t\tsetExpandedState,\n\t} );\n\tconst selectEditorBlock = useCallback(\n\t\t/**\n\t\t * @param {MouseEvent | KeyboardEvent | undefined} event\n\t\t * @param {string} blockClientId\n\t\t * @param {null | undefined | -1 | 1} focusPosition\n\t\t */\n\t\t( event, blockClientId, focusPosition ) => {\n\t\t\tupdateBlockSelection( event, blockClientId, null, focusPosition );\n\t\t\tsetSelectedTreeId( blockClientId );\n\t\t\tif ( onSelect ) {\n\t\t\t\tonSelect( getBlock( blockClientId ) );\n\t\t\t}\n\t\t},\n\t\t[ setSelectedTreeId, updateBlockSelection, onSelect, getBlock ]\n\t);\n\n\tconst { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone( {\n\t\tdropZoneElement,\n\t\texpandedState,\n\t\tsetExpandedState,\n\t} );\n\tconst elementRef = useRef();\n\n\t// Allow handling of copy, cut, and paste events.\n\tconst clipBoardRef = useClipboardHandler( {\n\t\tselectBlock: selectEditorBlock,\n\t} );\n\n\tconst treeGridRef = useMergeRefs( [\n\t\tclipBoardRef,\n\t\telementRef,\n\t\tdropZoneRef,\n\t\tref,\n\t] );\n\n\tuseEffect( () => {\n\t\t// If a blocks are already selected when the list view is initially\n\t\t// mounted, shift focus to the first selected block.\n\t\tif ( selectedClientIds?.length ) {\n\t\t\tfocusListItem( selectedClientIds[ 0 ], elementRef?.current );\n\t\t}\n\t\t// Disable reason: Only focus on the selected item when the list view is mounted.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst expand = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst clientIds = Array.isArray( clientId )\n\t\t\t\t? clientId\n\t\t\t\t: [ clientId ];\n\t\t\tsetExpandedState( { type: 'expand', clientIds } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst collapse = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'collapse', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst collapseAll = useCallback( () => {\n\t\tsetExpandedState( { type: 'clear' } );\n\t}, [ setExpandedState ] );\n\tconst expandRow = useCallback(\n\t\t( row ) => {\n\t\t\texpand( row?.dataset?.block );\n\t\t},\n\t\t[ expand ]\n\t);\n\tconst collapseRow = useCallback(\n\t\t( row ) => {\n\t\t\tcollapse( row?.dataset?.block );\n\t\t},\n\t\t[ collapse ]\n\t);\n\tconst focusRow = useCallback(\n\t\t( event, startRow, endRow ) => {\n\t\t\tif ( event.shiftKey ) {\n\t\t\t\tupdateBlockSelection(\n\t\t\t\t\tevent,\n\t\t\t\t\tstartRow?.dataset?.block,\n\t\t\t\t\tendRow?.dataset?.block\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ updateBlockSelection ]\n\t);\n\n\tuseListViewCollapseItems( {\n\t\tcollapseAll,\n\t\texpand,\n\t} );\n\n\tconst firstDraggedBlockClientId = draggedClientIds?.[ 0 ];\n\n\t// Convert a blockDropTarget into indexes relative to the blocks in the list view.\n\t// These values are used to determine which blocks should be displaced to make room\n\t// for the drop indicator. See `ListViewBranch` and `getDragDisplacementValues`.\n\tconst { blockDropTargetIndex, blockDropPosition, firstDraggedBlockIndex } =\n\t\tuseMemo( () => {\n\t\t\tlet _blockDropTargetIndex, _firstDraggedBlockIndex;\n\n\t\t\tif ( blockDropTarget?.clientId ) {\n\t\t\t\tconst foundBlockIndex =\n\t\t\t\t\tblockIndexes[ blockDropTarget.clientId ];\n\t\t\t\t// If dragging below or inside the block, treat the drop target as the next block.\n\t\t\t\t_blockDropTargetIndex =\n\t\t\t\t\tfoundBlockIndex === undefined ||\n\t\t\t\t\tblockDropTarget?.dropPosition === 'top'\n\t\t\t\t\t\t? foundBlockIndex\n\t\t\t\t\t\t: foundBlockIndex + 1;\n\t\t\t} else if ( blockDropTarget === null ) {\n\t\t\t\t// A `null` value is used to indicate that the user is dragging outside of the list view.\n\t\t\t\t_blockDropTargetIndex = null;\n\t\t\t}\n\n\t\t\tif ( firstDraggedBlockClientId ) {\n\t\t\t\tconst foundBlockIndex =\n\t\t\t\t\tblockIndexes[ firstDraggedBlockClientId ];\n\t\t\t\t_firstDraggedBlockIndex =\n\t\t\t\t\tfoundBlockIndex === undefined ||\n\t\t\t\t\tblockDropTarget?.dropPosition === 'top'\n\t\t\t\t\t\t? foundBlockIndex\n\t\t\t\t\t\t: foundBlockIndex + 1;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tblockDropTargetIndex: _blockDropTargetIndex,\n\t\t\t\tblockDropPosition: blockDropTarget?.dropPosition,\n\t\t\t\tfirstDraggedBlockIndex: _firstDraggedBlockIndex,\n\t\t\t};\n\t\t}, [ blockDropTarget, blockIndexes, firstDraggedBlockClientId ] );\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tblockDropPosition,\n\t\t\tblockDropTargetIndex,\n\t\t\tblockIndexes,\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tfirstDraggedBlockIndex,\n\t\t\tcollapse,\n\t\t\tcollapseAll,\n\t\t\tBlockSettingsMenu,\n\t\t\tlistViewInstanceId: instanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\ttreeGridElementRef: elementRef,\n\t\t\trootClientId,\n\t\t} ),\n\t\t[\n\t\t\tblockDropPosition,\n\t\t\tblockDropTargetIndex,\n\t\t\tblockIndexes,\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tfirstDraggedBlockIndex,\n\t\t\tcollapse,\n\t\t\tcollapseAll,\n\t\t\tBlockSettingsMenu,\n\t\t\tinstanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\trootClientId,\n\t\t]\n\t);\n\n\t// List View renders a fixed number of items and relies on each having a fixed item height of 36px.\n\t// If this value changes, we should also change the itemHeight value set in useFixedWindowList.\n\t// See: https://github.com/WordPress/gutenberg/pull/35230 for additional context.\n\tconst [ fixedListWindow ] = useFixedWindowList(\n\t\telementRef,\n\t\tBLOCK_LIST_ITEM_HEIGHT,\n\t\tvisibleBlockCount,\n\t\t{\n\t\t\t// Ensure that the windowing logic is recalculated when the expanded state changes.\n\t\t\t// This is necessary because expanding a collapsed block in a short list view can\n\t\t\t// switch the list view to a tall list view with a scrollbar, and vice versa.\n\t\t\t// When this happens, the windowing logic needs to be recalculated to ensure that\n\t\t\t// the correct number of blocks are rendered, by rechecking for a scroll container.\n\t\t\texpandedState,\n\t\t\tuseWindowing: true,\n\t\t\twindowOverscan: 40,\n\t\t}\n\t);\n\n\t// If there are no blocks to show and we're not showing the appender, do not render the list view.\n\tif ( ! clientIdsTree.length && ! showAppender ) {\n\t\treturn null;\n\t}\n\n\tconst describedById =\n\t\tdescription && `block-editor-list-view-description-${ instanceId }`;\n\n\treturn (\n\t\t<AsyncModeProvider value>\n\t\t\t<ListViewDropIndicatorPreview\n\t\t\t\tdraggedBlockClientId={ firstDraggedBlockClientId }\n\t\t\t\tlistViewRef={ elementRef }\n\t\t\t\tblockDropTarget={ blockDropTarget }\n\t\t\t/>\n\t\t\t{ description && (\n\t\t\t\t<VisuallyHidden id={ describedById }>\n\t\t\t\t\t{ description }\n\t\t\t\t</VisuallyHidden>\n\t\t\t) }\n\t\t\t<TreeGrid\n\t\t\t\tid={ id }\n\t\t\t\tclassName={ clsx( 'block-editor-list-view-tree', {\n\t\t\t\t\t'is-dragging':\n\t\t\t\t\t\tdraggedClientIds?.length > 0 &&\n\t\t\t\t\t\tblockDropTargetIndex !== undefined,\n\t\t\t\t} ) }\n\t\t\t\taria-label={ __( 'Block navigation structure' ) }\n\t\t\t\tref={ treeGridRef }\n\t\t\t\tonCollapseRow={ collapseRow }\n\t\t\t\tonExpandRow={ expandRow }\n\t\t\t\tonFocusRow={ focusRow }\n\t\t\t\tapplicationAriaLabel={ __( 'Block navigation structure' ) }\n\t\t\t\taria-describedby={ describedById }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-admin--list-view-dragged-items-height':\n\t\t\t\t\t\tdraggedClientIds?.length\n\t\t\t\t\t\t\t? `${\n\t\t\t\t\t\t\t\t\tBLOCK_LIST_ITEM_HEIGHT *\n\t\t\t\t\t\t\t\t\t( draggedClientIds.length - 1 )\n\t\t\t\t\t\t\t }px`\n\t\t\t\t\t\t\t: null,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ListViewContext.Provider value={ contextValue }>\n\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\t\t\tparentId={ rootClientId }\n\t\t\t\t\t\tselectBlock={ selectEditorBlock }\n\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\tshouldShowInnerBlocks={ shouldShowInnerBlocks }\n\t\t\t\t\t\tshowAppender={ showAppender }\n\t\t\t\t\t/>\n\t\t\t\t</ListViewContext.Provider>\n\t\t\t</TreeGrid>\n\t\t</AsyncModeProvider>\n\t);\n}\n\n// This is the private API for the ListView component.\n// It allows access to all props, not just the public ones.\nexport const PrivateListView = forwardRef( ListViewComponent );\n\n// This is the public API for the ListView component.\n// We wrap the PrivateListView component to hide some props from the public API.\nexport default forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<PrivateListView\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tshowAppender={ false }\n\t\t\trootClientId={ null }\n\t\t\tonSelect={ null }\n\t\t\tadditionalBlockContent={ null }\n\t\t\tblockSettingsMenu={ undefined }\n\t\t/>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,aAAa,EACbC,YAAY,EACZC,gCAAgC,IAAIC,kBAAkB,QAChD,oBAAoB;AAC3B,SACCC,sBAAsB,IAAIC,QAAQ,EAClCC,cAAc,QACR,uBAAuB;AAC9B,SAASC,iBAAiB,EAAEC,SAAS,Q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AehC,UAAU,CAAE,CAAE2H,KAAK,EAAE9E,GAAG,KAAM;EAC5C,oBACC3B,IAAA,CAACwG,eAAe;IACf7E,GAAG,EAAGA,GAAK;IAAA,GACN8E,KAAK;IACVtF,YAAY,EAAG,KAAO;IACtBG,YAAY,EAAG,IAAM;IACrBE,QAAQ,EAAG,IAAM;IACjBC,sBAAsB,EAAG,IAAM;IAC/BL,iBAAiB,EAAG+D;EAAW,CAC/B,CAAC;AAEJ,CAAE,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useInstanceId","useMergeRefs","__experimentalUseFixedWindowList","useFixedWindowList","__experimentalTreeGrid","TreeGrid","VisuallyHidden","AsyncModeProvider","useSelect","deprecated","useCallback","useEffect","useMemo","useRef","useReducer","forwardRef","useState","__","ListViewBranch","ListViewContext","ListViewDropIndicatorPreview","useBlockSelection","useListViewBlockIndexes","useListViewClientIds","useListViewCollapseItems","useListViewDropZone","useListViewExpandSelectedItem","store","blockEditorStore","BlockSettingsDropdown","focusListItem","useClipboardHandler","jsx","_jsx","jsxs","_jsxs","expanded","state","action","type","Array","isArray","clientIds","reduce","newState","id","BLOCK_LIST_ITEM_HEIGHT","ListViewComponent","blocks","dropZoneElement","showBlockMovers","isExpanded","showAppender","blockSettingsMenu","BlockSettingsMenu","rootClientId","description","onSelect","additionalBlockContent","AdditionalBlockContent","ref","since","alternative","instanceId","clientIdsTree","draggedClientIds","selectedClientIds","blockIndexes","getBlock","visibleBlockCount","select","getGlobalBlockCount","getClientIdsOfDescendants","draggedBlockCount","length","updateBlockSelection","expandedState","setExpandedState","insertedBlock","setInsertedBlock","setSelectedTreeId","firstSelectedBlockClientId","selectEditorBlock","event","blockClientId","focusPosition","dropZoneRef","target","blockDropTarget","elementRef","clipBoardRef","selectBlock","treeGridRef","current","expand","clientId","collapse","collapseAll","expandRow","row","dataset","block","collapseRow","focusRow","startRow","endRow","shiftKey","firstDraggedBlockClientId","blockDropTargetIndex","blockDropPosition","firstDraggedBlockIndex","_blockDropTargetIndex","_firstDraggedBlockIndex","foundBlockIndex","undefined","dropPosition","contextValue","listViewInstanceId","treeGridElementRef","fixedListWindow","useWindowing","windowOverscan","describedById","value","children","draggedBlockClientId","listViewRef","className","onCollapseRow","onExpandRow","onFocusRow","applicationAriaLabel","style","Provider","parentId","PrivateListView","props"],"sources":["@wordpress/block-editor/src/components/list-view/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseInstanceId,\n\tuseMergeRefs,\n\t__experimentalUseFixedWindowList as useFixedWindowList,\n} from '@wordpress/compose';\nimport {\n\t__experimentalTreeGrid as TreeGrid,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseReducer,\n\tforwardRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewBranch from './branch';\nimport { ListViewContext } from './context';\nimport ListViewDropIndicatorPreview from './drop-indicator';\nimport useBlockSelection from './use-block-selection';\nimport useListViewBlockIndexes from './use-list-view-block-indexes';\nimport useListViewClientIds from './use-list-view-client-ids';\nimport useListViewCollapseItems from './use-list-view-collapse-items';\nimport useListViewDropZone from './use-list-view-drop-zone';\nimport useListViewExpandSelectedItem from './use-list-view-expand-selected-item';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockSettingsDropdown } from '../block-settings-menu/block-settings-dropdown';\nimport { focusListItem } from './utils';\nimport useClipboardHandler from './use-clipboard-handler';\n\nconst expanded = ( state, action ) => {\n\tif ( action.type === 'clear' ) {\n\t\treturn {};\n\t}\n\tif ( Array.isArray( action.clientIds ) ) {\n\t\treturn {\n\t\t\t...state,\n\t\t\t...action.clientIds.reduce(\n\t\t\t\t( newState, id ) => ( {\n\t\t\t\t\t...newState,\n\t\t\t\t\t[ id ]: action.type === 'expand',\n\t\t\t\t} ),\n\t\t\t\t{}\n\t\t\t),\n\t\t};\n\t}\n\treturn state;\n};\n\nexport const BLOCK_LIST_ITEM_HEIGHT = 32;\n\n/** @typedef {import('react').ComponentType} ComponentType */\n/** @typedef {import('react').Ref<HTMLElement>} Ref */\n\n/**\n * Show a hierarchical list of blocks.\n *\n * @param {Object} props Components props.\n * @param {string} props.id An HTML element id for the root element of ListView.\n * @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.\n * @param {?HTMLElement} props.dropZoneElement Optional element to be used as the drop zone.\n * @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.\n * @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.\n * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.\n * @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.\n * @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.\n * @param {string} props.description Optional accessible description for the tree grid component.\n * @param {?Function} props.onSelect Optional callback to be invoked when a block is selected. Receives the block object that was selected.\n * @param {?ComponentType} props.additionalBlockContent Component that renders additional block content UI.\n * @param {Ref} ref Forwarded ref\n */\nfunction ListViewComponent(\n\t{\n\t\tid,\n\t\tblocks,\n\t\tdropZoneElement,\n\t\tshowBlockMovers = false,\n\t\tisExpanded = false,\n\t\tshowAppender = false,\n\t\tblockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,\n\t\trootClientId,\n\t\tdescription,\n\t\tonSelect,\n\t\tadditionalBlockContent: AdditionalBlockContent,\n\t},\n\tref\n) {\n\t// This can be removed once we no longer need to support the blocks prop.\n\tif ( blocks ) {\n\t\tdeprecated(\n\t\t\t'`blocks` property in `wp.blockEditor.__experimentalListView`',\n\t\t\t{\n\t\t\t\tsince: '6.3',\n\t\t\t\talternative: '`rootClientId` property',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst instanceId = useInstanceId( ListViewComponent );\n\tconst { clientIdsTree, draggedClientIds, selectedClientIds } =\n\t\tuseListViewClientIds( { blocks, rootClientId } );\n\tconst blockIndexes = useListViewBlockIndexes( clientIdsTree );\n\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst { visibleBlockCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getGlobalBlockCount, getClientIdsOfDescendants } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst draggedBlockCount =\n\t\t\t\tdraggedClientIds?.length > 0\n\t\t\t\t\t? getClientIdsOfDescendants( draggedClientIds ).length + 1\n\t\t\t\t\t: 0;\n\t\t\treturn {\n\t\t\t\tvisibleBlockCount: getGlobalBlockCount() - draggedBlockCount,\n\t\t\t};\n\t\t},\n\t\t[ draggedClientIds ]\n\t);\n\n\tconst { updateBlockSelection } = useBlockSelection();\n\n\tconst [ expandedState, setExpandedState ] = useReducer( expanded, {} );\n\n\tconst [ insertedBlock, setInsertedBlock ] = useState( null );\n\n\tconst { setSelectedTreeId } = useListViewExpandSelectedItem( {\n\t\tfirstSelectedBlockClientId: selectedClientIds[ 0 ],\n\t\tsetExpandedState,\n\t} );\n\tconst selectEditorBlock = useCallback(\n\t\t/**\n\t\t * @param {MouseEvent | KeyboardEvent | undefined} event\n\t\t * @param {string} blockClientId\n\t\t * @param {null | undefined | -1 | 1} focusPosition\n\t\t */\n\t\t( event, blockClientId, focusPosition ) => {\n\t\t\tupdateBlockSelection( event, blockClientId, null, focusPosition );\n\t\t\tsetSelectedTreeId( blockClientId );\n\t\t\tif ( onSelect ) {\n\t\t\t\tonSelect( getBlock( blockClientId ) );\n\t\t\t}\n\t\t},\n\t\t[ setSelectedTreeId, updateBlockSelection, onSelect, getBlock ]\n\t);\n\n\tconst { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone( {\n\t\tdropZoneElement,\n\t\texpandedState,\n\t\tsetExpandedState,\n\t} );\n\tconst elementRef = useRef();\n\n\t// Allow handling of copy, cut, and paste events.\n\tconst clipBoardRef = useClipboardHandler( {\n\t\tselectBlock: selectEditorBlock,\n\t} );\n\n\tconst treeGridRef = useMergeRefs( [\n\t\tclipBoardRef,\n\t\telementRef,\n\t\tdropZoneRef,\n\t\tref,\n\t] );\n\n\tuseEffect( () => {\n\t\t// If a blocks are already selected when the list view is initially\n\t\t// mounted, shift focus to the first selected block.\n\t\tif ( selectedClientIds?.length ) {\n\t\t\tfocusListItem( selectedClientIds[ 0 ], elementRef?.current );\n\t\t}\n\t\t// Disable reason: Only focus on the selected item when the list view is mounted.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst expand = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst clientIds = Array.isArray( clientId )\n\t\t\t\t? clientId\n\t\t\t\t: [ clientId ];\n\t\t\tsetExpandedState( { type: 'expand', clientIds } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst collapse = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'collapse', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst collapseAll = useCallback( () => {\n\t\tsetExpandedState( { type: 'clear' } );\n\t}, [ setExpandedState ] );\n\tconst expandRow = useCallback(\n\t\t( row ) => {\n\t\t\texpand( row?.dataset?.block );\n\t\t},\n\t\t[ expand ]\n\t);\n\tconst collapseRow = useCallback(\n\t\t( row ) => {\n\t\t\tcollapse( row?.dataset?.block );\n\t\t},\n\t\t[ collapse ]\n\t);\n\tconst focusRow = useCallback(\n\t\t( event, startRow, endRow ) => {\n\t\t\tif ( event.shiftKey ) {\n\t\t\t\tupdateBlockSelection(\n\t\t\t\t\tevent,\n\t\t\t\t\tstartRow?.dataset?.block,\n\t\t\t\t\tendRow?.dataset?.block\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ updateBlockSelection ]\n\t);\n\n\tuseListViewCollapseItems( {\n\t\tcollapseAll,\n\t\texpand,\n\t} );\n\n\tconst firstDraggedBlockClientId = draggedClientIds?.[ 0 ];\n\n\t// Convert a blockDropTarget into indexes relative to the blocks in the list view.\n\t// These values are used to determine which blocks should be displaced to make room\n\t// for the drop indicator. See `ListViewBranch` and `getDragDisplacementValues`.\n\tconst { blockDropTargetIndex, blockDropPosition, firstDraggedBlockIndex } =\n\t\tuseMemo( () => {\n\t\t\tlet _blockDropTargetIndex, _firstDraggedBlockIndex;\n\n\t\t\tif ( blockDropTarget?.clientId ) {\n\t\t\t\tconst foundBlockIndex =\n\t\t\t\t\tblockIndexes[ blockDropTarget.clientId ];\n\t\t\t\t// If dragging below or inside the block, treat the drop target as the next block.\n\t\t\t\t_blockDropTargetIndex =\n\t\t\t\t\tfoundBlockIndex === undefined ||\n\t\t\t\t\tblockDropTarget?.dropPosition === 'top'\n\t\t\t\t\t\t? foundBlockIndex\n\t\t\t\t\t\t: foundBlockIndex + 1;\n\t\t\t} else if ( blockDropTarget === null ) {\n\t\t\t\t// A `null` value is used to indicate that the user is dragging outside of the list view.\n\t\t\t\t_blockDropTargetIndex = null;\n\t\t\t}\n\n\t\t\tif ( firstDraggedBlockClientId ) {\n\t\t\t\tconst foundBlockIndex =\n\t\t\t\t\tblockIndexes[ firstDraggedBlockClientId ];\n\t\t\t\t_firstDraggedBlockIndex =\n\t\t\t\t\tfoundBlockIndex === undefined ||\n\t\t\t\t\tblockDropTarget?.dropPosition === 'top'\n\t\t\t\t\t\t? foundBlockIndex\n\t\t\t\t\t\t: foundBlockIndex + 1;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tblockDropTargetIndex: _blockDropTargetIndex,\n\t\t\t\tblockDropPosition: blockDropTarget?.dropPosition,\n\t\t\t\tfirstDraggedBlockIndex: _firstDraggedBlockIndex,\n\t\t\t};\n\t\t}, [ blockDropTarget, blockIndexes, firstDraggedBlockClientId ] );\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tblockDropPosition,\n\t\t\tblockDropTargetIndex,\n\t\t\tblockIndexes,\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tfirstDraggedBlockIndex,\n\t\t\tcollapse,\n\t\t\tcollapseAll,\n\t\t\tBlockSettingsMenu,\n\t\t\tlistViewInstanceId: instanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\ttreeGridElementRef: elementRef,\n\t\t\trootClientId,\n\t\t} ),\n\t\t[\n\t\t\tblockDropPosition,\n\t\t\tblockDropTargetIndex,\n\t\t\tblockIndexes,\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tfirstDraggedBlockIndex,\n\t\t\tcollapse,\n\t\t\tcollapseAll,\n\t\t\tBlockSettingsMenu,\n\t\t\tinstanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\trootClientId,\n\t\t]\n\t);\n\n\t// List View renders a fixed number of items and relies on each having a fixed item height of 36px.\n\t// If this value changes, we should also change the itemHeight value set in useFixedWindowList.\n\t// See: https://github.com/WordPress/gutenberg/pull/35230 for additional context.\n\tconst [ fixedListWindow ] = useFixedWindowList(\n\t\telementRef,\n\t\tBLOCK_LIST_ITEM_HEIGHT,\n\t\tvisibleBlockCount,\n\t\t{\n\t\t\t// Ensure that the windowing logic is recalculated when the expanded state changes.\n\t\t\t// This is necessary because expanding a collapsed block in a short list view can\n\t\t\t// switch the list view to a tall list view with a scrollbar, and vice versa.\n\t\t\t// When this happens, the windowing logic needs to be recalculated to ensure that\n\t\t\t// the correct number of blocks are rendered, by rechecking for a scroll container.\n\t\t\texpandedState,\n\t\t\tuseWindowing: true,\n\t\t\twindowOverscan: 40,\n\t\t}\n\t);\n\n\t// If there are no blocks to show and we're not showing the appender, do not render the list view.\n\tif ( ! clientIdsTree.length && ! showAppender ) {\n\t\treturn null;\n\t}\n\n\tconst describedById =\n\t\tdescription && `block-editor-list-view-description-${ instanceId }`;\n\n\treturn (\n\t\t<AsyncModeProvider value>\n\t\t\t<ListViewDropIndicatorPreview\n\t\t\t\tdraggedBlockClientId={ firstDraggedBlockClientId }\n\t\t\t\tlistViewRef={ elementRef }\n\t\t\t\tblockDropTarget={ blockDropTarget }\n\t\t\t/>\n\t\t\t{ description && (\n\t\t\t\t<VisuallyHidden id={ describedById }>\n\t\t\t\t\t{ description }\n\t\t\t\t</VisuallyHidden>\n\t\t\t) }\n\t\t\t<TreeGrid\n\t\t\t\tid={ id }\n\t\t\t\tclassName={ clsx( 'block-editor-list-view-tree', {\n\t\t\t\t\t'is-dragging':\n\t\t\t\t\t\tdraggedClientIds?.length > 0 &&\n\t\t\t\t\t\tblockDropTargetIndex !== undefined,\n\t\t\t\t} ) }\n\t\t\t\taria-label={ __( 'Block navigation structure' ) }\n\t\t\t\tref={ treeGridRef }\n\t\t\t\tonCollapseRow={ collapseRow }\n\t\t\t\tonExpandRow={ expandRow }\n\t\t\t\tonFocusRow={ focusRow }\n\t\t\t\tapplicationAriaLabel={ __( 'Block navigation structure' ) }\n\t\t\t\taria-describedby={ describedById }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-admin--list-view-dragged-items-height':\n\t\t\t\t\t\tdraggedClientIds?.length\n\t\t\t\t\t\t\t? `${\n\t\t\t\t\t\t\t\t\tBLOCK_LIST_ITEM_HEIGHT *\n\t\t\t\t\t\t\t\t\t( draggedClientIds.length - 1 )\n\t\t\t\t\t\t\t }px`\n\t\t\t\t\t\t\t: null,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ListViewContext.Provider value={ contextValue }>\n\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\t\t\tparentId={ rootClientId }\n\t\t\t\t\t\tselectBlock={ selectEditorBlock }\n\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\tshowAppender={ showAppender }\n\t\t\t\t\t/>\n\t\t\t\t</ListViewContext.Provider>\n\t\t\t</TreeGrid>\n\t\t</AsyncModeProvider>\n\t);\n}\n\n// This is the private API for the ListView component.\n// It allows access to all props, not just the public ones.\nexport const PrivateListView = forwardRef( ListViewComponent );\n\n// This is the public API for the ListView component.\n// We wrap the PrivateListView component to hide some props from the public API.\nexport default forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<PrivateListView\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tshowAppender={ false }\n\t\t\trootClientId={ null }\n\t\t\tonSelect={ null }\n\t\t\tadditionalBlockContent={ null }\n\t\t\tblockSettingsMenu={ undefined }\n\t\t/>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,aAAa,EACbC,YAAY,EACZC,gCAAgC,IAAIC,kBAAkB,QAChD,oBAAoB;AAC3B,SACCC,sBAAsB,IAAIC,QAAQ,EAClCC,cAAc,QACR,uBAAuB;AAC9B,SAASC,iBAAiB,EAAEC,SAAS,QAAQ,iBAAiB;AAC9D,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SACCC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,UAAU,EACVC,UAAU,EACVC,QAAQ,QACF,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,cAAc,MAAM,UAAU;AACrC,SAASC,eAAe,QAAQ,WAAW;AAC3C,OAAOC,4BAA4B,MAAM,kBAAkB;AAC3D,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,uBAAuB,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AU;MACvB4B,oBAAoB,EAAGlH,EAAE,CAAE,4BAA6B,CAAG;MAC3D,oBAAmByG,aAAe;MAClCU,KAAK,EAAG;QACP,4CAA4C,EAC3CnE,gBAAgB,EAAES,MAAM,GACpB,GACD5B,sBAAsB,IACpBmB,gBAAgB,CAACS,MAAM,GAAG,CAAC,CAC5B,IAAG,GACJ;MACL,CAAG;MAAAkD,QAAA,eAEH3F,IAAA,CAACd,eAAe,CAACkH,QAAQ;QAACV,KAAK,EAAGP,YAAc;QAAAQ,QAAA,eAC/C3F,IAAA,CAACf,cAAc;UACd8B,MAAM,EAAGgB,aAAe;UACxBsE,QAAQ,EAAG/E,YAAc;UACzBoC,WAAW,EAAGT,iBAAmB;UACjChC,eAAe,EAAGA,eAAiB;UACnCqE,eAAe,EAAGA,eAAiB;UACnCrD,iBAAiB,EAAGA,iBAAmB;UACvCf,UAAU,EAAGA,UAAY;UACzBC,YAAY,EAAGA;QAAc,CAC7B;MAAC,CACuB;IAAC,CAClB,CAAC;EAAA,CACO,CAAC;AAEtB;;AAEA;AACA;AACA,OAAO,MAAMmF,eAAe,GAAGxH,UAAU,CAAEgC,iBAAkB,CAAC;;AAE9D;AACA;AACA,eAAehC,UAAU,CAAE,CAAEyH,KAAK,EAAE5E,GAAG,KAAM;EAC5C,oBACC3B,IAAA,CAACsG,eAAe;IACf3E,GAAG,EAAGA,GAAK;IAAA,GACN4E,KAAK;IACVpF,YAAY,EAAG,KAAO;IACtBG,YAAY,EAAG,IAAM;IACrBE,QAAQ,EAAG,IAAM;IACjBC,sBAAsB,EAAG,IAAM;IAC/BL,iBAAiB,EAAG6D;EAAW,CAC/B,CAAC;AAEJ,CAAE,CAAC","ignoreList":[]}
|
|
@@ -155,7 +155,7 @@ export function MediaPlaceholder({
|
|
|
155
155
|
setSrc(event.target.value);
|
|
156
156
|
};
|
|
157
157
|
const onFilesUpload = files => {
|
|
158
|
-
if (!handleUpload) {
|
|
158
|
+
if (!handleUpload || typeof handleUpload === 'function' && !handleUpload(files)) {
|
|
159
159
|
return onSelect(files);
|
|
160
160
|
}
|
|
161
161
|
onFilesPreUpload(files);
|
|
@@ -274,11 +274,11 @@ export function MediaPlaceholder({
|
|
|
274
274
|
if (instructions === undefined && mediaUpload) {
|
|
275
275
|
instructions = __('Upload a media file or pick one from your media library.');
|
|
276
276
|
if (isAudio) {
|
|
277
|
-
instructions = __('Upload an audio file, pick one from your
|
|
277
|
+
instructions = __('Upload or drag an audio file here, or pick one from your library.');
|
|
278
278
|
} else if (isImage) {
|
|
279
|
-
instructions = __('Upload an image file, pick one from your
|
|
279
|
+
instructions = __('Upload or drag an image file here, or pick one from your library.');
|
|
280
280
|
} else if (isVideo) {
|
|
281
|
-
instructions = __('Upload a video file, pick one from your
|
|
281
|
+
instructions = __('Upload or drag a video file here, or pick one from your library.');
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
if (title === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","Button","FormFileUpload","Placeholder","DropZone","withFilters","__","useState","useEffect","useSelect","keyboardReturn","pasteHandler","deprecated","MediaUpload","MediaUploadCheck","URLPopover","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","noop","InsertFromURLPopover","src","onChange","onSubmit","onClose","popoverAnchor","anchor","children","className","type","placeholder","value","__next40pxDefaultSize","icon","label","URLSelectionUI","onChangeSrc","onSelectURL","setPopoverAnchor","isURLInputVisible","setIsURLInputVisible","openURLInput","closeURLInput","focus","onSubmitSrc","event","preventDefault","onClick","isPressed","variant","ref","MediaPlaceholder","allowedTypes","labels","mediaPreview","notices","isAppender","accept","addToGallery","multiple","handleUpload","disableDropZone","disableMediaButtons","onError","onSelect","onCancel","onToggleFeaturedImage","onDoubleClick","onFilesPreUpload","onHTMLDrop","deprecatedOnHTMLDrop","mediaLibraryButton","style","since","version","mediaUpload","select","getSettings","setSrc","_value$src","onlyAllowsImages","length","every","allowedType","startsWith","target","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","onUpload","defaultRenderPlaceholder","content","instructions","undefined","typesAllowed","firstAllowedType","isOneType","isAudio","isImage","isVideo","placeholderClassName","preview","renderPlaceholder","renderDropZone","onFilesDrop","renderCancelLink","renderUrlSelectionUI","renderFeaturedImageToggle","renderMediaUploadChecked","defaultButton","open","libraryButton","uploadMediaLibraryButton","gallery","mode","render","openFileDialog","fallback"],"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\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<input\n\t\t\t\tclassName=\"block-editor-media-placeholder__url-input-field\"\n\t\t\t\ttype=\"text\"\n\t\t\t\taria-label={ __( 'URL' ) }\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/>\n\t\t\t<Button\n\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\tclassName=\"block-editor-media-placeholder__url-input-submit-button\"\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\ttype=\"submit\"\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// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t__next40pxDefaultSize={ false }\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 onChangeSrc = ( event ) => {\n\t\tsetSrc( event.target.value );\n\t};\n\n\tconst onFilesUpload = ( files ) => {\n\t\tif ( ! handleUpload ) {\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'Upload a media file or pick one from your media 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'Upload an audio file, pick one from your media library, or add one with a URL.'\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'Upload an image file, pick one from your media library, or add one with a URL.'\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'Upload a video file, pick one from your media library, or add one with a URL.'\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// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t__next40pxDefaultSize={ false }\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={ onChangeSrc }\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// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t__next40pxDefaultSize={ false }\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// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t__next40pxDefaultSize={ false }\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// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize={ false }\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// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ false }\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":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,MAAM,EACNC,cAAc,EACdC,WAAW,EACXC,QAAQ,EACRC,WAAW,QACL,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,YAAY,QAAQ,mBAAmB;AAChD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,gBAAgB,MAAM,uBAAuB;AACpD,OAAOC,UAAU,MAAM,gBAAgB;AACvC,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAExD,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,MAAMC,oBAAoB,GAAGA,CAAE;EAC9BC,GAAG;EACHC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC;AACD,CAAC,kBACAX,IAAA,CAACJ,UAAU;EAACgB,MAAM,EAAGD,aAAe;EAACD,OAAO,EAAGA,OAAS;EAAAG,QAAA,eACvDX,KAAA;IACCY,SAAS,EAAC,gDAAgD;IAC1DL,QAAQ,EAAGA,QAAU;IAAAI,QAAA,gBAErBb,IAAA;MACCc,SAAS,EAAC,i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BAA0B,CAAC,CAAEmD,gBAAiB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","Button","FormFileUpload","Placeholder","DropZone","withFilters","__","useState","useEffect","useSelect","keyboardReturn","pasteHandler","deprecated","MediaUpload","MediaUploadCheck","URLPopover","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","noop","InsertFromURLPopover","src","onChange","onSubmit","onClose","popoverAnchor","anchor","children","className","type","placeholder","value","__next40pxDefaultSize","icon","label","URLSelectionUI","onChangeSrc","onSelectURL","setPopoverAnchor","isURLInputVisible","setIsURLInputVisible","openURLInput","closeURLInput","focus","onSubmitSrc","event","preventDefault","onClick","isPressed","variant","ref","MediaPlaceholder","allowedTypes","labels","mediaPreview","notices","isAppender","accept","addToGallery","multiple","handleUpload","disableDropZone","disableMediaButtons","onError","onSelect","onCancel","onToggleFeaturedImage","onDoubleClick","onFilesPreUpload","onHTMLDrop","deprecatedOnHTMLDrop","mediaLibraryButton","style","since","version","mediaUpload","select","getSettings","setSrc","_value$src","onlyAllowsImages","length","every","allowedType","startsWith","target","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","onUpload","defaultRenderPlaceholder","content","instructions","undefined","typesAllowed","firstAllowedType","isOneType","isAudio","isImage","isVideo","placeholderClassName","preview","renderPlaceholder","renderDropZone","onFilesDrop","renderCancelLink","renderUrlSelectionUI","renderFeaturedImageToggle","renderMediaUploadChecked","defaultButton","open","libraryButton","uploadMediaLibraryButton","gallery","mode","render","openFileDialog","fallback"],"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\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<input\n\t\t\t\tclassName=\"block-editor-media-placeholder__url-input-field\"\n\t\t\t\ttype=\"text\"\n\t\t\t\taria-label={ __( 'URL' ) }\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/>\n\t\t\t<Button\n\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\tclassName=\"block-editor-media-placeholder__url-input-submit-button\"\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\ttype=\"submit\"\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// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t__next40pxDefaultSize={ false }\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 onChangeSrc = ( event ) => {\n\t\tsetSrc( event.target.value );\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'Upload a media file or pick one from your media 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'Upload or drag an audio file here, or pick one 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'Upload or drag an image file here, or pick one 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'Upload or drag a video file here, or pick one 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// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t__next40pxDefaultSize={ false }\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={ onChangeSrc }\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// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t__next40pxDefaultSize={ false }\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// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t__next40pxDefaultSize={ false }\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// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize={ false }\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// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ false }\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":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,MAAM,EACNC,cAAc,EACdC,WAAW,EACXC,QAAQ,EACRC,WAAW,QACL,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACxD,SAASC,SAAS,QAA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H,cAAgB;YAC1BpH,OAAO,EAAC,SAAS;YACjBrB,SAAS,EAAGjC,IAAI,CACf,wCAAwC,EACxC,+CACD,CAAG;YAAAgC,QAAA,EAED1B,EAAE,CAAE,QAAS;UAAC,CACT,CACN;UACHqB,QAAQ,EAAGoH,QAAU;UACrBjF,MAAM,EAAGA,MAAQ;UACjBE,QAAQ,EAAG,CAAC,CAAEA;QAAU,CACxB,CAAC,EACAsG,wBAAwB,EACxBN,oBAAoB,CAAC,CAAC,EACtBC,yBAAyB,CAAC,CAAC,EAC3BF,gBAAgB,CAAC,CAAC;MAAA,CACnB,CACF;MACD,OAAOH,iBAAiB,CAAEX,OAAQ,CAAC;IACpC;IAEA,OAAOW,iBAAiB,CAAEU,wBAAyB,CAAC;EACrD,CAAC;EAED,IAAKnG,mBAAmB,EAAG;IAC1B,oBAAOhD,IAAA,CAACL,gBAAgB;MAAAkB,QAAA,EAAG6H,cAAc,CAAC;IAAC,CAAoB,CAAC;EACjE;EAEA,oBACC1I,IAAA,CAACL,gBAAgB;IAChB6J,QAAQ,EAAGf,iBAAiB,CAAEI,oBAAoB,CAAC,CAAE,CAAG;IAAAhI,QAAA,EAEtDkI,wBAAwB,CAAC;EAAC,CACX,CAAC;AAErB;;AAEA;AACA;AACA;AACA,eAAe7J,WAAW,CAAE,yBAA0B,CAAC,CAAEmD,gBAAiB,CAAC","ignoreList":[]}
|
|
@@ -183,6 +183,20 @@ export function isDropTargetValid(getBlockType, allowedBlocks, draggedBlockNames
|
|
|
183
183
|
return areBlocksAllowed && targetMatchesDraggedBlockParents;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Checks if the given element is an insertion point.
|
|
188
|
+
*
|
|
189
|
+
* @param {EventTarget|null} targetToCheck - The element to check.
|
|
190
|
+
* @param {Document} ownerDocument - The owner document of the element.
|
|
191
|
+
* @return {boolean} True if the element is a insertion point, false otherwise.
|
|
192
|
+
*/
|
|
193
|
+
function isInsertionPoint(targetToCheck, ownerDocument) {
|
|
194
|
+
const {
|
|
195
|
+
defaultView
|
|
196
|
+
} = ownerDocument;
|
|
197
|
+
return !!(defaultView && targetToCheck instanceof defaultView.HTMLElement && targetToCheck.dataset.isInsertionPoint);
|
|
198
|
+
}
|
|
199
|
+
|
|
186
200
|
/**
|
|
187
201
|
* @typedef {Object} WPBlockDropZoneConfig
|
|
188
202
|
* @property {?HTMLElement} dropZoneElement Optional element to be used as the drop zone.
|
|
@@ -292,6 +306,9 @@ export default function useBlockDropZone({
|
|
|
292
306
|
rootBlockIndex: getBlockIndex(targetRootClientId)
|
|
293
307
|
});
|
|
294
308
|
const [targetIndex, operation, nearestSide] = dropTargetPosition;
|
|
309
|
+
if (isZoomOutMode() && operation !== 'insert') {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
295
312
|
if (operation === 'group') {
|
|
296
313
|
const targetBlock = blocks[targetIndex];
|
|
297
314
|
const areAllImages = [targetBlock.name, ...draggedBlockNames].every(name => name === 'core/image');
|
|
@@ -336,7 +353,16 @@ export default function useBlockDropZone({
|
|
|
336
353
|
// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget
|
|
337
354
|
throttled(event, event.currentTarget.ownerDocument);
|
|
338
355
|
},
|
|
339
|
-
onDragLeave() {
|
|
356
|
+
onDragLeave(event) {
|
|
357
|
+
const {
|
|
358
|
+
ownerDocument
|
|
359
|
+
} = event.currentTarget;
|
|
360
|
+
|
|
361
|
+
// If the drag event is leaving the drop zone and entering an insertion point,
|
|
362
|
+
// do not hide the insertion point as it is conceptually within the dropzone.
|
|
363
|
+
if (isInsertionPoint(event.relatedTarget, ownerDocument) || isInsertionPoint(event.target, ownerDocument)) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
340
366
|
throttled.cancel();
|
|
341
367
|
hideInsertionPoint();
|
|
342
368
|
},
|