@wordpress/editor 14.18.0 → 14.19.1
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/README.md +2 -0
- package/build/components/document-bar/index.js +3 -2
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/index.js +37 -17
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +32 -20
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +4 -3
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +2 -1
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/index.js +66 -42
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/post-actions/index.js +19 -28
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-card-panel/index.js +5 -5
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +4 -2
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-template/block-theme.js +68 -48
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +30 -18
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/create-new-template-modal.js +3 -1
- package/build/components/post-template/create-new-template-modal.js.map +1 -1
- package/build/components/post-template/panel.js +3 -11
- package/build/components/post-template/panel.js.map +1 -1
- package/build/components/preferences-modal/block-visibility.js +2 -1
- package/build/components/preferences-modal/block-visibility.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +6 -3
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.js +19 -18
- package/build/components/provider/index.js.map +1 -1
- package/build/components/sidebar/header.js +1 -1
- package/build/components/sidebar/header.js.map +1 -1
- package/build/components/sidebar/index.js +1 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/start-page-options/index.js +148 -23
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build/store/private-actions.js +29 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +45 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/selectors.js +8 -7
- package/build/store/selectors.js.map +1 -1
- package/build/utils/media-upload/index.js +5 -2
- package/build/utils/media-upload/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +3 -2
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/index.js +38 -18
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +32 -20
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +4 -3
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +2 -1
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +67 -43
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/post-actions/index.js +19 -28
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +5 -5
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +4 -2
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +68 -48
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +30 -18
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/create-new-template-modal.js +3 -1
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-template/panel.js +3 -11
- package/build-module/components/post-template/panel.js.map +1 -1
- package/build-module/components/preferences-modal/block-visibility.js +2 -1
- package/build-module/components/preferences-modal/block-visibility.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +6 -3
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +19 -18
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/sidebar/header.js +1 -1
- package/build-module/components/sidebar/header.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +148 -24
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build-module/store/private-actions.js +25 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +44 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/selectors.js +8 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js +5 -2
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-style/style-rtl.css +51 -9
- package/build-style/style.css +51 -9
- package/build-types/components/document-outline/index.d.ts.map +1 -1
- package/build-types/components/document-outline/item.d.ts +2 -1
- package/build-types/components/document-outline/item.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/index.d.ts +6 -2
- package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
- package/build-types/components/post-actions/index.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
- package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
- package/build-types/components/post-template/panel.d.ts.map +1 -1
- package/build-types/components/preferences-modal/block-visibility.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/start-page-options/index.d.ts +2 -1
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +4 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +13 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/media-upload/index.d.ts +3 -1
- package/build-types/utils/media-upload/index.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/components/document-bar/index.js +2 -2
- package/src/components/document-outline/index.js +49 -17
- package/src/components/document-outline/item.js +38 -23
- package/src/components/document-outline/style.scss +2 -0
- package/src/components/entities-saved-states/entity-record-item.js +2 -4
- package/src/components/entities-saved-states/entity-type-list.js +6 -2
- package/src/components/entities-saved-states/index.js +98 -58
- package/src/components/entities-saved-states/style.scss +40 -5
- package/src/components/post-actions/index.js +19 -37
- package/src/components/post-card-panel/index.js +9 -7
- package/src/components/post-featured-image/index.js +2 -0
- package/src/components/post-template/block-theme.js +76 -56
- package/src/components/post-template/classic-theme.js +31 -15
- package/src/components/post-template/create-new-template-modal.js +1 -0
- package/src/components/post-template/panel.js +2 -12
- package/src/components/post-text-editor/style.scss +0 -2
- package/src/components/preferences-modal/block-visibility.js +2 -1
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/preview-dropdown/index.js +8 -6
- package/src/components/provider/index.js +21 -30
- package/src/components/sidebar/header.js +1 -1
- package/src/components/sidebar/index.js +1 -1
- package/src/components/start-page-options/index.js +149 -23
- package/src/components/start-page-options/style.scss +27 -0
- package/src/components/visual-editor/edit-template-blocks-notification.js +1 -1
- package/src/store/private-actions.js +33 -0
- package/src/store/private-selectors.js +59 -4
- package/src/store/selectors.js +9 -14
- package/src/utils/media-upload/index.js +3 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.EntitiesSavedStatesExtensible = EntitiesSavedStatesExtensible;
|
|
8
8
|
exports.default = EntitiesSavedStates;
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
9
10
|
var _components = require("@wordpress/components");
|
|
10
11
|
var _i18n = require("@wordpress/i18n");
|
|
11
12
|
var _element = require("@wordpress/element");
|
|
@@ -16,6 +17,10 @@ var _useIsDirty = require("./hooks/use-is-dirty");
|
|
|
16
17
|
var _store = require("../../store");
|
|
17
18
|
var _lockUnlock = require("../../lock-unlock");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
/**
|
|
21
|
+
* External dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
19
24
|
/**
|
|
20
25
|
* WordPress dependencies
|
|
21
26
|
*/
|
|
@@ -34,17 +39,20 @@ function identity(values) {
|
|
|
34
39
|
* @param {Object} props The component props.
|
|
35
40
|
* @param {Function} props.close The function to close the dialog.
|
|
36
41
|
* @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior.
|
|
42
|
+
* @param {string} props.variant Changes the layout of the component. When an `inline` value is provided, the action buttons are rendered at the end of the component instead of at the start.
|
|
37
43
|
*
|
|
38
44
|
* @return {React.ReactNode} The rendered component.
|
|
39
45
|
*/
|
|
40
46
|
function EntitiesSavedStates({
|
|
41
47
|
close,
|
|
42
|
-
renderDialog
|
|
48
|
+
renderDialog,
|
|
49
|
+
variant
|
|
43
50
|
}) {
|
|
44
51
|
const isDirtyProps = (0, _useIsDirty.useIsDirty)();
|
|
45
52
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(EntitiesSavedStatesExtensible, {
|
|
46
53
|
close: close,
|
|
47
54
|
renderDialog: renderDialog,
|
|
55
|
+
variant: variant,
|
|
48
56
|
...isDirtyProps
|
|
49
57
|
});
|
|
50
58
|
}
|
|
@@ -63,6 +71,7 @@ function EntitiesSavedStates({
|
|
|
63
71
|
* @param {boolean} props.isDirty Flag indicating if there are dirty entities.
|
|
64
72
|
* @param {Function} props.setUnselectedEntities Function to set unselected entities.
|
|
65
73
|
* @param {Array} props.unselectedEntities Array of unselected entities.
|
|
74
|
+
* @param {string} props.variant Changes the layout of the component. When an `inline` value is provided, the action buttons are rendered at the end of the component instead of at the start.
|
|
66
75
|
*
|
|
67
76
|
* @return {React.ReactNode} The rendered component.
|
|
68
77
|
*/
|
|
@@ -76,7 +85,8 @@ function EntitiesSavedStatesExtensible({
|
|
|
76
85
|
dirtyEntityRecords,
|
|
77
86
|
isDirty,
|
|
78
87
|
setUnselectedEntities,
|
|
79
|
-
unselectedEntities
|
|
88
|
+
unselectedEntities,
|
|
89
|
+
variant = 'default'
|
|
80
90
|
}) {
|
|
81
91
|
const saveButtonRef = (0, _element.useRef)();
|
|
82
92
|
const {
|
|
@@ -109,58 +119,67 @@ function EntitiesSavedStatesExtensible({
|
|
|
109
119
|
const [saveDialogRef, saveDialogProps] = (0, _compose.__experimentalUseDialog)({
|
|
110
120
|
onClose: () => dismissPanel()
|
|
111
121
|
});
|
|
112
|
-
const
|
|
113
|
-
const
|
|
122
|
+
const dialogLabelId = (0, _compose.useInstanceId)(EntitiesSavedStatesExtensible, 'entities-saved-states__panel-label');
|
|
123
|
+
const dialogDescriptionId = (0, _compose.useInstanceId)(EntitiesSavedStatesExtensible, 'entities-saved-states__panel-description');
|
|
114
124
|
const selectItemsToSaveDescription = !!dirtyEntityRecords.length ? (0, _i18n.__)('Select the items you want to save.') : undefined;
|
|
125
|
+
const isInline = variant === 'inline';
|
|
126
|
+
const actionButtons = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
127
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
128
|
+
isBlock: isInline ? false : true,
|
|
129
|
+
as: _components.Button,
|
|
130
|
+
variant: isInline ? 'tertiary' : 'secondary',
|
|
131
|
+
size: isInline ? undefined : 'compact',
|
|
132
|
+
onClick: dismissPanel,
|
|
133
|
+
children: (0, _i18n.__)('Cancel')
|
|
134
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
135
|
+
isBlock: isInline ? false : true,
|
|
136
|
+
as: _components.Button,
|
|
137
|
+
ref: saveButtonRef,
|
|
138
|
+
variant: "primary",
|
|
139
|
+
size: isInline ? undefined : 'compact',
|
|
140
|
+
disabled: !saveEnabled,
|
|
141
|
+
accessibleWhenDisabled: true,
|
|
142
|
+
onClick: () => saveDirtyEntities({
|
|
143
|
+
onSave,
|
|
144
|
+
dirtyEntityRecords,
|
|
145
|
+
entitiesToSkip: unselectedEntities,
|
|
146
|
+
close
|
|
147
|
+
}),
|
|
148
|
+
className: "editor-entities-saved-states__save-button",
|
|
149
|
+
children: saveLabel
|
|
150
|
+
})]
|
|
151
|
+
});
|
|
115
152
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
116
153
|
ref: renderDialog ? saveDialogRef : undefined,
|
|
117
154
|
...(renderDialog && saveDialogProps),
|
|
118
|
-
className:
|
|
155
|
+
className: (0, _clsx.default)('entities-saved-states__panel', {
|
|
156
|
+
'is-inline': isInline
|
|
157
|
+
}),
|
|
119
158
|
role: renderDialog ? 'dialog' : undefined,
|
|
120
|
-
"aria-labelledby": renderDialog ?
|
|
121
|
-
"aria-describedby": renderDialog ?
|
|
122
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
159
|
+
"aria-labelledby": renderDialog ? dialogLabelId : undefined,
|
|
160
|
+
"aria-describedby": renderDialog ? dialogDescriptionId : undefined,
|
|
161
|
+
children: [!isInline && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Flex, {
|
|
123
162
|
className: "entities-saved-states__panel-header",
|
|
124
163
|
gap: 2,
|
|
125
|
-
children:
|
|
126
|
-
isBlock: true,
|
|
127
|
-
as: _components.Button,
|
|
128
|
-
variant: "secondary",
|
|
129
|
-
size: "compact",
|
|
130
|
-
onClick: dismissPanel,
|
|
131
|
-
children: (0, _i18n.__)('Cancel')
|
|
132
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
133
|
-
isBlock: true,
|
|
134
|
-
as: _components.Button,
|
|
135
|
-
ref: saveButtonRef,
|
|
136
|
-
variant: "primary",
|
|
137
|
-
size: "compact",
|
|
138
|
-
disabled: !saveEnabled,
|
|
139
|
-
accessibleWhenDisabled: true,
|
|
140
|
-
onClick: () => saveDirtyEntities({
|
|
141
|
-
onSave,
|
|
142
|
-
dirtyEntityRecords,
|
|
143
|
-
entitiesToSkip: unselectedEntities,
|
|
144
|
-
close
|
|
145
|
-
}),
|
|
146
|
-
className: "editor-entities-saved-states__save-button",
|
|
147
|
-
children: saveLabel
|
|
148
|
-
})]
|
|
164
|
+
children: actionButtons
|
|
149
165
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
150
166
|
className: "entities-saved-states__text-prompt",
|
|
151
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
167
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
152
168
|
className: "entities-saved-states__text-prompt--header-wrapper",
|
|
153
|
-
|
|
154
|
-
|
|
169
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
170
|
+
id: renderDialog ? dialogLabelId : undefined,
|
|
155
171
|
className: "entities-saved-states__text-prompt--header",
|
|
156
172
|
children: (0, _i18n.__)('Are you ready to save?')
|
|
157
|
-
})
|
|
158
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
159
|
-
id: renderDialog ?
|
|
160
|
-
children:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
173
|
+
})
|
|
174
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
175
|
+
id: renderDialog ? dialogDescriptionId : undefined,
|
|
176
|
+
children: [additionalPrompt, /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
177
|
+
className: "entities-saved-states__text-prompt--changes-count",
|
|
178
|
+
children: isDirty ? (0, _element.createInterpolateElement)((0, _i18n.sprintf)(/* translators: %d: number of site changes waiting to be saved. */
|
|
179
|
+
(0, _i18n._n)('There is <strong>%d site change</strong> waiting to be saved.', 'There are <strong>%d site changes</strong> waiting to be saved.', dirtyEntityRecords.length), dirtyEntityRecords.length), {
|
|
180
|
+
strong: /*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {})
|
|
181
|
+
}) : selectItemsToSaveDescription
|
|
182
|
+
})]
|
|
164
183
|
})]
|
|
165
184
|
}), sortedPartitionedSavables.map(list => {
|
|
166
185
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_entityTypeList.default, {
|
|
@@ -168,6 +187,11 @@ function EntitiesSavedStatesExtensible({
|
|
|
168
187
|
unselectedEntities: unselectedEntities,
|
|
169
188
|
setUnselectedEntities: setUnselectedEntities
|
|
170
189
|
}, list[0].name);
|
|
190
|
+
}), isInline && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Flex, {
|
|
191
|
+
direction: "row",
|
|
192
|
+
justify: "flex-end",
|
|
193
|
+
className: "entities-saved-states__panel-footer",
|
|
194
|
+
children: actionButtons
|
|
171
195
|
})]
|
|
172
196
|
});
|
|
173
197
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_element","_compose","_data","_entityTypeList","_interopRequireDefault","_useIsDirty","_store","_lockUnlock","_jsxRuntime","identity","values","EntitiesSavedStates","close","renderDialog","isDirtyProps","useIsDirty","jsx","EntitiesSavedStatesExtensible","additionalPrompt","undefined","onSave","saveEnabled","saveEnabledProp","saveLabel","__","dirtyEntityRecords","isDirty","setUnselectedEntities","unselectedEntities","saveButtonRef","useRef","saveDirtyEntities","unlock","useDispatch","editorStore","partitionedSavables","reduce","acc","record","name","push","site","siteSavables","wp_template","templateSavables","wp_template_part","templatePartSavables","contentSavables","sortedPartitionedSavables","Object","filter","Array","isArray","dismissPanel","useCallback","saveDialogRef","saveDialogProps","useDialog","onClose","dialogLabel","useInstanceId","dialogDescription","selectItemsToSaveDescription","length","jsxs","ref","className","role","children","Flex","gap","FlexItem","isBlock","as","Button","variant","size","onClick","disabled","accessibleWhenDisabled","entitiesToSkip","id","createInterpolateElement","sprintf","_n","strong","map","list","default"],"sources":["@wordpress/editor/src/components/entities-saved-states/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tuseCallback,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport {\n\t__experimentalUseDialog as useDialog,\n\tuseInstanceId,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport EntityTypeList from './entity-type-list';\nimport { useIsDirty } from './hooks/use-is-dirty';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction identity( values ) {\n\treturn values;\n}\n\n/**\n * Renders the component for managing saved states of entities.\n *\n * @param {Object} props The component props.\n * @param {Function} props.close The function to close the dialog.\n * @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior.\n *\n * @return {React.ReactNode} The rendered component.\n */\nexport default function EntitiesSavedStates( { close, renderDialog } ) {\n\tconst isDirtyProps = useIsDirty();\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\tclose={ close }\n\t\t\trenderDialog={ renderDialog }\n\t\t\t{ ...isDirtyProps }\n\t\t/>\n\t);\n}\n\n/**\n * Renders a panel for saving entities with dirty records.\n *\n * @param {Object} props The component props.\n * @param {string} props.additionalPrompt Additional prompt to display.\n * @param {Function} props.close Function to close the panel.\n * @param {Function} props.onSave Function to call when saving entities.\n * @param {boolean} props.saveEnabled Flag indicating if save is enabled.\n * @param {string} props.saveLabel Label for the save button.\n * @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior.\n * @param {Array} props.dirtyEntityRecords Array of dirty entity records.\n * @param {boolean} props.isDirty Flag indicating if there are dirty entities.\n * @param {Function} props.setUnselectedEntities Function to set unselected entities.\n * @param {Array} props.unselectedEntities Array of unselected entities.\n *\n * @return {React.ReactNode} The rendered component.\n */\nexport function EntitiesSavedStatesExtensible( {\n\tadditionalPrompt = undefined,\n\tclose,\n\tonSave = identity,\n\tsaveEnabled: saveEnabledProp = undefined,\n\tsaveLabel = __( 'Save' ),\n\trenderDialog,\n\tdirtyEntityRecords,\n\tisDirty,\n\tsetUnselectedEntities,\n\tunselectedEntities,\n} ) {\n\tconst saveButtonRef = useRef();\n\tconst { saveDirtyEntities } = unlock( useDispatch( editorStore ) );\n\t// To group entities by type.\n\tconst partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {\n\t\tconst { name } = record;\n\t\tif ( ! acc[ name ] ) {\n\t\t\tacc[ name ] = [];\n\t\t}\n\t\tacc[ name ].push( record );\n\t\treturn acc;\n\t}, {} );\n\n\t// Sort entity groups.\n\tconst {\n\t\tsite: siteSavables,\n\t\twp_template: templateSavables,\n\t\twp_template_part: templatePartSavables,\n\t\t...contentSavables\n\t} = partitionedSavables;\n\tconst sortedPartitionedSavables = [\n\t\tsiteSavables,\n\t\ttemplateSavables,\n\t\ttemplatePartSavables,\n\t\t...Object.values( contentSavables ),\n\t].filter( Array.isArray );\n\n\tconst saveEnabled = saveEnabledProp ?? isDirty;\n\t// Explicitly define this with no argument passed. Using `close` on\n\t// its own will use the event object in place of the expected saved entities.\n\tconst dismissPanel = useCallback( () => close(), [ close ] );\n\n\tconst [ saveDialogRef, saveDialogProps ] = useDialog( {\n\t\tonClose: () => dismissPanel(),\n\t} );\n\tconst dialogLabel = useInstanceId( EntitiesSavedStatesExtensible, 'label' );\n\tconst dialogDescription = useInstanceId(\n\t\tEntitiesSavedStatesExtensible,\n\t\t'description'\n\t);\n\n\tconst selectItemsToSaveDescription = !! dirtyEntityRecords.length\n\t\t? __( 'Select the items you want to save.' )\n\t\t: undefined;\n\n\treturn (\n\t\t<div\n\t\t\tref={ renderDialog ? saveDialogRef : undefined }\n\t\t\t{ ...( renderDialog && saveDialogProps ) }\n\t\t\tclassName=\"entities-saved-states__panel\"\n\t\t\trole={ renderDialog ? 'dialog' : undefined }\n\t\t\taria-labelledby={ renderDialog ? dialogLabel : undefined }\n\t\t\taria-describedby={ renderDialog ? dialogDescription : undefined }\n\t\t>\n\t\t\t<Flex className=\"entities-saved-states__panel-header\" gap={ 2 }>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ dismissPanel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tref={ saveButtonRef }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tdisabled={ ! saveEnabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsaveDirtyEntities( {\n\t\t\t\t\t\t\tonSave,\n\t\t\t\t\t\t\tdirtyEntityRecords,\n\t\t\t\t\t\t\tentitiesToSkip: unselectedEntities,\n\t\t\t\t\t\t\tclose,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tclassName=\"editor-entities-saved-states__save-button\"\n\t\t\t\t>\n\t\t\t\t\t{ saveLabel }\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\n\t\t\t<div className=\"entities-saved-states__text-prompt\">\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"entities-saved-states__text-prompt--header-wrapper\"\n\t\t\t\t\tid={ renderDialog ? dialogLabel : undefined }\n\t\t\t\t>\n\t\t\t\t\t<strong className=\"entities-saved-states__text-prompt--header\">\n\t\t\t\t\t\t{ __( 'Are you ready to save?' ) }\n\t\t\t\t\t</strong>\n\t\t\t\t\t{ additionalPrompt }\n\t\t\t\t</div>\n\t\t\t\t<p id={ renderDialog ? dialogDescription : undefined }>\n\t\t\t\t\t{ isDirty\n\t\t\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %d: number of site changes waiting to be saved. */\n\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t'There is <strong>%d site change</strong> waiting to be saved.',\n\t\t\t\t\t\t\t\t\t\t'There are <strong>%d site changes</strong> waiting to be saved.',\n\t\t\t\t\t\t\t\t\t\tdirtyEntityRecords.length\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tdirtyEntityRecords.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{ strong: <strong /> }\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: selectItemsToSaveDescription }\n\t\t\t\t</p>\n\t\t\t</div>\n\n\t\t\t{ sortedPartitionedSavables.map( ( list ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityTypeList\n\t\t\t\t\t\tkey={ list[ 0 ].name }\n\t\t\t\t\t\tlist={ list }\n\t\t\t\t\t\tunselectedEntities={ unselectedEntities }\n\t\t\t\t\t\tsetUnselectedEntities={ setUnselectedEntities }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,eAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA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AE,QAAA,EAC3D,IAAA5C,QAAE,EAAE,wBAAyB;QAAC,CACzB,CAAC,EACPN,gBAAgB;MAAA,CACd,CAAC,eACN,IAAAV,WAAA,CAAAQ,GAAA;QAAGiE,EAAE,EAAGpE,YAAY,GAAGgD,iBAAiB,GAAG1C,SAAW;QAAAiD,QAAA,EACnD1C,OAAO,GACN,IAAAwD,iCAAwB,EACxB,IAAAC,aAAO,EACN;QACA,IAAAC,QAAE,EACD,+DAA+D,EAC/D,iEAAiE,EACjE3D,kBAAkB,CAACsC,MACpB,CAAC,EACDtC,kBAAkB,CAACsC,MACpB,CAAC,EACD;UAAEsB,MAAM,eAAE,IAAA7E,WAAA,CAAAQ,GAAA,cAAS;QAAE,CACrB,CAAC,GACD8C;MAA4B,CAC7B,CAAC;IAAA,CACA,CAAC,EAEJd,yBAAyB,CAACsC,GAAG,CAAIC,IAAI,IAAM;MAC5C,oBACC,IAAA/E,WAAA,CAAAQ,GAAA,EAACb,eAAA,CAAAqF,OAAc;QAEdD,IAAI,EAAGA,IAAM;QACb3D,kBAAkB,EAAGA,kBAAoB;QACzCD,qBAAqB,EAAGA;MAAuB,GAHzC4D,IAAI,CAAE,CAAC,CAAE,CAAChD,IAIhB,CAAC;IAEJ,CAAE,CAAC;EAAA,CACC,CAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_i18n","_element","_compose","_data","_entityTypeList","_useIsDirty","_store","_lockUnlock","_jsxRuntime","identity","values","EntitiesSavedStates","close","renderDialog","variant","isDirtyProps","useIsDirty","jsx","EntitiesSavedStatesExtensible","additionalPrompt","undefined","onSave","saveEnabled","saveEnabledProp","saveLabel","__","dirtyEntityRecords","isDirty","setUnselectedEntities","unselectedEntities","saveButtonRef","useRef","saveDirtyEntities","unlock","useDispatch","editorStore","partitionedSavables","reduce","acc","record","name","push","site","siteSavables","wp_template","templateSavables","wp_template_part","templatePartSavables","contentSavables","sortedPartitionedSavables","Object","filter","Array","isArray","dismissPanel","useCallback","saveDialogRef","saveDialogProps","useDialog","onClose","dialogLabelId","useInstanceId","dialogDescriptionId","selectItemsToSaveDescription","length","isInline","actionButtons","jsxs","Fragment","children","FlexItem","isBlock","as","Button","size","onClick","ref","disabled","accessibleWhenDisabled","entitiesToSkip","className","clsx","role","Flex","gap","id","createInterpolateElement","sprintf","_n","strong","map","list","default","direction","justify"],"sources":["@wordpress/editor/src/components/entities-saved-states/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tuseCallback,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport {\n\t__experimentalUseDialog as useDialog,\n\tuseInstanceId,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport EntityTypeList from './entity-type-list';\nimport { useIsDirty } from './hooks/use-is-dirty';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction identity( values ) {\n\treturn values;\n}\n\n/**\n * Renders the component for managing saved states of entities.\n *\n * @param {Object} props The component props.\n * @param {Function} props.close The function to close the dialog.\n * @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior.\n * @param {string} props.variant Changes the layout of the component. When an `inline` value is provided, the action buttons are rendered at the end of the component instead of at the start.\n *\n * @return {React.ReactNode} The rendered component.\n */\nexport default function EntitiesSavedStates( {\n\tclose,\n\trenderDialog,\n\tvariant,\n} ) {\n\tconst isDirtyProps = useIsDirty();\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\tclose={ close }\n\t\t\trenderDialog={ renderDialog }\n\t\t\tvariant={ variant }\n\t\t\t{ ...isDirtyProps }\n\t\t/>\n\t);\n}\n\n/**\n * Renders a panel for saving entities with dirty records.\n *\n * @param {Object} props The component props.\n * @param {string} props.additionalPrompt Additional prompt to display.\n * @param {Function} props.close Function to close the panel.\n * @param {Function} props.onSave Function to call when saving entities.\n * @param {boolean} props.saveEnabled Flag indicating if save is enabled.\n * @param {string} props.saveLabel Label for the save button.\n * @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior.\n * @param {Array} props.dirtyEntityRecords Array of dirty entity records.\n * @param {boolean} props.isDirty Flag indicating if there are dirty entities.\n * @param {Function} props.setUnselectedEntities Function to set unselected entities.\n * @param {Array} props.unselectedEntities Array of unselected entities.\n * @param {string} props.variant Changes the layout of the component. When an `inline` value is provided, the action buttons are rendered at the end of the component instead of at the start.\n *\n * @return {React.ReactNode} The rendered component.\n */\nexport function EntitiesSavedStatesExtensible( {\n\tadditionalPrompt = undefined,\n\tclose,\n\tonSave = identity,\n\tsaveEnabled: saveEnabledProp = undefined,\n\tsaveLabel = __( 'Save' ),\n\trenderDialog,\n\tdirtyEntityRecords,\n\tisDirty,\n\tsetUnselectedEntities,\n\tunselectedEntities,\n\tvariant = 'default',\n} ) {\n\tconst saveButtonRef = useRef();\n\tconst { saveDirtyEntities } = unlock( useDispatch( editorStore ) );\n\t// To group entities by type.\n\tconst partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {\n\t\tconst { name } = record;\n\t\tif ( ! acc[ name ] ) {\n\t\t\tacc[ name ] = [];\n\t\t}\n\t\tacc[ name ].push( record );\n\t\treturn acc;\n\t}, {} );\n\n\t// Sort entity groups.\n\tconst {\n\t\tsite: siteSavables,\n\t\twp_template: templateSavables,\n\t\twp_template_part: templatePartSavables,\n\t\t...contentSavables\n\t} = partitionedSavables;\n\tconst sortedPartitionedSavables = [\n\t\tsiteSavables,\n\t\ttemplateSavables,\n\t\ttemplatePartSavables,\n\t\t...Object.values( contentSavables ),\n\t].filter( Array.isArray );\n\n\tconst saveEnabled = saveEnabledProp ?? isDirty;\n\t// Explicitly define this with no argument passed. Using `close` on\n\t// its own will use the event object in place of the expected saved entities.\n\tconst dismissPanel = useCallback( () => close(), [ close ] );\n\n\tconst [ saveDialogRef, saveDialogProps ] = useDialog( {\n\t\tonClose: () => dismissPanel(),\n\t} );\n\tconst dialogLabelId = useInstanceId(\n\t\tEntitiesSavedStatesExtensible,\n\t\t'entities-saved-states__panel-label'\n\t);\n\tconst dialogDescriptionId = useInstanceId(\n\t\tEntitiesSavedStatesExtensible,\n\t\t'entities-saved-states__panel-description'\n\t);\n\n\tconst selectItemsToSaveDescription = !! dirtyEntityRecords.length\n\t\t? __( 'Select the items you want to save.' )\n\t\t: undefined;\n\n\tconst isInline = variant === 'inline';\n\n\tconst actionButtons = (\n\t\t<>\n\t\t\t<FlexItem\n\t\t\t\tisBlock={ isInline ? false : true }\n\t\t\t\tas={ Button }\n\t\t\t\tvariant={ isInline ? 'tertiary' : 'secondary' }\n\t\t\t\tsize={ isInline ? undefined : 'compact' }\n\t\t\t\tonClick={ dismissPanel }\n\t\t\t>\n\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t</FlexItem>\n\t\t\t<FlexItem\n\t\t\t\tisBlock={ isInline ? false : true }\n\t\t\t\tas={ Button }\n\t\t\t\tref={ saveButtonRef }\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tsize={ isInline ? undefined : 'compact' }\n\t\t\t\tdisabled={ ! saveEnabled }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tonClick={ () =>\n\t\t\t\t\tsaveDirtyEntities( {\n\t\t\t\t\t\tonSave,\n\t\t\t\t\t\tdirtyEntityRecords,\n\t\t\t\t\t\tentitiesToSkip: unselectedEntities,\n\t\t\t\t\t\tclose,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tclassName=\"editor-entities-saved-states__save-button\"\n\t\t\t>\n\t\t\t\t{ saveLabel }\n\t\t\t</FlexItem>\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ renderDialog ? saveDialogRef : undefined }\n\t\t\t{ ...( renderDialog && saveDialogProps ) }\n\t\t\tclassName={ clsx( 'entities-saved-states__panel', {\n\t\t\t\t'is-inline': isInline,\n\t\t\t} ) }\n\t\t\trole={ renderDialog ? 'dialog' : undefined }\n\t\t\taria-labelledby={ renderDialog ? dialogLabelId : undefined }\n\t\t\taria-describedby={ renderDialog ? dialogDescriptionId : undefined }\n\t\t>\n\t\t\t{ ! isInline && (\n\t\t\t\t<Flex className=\"entities-saved-states__panel-header\" gap={ 2 }>\n\t\t\t\t\t{ actionButtons }\n\t\t\t\t</Flex>\n\t\t\t) }\n\n\t\t\t<div className=\"entities-saved-states__text-prompt\">\n\t\t\t\t<div className=\"entities-saved-states__text-prompt--header-wrapper\">\n\t\t\t\t\t<strong\n\t\t\t\t\t\tid={ renderDialog ? dialogLabelId : undefined }\n\t\t\t\t\t\tclassName=\"entities-saved-states__text-prompt--header\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Are you ready to save?' ) }\n\t\t\t\t\t</strong>\n\t\t\t\t</div>\n\t\t\t\t<div id={ renderDialog ? dialogDescriptionId : undefined }>\n\t\t\t\t\t{ additionalPrompt }\n\t\t\t\t\t<p className=\"entities-saved-states__text-prompt--changes-count\">\n\t\t\t\t\t\t{ isDirty\n\t\t\t\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %d: number of site changes waiting to be saved. */\n\t\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t\t'There is <strong>%d site change</strong> waiting to be saved.',\n\t\t\t\t\t\t\t\t\t\t\t'There are <strong>%d site changes</strong> waiting to be saved.',\n\t\t\t\t\t\t\t\t\t\t\tdirtyEntityRecords.length\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\tdirtyEntityRecords.length\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{ strong: <strong /> }\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: selectItemsToSaveDescription }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{ sortedPartitionedSavables.map( ( list ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityTypeList\n\t\t\t\t\t\tkey={ list[ 0 ].name }\n\t\t\t\t\t\tlist={ list }\n\t\t\t\t\t\tunselectedEntities={ unselectedEntities }\n\t\t\t\t\t\tsetUnselectedEntities={ setUnselectedEntities }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\n\t\t\t{ isInline && (\n\t\t\t\t<Flex\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\tclassName=\"entities-saved-states__panel-footer\"\n\t\t\t\t>\n\t\t\t\t\t{ actionButtons }\n\t\t\t\t</Flex>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAJ,OAAA;AAIA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,eAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AA3B3C;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;;AAMA,SAASW,QAAQA,CAAEC,MAAM,EAAG;EAC3B,OAAOA,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,mBAAmBA,CAAE;EAC5CC,KAAK;EACLC,YAAY;EACZC;AACD,CAAC,EAAG;EACH,MAAMC,YAAY,GAAG,IAAAC,sBAAU,EAAC,CAAC;EACjC,oBACC,IAAAR,WAAA,CAAAS,GAAA,EAACC,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
|
|
27
27
|
kebabCase
|
|
28
28
|
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
29
|
-
function
|
|
29
|
+
function PostActions({
|
|
30
|
+
postType,
|
|
31
|
+
postId,
|
|
32
|
+
onActionPerformed
|
|
33
|
+
}) {
|
|
34
|
+
const [activeModalAction, setActiveModalAction] = (0, _element.useState)(null);
|
|
30
35
|
const {
|
|
31
|
-
|
|
36
|
+
item,
|
|
32
37
|
permissions
|
|
33
38
|
} = (0, _data.useSelect)(select => {
|
|
34
39
|
const {
|
|
@@ -36,39 +41,25 @@ function useEditedEntityRecordsWithPermissions(postType, postIds) {
|
|
|
36
41
|
getEntityRecordPermissions
|
|
37
42
|
} = (0, _lockUnlock.unlock)(select(_coreData.store));
|
|
38
43
|
return {
|
|
39
|
-
|
|
40
|
-
permissions:
|
|
44
|
+
item: getEditedEntityRecord('postType', postType, postId),
|
|
45
|
+
permissions: getEntityRecordPermissions('postType', postType, postId)
|
|
41
46
|
};
|
|
42
|
-
}, [
|
|
43
|
-
|
|
44
|
-
return
|
|
47
|
+
}, [postId, postType]);
|
|
48
|
+
const itemWithPermissions = (0, _element.useMemo)(() => {
|
|
49
|
+
return {
|
|
45
50
|
...item,
|
|
46
|
-
permissions
|
|
47
|
-
}
|
|
48
|
-
}, [
|
|
49
|
-
}
|
|
50
|
-
function PostActions({
|
|
51
|
-
postType,
|
|
52
|
-
postId,
|
|
53
|
-
onActionPerformed
|
|
54
|
-
}) {
|
|
55
|
-
const [activeModalAction, setActiveModalAction] = (0, _element.useState)(null);
|
|
56
|
-
const _postIds = (0, _element.useMemo)(() => {
|
|
57
|
-
if (Array.isArray(postId)) {
|
|
58
|
-
return postId;
|
|
59
|
-
}
|
|
60
|
-
return postId ? [postId] : [];
|
|
61
|
-
}, [postId]);
|
|
62
|
-
const itemsWithPermissions = useEditedEntityRecordsWithPermissions(postType, _postIds);
|
|
51
|
+
permissions
|
|
52
|
+
};
|
|
53
|
+
}, [item, permissions]);
|
|
63
54
|
const allActions = (0, _actions.usePostActions)({
|
|
64
55
|
postType,
|
|
65
56
|
onActionPerformed
|
|
66
57
|
});
|
|
67
58
|
const actions = (0, _element.useMemo)(() => {
|
|
68
59
|
return allActions.filter(action => {
|
|
69
|
-
return
|
|
60
|
+
return !action.isEligible || action.isEligible(itemWithPermissions);
|
|
70
61
|
});
|
|
71
|
-
}, [allActions,
|
|
62
|
+
}, [allActions, itemWithPermissions]);
|
|
72
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
73
64
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Menu, {
|
|
74
65
|
placement: "bottom-end",
|
|
@@ -84,13 +75,13 @@ function PostActions({
|
|
|
84
75
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.Popover, {
|
|
85
76
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionsDropdownMenuGroup, {
|
|
86
77
|
actions: actions,
|
|
87
|
-
items:
|
|
78
|
+
items: [itemWithPermissions],
|
|
88
79
|
setActiveModalAction: setActiveModalAction
|
|
89
80
|
})
|
|
90
81
|
})]
|
|
91
82
|
}), !!activeModalAction && /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionModal, {
|
|
92
83
|
action: activeModalAction,
|
|
93
|
-
items:
|
|
84
|
+
items: [itemWithPermissions],
|
|
94
85
|
closeModal: () => setActiveModalAction(null)
|
|
95
86
|
})]
|
|
96
87
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_element","_i18n","_components","_icons","_coreData","_lockUnlock","_actions","_jsxRuntime","Menu","kebabCase","unlock","componentsPrivateApis","useEditedEntityRecordsWithPermissions","postType","postIds","items","permissions","useSelect","select","getEditedEntityRecord","getEntityRecordPermissions","coreStore","map","postId","useMemo","item","index","PostActions","onActionPerformed","activeModalAction","setActiveModalAction","useState","_postIds","Array","isArray","itemsWithPermissions","allActions","usePostActions","actions","filter","action","isEligible","some","itemWithPermissions","length","supportsBulk","jsxs","Fragment","children","placement","jsx","TriggerButton","render","Button","size","icon","moreVertical","label","__","disabled","accessibleWhenDisabled","className","Popover","ActionsDropdownMenuGroup","ActionModal","closeModal","DropdownMenuItemTrigger","onClick","Item","ItemLabel","Modal","title","modalHeader","__experimentalHideHeader","hideModalHeader","onRequestClose","focusOnMount","overlayClassName","id","RenderModal","registry","useRegistry","Group","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\n\nconst { Menu, kebabCase } = unlock( componentsPrivateApis );\n\nfunction useEditedEntityRecordsWithPermissions( postType, postIds ) {\n\tconst { items, permissions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getEntityRecordPermissions } =\n\t\t\t\tunlock( select( coreStore ) );\n\t\t\treturn {\n\t\t\t\titems: postIds.map( ( postId ) =>\n\t\t\t\t\tgetEditedEntityRecord( 'postType', postType, postId )\n\t\t\t\t),\n\t\t\t\tpermissions: postIds.map( ( postId ) =>\n\t\t\t\t\tgetEntityRecordPermissions( 'postType', postType, postId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postIds, postType ]\n\t);\n\n\treturn useMemo( () => {\n\t\treturn items.map( ( item, index ) => ( {\n\t\t\t...item,\n\t\t\tpermissions: permissions[ index ],\n\t\t} ) );\n\t}, [ items, permissions ] );\n}\n\nexport default function PostActions( { postType, postId, onActionPerformed } ) {\n\tconst [ activeModalAction, setActiveModalAction ] = useState( null );\n\tconst _postIds = useMemo( () => {\n\t\tif ( Array.isArray( postId ) ) {\n\t\t\treturn postId;\n\t\t}\n\t\treturn postId ? [ postId ] : [];\n\t}, [ postId ] );\n\n\tconst itemsWithPermissions = useEditedEntityRecordsWithPermissions(\n\t\tpostType,\n\t\t_postIds\n\t);\n\tconst allActions = usePostActions( { postType, onActionPerformed } );\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn (\n\t\t\t\t( ! action.isEligible ||\n\t\t\t\t\titemsWithPermissions.some( ( itemWithPermissions ) =>\n\t\t\t\t\t\taction.isEligible( itemWithPermissions )\n\t\t\t\t\t) ) &&\n\t\t\t\t( itemsWithPermissions.length < 2 || action.supportsBulk )\n\t\t\t);\n\t\t} );\n\t}, [ allActions, itemsWithPermissions ] );\n\n\treturn (\n\t\t<>\n\t\t\t<Menu placement=\"bottom-end\">\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Menu.Popover>\n\t\t\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\titems={ itemsWithPermissions }\n\t\t\t\t\t\tsetActiveModalAction={ setActiveModalAction }\n\t\t\t\t\t/>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\t\t\t{ !! activeModalAction && (\n\t\t\t\t<ActionModal\n\t\t\t\t\taction={ activeModalAction }\n\t\t\t\t\titems={ itemsWithPermissions }\n\t\t\t\t\tcloseModal={ () => setActiveModalAction( null ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Menu.Item onClick={ onClick }>\n\t\t\t<Menu.ItemLabel>{ label }</Menu.ItemLabel>\n\t\t</Menu.Item>\n\t);\n}\n\nexport function ActionModal( { action, items, closeModal } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ action.modalHeader || label }\n\t\t\t__experimentalHideHeader={ !! action.hideModalHeader }\n\t\t\tonRequestClose={ closeModal ?? ( () => {} ) }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"medium\"\n\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\taction.id\n\t\t\t) }` }\n\t\t>\n\t\t\t<action.RenderModal items={ items } closeModal={ closeModal } />\n\t\t</Modal>\n\t);\n}\n\nfunction ActionsDropdownMenuGroup( { actions, items, setActiveModalAction } ) {\n\tconst registry = useRegistry();\n\treturn (\n\t\t<Menu.Group>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( 'RenderModal' in action ) {\n\t\t\t\t\t\t\t\tsetActiveModalAction( action );\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taction.callback( items, { registry } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\titems={ items }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Menu.Group>\n\t);\n}\n"],"mappings":";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MAAM,CAAC2C,QAAQ,CAAEpE,KAAK,EAAE;YAAEiE;UAAS,CAAE,CAAC;QACvC,CAAG;QACHjE,KAAK,EAAGA;MAAO,GATTyB,MAAM,CAACsC,EAUb,CAAC;IAEJ,CAAE;EAAC,CACQ,CAAC;AAEf","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_i18n","_components","_icons","_coreData","_lockUnlock","_actions","_jsxRuntime","Menu","kebabCase","unlock","componentsPrivateApis","PostActions","postType","postId","onActionPerformed","activeModalAction","setActiveModalAction","useState","item","permissions","useSelect","select","getEditedEntityRecord","getEntityRecordPermissions","coreStore","itemWithPermissions","useMemo","allActions","usePostActions","actions","filter","action","isEligible","jsxs","Fragment","children","placement","jsx","TriggerButton","render","Button","size","icon","moreVertical","label","__","disabled","length","accessibleWhenDisabled","className","Popover","ActionsDropdownMenuGroup","items","ActionModal","closeModal","DropdownMenuItemTrigger","onClick","Item","ItemLabel","Modal","title","modalHeader","__experimentalHideHeader","hideModalHeader","onRequestClose","focusOnMount","overlayClassName","id","RenderModal","registry","useRegistry","Group","map","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\n\nconst { Menu, kebabCase } = unlock( componentsPrivateApis );\n\nexport default function PostActions( { postType, postId, onActionPerformed } ) {\n\tconst [ activeModalAction, setActiveModalAction ] = useState( null );\n\n\tconst { item, permissions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getEntityRecordPermissions } =\n\t\t\t\tunlock( select( coreStore ) );\n\t\t\treturn {\n\t\t\t\titem: getEditedEntityRecord( 'postType', postType, postId ),\n\t\t\t\tpermissions: getEntityRecordPermissions(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\tconst itemWithPermissions = useMemo( () => {\n\t\treturn {\n\t\t\t...item,\n\t\t\tpermissions,\n\t\t};\n\t}, [ item, permissions ] );\n\tconst allActions = usePostActions( { postType, onActionPerformed } );\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn (\n\t\t\t\t! action.isEligible || action.isEligible( itemWithPermissions )\n\t\t\t);\n\t\t} );\n\t}, [ allActions, itemWithPermissions ] );\n\n\treturn (\n\t\t<>\n\t\t\t<Menu placement=\"bottom-end\">\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Menu.Popover>\n\t\t\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\titems={ [ itemWithPermissions ] }\n\t\t\t\t\t\tsetActiveModalAction={ setActiveModalAction }\n\t\t\t\t\t/>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\t\t\t{ !! activeModalAction && (\n\t\t\t\t<ActionModal\n\t\t\t\t\taction={ activeModalAction }\n\t\t\t\t\titems={ [ itemWithPermissions ] }\n\t\t\t\t\tcloseModal={ () => setActiveModalAction( null ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Menu.Item onClick={ onClick }>\n\t\t\t<Menu.ItemLabel>{ label }</Menu.ItemLabel>\n\t\t</Menu.Item>\n\t);\n}\n\nexport function ActionModal( { action, items, closeModal } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ action.modalHeader || label }\n\t\t\t__experimentalHideHeader={ !! action.hideModalHeader }\n\t\t\tonRequestClose={ closeModal ?? ( () => {} ) }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"medium\"\n\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\taction.id\n\t\t\t) }` }\n\t\t>\n\t\t\t<action.RenderModal items={ items } closeModal={ closeModal } />\n\t\t</Modal>\n\t);\n}\n\nfunction ActionsDropdownMenuGroup( { actions, items, setActiveModalAction } ) {\n\tconst registry = useRegistry();\n\treturn (\n\t\t<Menu.Group>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( 'RenderModal' in action ) {\n\t\t\t\t\t\t\t\tsetActiveModalAction( action );\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taction.callback( items, { registry } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\titems={ items }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Menu.Group>\n\t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,MAAM,CAACqC,WAAW;MAAChB,KAAK,EAAGA,KAAO;MAACE,UAAU,EAAGA;IAAY,CAAE;EAAC,CAC1D,CAAC;AAEV;AAEA,SAASH,wBAAwBA,CAAE;EAAEtB,OAAO;EAAEuB,KAAK;EAAEpC;AAAqB,CAAC,EAAG;EAC7E,MAAMqD,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,oBACC,IAAAhE,WAAA,CAAA+B,GAAA,EAAC9B,IAAI,CAACgE,KAAK;IAAApC,QAAA,EACRN,OAAO,CAAC2C,GAAG,CAAIzC,MAAM,IAAM;MAC5B,oBACC,IAAAzB,WAAA,CAAA+B,GAAA,EAACkB,uBAAuB;QAEvBxB,MAAM,EAAGA,MAAQ;QACjByB,OAAO,EAAGA,CAAA,KAAM;UACf,IAAK,aAAa,IAAIzB,MAAM,EAAG;YAC9Bf,oBAAoB,CAAEe,MAAO,CAAC;YAC9B;UACD;UACAA,MAAM,CAAC0C,QAAQ,CAAErB,KAAK,EAAE;YAAEiB;UAAS,CAAE,CAAC;QACvC,CAAG;QACHjB,KAAK,EAAGA;MAAO,GATTrB,MAAM,CAACoC,EAUb,CAAC;IAEJ,CAAE;EAAC,CACQ,CAAC;AAEf","ignoreList":[]}
|
|
@@ -52,7 +52,7 @@ function PostCardPanel({
|
|
|
52
52
|
} = (0, _data.useSelect)(select => {
|
|
53
53
|
const {
|
|
54
54
|
getEditedEntityRecord,
|
|
55
|
-
|
|
55
|
+
getCurrentTheme,
|
|
56
56
|
getPostType
|
|
57
57
|
} = select(_coreData.store);
|
|
58
58
|
const {
|
|
@@ -61,10 +61,10 @@ function PostCardPanel({
|
|
|
61
61
|
let _title = '';
|
|
62
62
|
const _record = getEditedEntityRecord('postType', postType, postIds[0]);
|
|
63
63
|
if (postIds.length === 1) {
|
|
64
|
-
var
|
|
64
|
+
var _getCurrentTheme;
|
|
65
65
|
const {
|
|
66
66
|
default_template_types: templateTypes = []
|
|
67
|
-
} = (
|
|
67
|
+
} = (_getCurrentTheme = getCurrentTheme()) !== null && _getCurrentTheme !== void 0 ? _getCurrentTheme : {};
|
|
68
68
|
const _templateInfo = [_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE].includes(postType) ? (0, _getTemplateInfo.getTemplateInfo)({
|
|
69
69
|
template: _record,
|
|
70
70
|
templateTypes
|
|
@@ -109,9 +109,9 @@ function PostCardPanel({
|
|
|
109
109
|
}), pageTypeBadge && postIds.length === 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(Badge, {
|
|
110
110
|
children: pageTypeBadge
|
|
111
111
|
})]
|
|
112
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postActions.default, {
|
|
112
|
+
}), postIds.length === 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_postActions.default, {
|
|
113
113
|
postType: postType,
|
|
114
|
-
postId:
|
|
114
|
+
postId: postIds[0],
|
|
115
115
|
onActionPerformed: onActionPerformed
|
|
116
116
|
})]
|
|
117
117
|
}), postIds.length > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_coreData","_data","_element","_i18n","_dom","_store","_constants","_lockUnlock","_postActions","_interopRequireDefault","_pageTypeBadge","_getTemplateInfo","_jsxRuntime","Badge","unlock","componentsPrivateApis","PostCardPanel","postType","postId","onActionPerformed","postIds","useMemo","Array","isArray","postTitle","icon","labels","useSelect","select","getEditedEntityRecord","
|
|
1
|
+
{"version":3,"names":["_components","require","_coreData","_data","_element","_i18n","_dom","_store","_constants","_lockUnlock","_postActions","_interopRequireDefault","_pageTypeBadge","_getTemplateInfo","_jsxRuntime","Badge","unlock","componentsPrivateApis","PostCardPanel","postType","postId","onActionPerformed","postIds","useMemo","Array","isArray","postTitle","icon","labels","useSelect","select","getEditedEntityRecord","getCurrentTheme","getPostType","coreStore","getPostIcon","editorStore","_title","_record","length","_getCurrentTheme","default_template_types","templateTypes","_templateInfo","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","includes","getTemplateInfo","template","title","area","pageTypeBadge","usePageTypeBadge","__","name","sprintf","stripHTML","jsxs","__experimentalVStack","spacing","className","children","__experimentalHStack","align","jsx","Icon","__experimentalText","numberOfLines","truncate","as","default","toLowerCase"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\nimport PostActions from '../post-actions';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\nconst { Badge } = unlock( componentsPrivateApis );\n\n/**\n * Renders a title of the post type and the available quick actions available within a 3-dot dropdown.\n *\n * @param {Object} props - Component props.\n * @param {string} [props.postType] - The post type string.\n * @param {string|string[]} [props.postId] - The post id or list of post ids.\n * @param {Function} [props.onActionPerformed] - A callback function for when a quick action is performed.\n * @return {React.ReactNode} The rendered component.\n */\nexport default function PostCardPanel( {\n\tpostType,\n\tpostId,\n\tonActionPerformed,\n} ) {\n\tconst postIds = useMemo(\n\t\t() => ( Array.isArray( postId ) ? postId : [ postId ] ),\n\t\t[ postId ]\n\t);\n\tconst { postTitle, icon, labels } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getCurrentTheme, getPostType } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getPostIcon } = unlock( select( editorStore ) );\n\t\t\tlet _title = '';\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostIds[ 0 ]\n\t\t\t);\n\t\t\tif ( postIds.length === 1 ) {\n\t\t\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\t\t\tgetCurrentTheme() ?? {};\n\n\t\t\t\tconst _templateInfo = [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t].includes( postType )\n\t\t\t\t\t? getTemplateInfo( {\n\t\t\t\t\t\t\ttemplate: _record,\n\t\t\t\t\t\t\ttemplateTypes,\n\t\t\t\t\t } )\n\t\t\t\t\t: {};\n\t\t\t\t_title = _templateInfo?.title || _record?.title;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tpostTitle: _title,\n\t\t\t\ticon: getPostIcon( postType, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t\tlabels: getPostType( postType )?.labels,\n\t\t\t};\n\t\t},\n\t\t[ postIds, postType ]\n\t);\n\n\tconst pageTypeBadge = usePageTypeBadge( postId );\n\tlet title = __( 'No title' );\n\tif ( labels?.name && postIds.length > 1 ) {\n\t\ttitle = sprintf(\n\t\t\t// translators: %i number of selected items %s: Name of the plural post type e.g: \"Posts\".\n\t\t\t__( '%i %s' ),\n\t\t\tpostId.length,\n\t\t\tlabels?.name\n\t\t);\n\t} else if ( postTitle ) {\n\t\ttitle = stripHTML( postTitle );\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 1 } className=\"editor-post-card-panel\">\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\talign=\"flex-start\"\n\t\t\t>\n\t\t\t\t<Icon className=\"editor-post-card-panel__icon\" icon={ icon } />\n\t\t\t\t<Text\n\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\ttruncate\n\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t>\n\t\t\t\t\t<span className=\"editor-post-card-panel__title-name\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ pageTypeBadge && postIds.length === 1 && (\n\t\t\t\t\t\t<Badge>{ pageTypeBadge }</Badge>\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t{ postIds.length === 1 && (\n\t\t\t\t\t<PostActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postIds[ 0 ] }\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ postIds.length > 1 && (\n\t\t\t\t<Text className=\"editor-post-card-panel__description\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t// translators: %s: Name of the plural post type e.g: \"Posts\".\n\t\t\t\t\t\t__( 'Changes will be applied to all selected %s.' ),\n\t\t\t\t\t\tlabels?.name.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAIA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,cAAA,GAAAD,sBAAA,CAAAV,OAAA;AACA,IAAAY,gBAAA,GAAAZ,OAAA;AAAgE,IAAAa,WAAA,GAAAb,OAAA;A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AAG,CAAG;QACnBC,QAAQ;QACRR,SAAS,EAAC,+BAA+B;QACzCS,EAAE,EAAC,IAAI;QAAAR,QAAA,gBAEP,IAAA/C,WAAA,CAAAkD,GAAA;UAAMJ,SAAS,EAAC,oCAAoC;UAAAC,QAAA,EACjDZ;QAAK,CACF,CAAC,EACLE,aAAa,IAAI7B,OAAO,CAACiB,MAAM,KAAK,CAAC,iBACtC,IAAAzB,WAAA,CAAAkD,GAAA,EAACjD,KAAK;UAAA8C,QAAA,EAAGV;QAAa,CAAS,CAC/B;MAAA,CACI,CAAC,EACL7B,OAAO,CAACiB,MAAM,KAAK,CAAC,iBACrB,IAAAzB,WAAA,CAAAkD,GAAA,EAACtD,YAAA,CAAA4D,OAAW;QACXnD,QAAQ,EAAGA,QAAU;QACrBC,MAAM,EAAGE,OAAO,CAAE,CAAC,CAAI;QACvBD,iBAAiB,EAAGA;MAAmB,CACvC,CACD;IAAA,CACM,CAAC,EACPC,OAAO,CAACiB,MAAM,GAAG,CAAC,iBACnB,IAAAzB,WAAA,CAAAkD,GAAA,EAAChE,WAAA,CAAAkE,kBAAI;MAACN,SAAS,EAAC,qCAAqC;MAAAC,QAAA,EAClD,IAAAN,aAAO;MACR;MACA,IAAAF,QAAE,EAAE,6CAA8C,CAAC,EACnDzB,MAAM,EAAE0B,IAAI,CAACiB,WAAW,CAAC,CAC1B;IAAC,CACI,CACN;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
|
|
@@ -105,7 +105,8 @@ function PostFeaturedImage({
|
|
|
105
105
|
onError(message) {
|
|
106
106
|
noticeOperations.removeAllNotices();
|
|
107
107
|
noticeOperations.createErrorNotice(message);
|
|
108
|
-
}
|
|
108
|
+
},
|
|
109
|
+
multiple: false
|
|
109
110
|
});
|
|
110
111
|
}
|
|
111
112
|
|
|
@@ -261,7 +262,8 @@ const applyWithDispatch = (0, _data.withDispatch)((dispatch, {
|
|
|
261
262
|
onError(message) {
|
|
262
263
|
noticeOperations.removeAllNotices();
|
|
263
264
|
noticeOperations.createErrorNotice(message);
|
|
264
|
-
}
|
|
265
|
+
},
|
|
266
|
+
multiple: false
|
|
265
267
|
});
|
|
266
268
|
},
|
|
267
269
|
onRemoveImage() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_hooks","_components","_blob","_element","_compose","_data","_blockEditor","_coreData","_check","_store","_jsxRuntime","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","__","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","jsx","children","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","applyFilters","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","isRequestingFeaturedImageMedia","returnsFocusRef","useRef","isLoading","setIsLoading","useState","getSettings","useSelect","blockEditorStore","onDropFiles","filesList","mediaUpload","allowedTypes","onFileChange","image","isBlobURL","url","onError","message","removeAllNotices","createErrorNotice","getImageDescription","imageMedia","alt_text","sprintf","full","file","slug","returnFocus","node","current","focus","isMissingMedia","jsxs","default","className","MediaUploadCheck","fallback","MediaUpload","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","Notice","status","isDismissible","Button","__next40pxDefaultSize","ref","onClick","disabled","accessibleWhenDisabled","src","alt","Spinner","set_featured_image","__experimentalHStack","clsx","variant","undefined","isDestructive","DropZone","onFilesDrop","value","applyWithSelect","withSelect","select","getMedia","getPostType","hasFinishedResolution","coreStore","getCurrentPostId","getEditedPostAttribute","editorStore","context","applyWithDispatch","withDispatch","dispatch","editPost","featured_media","onDropImage","_default","exports","compose","withNotices","withFilters"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n\tNotice,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Add a featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n\tisRequestingFeaturedImageMedia,\n} ) {\n\tconst returnsFocusRef = useRef( false );\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\tconst { mediaSourceUrl } = getMediaDetails( media, currentPostId );\n\n\tfunction onDropFiles( filesList ) {\n\t\tgetSettings().mediaUpload( {\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( image ) {\n\t\t\t\t\tonUpdateImage( image );\n\t\t\t\t}\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\t/**\n\t * Generates the featured image alt text for this editing context.\n\t *\n\t * @param {Object} imageMedia The image media object.\n\t * @param {string} imageMedia.alt_text The alternative text of the image.\n\t * @param {Object} imageMedia.media_details The media details of the image.\n\t * @param {Object} imageMedia.media_details.sizes The sizes of the image.\n\t * @param {Object} imageMedia.media_details.sizes.full The full size details of the image.\n\t * @param {string} imageMedia.media_details.sizes.full.file The file name of the full size image.\n\t * @param {string} imageMedia.slug The slug of the image.\n\t * @return {string} The featured image alt text.\n\t */\n\tfunction getImageDescription( imageMedia ) {\n\t\tif ( imageMedia.alt_text ) {\n\t\t\treturn sprintf(\n\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\timageMedia.alt_text\n\t\t\t);\n\t\t}\n\t\treturn sprintf(\n\t\t\t// Translators: %s: The selected image filename.\n\t\t\t__(\n\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t),\n\t\t\timageMedia.media_details.sizes?.full?.file || imageMedia.slug\n\t\t);\n\t}\n\n\tfunction returnFocus( node ) {\n\t\tif ( returnsFocusRef.current && node ) {\n\t\t\tnode.focus();\n\t\t\treturnsFocusRef.current = false;\n\t\t}\n\t}\n\n\tconst isMissingMedia =\n\t\t! isRequestingFeaturedImageMedia && !! featuredImageId && ! media;\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ getImageDescription( media ) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t{ isMissingMedia ? (\n\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'Could not retrieve the featured image data.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\tref={ returnFocus }\n\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Edit or replace the featured image'\n\t\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\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\t\tdisabled={ isLoading }\n\t\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__preview-image\"\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\t\talt={ getImageDescription(\n\t\t\t\t\t\t\t\t\t\t\t\t\tmedia\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ ( isLoading ||\n\t\t\t\t\t\t\t\t\t\t\tisRequestingFeaturedImageMedia ) && (\n\t\t\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'editor-post-featured-image__actions',\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t'editor-post-featured-image__actions-missing-image':\n\t\t\t\t\t\t\t\t\t\t\t\t\tisMissingMedia,\n\t\t\t\t\t\t\t\t\t\t\t\t'editor-post-featured-image__actions-is-requesting-image':\n\t\t\t\t\t\t\t\t\t\t\t\t\tisRequestingFeaturedImageMedia,\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\t\tisMissingMedia\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'secondary'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\t// Signal that the toggle button should be focused,\n\t\t\t\t\t\t\t\t\t\t\t\t// when it is rendered. Can't focus it directly here\n\t\t\t\t\t\t\t\t\t\t\t\t// because it's rendered conditionally.\n\t\t\t\t\t\t\t\t\t\t\t\treturnsFocusRef.current = true;\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\t\tisMissingMedia\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'secondary'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tisDestructive={ isMissingMedia }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType, hasFinishedResolution } =\n\t\tselect( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t\tisRequestingFeaturedImageMedia:\n\t\t\t!! featuredImageId &&\n\t\t\t! hasFinishedResolution( 'getMedia', [\n\t\t\t\tfeaturedImageId,\n\t\t\t\t{ context: 'view' },\n\t\t\t] ),\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\n/**\n * Renders the component for managing the featured image of a post.\n *\n * @param {Object} props Props.\n * @param {number} props.currentPostId ID of the current post.\n * @param {number} props.featuredImageId ID of the featured image.\n * @param {Function} props.onUpdateImage Function to call when the image is updated.\n * @param {Function} props.onRemoveImage Function to call when the image is removed.\n * @param {Object} props.media The media object representing the featured image.\n * @param {string} props.postType Post type.\n * @param {Element} props.noticeUI UI for displaying notices.\n * @param {Object} props.noticeOperations Operations for managing notices.\n *\n * @return {Element} Component to be rendered .\n */\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAKA,IAAAS,SAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAAmD,IAAAY,WAAA,GAAAZ,OAAA;AAlCnD;AACA;AACA;;AAGA;AACA;AACA;;AAuBA;AACA;AACA;;AAIA,MAAMa,mBAAmB,GAAG,CAA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AE,OAAO,CAAE;QACzBF,SAAS;QACTG,YAAYA,CAAE,CAAEC,KAAK,CAAE,EAAG;UACzBoE,QAAQ,CAAE;YAAEC,cAAc,EAAErE,KAAK,CAAChC;UAAG,CAAE,CAAC;QACzC,CAAC;QACDmC,OAAOA,CAAEC,OAAO,EAAG;UAClBnB,gBAAgB,CAACoB,gBAAgB,CAAC,CAAC;UACnCpB,gBAAgB,CAACqB,iBAAiB,CAAEF,OAAQ,CAAC;QAC9C;MACD,CAAE,CAAC;IACL,CAAC;IACDtB,aAAaA,CAAA,EAAG;MACfsF,QAAQ,CAAE;QAAEC,cAAc,EAAE;MAAE,CAAE,CAAC;IAClC;EACD,CAAC;AACF,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,IAAAE,QAAA,GAAAC,OAAA,CAAApD,OAAA,GAee,IAAAqD,gBAAO,EACrBC,uBAAW,EACXpB,eAAe,EACfW,iBAAiB,EACjB,IAAAU,uBAAW,EAAE,0BAA2B,CACzC,CAAC,CAAEjG,iBAAkB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_hooks","_components","_blob","_element","_compose","_data","_blockEditor","_coreData","_check","_store","_jsxRuntime","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","__","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","jsx","children","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","applyFilters","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","isRequestingFeaturedImageMedia","returnsFocusRef","useRef","isLoading","setIsLoading","useState","getSettings","useSelect","blockEditorStore","onDropFiles","filesList","mediaUpload","allowedTypes","onFileChange","image","isBlobURL","url","onError","message","removeAllNotices","createErrorNotice","multiple","getImageDescription","imageMedia","alt_text","sprintf","full","file","slug","returnFocus","node","current","focus","isMissingMedia","jsxs","default","className","MediaUploadCheck","fallback","MediaUpload","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","Notice","status","isDismissible","Button","__next40pxDefaultSize","ref","onClick","disabled","accessibleWhenDisabled","src","alt","Spinner","set_featured_image","__experimentalHStack","clsx","variant","undefined","isDestructive","DropZone","onFilesDrop","value","applyWithSelect","withSelect","select","getMedia","getPostType","hasFinishedResolution","coreStore","getCurrentPostId","getEditedPostAttribute","editorStore","context","applyWithDispatch","withDispatch","dispatch","editPost","featured_media","onDropImage","_default","exports","compose","withNotices","withFilters"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n\tNotice,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Add a featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n\tisRequestingFeaturedImageMedia,\n} ) {\n\tconst returnsFocusRef = useRef( false );\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\tconst { mediaSourceUrl } = getMediaDetails( media, currentPostId );\n\n\tfunction onDropFiles( filesList ) {\n\t\tgetSettings().mediaUpload( {\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( image ) {\n\t\t\t\t\tonUpdateImage( image );\n\t\t\t\t}\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t\tmultiple: false,\n\t\t} );\n\t}\n\n\t/**\n\t * Generates the featured image alt text for this editing context.\n\t *\n\t * @param {Object} imageMedia The image media object.\n\t * @param {string} imageMedia.alt_text The alternative text of the image.\n\t * @param {Object} imageMedia.media_details The media details of the image.\n\t * @param {Object} imageMedia.media_details.sizes The sizes of the image.\n\t * @param {Object} imageMedia.media_details.sizes.full The full size details of the image.\n\t * @param {string} imageMedia.media_details.sizes.full.file The file name of the full size image.\n\t * @param {string} imageMedia.slug The slug of the image.\n\t * @return {string} The featured image alt text.\n\t */\n\tfunction getImageDescription( imageMedia ) {\n\t\tif ( imageMedia.alt_text ) {\n\t\t\treturn sprintf(\n\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\timageMedia.alt_text\n\t\t\t);\n\t\t}\n\t\treturn sprintf(\n\t\t\t// Translators: %s: The selected image filename.\n\t\t\t__(\n\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t),\n\t\t\timageMedia.media_details.sizes?.full?.file || imageMedia.slug\n\t\t);\n\t}\n\n\tfunction returnFocus( node ) {\n\t\tif ( returnsFocusRef.current && node ) {\n\t\t\tnode.focus();\n\t\t\treturnsFocusRef.current = false;\n\t\t}\n\t}\n\n\tconst isMissingMedia =\n\t\t! isRequestingFeaturedImageMedia && !! featuredImageId && ! media;\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ getImageDescription( media ) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t{ isMissingMedia ? (\n\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'Could not retrieve the featured image data.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\tref={ returnFocus }\n\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Edit or replace the featured image'\n\t\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\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\t\tdisabled={ isLoading }\n\t\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__preview-image\"\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\t\talt={ getImageDescription(\n\t\t\t\t\t\t\t\t\t\t\t\t\tmedia\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ ( isLoading ||\n\t\t\t\t\t\t\t\t\t\t\tisRequestingFeaturedImageMedia ) && (\n\t\t\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'editor-post-featured-image__actions',\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t'editor-post-featured-image__actions-missing-image':\n\t\t\t\t\t\t\t\t\t\t\t\t\tisMissingMedia,\n\t\t\t\t\t\t\t\t\t\t\t\t'editor-post-featured-image__actions-is-requesting-image':\n\t\t\t\t\t\t\t\t\t\t\t\t\tisRequestingFeaturedImageMedia,\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\t\tisMissingMedia\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'secondary'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\t// Signal that the toggle button should be focused,\n\t\t\t\t\t\t\t\t\t\t\t\t// when it is rendered. Can't focus it directly here\n\t\t\t\t\t\t\t\t\t\t\t\t// because it's rendered conditionally.\n\t\t\t\t\t\t\t\t\t\t\t\treturnsFocusRef.current = true;\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\t\tisMissingMedia\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'secondary'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tisDestructive={ isMissingMedia }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType, hasFinishedResolution } =\n\t\tselect( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t\tisRequestingFeaturedImageMedia:\n\t\t\t!! featuredImageId &&\n\t\t\t! hasFinishedResolution( 'getMedia', [\n\t\t\t\tfeaturedImageId,\n\t\t\t\t{ context: 'view' },\n\t\t\t] ),\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmultiple: false,\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\n/**\n * Renders the component for managing the featured image of a post.\n *\n * @param {Object} props Props.\n * @param {number} props.currentPostId ID of the current post.\n * @param {number} props.featuredImageId ID of the featured image.\n * @param {Function} props.onUpdateImage Function to call when the image is updated.\n * @param {Function} props.onRemoveImage Function to call when the image is removed.\n * @param {Object} props.media The media object representing the featured image.\n * @param {string} props.postType Post type.\n * @param {Element} props.noticeUI UI for displaying notices.\n * @param {Object} props.noticeOperations Operations for managing notices.\n *\n * @return {Element} Component to be rendered .\n */\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWith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