@wordpress/block-editor 15.10.1-next.v.0 → 15.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/block-edit/context.cjs +5 -0
- package/build/components/block-edit/context.cjs.map +2 -2
- package/build/components/block-edit/index.cjs +3 -0
- package/build/components/block-edit/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +2 -9
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-list/block.cjs +3 -0
- package/build/components/block-list/block.cjs.map +2 -2
- package/build/components/button-block-appender/index.cjs +23 -19
- package/build/components/button-block-appender/index.cjs.map +2 -2
- package/build/components/font-sizes/font-size-picker.cjs +2 -1
- package/build/components/font-sizes/font-size-picker.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +4 -25
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +6 -6
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/hooks/block-fields/index.cjs +52 -86
- package/build/hooks/block-fields/index.cjs.map +3 -3
- package/build/hooks/block-fields/link/index.cjs +2 -11
- package/build/hooks/block-fields/link/index.cjs.map +2 -2
- package/build/hooks/block-fields/media/index.cjs +9 -14
- package/build/hooks/block-fields/media/index.cjs.map +2 -2
- package/build/hooks/index.cjs +2 -1
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/list-view.cjs +27 -10
- package/build/hooks/list-view.cjs.map +2 -2
- package/build/hooks/utils.cjs +3 -2
- package/build/hooks/utils.cjs.map +2 -2
- package/build/store/selectors.cjs +7 -1
- package/build/store/selectors.cjs.map +2 -2
- package/build-module/components/block-edit/context.mjs +4 -0
- package/build-module/components/block-edit/context.mjs.map +2 -2
- package/build-module/components/block-edit/index.mjs +4 -0
- package/build-module/components/block-edit/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +2 -9
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +3 -0
- package/build-module/components/block-list/block.mjs.map +2 -2
- package/build-module/components/button-block-appender/index.mjs +23 -19
- package/build-module/components/button-block-appender/index.mjs.map +2 -2
- package/build-module/components/font-sizes/font-size-picker.mjs +2 -1
- package/build-module/components/font-sizes/font-size-picker.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +6 -22
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +6 -6
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/hooks/block-fields/index.mjs +45 -87
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/link/index.mjs +2 -11
- package/build-module/hooks/block-fields/link/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/media/index.mjs +9 -14
- package/build-module/hooks/block-fields/media/index.mjs.map +2 -2
- package/build-module/hooks/index.mjs +2 -1
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +27 -10
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/utils.mjs +5 -3
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/store/selectors.mjs +7 -1
- package/build-module/store/selectors.mjs.map +2 -2
- package/package.json +39 -39
- package/src/components/block-edit/context.js +3 -0
- package/src/components/block-edit/index.js +6 -0
- package/src/components/block-inspector/index.js +2 -6
- package/src/components/block-list/block.js +3 -0
- package/src/components/block-list/block.native.js +5 -0
- package/src/components/block-patterns-list/stories/index.story.jsx +1 -1
- package/src/components/button-block-appender/index.js +2 -2
- package/src/components/font-sizes/font-size-picker.js +1 -0
- package/src/components/inspector-controls/fill.js +10 -20
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +11 -8
- package/src/hooks/block-fields/index.js +66 -111
- package/src/hooks/block-fields/link/index.js +2 -14
- package/src/hooks/block-fields/media/index.js +9 -21
- package/src/hooks/index.js +2 -1
- package/src/hooks/list-view.js +40 -10
- package/src/hooks/utils.js +4 -0
- package/src/store/selectors.js +14 -6
- /package/src/components/block-icon/stories/{index.story.js → index.story.ts} +0 -0
- /package/src/components/contrast-checker/stories/{index.story.js → index.story.ts} +0 -0
|
@@ -8,16 +8,16 @@ import deprecated from "@wordpress/deprecated";
|
|
|
8
8
|
import { useEffect, useContext } from "@wordpress/element";
|
|
9
9
|
import {
|
|
10
10
|
useBlockEditContext,
|
|
11
|
-
mayDisplayControlsKey
|
|
11
|
+
mayDisplayControlsKey,
|
|
12
|
+
mayDisplayPatternEditingControlsKey
|
|
12
13
|
} from "../block-edit/context.mjs";
|
|
13
14
|
import groups from "./groups.mjs";
|
|
14
15
|
import { jsx } from "react/jsx-runtime";
|
|
15
|
-
function
|
|
16
|
+
function InspectorControlsFill({
|
|
16
17
|
children,
|
|
17
18
|
group = "default",
|
|
18
19
|
__experimentalGroup,
|
|
19
|
-
resetAllFilter
|
|
20
|
-
forceDisplayControls
|
|
20
|
+
resetAllFilter
|
|
21
21
|
}) {
|
|
22
22
|
if (__experimentalGroup) {
|
|
23
23
|
deprecated(
|
|
@@ -36,7 +36,8 @@ function PrivateInspectorControlsFill({
|
|
|
36
36
|
warning(`Unknown InspectorControls group "${group}" provided.`);
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
const shouldDisplayForPatternEditing = context[mayDisplayPatternEditingControlsKey] && (group === "list" || group === "content");
|
|
40
|
+
if (!context[mayDisplayControlsKey] && !shouldDisplayForPatternEditing) {
|
|
40
41
|
return null;
|
|
41
42
|
}
|
|
42
43
|
return /* @__PURE__ */ jsx(StyleProvider, { document, children: /* @__PURE__ */ jsx(Fill, { children: (fillProps) => {
|
|
@@ -50,22 +51,6 @@ function PrivateInspectorControlsFill({
|
|
|
50
51
|
);
|
|
51
52
|
} }) });
|
|
52
53
|
}
|
|
53
|
-
function InspectorControlsFill({
|
|
54
|
-
children,
|
|
55
|
-
group = "default",
|
|
56
|
-
__experimentalGroup,
|
|
57
|
-
resetAllFilter
|
|
58
|
-
}) {
|
|
59
|
-
return /* @__PURE__ */ jsx(
|
|
60
|
-
PrivateInspectorControlsFill,
|
|
61
|
-
{
|
|
62
|
-
group,
|
|
63
|
-
__experimentalGroup,
|
|
64
|
-
resetAllFilter,
|
|
65
|
-
children
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
54
|
function RegisterResetAll({ resetAllFilter, children }) {
|
|
70
55
|
const { registerResetAllFilter, deregisterResetAllFilter } = useContext(ToolsPanelContext);
|
|
71
56
|
useEffect(() => {
|
|
@@ -87,7 +72,6 @@ function ToolsPanelInspectorControl({ children, resetAllFilter, fillProps }) {
|
|
|
87
72
|
);
|
|
88
73
|
}
|
|
89
74
|
export {
|
|
90
|
-
PrivateInspectorControlsFill,
|
|
91
75
|
InspectorControlsFill as default
|
|
92
76
|
};
|
|
93
77
|
//# sourceMappingURL=fill.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/inspector-controls/fill.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalStyleProvider as StyleProvider,\n\t__experimentalToolsPanelContext as ToolsPanelContext,\n} from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\nimport { useEffect, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseBlockEditContext,\n\tmayDisplayControlsKey,\n} from '../block-edit/context';\nimport groups from './groups';\n\nexport function
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC,+BAA+B;AAAA,EAC/B,mCAAmC;AAAA,OAC7B;AACP,OAAO,aAAa;AACpB,OAAO,gBAAgB;AACvB,SAAS,WAAW,kBAAkB;AAKtC;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,OAAO,YAAY;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalStyleProvider as StyleProvider,\n\t__experimentalToolsPanelContext as ToolsPanelContext,\n} from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\nimport { useEffect, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseBlockEditContext,\n\tmayDisplayControlsKey,\n\tmayDisplayPatternEditingControlsKey,\n} from '../block-edit/context';\nimport groups from './groups';\n\nexport default function InspectorControlsFill( {\n\tchildren,\n\tgroup = 'default',\n\t__experimentalGroup,\n\tresetAllFilter,\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsFill`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\n\tconst context = useBlockEditContext();\n\tconst Fill = groups[ group ]?.Fill;\n\tif ( ! Fill ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\tconst shouldDisplayForPatternEditing =\n\t\tcontext[ mayDisplayPatternEditingControlsKey ] &&\n\t\t( group === 'list' || group === 'content' );\n\n\tif (\n\t\t! context[ mayDisplayControlsKey ] &&\n\t\t! shouldDisplayForPatternEditing\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StyleProvider document={ document }>\n\t\t\t<Fill>\n\t\t\t\t{ ( fillProps ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ToolsPanelInspectorControl\n\t\t\t\t\t\t\tfillProps={ fillProps }\n\t\t\t\t\t\t\tchildren={ children }\n\t\t\t\t\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</Fill>\n\t\t</StyleProvider>\n\t);\n}\n\nfunction RegisterResetAll( { resetAllFilter, children } ) {\n\tconst { registerResetAllFilter, deregisterResetAllFilter } =\n\t\tuseContext( ToolsPanelContext );\n\tuseEffect( () => {\n\t\tif (\n\t\t\tresetAllFilter &&\n\t\t\tregisterResetAllFilter &&\n\t\t\tderegisterResetAllFilter\n\t\t) {\n\t\t\tregisterResetAllFilter( resetAllFilter );\n\t\t\treturn () => {\n\t\t\t\tderegisterResetAllFilter( resetAllFilter );\n\t\t\t};\n\t\t}\n\t}, [ resetAllFilter, registerResetAllFilter, deregisterResetAllFilter ] );\n\treturn children;\n}\n\nfunction ToolsPanelInspectorControl( { children, resetAllFilter, fillProps } ) {\n\t// `fillProps.forwardedContext` is an array of context provider entries, provided by slot,\n\t// that should wrap the fill markup.\n\tconst { forwardedContext = [] } = fillProps;\n\n\t// Children passed to InspectorControlsFill will not have\n\t// access to any React Context whose Provider is part of\n\t// the InspectorControlsSlot tree. So we re-create the\n\t// Provider in this subtree.\n\tconst innerMarkup = (\n\t\t<RegisterResetAll resetAllFilter={ resetAllFilter }>\n\t\t\t{ children }\n\t\t</RegisterResetAll>\n\t);\n\treturn forwardedContext.reduce(\n\t\t( inner, [ Provider, props ] ) => (\n\t\t\t<Provider { ...props }>{ inner }</Provider>\n\t\t),\n\t\tinnerMarkup\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC,+BAA+B;AAAA,EAC/B,mCAAmC;AAAA,OAC7B;AACP,OAAO,aAAa;AACpB,OAAO,gBAAgB;AACvB,SAAS,WAAW,kBAAkB;AAKtC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,YAAY;AA0Cb;AAxCS,SAAR,sBAAwC;AAAA,EAC9C;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AACD,GAAI;AACH,MAAK,qBAAsB;AAC1B;AAAA,MACC;AAAA,MACA;AAAA,QACC,OAAO;AAAA,QACP,SAAS;AAAA,QACT,aAAa;AAAA,MACd;AAAA,IACD;AACA,YAAQ;AAAA,EACT;AAEA,QAAM,UAAU,oBAAoB;AACpC,QAAM,OAAO,OAAQ,KAAM,GAAG;AAC9B,MAAK,CAAE,MAAO;AACb,YAAS,oCAAqC,KAAM,aAAc;AAClE,WAAO;AAAA,EACR;AACA,QAAM,iCACL,QAAS,mCAAoC,MAC3C,UAAU,UAAU,UAAU;AAEjC,MACC,CAAE,QAAS,qBAAsB,KACjC,CAAE,gCACD;AACD,WAAO;AAAA,EACR;AAEA,SACC,oBAAC,iBAAc,UACd,8BAAC,QACE,WAAE,cAAe;AAClB,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,EAEF,GACD,GACD;AAEF;AAEA,SAAS,iBAAkB,EAAE,gBAAgB,SAAS,GAAI;AACzD,QAAM,EAAE,wBAAwB,yBAAyB,IACxD,WAAY,iBAAkB;AAC/B,YAAW,MAAM;AAChB,QACC,kBACA,0BACA,0BACC;AACD,6BAAwB,cAAe;AACvC,aAAO,MAAM;AACZ,iCAA0B,cAAe;AAAA,MAC1C;AAAA,IACD;AAAA,EACD,GAAG,CAAE,gBAAgB,wBAAwB,wBAAyB,CAAE;AACxE,SAAO;AACR;AAEA,SAAS,2BAA4B,EAAE,UAAU,gBAAgB,UAAU,GAAI;AAG9E,QAAM,EAAE,mBAAmB,CAAC,EAAE,IAAI;AAMlC,QAAM,cACL,oBAAC,oBAAiB,gBACf,UACH;AAED,SAAO,iBAAiB;AAAA,IACvB,CAAE,OAAO,CAAE,UAAU,KAAM,MAC1B,oBAAC,YAAW,GAAG,OAAU,iBAAO;AAAA,IAEjC;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -52,16 +52,16 @@ function useInspectorControlsTabs(blockName, contentClientIds, isSectionBlock, h
|
|
|
52
52
|
...useSlotFills(positionGroup.name) || [],
|
|
53
53
|
...hasListFills && hasStyleFills > 1 ? advancedFills : []
|
|
54
54
|
];
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
if (hasListTab) {
|
|
58
|
-
tabs.push(TAB_LIST_VIEW);
|
|
59
|
-
}
|
|
55
|
+
const shouldShowBlockFields = window?.__experimentalContentOnlyInspectorFields;
|
|
56
|
+
const hasContentTab = hasContentFills || !shouldShowBlockFields && contentClientIds?.length;
|
|
60
57
|
if (hasContentTab) {
|
|
61
58
|
tabs.push(TAB_CONTENT);
|
|
62
59
|
}
|
|
60
|
+
if (hasListFills) {
|
|
61
|
+
tabs.push(TAB_LIST_VIEW);
|
|
62
|
+
}
|
|
63
63
|
if ((settingsFills.length || // Advanded fills who up in settings tab if available or they blend into the default tab, if there's only one tab.
|
|
64
|
-
advancedFills.length && (hasContentTab ||
|
|
64
|
+
advancedFills.length && (hasContentTab || hasListFills)) && !isSectionBlock) {
|
|
65
65
|
tabs.push(TAB_SETTINGS);
|
|
66
66
|
}
|
|
67
67
|
if (hasBlockStyles || hasStyleFills) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/inspector-controls-tabs/use-inspector-controls-tabs.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport InspectorControlsGroups from '../inspector-controls/groups';\nimport { InspectorAdvancedControls } from '../inspector-controls';\nimport { TAB_LIST_VIEW, TAB_SETTINGS, TAB_STYLES, TAB_CONTENT } from './utils';\nimport { store as blockEditorStore } from '../../store';\n\nconst EMPTY_ARRAY = [];\n\nfunction getShowTabs( blockName, tabSettings = {} ) {\n\t// Block specific setting takes precedence over generic default.\n\tif ( tabSettings[ blockName ] !== undefined ) {\n\t\treturn tabSettings[ blockName ];\n\t}\n\n\t// Use generic default if set over the Gutenberg experiment option.\n\tif ( tabSettings.default !== undefined ) {\n\t\treturn tabSettings.default;\n\t}\n\n\treturn true;\n}\n\nexport default function useInspectorControlsTabs(\n\tblockName,\n\tcontentClientIds,\n\tisSectionBlock,\n\thasBlockStyles\n) {\n\tconst tabs = [];\n\tconst {\n\t\tbindings: bindingsGroup,\n\t\tborder: borderGroup,\n\t\tcolor: colorGroup,\n\t\tcontent: contentGroup,\n\t\tdefault: defaultGroup,\n\t\tdimensions: dimensionsGroup,\n\t\tlist: listGroup,\n\t\tposition: positionGroup,\n\t\tstyles: stylesGroup,\n\t\ttypography: typographyGroup,\n\t\teffects: effectsGroup,\n\t} = InspectorControlsGroups;\n\n\t// List View Tab: If there are any fills for the list group add that tab.\n\tconst listFills = useSlotFills( listGroup.name );\n\tconst hasListFills = !! listFills && listFills.length;\n\n\t// Content Tab: If there are any fills for the content group add that tab.\n\tconst contentFills = useSlotFills( contentGroup.name );\n\tconst hasContentFills = !! contentFills && contentFills.length;\n\n\t// Styles Tab: Add this tab if there are any fills for block supports\n\t// e.g. border, color, spacing, typography, etc.\n\tconst styleFills = [\n\t\t...( useSlotFills( borderGroup.name ) || [] ),\n\t\t...( useSlotFills( colorGroup.name ) || [] ),\n\t\t...( useSlotFills( dimensionsGroup.name ) || [] ),\n\t\t...( useSlotFills( stylesGroup.name ) || [] ),\n\t\t...( useSlotFills( typographyGroup.name ) || [] ),\n\t\t...( useSlotFills( effectsGroup.name ) || [] ),\n\t];\n\tconst hasStyleFills = styleFills.length;\n\n\t// Settings Tab: If we don't have multiple tabs to display\n\t// (i.e. both list view and styles), check only the default and position\n\t// InspectorControls slots. If we have multiple tabs, we'll need to check\n\t// the advanced controls slot as well to ensure they are rendered.\n\tconst advancedFills = [\n\t\t...( useSlotFills( InspectorAdvancedControls.slotName ) || [] ),\n\t\t...( useSlotFills( bindingsGroup.name ) || [] ),\n\t];\n\n\tconst settingsFills = [\n\t\t...( useSlotFills( defaultGroup.name ) || [] ),\n\t\t...( useSlotFills( positionGroup.name ) || [] ),\n\t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,IAAK,KAAK,CAAC;AAAA,EAC5C;AACA,QAAM,gBAAgB,WAAW;AAMjC,QAAM,gBAAgB;AAAA,IACrB,GAAK,aAAc,0BAA0B,QAAS,KAAK,CAAC;AAAA,IAC5D,GAAK,aAAc,cAAc,IAAK,KAAK,CAAC;AAAA,EAC7C;AAEA,QAAM,gBAAgB;AAAA,IACrB,GAAK,aAAc,aAAa,IAAK,KAAK,CAAC;AAAA,IAC3C,GAAK,aAAc,cAAc,IAAK,KAAK,CAAC;AAAA,IAC5C,GAAK,gBAAgB,gBAAgB,IAAI,gBAAgB,CAAC;AAAA,EAC3D;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport InspectorControlsGroups from '../inspector-controls/groups';\nimport { InspectorAdvancedControls } from '../inspector-controls';\nimport { TAB_LIST_VIEW, TAB_SETTINGS, TAB_STYLES, TAB_CONTENT } from './utils';\nimport { store as blockEditorStore } from '../../store';\n\nconst EMPTY_ARRAY = [];\n\nfunction getShowTabs( blockName, tabSettings = {} ) {\n\t// Block specific setting takes precedence over generic default.\n\tif ( tabSettings[ blockName ] !== undefined ) {\n\t\treturn tabSettings[ blockName ];\n\t}\n\n\t// Use generic default if set over the Gutenberg experiment option.\n\tif ( tabSettings.default !== undefined ) {\n\t\treturn tabSettings.default;\n\t}\n\n\treturn true;\n}\n\nexport default function useInspectorControlsTabs(\n\tblockName,\n\tcontentClientIds,\n\tisSectionBlock,\n\thasBlockStyles\n) {\n\tconst tabs = [];\n\tconst {\n\t\tbindings: bindingsGroup,\n\t\tborder: borderGroup,\n\t\tcolor: colorGroup,\n\t\tcontent: contentGroup,\n\t\tdefault: defaultGroup,\n\t\tdimensions: dimensionsGroup,\n\t\tlist: listGroup,\n\t\tposition: positionGroup,\n\t\tstyles: stylesGroup,\n\t\ttypography: typographyGroup,\n\t\teffects: effectsGroup,\n\t} = InspectorControlsGroups;\n\n\t// List View Tab: If there are any fills for the list group add that tab.\n\tconst listFills = useSlotFills( listGroup.name );\n\tconst hasListFills = !! listFills && listFills.length;\n\n\t// Content Tab: If there are any fills for the content group add that tab.\n\tconst contentFills = useSlotFills( contentGroup.name );\n\tconst hasContentFills = !! contentFills && contentFills.length;\n\n\t// Styles Tab: Add this tab if there are any fills for block supports\n\t// e.g. border, color, spacing, typography, etc.\n\tconst styleFills = [\n\t\t...( useSlotFills( borderGroup.name ) || [] ),\n\t\t...( useSlotFills( colorGroup.name ) || [] ),\n\t\t...( useSlotFills( dimensionsGroup.name ) || [] ),\n\t\t...( useSlotFills( stylesGroup.name ) || [] ),\n\t\t...( useSlotFills( typographyGroup.name ) || [] ),\n\t\t...( useSlotFills( effectsGroup.name ) || [] ),\n\t];\n\tconst hasStyleFills = styleFills.length;\n\n\t// Settings Tab: If we don't have multiple tabs to display\n\t// (i.e. both list view and styles), check only the default and position\n\t// InspectorControls slots. If we have multiple tabs, we'll need to check\n\t// the advanced controls slot as well to ensure they are rendered.\n\tconst advancedFills = [\n\t\t...( useSlotFills( InspectorAdvancedControls.slotName ) || [] ),\n\t\t...( useSlotFills( bindingsGroup.name ) || [] ),\n\t];\n\n\tconst settingsFills = [\n\t\t...( useSlotFills( defaultGroup.name ) || [] ),\n\t\t...( useSlotFills( positionGroup.name ) || [] ),\n\t\t...( hasListFills && hasStyleFills > 1 ? advancedFills : [] ),\n\t];\n\n\t// When the block fields experiment is active, only rely on `hasContentFills`\n\t// to determine whether the content tab to be shown. The tab purely uses slot\n\t// fills in this situation.\n\tconst shouldShowBlockFields =\n\t\twindow?.__experimentalContentOnlyInspectorFields;\n\tconst hasContentTab =\n\t\thasContentFills ||\n\t\t( ! shouldShowBlockFields && contentClientIds?.length );\n\n\tif ( hasContentTab ) {\n\t\ttabs.push( TAB_CONTENT );\n\t}\n\n\t// Add the tabs in the order that they will default to if available.\n\t// List View > Content > Settings > Styles.\n\tif ( hasListFills ) {\n\t\ttabs.push( TAB_LIST_VIEW );\n\t}\n\n\tif (\n\t\t( settingsFills.length ||\n\t\t\t// Advanded fills who up in settings tab if available or they blend into the default tab, if there's only one tab.\n\t\t\t( advancedFills.length && ( hasContentTab || hasListFills ) ) ) &&\n\t\t! isSectionBlock\n\t) {\n\t\ttabs.push( TAB_SETTINGS );\n\t}\n\n\tif ( hasBlockStyles || hasStyleFills ) {\n\t\ttabs.push( TAB_STYLES );\n\t}\n\n\tconst tabSettings = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).getSettings().blockInspectorTabs;\n\t}, [] );\n\n\tconst showTabs = getShowTabs( blockName, tabSettings );\n\treturn showTabs ? tabs : EMPTY_ARRAY;\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,8BAA8B,oBAAoB;AAC3D,SAAS,iBAAiB;AAK1B,OAAO,6BAA6B;AACpC,SAAS,iCAAiC;AAC1C,SAAS,eAAe,cAAc,YAAY,mBAAmB;AACrE,SAAS,SAAS,wBAAwB;AAE1C,IAAM,cAAc,CAAC;AAErB,SAAS,YAAa,WAAW,cAAc,CAAC,GAAI;AAEnD,MAAK,YAAa,SAAU,MAAM,QAAY;AAC7C,WAAO,YAAa,SAAU;AAAA,EAC/B;AAGA,MAAK,YAAY,YAAY,QAAY;AACxC,WAAO,YAAY;AAAA,EACpB;AAEA,SAAO;AACR;AAEe,SAAR,yBACN,WACA,kBACA,gBACA,gBACC;AACD,QAAM,OAAO,CAAC;AACd,QAAM;AAAA,IACL,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,SAAS;AAAA,EACV,IAAI;AAGJ,QAAM,YAAY,aAAc,UAAU,IAAK;AAC/C,QAAM,eAAe,CAAC,CAAE,aAAa,UAAU;AAG/C,QAAM,eAAe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,WAAW,WAAY;AACrD,SAAO,WAAW,OAAO;AAC1B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,35 +1,30 @@
|
|
|
1
1
|
// packages/block-editor/src/hooks/block-fields/index.js
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
privateApis as blocksPrivateApis,
|
|
4
|
+
getBlockType
|
|
5
|
+
} from "@wordpress/blocks";
|
|
4
6
|
import {
|
|
5
7
|
__experimentalHStack as HStack,
|
|
6
8
|
__experimentalTruncate as Truncate
|
|
7
9
|
} from "@wordpress/components";
|
|
8
|
-
import {
|
|
10
|
+
import { useSelect } from "@wordpress/data";
|
|
9
11
|
import { DataForm } from "@wordpress/dataviews";
|
|
10
12
|
import { useContext, useState, useMemo } from "@wordpress/element";
|
|
11
13
|
import { __ } from "@wordpress/i18n";
|
|
14
|
+
import { store as blockEditorStore } from "../../store/index.mjs";
|
|
12
15
|
import { unlock } from "../../lock-unlock.mjs";
|
|
13
16
|
import BlockIcon from "../../components/block-icon/index.mjs";
|
|
14
17
|
import useBlockDisplayTitle from "../../components/block-title/use-block-display-title.mjs";
|
|
15
18
|
import useBlockDisplayInformation from "../../components/use-block-display-information/index.mjs";
|
|
16
19
|
import FieldsDropdownMenu from "./fields-dropdown-menu.mjs";
|
|
17
20
|
import { PrivateBlockContext } from "../../components/block-list/private-block-context.mjs";
|
|
18
|
-
import
|
|
21
|
+
import InspectorControls from "../../components/inspector-controls/fill.mjs";
|
|
19
22
|
import RichText from "./rich-text/index.mjs";
|
|
20
23
|
import Media from "./media/index.mjs";
|
|
21
24
|
import Link from "./link/index.mjs";
|
|
22
25
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
26
|
var { fieldsKey, formKey } = unlock(blocksPrivateApis);
|
|
24
|
-
|
|
25
|
-
richtext: RichText,
|
|
26
|
-
media: Media,
|
|
27
|
-
link: Link
|
|
28
|
-
};
|
|
29
|
-
function createConfiguredControl(ControlComponent, type, config) {
|
|
30
|
-
if (!ControlComponent) {
|
|
31
|
-
throw new Error(`Control type "${type}" not found`);
|
|
32
|
-
}
|
|
27
|
+
function createConfiguredControl(ControlComponent, config = {}) {
|
|
33
28
|
return function ConfiguredControl(props) {
|
|
34
29
|
return /* @__PURE__ */ jsx(ControlComponent, { ...props, config });
|
|
35
30
|
};
|
|
@@ -37,7 +32,6 @@ function createConfiguredControl(ControlComponent, type, config) {
|
|
|
37
32
|
function BlockFields({
|
|
38
33
|
clientId,
|
|
39
34
|
blockType,
|
|
40
|
-
attributes,
|
|
41
35
|
setAttributes,
|
|
42
36
|
isCollapsed = false
|
|
43
37
|
}) {
|
|
@@ -47,6 +41,10 @@ function BlockFields({
|
|
|
47
41
|
});
|
|
48
42
|
const blockInformation = useBlockDisplayInformation(clientId);
|
|
49
43
|
const blockTypeFields = blockType?.[fieldsKey];
|
|
44
|
+
const attributes = useSelect(
|
|
45
|
+
(select) => select(blockEditorStore).getBlockAttributes(clientId),
|
|
46
|
+
[clientId]
|
|
47
|
+
);
|
|
50
48
|
const computedForm = useMemo(() => {
|
|
51
49
|
if (!isCollapsed) {
|
|
52
50
|
return blockType?.[formKey];
|
|
@@ -63,41 +61,18 @@ function BlockFields({
|
|
|
63
61
|
}
|
|
64
62
|
return blockTypeFields.map((fieldDef) => {
|
|
65
63
|
const field = {
|
|
66
|
-
|
|
67
|
-
label: fieldDef.label,
|
|
68
|
-
type: fieldDef.type
|
|
69
|
-
// Use the field's type; DataForm will use built-in or custom Edit
|
|
64
|
+
...fieldDef
|
|
70
65
|
};
|
|
71
|
-
if (fieldDef.
|
|
72
|
-
field.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
field.setValue = ({ value }) => {
|
|
82
|
-
const attributeUpdates = {};
|
|
83
|
-
Object.entries(fieldDef.mapping).forEach(
|
|
84
|
-
([key, attrKey]) => {
|
|
85
|
-
attributeUpdates[attrKey] = value[key];
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
return attributeUpdates;
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
const ControlComponent = CONTROLS[fieldDef.type];
|
|
92
|
-
if (ControlComponent) {
|
|
93
|
-
field.Edit = createConfiguredControl(
|
|
94
|
-
ControlComponent,
|
|
95
|
-
fieldDef.type,
|
|
96
|
-
{
|
|
97
|
-
clientId,
|
|
98
|
-
fieldDef
|
|
99
|
-
}
|
|
100
|
-
);
|
|
66
|
+
if ("string" === typeof fieldDef.Edit && fieldDef.Edit === "rich-text") {
|
|
67
|
+
field.Edit = createConfiguredControl(RichText, {
|
|
68
|
+
clientId
|
|
69
|
+
});
|
|
70
|
+
} else if ("string" === typeof fieldDef.Edit && fieldDef.Edit === "link") {
|
|
71
|
+
field.Edit = createConfiguredControl(Link);
|
|
72
|
+
} else if ("object" === typeof fieldDef.Edit && fieldDef.Edit.control === "media") {
|
|
73
|
+
field.Edit = createConfiguredControl(Media, {
|
|
74
|
+
...fieldDef.Edit
|
|
75
|
+
});
|
|
101
76
|
}
|
|
102
77
|
return field;
|
|
103
78
|
});
|
|
@@ -152,45 +127,28 @@ function BlockFields({
|
|
|
152
127
|
)
|
|
153
128
|
] });
|
|
154
129
|
}
|
|
155
|
-
|
|
156
|
-
(
|
|
157
|
-
|
|
130
|
+
function hasBlockFieldsSupport(blockName) {
|
|
131
|
+
return !!(window?.__experimentalContentOnlyInspectorFields && getBlockType(blockName)?.[fieldsKey]);
|
|
132
|
+
}
|
|
133
|
+
function BlockFieldsPanel(props) {
|
|
134
|
+
const { blockType, isSelectionWithinCurrentSection } = useContext(PrivateBlockContext);
|
|
135
|
+
return /* @__PURE__ */ jsx(InspectorControls, { group: "content", children: /* @__PURE__ */ jsx(
|
|
136
|
+
BlockFields,
|
|
137
|
+
{
|
|
138
|
+
...props,
|
|
158
139
|
blockType,
|
|
159
|
-
isSelectionWithinCurrentSection
|
|
160
|
-
isSectionBlock,
|
|
161
|
-
blockEditingMode,
|
|
162
|
-
isSelected
|
|
163
|
-
} = useContext(PrivateBlockContext);
|
|
164
|
-
const shouldShowBlockFields = window?.__experimentalContentOnlyInspectorFields;
|
|
165
|
-
const blockTypeFields = blockType?.[fieldsKey];
|
|
166
|
-
if (!shouldShowBlockFields || !blockTypeFields?.length) {
|
|
167
|
-
return /* @__PURE__ */ jsx(BlockEdit, { ...props }, "edit");
|
|
140
|
+
isCollapsed: isSelectionWithinCurrentSection
|
|
168
141
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
blockType,
|
|
182
|
-
isCollapsed: true
|
|
183
|
-
}
|
|
184
|
-
)
|
|
185
|
-
}
|
|
186
|
-
),
|
|
187
|
-
!isSelectionWithinCurrentSection && isSelected && /* @__PURE__ */ jsx(PrivateInspectorControlsFill, { group: "content", children: /* @__PURE__ */ jsx(BlockFields, { ...props, blockType }) })
|
|
188
|
-
] });
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
addFilter(
|
|
192
|
-
"editor.BlockEdit",
|
|
193
|
-
"core/content-only-controls/block-fields",
|
|
194
|
-
withBlockFields
|
|
195
|
-
);
|
|
142
|
+
) });
|
|
143
|
+
}
|
|
144
|
+
var block_fields_default = {
|
|
145
|
+
edit: BlockFieldsPanel,
|
|
146
|
+
hasSupport: hasBlockFieldsSupport,
|
|
147
|
+
attributeKeys: [],
|
|
148
|
+
supportsPatternEditing: true
|
|
149
|
+
};
|
|
150
|
+
export {
|
|
151
|
+
BlockFieldsPanel,
|
|
152
|
+
block_fields_default as default
|
|
153
|
+
};
|
|
196
154
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/block-fields/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";AAGA
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blocksPrivateApis,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { useContext, useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport BlockIcon from '../../components/block-icon';\nimport useBlockDisplayTitle from '../../components/block-title/use-block-display-title';\nimport useBlockDisplayInformation from '../../components/use-block-display-information';\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\nimport FieldsDropdownMenu from './fields-dropdown-menu';\nimport { PrivateBlockContext } from '../../components/block-list/private-block-context';\nimport InspectorControls from '../../components/inspector-controls/fill';\n\n// controls\nimport RichText from './rich-text';\nimport Media from './media';\nimport Link from './link';\n\n/**\n * Creates a configured control component that wraps a custom control\n * and passes configuration as props.\n *\n * @param {Component} ControlComponent The React component for the control.\n * @param {Object} config The control configuration passed as a prop.\n *\n * @return {Function} A wrapped control component\n */\nfunction createConfiguredControl( ControlComponent, config = {} ) {\n\treturn function ConfiguredControl( props ) {\n\t\treturn <ControlComponent { ...props } config={ config } />;\n\t};\n}\n\n/**\n * Component that renders a DataForm for a single block's attributes\n * @param {Object} props\n * @param {string} props.clientId The clientId of the block.\n * @param {Object} props.blockType The blockType definition.\n * @param {Function} props.setAttributes Action to set the block's attributes.\n * @param {boolean} props.isCollapsed Whether the DataForm is rendered as 'collapsed' with only the first field\n * displayed by default. When collapsed a dropdown is displayed to allow\n * displaying additional fields. The block's title is displayed as the title.\n * The collapsed mode is often used when multiple BlockForms are shown together.\n */\nfunction BlockFields( {\n\tclientId,\n\tblockType,\n\tsetAttributes,\n\tisCollapsed = false,\n} ) {\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\tconst blockTypeFields = blockType?.[ fieldsKey ];\n\n\tconst attributes = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockAttributes( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tconst computedForm = useMemo( () => {\n\t\tif ( ! isCollapsed ) {\n\t\t\treturn blockType?.[ formKey ];\n\t\t}\n\n\t\t// For a collapsed form only show the first field by default.\n\t\treturn {\n\t\t\t...blockType?.[ formKey ],\n\t\t\tfields: [ blockType?.[ formKey ]?.fields?.[ 0 ] ],\n\t\t};\n\t}, [ blockType, isCollapsed ] );\n\n\tconst [ form, setForm ] = useState( computedForm );\n\n\t// Build DataForm fields with proper structure\n\tconst dataFormFields = useMemo( () => {\n\t\tif ( ! blockTypeFields?.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn blockTypeFields.map( ( fieldDef ) => {\n\t\t\tconst field = {\n\t\t\t\t...fieldDef,\n\t\t\t};\n\n\t\t\t// These should be custom Edit components, not replaced here.\n\t\t\t//\n\t\t\t// - rich-text control: it needs clientId\n\t\t\t// - link control: does not need anything extra\n\t\t\t// - media control: needs the Edit config\n\t\t\tif (\n\t\t\t\t'string' === typeof fieldDef.Edit &&\n\t\t\t\tfieldDef.Edit === 'rich-text'\n\t\t\t) {\n\t\t\t\tfield.Edit = createConfiguredControl( RichText, {\n\t\t\t\t\tclientId,\n\t\t\t\t} );\n\t\t\t} else if (\n\t\t\t\t'string' === typeof fieldDef.Edit &&\n\t\t\t\tfieldDef.Edit === 'link'\n\t\t\t) {\n\t\t\t\tfield.Edit = createConfiguredControl( Link );\n\t\t\t} else if (\n\t\t\t\t'object' === typeof fieldDef.Edit &&\n\t\t\t\tfieldDef.Edit.control === 'media'\n\t\t\t) {\n\t\t\t\tfield.Edit = createConfiguredControl( Media, {\n\t\t\t\t\t...fieldDef.Edit,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn field;\n\t\t} );\n\t}, [ blockTypeFields, clientId ] );\n\n\tif ( ! blockTypeFields?.length ) {\n\t\t// TODO - we might still want to show a placeholder for blocks with no fields.\n\t\t// for example, a way to select the block.\n\t\treturn null;\n\t}\n\n\tconst handleToggleField = ( fieldId ) => {\n\t\tsetForm( ( prev ) => {\n\t\t\tif ( prev.fields?.includes( fieldId ) ) {\n\t\t\t\treturn {\n\t\t\t\t\t...prev,\n\t\t\t\t\tfields: prev.fields.filter( ( id ) => id !== fieldId ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfields: [ ...( prev.fields || [] ), fieldId ],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-fields__container\">\n\t\t\t<div className=\"block-editor-block-fields__header\">\n\t\t\t\t<HStack spacing={ 1 }>\n\t\t\t\t\t{ isCollapsed && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-fields__header-icon\"\n\t\t\t\t\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<h2 className=\"block-editor-block-fields__header-title\">\n\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t{ blockTitle }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t<FieldsDropdownMenu\n\t\t\t\t\t\t\t\tfields={ dataFormFields }\n\t\t\t\t\t\t\t\tvisibleFields={ form.fields }\n\t\t\t\t\t\t\t\tonToggleField={ handleToggleField }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isCollapsed && (\n\t\t\t\t\t\t<h2 className=\"block-editor-block-fields__header-title\">\n\t\t\t\t\t\t\t{ __( 'Content' ) }\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</div>\n\t\t\t<DataForm\n\t\t\t\tdata={ attributes }\n\t\t\t\tfields={ dataFormFields }\n\t\t\t\tform={ form }\n\t\t\t\tonChange={ setAttributes }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction hasBlockFieldsSupport( blockName ) {\n\treturn !! (\n\t\twindow?.__experimentalContentOnlyInspectorFields &&\n\t\tgetBlockType( blockName )?.[ fieldsKey ]\n\t);\n}\n\nexport function BlockFieldsPanel( props ) {\n\tconst { blockType, isSelectionWithinCurrentSection } =\n\t\tuseContext( PrivateBlockContext );\n\n\treturn (\n\t\t<InspectorControls group=\"content\">\n\t\t\t<BlockFields\n\t\t\t\t{ ...props }\n\t\t\t\tblockType={ blockType }\n\t\t\t\tisCollapsed={ isSelectionWithinCurrentSection }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Export block support definition.\n */\nexport default {\n\tedit: BlockFieldsPanel,\n\thasSupport: hasBlockFieldsSupport,\n\tattributeKeys: [],\n\tsupportsPatternEditing: true,\n};\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC,eAAe;AAAA,EACf;AAAA,OACM;AACP;AAAA,EACC,wBAAwB;AAAA,EACxB,0BAA0B;AAAA,OACpB;AACP,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,YAAY,UAAU,eAAe;AAC9C,SAAS,UAAU;AAKnB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AACvB,OAAO,eAAe;AACtB,OAAO,0BAA0B;AACjC,OAAO,gCAAgC;AAEvC,OAAO,wBAAwB;AAC/B,SAAS,2BAA2B;AACpC,OAAO,uBAAuB;AAG9B,OAAO,cAAc;AACrB,OAAO,WAAW;AAClB,OAA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A,IACZ;AAAA,KACD;AAEF;AAEA,SAAS,sBAAuB,WAAY;AAC3C,SAAO,CAAC,EACP,QAAQ,4CACR,aAAc,SAAU,IAAK,SAAU;AAEzC;AAEO,SAAS,iBAAkB,OAAQ;AACzC,QAAM,EAAE,WAAW,gCAAgC,IAClD,WAAY,mBAAoB;AAEjC,SACC,oBAAC,qBAAkB,OAAM,WACxB;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACL;AAAA,MACA,aAAc;AAAA;AAAA,EACf,GACD;AAEF;AAKA,IAAO,uBAAQ;AAAA,EACd,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,eAAe,CAAC;AAAA,EAChB,wBAAwB;AACzB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -42,12 +42,11 @@ function getUpdatedLinkAttributes({
|
|
|
42
42
|
rel: updatedRel || void 0
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
function Link({ data, field, onChange
|
|
45
|
+
function Link({ data, field, onChange }) {
|
|
46
46
|
const [isLinkControlOpen, setIsLinkControlOpen] = useState(false);
|
|
47
47
|
const { popoverProps } = useInspectorPopoverPlacement({
|
|
48
48
|
isControl: true
|
|
49
49
|
});
|
|
50
|
-
const { fieldDef } = config;
|
|
51
50
|
const value = field.getValue({ item: data });
|
|
52
51
|
const url = value?.url;
|
|
53
52
|
const rel = value?.rel || "";
|
|
@@ -119,18 +118,10 @@ function Link({ data, field, onChange, config = {} }) {
|
|
|
119
118
|
);
|
|
120
119
|
},
|
|
121
120
|
onRemove: () => {
|
|
122
|
-
const removeValue = {};
|
|
123
|
-
if (fieldDef?.mapping) {
|
|
124
|
-
Object.keys(fieldDef.mapping).forEach(
|
|
125
|
-
(key) => {
|
|
126
|
-
removeValue[key] = void 0;
|
|
127
|
-
}
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
121
|
onChange(
|
|
131
122
|
field.setValue({
|
|
132
123
|
item: data,
|
|
133
|
-
value:
|
|
124
|
+
value: {}
|
|
134
125
|
})
|
|
135
126
|
);
|
|
136
127
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/hooks/block-fields/link/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon,\n\t__experimentalGrid as Grid,\n\tPopover,\n} from '@wordpress/components';\nimport { useMemo, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { link } from '@wordpress/icons';\nimport { prependHTTP } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport LinkControl from '../../../components/link-control';\nimport { useInspectorPopoverPlacement } from '../use-inspector-popover-placement';\n\nexport const NEW_TAB_REL = 'noreferrer noopener';\nexport const NEW_TAB_TARGET = '_blank';\nexport const NOFOLLOW_REL = 'nofollow';\n\n/**\n * Updates the link attributes.\n *\n * @param {Object} attributes The current block attributes.\n * @param {string} attributes.rel The current link rel attribute.\n * @param {string} attributes.url The current link url.\n * @param {boolean} attributes.opensInNewTab Whether the link should open in a new window.\n * @param {boolean} attributes.nofollow Whether the link should be marked as nofollow.\n */\nexport function getUpdatedLinkAttributes( {\n\trel = '',\n\turl = '',\n\topensInNewTab,\n\tnofollow,\n} ) {\n\tlet newLinkTarget;\n\t// Since `rel` is editable attribute, we need to check for existing values and proceed accordingly.\n\tlet updatedRel = rel;\n\n\tif ( opensInNewTab ) {\n\t\tnewLinkTarget = NEW_TAB_TARGET;\n\t\tupdatedRel = updatedRel?.includes( NEW_TAB_REL )\n\t\t\t? updatedRel\n\t\t\t: updatedRel + ` ${ NEW_TAB_REL }`;\n\t} else {\n\t\tconst relRegex = new RegExp( `\\\\b${ NEW_TAB_REL }\\\\s*`, 'g' );\n\t\tupdatedRel = updatedRel?.replace( relRegex, '' ).trim();\n\t}\n\n\tif ( nofollow ) {\n\t\tupdatedRel = updatedRel?.includes( NOFOLLOW_REL )\n\t\t\t? updatedRel\n\t\t\t: ( updatedRel + ` ${ NOFOLLOW_REL }` ).trim();\n\t} else {\n\t\tconst relRegex = new RegExp( `\\\\b${ NOFOLLOW_REL }\\\\s*`, 'g' );\n\t\tupdatedRel = updatedRel?.replace( relRegex, '' ).trim();\n\t}\n\n\treturn {\n\t\turl: prependHTTP( url ),\n\t\tlinkTarget: newLinkTarget,\n\t\trel: updatedRel || undefined,\n\t};\n}\n\nexport default function Link( { data, field, onChange
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,EACtB;AAAA,OACM;AACP,SAAS,SAAS,gBAAgB;AAClC,SAAS,UAAU;AACnB,SAAS,YAAY;AACrB,SAAS,mBAAmB;AAK5B,OAAO,iBAAiB;AACxB,SAAS,oCAAoC;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon,\n\t__experimentalGrid as Grid,\n\tPopover,\n} from '@wordpress/components';\nimport { useMemo, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { link } from '@wordpress/icons';\nimport { prependHTTP } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport LinkControl from '../../../components/link-control';\nimport { useInspectorPopoverPlacement } from '../use-inspector-popover-placement';\n\nexport const NEW_TAB_REL = 'noreferrer noopener';\nexport const NEW_TAB_TARGET = '_blank';\nexport const NOFOLLOW_REL = 'nofollow';\n\n/**\n * Updates the link attributes.\n *\n * @param {Object} attributes The current block attributes.\n * @param {string} attributes.rel The current link rel attribute.\n * @param {string} attributes.url The current link url.\n * @param {boolean} attributes.opensInNewTab Whether the link should open in a new window.\n * @param {boolean} attributes.nofollow Whether the link should be marked as nofollow.\n */\nexport function getUpdatedLinkAttributes( {\n\trel = '',\n\turl = '',\n\topensInNewTab,\n\tnofollow,\n} ) {\n\tlet newLinkTarget;\n\t// Since `rel` is editable attribute, we need to check for existing values and proceed accordingly.\n\tlet updatedRel = rel;\n\n\tif ( opensInNewTab ) {\n\t\tnewLinkTarget = NEW_TAB_TARGET;\n\t\tupdatedRel = updatedRel?.includes( NEW_TAB_REL )\n\t\t\t? updatedRel\n\t\t\t: updatedRel + ` ${ NEW_TAB_REL }`;\n\t} else {\n\t\tconst relRegex = new RegExp( `\\\\b${ NEW_TAB_REL }\\\\s*`, 'g' );\n\t\tupdatedRel = updatedRel?.replace( relRegex, '' ).trim();\n\t}\n\n\tif ( nofollow ) {\n\t\tupdatedRel = updatedRel?.includes( NOFOLLOW_REL )\n\t\t\t? updatedRel\n\t\t\t: ( updatedRel + ` ${ NOFOLLOW_REL }` ).trim();\n\t} else {\n\t\tconst relRegex = new RegExp( `\\\\b${ NOFOLLOW_REL }\\\\s*`, 'g' );\n\t\tupdatedRel = updatedRel?.replace( relRegex, '' ).trim();\n\t}\n\n\treturn {\n\t\turl: prependHTTP( url ),\n\t\tlinkTarget: newLinkTarget,\n\t\trel: updatedRel || undefined,\n\t};\n}\n\nexport default function Link( { data, field, onChange } ) {\n\tconst [ isLinkControlOpen, setIsLinkControlOpen ] = useState( false );\n\tconst { popoverProps } = useInspectorPopoverPlacement( {\n\t\tisControl: true,\n\t} );\n\tconst value = field.getValue( { item: data } );\n\tconst url = value?.url;\n\tconst rel = value?.rel || '';\n\tconst target = value?.linkTarget;\n\n\tconst opensInNewTab = target === NEW_TAB_TARGET;\n\tconst nofollow = rel === NOFOLLOW_REL;\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/51256.\n\tconst linkValue = useMemo(\n\t\t() => ( { url, opensInNewTab, nofollow } ),\n\t\t[ url, opensInNewTab, nofollow ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"block-editor-content-only-controls__link\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsLinkControlOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<Grid\n\t\t\t\t\trowGap={ 0 }\n\t\t\t\t\tcolumnGap={ 8 }\n\t\t\t\t\ttemplateColumns=\"24px 1fr\"\n\t\t\t\t\tclassName=\"block-editor-content-only-controls__link-row\"\n\t\t\t\t>\n\t\t\t\t\t{ url && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Icon icon={ link } size={ 24 } />\n\t\t\t\t\t\t\t<span className=\"block-editor-content-only-controls__link-title\">\n\t\t\t\t\t\t\t\t{ url }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! url && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ link }\n\t\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t\t\tstyle={ { opacity: 0.3 } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<span className=\"block-editor-content-only-controls__link-title\">\n\t\t\t\t\t\t\t\t{ __( 'Link' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</Grid>\n\t\t\t</Button>\n\t\t\t{ isLinkControlOpen && (\n\t\t\t\t<Popover\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsLinkControlOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\t{ ...( popoverProps ?? {} ) }\n\t\t\t\t>\n\t\t\t\t\t<LinkControl\n\t\t\t\t\t\tvalue={ linkValue }\n\t\t\t\t\t\tonChange={ ( newValues ) => {\n\t\t\t\t\t\t\tconst updatedAttrs = getUpdatedLinkAttributes( {\n\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\t...newValues,\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tfield.setValue( {\n\t\t\t\t\t\t\t\t\titem: data,\n\t\t\t\t\t\t\t\t\tvalue: updatedAttrs,\n\t\t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sB,KAAM;AAAA,QAC7B;AAAA,QACE,GAAK,gBAAgB,CAAC;AAAA,QAExB;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ;AAAA,YACR,UAAW,CAAE,cAAe;AAC3B,oBAAM,eAAe,yBAA0B;AAAA,gBAC9C;AAAA,gBACA,GAAG;AAAA,cACJ,CAAE;AAEF;AAAA,gBACC,MAAM,SAAU;AAAA,kBACf,MAAM;AAAA,kBACN,OAAO;AAAA,gBACR,CAAE;AAAA,cACH;AAAA,YACD;AAAA,YACA,UAAW,MAAM;AAChB;AAAA,gBACC,MAAM,SAAU;AAAA,kBACf,MAAM;AAAA,kBACN,OAAO,CAAC;AAAA,gBACT,CAAE;AAAA,cACH;AAAA,YACD;AAAA;AAAA,QACD;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -19,8 +19,7 @@ import { getMediaSelectKey } from "../../../store/private-keys.mjs";
|
|
|
19
19
|
import { store as blockEditorStore } from "../../../store/index.mjs";
|
|
20
20
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
21
|
function MediaThumbnail({ data, field, attachment, config }) {
|
|
22
|
-
const {
|
|
23
|
-
const { allowedTypes = [], multiple = false } = fieldDef.args || {};
|
|
22
|
+
const { allowedTypes = [], multiple = false } = config || {};
|
|
24
23
|
if (multiple) {
|
|
25
24
|
return "todo multiple";
|
|
26
25
|
}
|
|
@@ -62,9 +61,11 @@ function Media({ data, field, onChange, config = {} }) {
|
|
|
62
61
|
isControl: true
|
|
63
62
|
});
|
|
64
63
|
const value = field.getValue({ item: data });
|
|
65
|
-
const {
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
const {
|
|
65
|
+
allowedTypes = [],
|
|
66
|
+
multiple = false,
|
|
67
|
+
useFeaturedImage = false
|
|
68
|
+
} = config;
|
|
68
69
|
const id = value?.id;
|
|
69
70
|
const url = value?.url;
|
|
70
71
|
const attachment = useSelect(
|
|
@@ -106,20 +107,14 @@ function Media({ data, field, onChange, config = {} }) {
|
|
|
106
107
|
multiple,
|
|
107
108
|
popoverProps,
|
|
108
109
|
onReset: () => {
|
|
109
|
-
const resetValue = {};
|
|
110
|
-
if (fieldDef?.mapping) {
|
|
111
|
-
Object.keys(fieldDef.mapping).forEach((key) => {
|
|
112
|
-
resetValue[key] = void 0;
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
110
|
onChange(
|
|
116
111
|
field.setValue({
|
|
117
112
|
item: data,
|
|
118
|
-
value:
|
|
113
|
+
value: {}
|
|
119
114
|
})
|
|
120
115
|
);
|
|
121
116
|
},
|
|
122
|
-
...
|
|
117
|
+
...useFeaturedImage && {
|
|
123
118
|
useFeaturedImage: !!value?.featuredImage,
|
|
124
119
|
onToggleFeaturedImage: () => {
|
|
125
120
|
onChange(
|
|
@@ -138,7 +133,7 @@ function Media({ data, field, onChange, config = {} }) {
|
|
|
138
133
|
...selectedMedia,
|
|
139
134
|
mediaType: selectedMedia.media_type
|
|
140
135
|
};
|
|
141
|
-
if (
|
|
136
|
+
if (useFeaturedImage) {
|
|
142
137
|
newValue.featuredImage = false;
|
|
143
138
|
}
|
|
144
139
|
onChange(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/hooks/block-fields/media/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon,\n\t__experimentalGrid as Grid,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\taudio as audioIcon,\n\timage as imageIcon,\n\tmedia as mediaIcon,\n\tvideo as videoIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport MediaReplaceFlow from '../../../components/media-replace-flow';\nimport MediaUploadCheck from '../../../components/media-upload/check';\nimport { useInspectorPopoverPlacement } from '../use-inspector-popover-placement';\nimport { getMediaSelectKey } from '../../../store/private-keys';\nimport { store as blockEditorStore } from '../../../store';\n\nfunction MediaThumbnail( { data, field, attachment, config } ) {\n\tconst {
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,OAChB;AACP,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AACnB;AAAA,EACC,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,OACH;AAKP,OAAO,sBAAsB;AAC7B,OAAO,sBAAsB;AAC7B,SAAS,oCAAoC;AAC7C,SAAS,yBAAyB;AAClC,SAAS,SAAS,wBAAwB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon,\n\t__experimentalGrid as Grid,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\taudio as audioIcon,\n\timage as imageIcon,\n\tmedia as mediaIcon,\n\tvideo as videoIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport MediaReplaceFlow from '../../../components/media-replace-flow';\nimport MediaUploadCheck from '../../../components/media-upload/check';\nimport { useInspectorPopoverPlacement } from '../use-inspector-popover-placement';\nimport { getMediaSelectKey } from '../../../store/private-keys';\nimport { store as blockEditorStore } from '../../../store';\n\nfunction MediaThumbnail( { data, field, attachment, config } ) {\n\tconst { allowedTypes = [], multiple = false } = config || {};\n\n\tif ( multiple ) {\n\t\treturn 'todo multiple';\n\t}\n\n\tif ( attachment?.media_type === 'image' || attachment?.poster ) {\n\t\treturn (\n\t\t\t<div className=\"block-editor-content-only-controls__media-thumbnail\">\n\t\t\t\t<img\n\t\t\t\t\talt=\"\"\n\t\t\t\t\twidth={ 24 }\n\t\t\t\t\theight={ 24 }\n\t\t\t\t\tsrc={\n\t\t\t\t\t\tattachment.media_type === 'image'\n\t\t\t\t\t\t\t? attachment.source_url\n\t\t\t\t\t\t\t: attachment.poster\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( allowedTypes.length === 1 ) {\n\t\tconst value = field.getValue( { item: data } );\n\t\tconst url = value?.url;\n\n\t\tif ( allowedTypes[ 0 ] === 'image' && url ) {\n\t\t\treturn (\n\t\t\t\t<div className=\"block-editor-content-only-controls__media-thumbnail\">\n\t\t\t\t\t<img alt=\"\" width={ 24 } height={ 24 } src={ url } />\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\tlet icon;\n\t\tif ( allowedTypes[ 0 ] === 'image' ) {\n\t\t\ticon = imageIcon;\n\t\t} else if ( allowedTypes[ 0 ] === 'video' ) {\n\t\t\ticon = videoIcon;\n\t\t} else if ( allowedTypes[ 0 ] === 'audio' ) {\n\t\t\ticon = audioIcon;\n\t\t} else {\n\t\t\ticon = mediaIcon;\n\t\t}\n\n\t\tif ( icon ) {\n\t\t\treturn <Icon icon={ icon } size={ 24 } />;\n\t\t}\n\t}\n\n\treturn <Icon icon={ mediaIcon } size={ 24 } />;\n}\n\nexport default function Media( { data, field, onChange, config = {} } ) {\n\tconst { popoverProps } = useInspectorPopoverPlacement( {\n\t\tisControl: true,\n\t} );\n\tconst value = field.getValue( { item: data } );\n\tconst {\n\t\tallowedTypes = [],\n\t\tmultiple = false,\n\t\tuseFeaturedImage = false,\n\t} = config;\n\n\tconst id = value?.id;\n\tconst url = value?.url;\n\n\tconst attachment = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! id ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\t\tconst getMedia = settings[ getMediaSelectKey ];\n\n\t\t\tif ( ! getMedia ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\treturn getMedia( select, id );\n\t\t},\n\t\t[ id ]\n\t);\n\n\t// TODO - pluralize when multiple.\n\tlet chooseItemLabel;\n\tif ( allowedTypes.length === 1 ) {\n\t\tconst allowedType = allowedTypes[ 0 ];\n\t\tif ( allowedType === 'image' ) {\n\t\t\tchooseItemLabel = __( 'Choose an image\u2026' );\n\t\t} else if ( allowedType === 'video' ) {\n\t\t\tchooseItemLabel = __( 'Choose a video\u2026' );\n\t\t} else if ( allowedType === 'application' ) {\n\t\t\tchooseItemLabel = __( 'Choose a file\u2026' );\n\t\t} else {\n\t\t\tchooseItemLabel = __( 'Choose a media item\u2026' );\n\t\t}\n\t} else {\n\t\tchooseItemLabel = __( 'Choose a media item\u2026' );\n\t}\n\n\treturn (\n\t\t<MediaUploadCheck>\n\t\t\t<MediaReplaceFlow\n\t\t\t\tclassName=\"block-editor-content-only-controls__media-replace-flow\"\n\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\tmediaId={ id }\n\t\t\t\tmediaURL={ url }\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tonReset={ () => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tfield.setValue( {\n\t\t\t\t\t\t\titem: data,\n\t\t\t\t\t\t\tvalue: {},\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t\t{ ...( useFeaturedImage && {\n\t\t\t\t\tuseFeaturedImage: !! value?.featuredImage,\n\t\t\t\t\tonToggleFeaturedImage: () => {\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tfield.setValue( {\n\t\t\t\t\t\t\t\titem: data,\n\t\t\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\t\t\tfeaturedImage: ! value?.featuredImage,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t} ) }\n\t\t\t\tonSelect={ ( selectedMedia ) => {\n\t\t\t\t\tif ( selectedMedia.id && selectedMedia.url ) {\n\t\t\t\t\t\tconst newValue = {\n\t\t\t\t\t\t\t...selectedMedia,\n\t\t\t\t\t\t\tmediaType: selectedMedia.media_type,\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// Turn off featured image when manually selecting media\n\t\t\t\t\t\tif ( useFeaturedImage ) {\n\t\t\t\t\t\t\tnewValue.featuredImage = false;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tfield.setValue( {\n\t\t\t\t\t\t\t\titem: data,\n\t\t\t\t\t\t\t\tvalue: newValue,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\trenderToggle={ ( buttonProps ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tclassName=\"block-editor-content-only-controls__media\"\n\t\t\t\t\t\t{ ...buttonProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Grid\n\t\t\t\t\t\t\trowGap={ 0 }\n\t\t\t\t\t\t\tcolumnGap={ 8 }\n\t\t\t\t\t\t\ttemplateColumns=\"24px 1fr\"\n\t\t\t\t\t\t\tclassName=\"block-editor-content-only-controls__media-row\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ url && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<MediaThumbnail\n\t\t\t\t\t\t\t\t\t\tattachment={ attachment }\n\t\t\t\t\t\t\t\t\t\tfield={ field }\n\t\t\t\t\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\t\t\t\t\tconfig={ config }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<span className=\"block-editor-content-only-controls__media-title\">\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t// TODO - truncate long titles or url smartly (e.g. show filename).\n\t\t\t\t\t\t\t\t\t\t\tattachment?.title?.raw &&\n\t\t\t\t\t\t\t\t\t\t\tattachment?.title?.raw !== ''\n\t\t\t\t\t\t\t\t\t\t\t\t? attachment?.title?.raw\n\t\t\t\t\t\t\t\t\t\t\t\t: url\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t</span>\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{ ! url && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-content-only-controls__media-placeholder\"\n\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\twidth: '24px',\n\t\t\t\t\t\t\t\t\t\t\theight: '24px',\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<span className=\"block-editor-content-only-controls__media-title\">\n\t\t\t\t\t\t\t\t\t\t{ chooseItemLabel }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Grid>\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</MediaUploadCheck>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,OAChB;AACP,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AACnB;AAAA,EACC,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,OACH;AAKP,OAAO,sBAAsB;AAC7B,OAAO,sBAAsB;AAC7B,SAAS,oCAAoC;AAC7C,SAAS,yBAAyB;AAClC,SAAS,SAAS,wBAAwB;AAYtC,SA6JI,UA7JJ,KA6JI,YA7JJ;AAVJ,SAAS,eAAgB,EAAE,MAAM,OAAO,YAAY,OAAO,GAAI;AAC9D,QAAM,EAAE,eAAe,CAAC,GAAG,WAAW,MAAM,IAAI,UAAU,CAAC;AAE3D,MAAK,UAAW;AACf,WAAO;AAAA,EACR;AAEA,MAAK,YAAY,eAAe,WAAW,YAAY,QAAS;AAC/D,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