@wordpress/block-library 9.41.1-next.v.202603161435.0 → 9.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/form-input/edit.cjs +36 -29
- package/build/form-input/edit.cjs.map +2 -2
- package/build/form-input/variations.cjs +10 -0
- package/build/form-input/variations.cjs.map +2 -2
- package/build/group/block.json +3 -1
- package/build/html/modal.cjs +151 -229
- package/build/html/modal.cjs.map +2 -2
- package/build/image/image.cjs +13 -4
- package/build/image/image.cjs.map +2 -2
- package/build/latest-comments/deprecated.cjs +33 -0
- package/build/latest-comments/deprecated.cjs.map +2 -2
- package/build/list-item/block.json +1 -0
- package/build/navigation/edit/index.cjs +123 -119
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/navigation-menu-selector.cjs +2 -1
- package/build/navigation/edit/navigation-menu-selector.cjs.map +2 -2
- package/build/post-date/block.json +1 -3
- package/build/post-date/deprecated.cjs +82 -6
- package/build/post-date/deprecated.cjs.map +3 -3
- package/build/post-date/edit.cjs +49 -62
- package/build/post-date/edit.cjs.map +3 -3
- package/build/site-logo/edit.cjs +19 -13
- package/build/site-logo/edit.cjs.map +3 -3
- package/build/site-tagline/deprecated.cjs +2 -1
- package/build/site-tagline/deprecated.cjs.map +2 -2
- package/build/site-title/index.cjs +5 -1
- package/build/site-title/index.cjs.map +2 -2
- package/build/tab/save.cjs +2 -4
- package/build/tab/save.cjs.map +2 -2
- package/build/tabs/save.cjs +2 -4
- package/build/tabs/save.cjs.map +2 -2
- package/build/utils/media-control.cjs +1 -1
- package/build/utils/media-control.cjs.map +2 -2
- package/build-module/form-input/edit.mjs +36 -29
- package/build-module/form-input/edit.mjs.map +2 -2
- package/build-module/form-input/variations.mjs +10 -0
- package/build-module/form-input/variations.mjs.map +2 -2
- package/build-module/group/block.json +3 -1
- package/build-module/html/modal.mjs +151 -229
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/image/image.mjs +13 -4
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/latest-comments/deprecated.mjs +33 -0
- package/build-module/latest-comments/deprecated.mjs.map +2 -2
- package/build-module/list-item/block.json +1 -0
- package/build-module/navigation/edit/index.mjs +123 -119
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-menu-selector.mjs +2 -1
- package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
- package/build-module/post-date/block.json +1 -3
- package/build-module/post-date/deprecated.mjs +82 -6
- package/build-module/post-date/deprecated.mjs.map +2 -2
- package/build-module/post-date/edit.mjs +49 -63
- package/build-module/post-date/edit.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +21 -14
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/site-tagline/deprecated.mjs +2 -1
- package/build-module/site-tagline/deprecated.mjs.map +2 -2
- package/build-module/site-title/index.mjs +5 -1
- package/build-module/site-title/index.mjs.map +2 -2
- package/build-module/tab/save.mjs +2 -4
- package/build-module/tab/save.mjs.map +2 -2
- package/build-module/tabs/save.mjs +2 -4
- package/build-module/tabs/save.mjs.map +2 -2
- package/build-module/utils/media-control.mjs +1 -1
- package/build-module/utils/media-control.mjs.map +2 -2
- package/build-style/editor-rtl.css +15 -5
- package/build-style/editor.css +15 -5
- package/build-style/form-input/editor-rtl.css +6 -5
- package/build-style/form-input/editor.css +6 -5
- package/build-style/icon/editor-rtl.css +5 -0
- package/build-style/icon/editor.css +5 -0
- package/build-style/image/editor-rtl.css +4 -0
- package/build-style/image/editor.css +4 -0
- package/build-style/navigation/style-rtl.css +4 -1
- package/build-style/navigation/style.css +4 -1
- package/build-style/style-rtl.css +4 -1
- package/build-style/style.css +4 -1
- package/package.json +38 -38
- package/src/form-input/edit.js +19 -15
- package/src/form-input/editor.scss +6 -6
- package/src/form-input/variations.js +10 -0
- package/src/group/block.json +3 -1
- package/src/home-link/index.php +14 -33
- package/src/html/modal.js +6 -77
- package/src/icon/editor.scss +5 -0
- package/src/image/editor.scss +5 -0
- package/src/image/image.js +18 -3
- package/src/latest-comments/deprecated.js +33 -0
- package/src/list-item/block.json +1 -0
- package/src/loginout/index.php +13 -0
- package/src/navigation/edit/index.js +134 -130
- package/src/navigation/edit/navigation-menu-selector.js +2 -1
- package/src/navigation/index.php +24 -6
- package/src/navigation/style.scss +5 -3
- package/src/navigation-link/index.php +10 -38
- package/src/navigation-link/shared/build-css-font-sizes.php +43 -0
- package/src/navigation-submenu/index.php +10 -38
- package/src/page-list/index.php +14 -41
- package/src/post-date/block.json +1 -3
- package/src/post-date/deprecated.js +86 -6
- package/src/post-date/edit.js +65 -82
- package/src/site-logo/edit.js +24 -13
- package/src/site-tagline/deprecated.js +1 -0
- package/src/site-title/index.js +5 -1
- package/src/tab/save.js +2 -6
- package/src/tabs/save.js +2 -6
- package/src/utils/media-control.js +3 -1
|
@@ -29,8 +29,6 @@ function HTMLEditModal({
|
|
|
29
29
|
const [editedHtml, setEditedHtml] = useState(html);
|
|
30
30
|
const [editedCss, setEditedCss] = useState(css);
|
|
31
31
|
const [editedJs, setEditedJs] = useState(js);
|
|
32
|
-
const [isDirty, setIsDirty] = useState(false);
|
|
33
|
-
const [showUnsavedWarning, setShowUnsavedWarning] = useState(false);
|
|
34
32
|
const [isFullscreen, setIsFullscreen] = useState(false);
|
|
35
33
|
const isMobileViewport = useViewportMatch("small", "<");
|
|
36
34
|
const { canUserUseUnfilteredHTML } = useSelect((select) => {
|
|
@@ -43,18 +41,6 @@ function HTMLEditModal({
|
|
|
43
41
|
if (!isOpen) {
|
|
44
42
|
return null;
|
|
45
43
|
}
|
|
46
|
-
const handleHtmlChange = (value) => {
|
|
47
|
-
setEditedHtml(value);
|
|
48
|
-
setIsDirty(true);
|
|
49
|
-
};
|
|
50
|
-
const handleCssChange = (value) => {
|
|
51
|
-
setEditedCss(value);
|
|
52
|
-
setIsDirty(true);
|
|
53
|
-
};
|
|
54
|
-
const handleJsChange = (value) => {
|
|
55
|
-
setEditedJs(value);
|
|
56
|
-
setIsDirty(true);
|
|
57
|
-
};
|
|
58
44
|
const handleUpdate = () => {
|
|
59
45
|
setAttributes({
|
|
60
46
|
content: serializeContent({
|
|
@@ -63,25 +49,6 @@ function HTMLEditModal({
|
|
|
63
49
|
js: canUserUseUnfilteredHTML ? editedJs : ""
|
|
64
50
|
})
|
|
65
51
|
});
|
|
66
|
-
setIsDirty(false);
|
|
67
|
-
};
|
|
68
|
-
const handleCancel = () => {
|
|
69
|
-
setIsDirty(false);
|
|
70
|
-
onRequestClose();
|
|
71
|
-
};
|
|
72
|
-
const handleRequestClose = () => {
|
|
73
|
-
if (isDirty) {
|
|
74
|
-
setShowUnsavedWarning(true);
|
|
75
|
-
} else {
|
|
76
|
-
onRequestClose();
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
const handleDiscardChanges = () => {
|
|
80
|
-
setShowUnsavedWarning(false);
|
|
81
|
-
onRequestClose();
|
|
82
|
-
};
|
|
83
|
-
const handleContinueEditing = () => {
|
|
84
|
-
setShowUnsavedWarning(false);
|
|
85
52
|
};
|
|
86
53
|
const handleUpdateAndClose = () => {
|
|
87
54
|
handleUpdate();
|
|
@@ -90,211 +57,166 @@ function HTMLEditModal({
|
|
|
90
57
|
const toggleFullscreen = () => {
|
|
91
58
|
setIsFullscreen((prevState) => !prevState);
|
|
92
59
|
};
|
|
93
|
-
return /* @__PURE__ */
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
/* @__PURE__ */ jsx(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
label: __(
|
|
124
|
-
"Enable/disable fullscreen"
|
|
125
|
-
),
|
|
126
|
-
onClick: toggleFullscreen,
|
|
127
|
-
variant: "tertiary"
|
|
128
|
-
}
|
|
129
|
-
) })
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
),
|
|
133
|
-
hasRestrictedContent && /* @__PURE__ */ jsx(
|
|
134
|
-
Notice,
|
|
135
|
-
{
|
|
136
|
-
status: "warning",
|
|
137
|
-
isDismissible: false,
|
|
138
|
-
className: "block-library-html__modal-notice",
|
|
139
|
-
children: __(
|
|
140
|
-
"This block contains CSS or JavaScript that will be removed when you save because you do not have permission to use unfiltered HTML."
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
),
|
|
144
|
-
/* @__PURE__ */ jsxs(
|
|
145
|
-
Flex,
|
|
146
|
-
{
|
|
147
|
-
direction: isMobileViewport ? "column" : "row",
|
|
148
|
-
className: "block-library-html__modal-tabs",
|
|
149
|
-
align: "stretch",
|
|
150
|
-
gap: 8,
|
|
151
|
-
children: [
|
|
152
|
-
/* @__PURE__ */ jsxs("div", { className: "block-library-html__modal-content", children: [
|
|
153
|
-
/* @__PURE__ */ jsx(
|
|
154
|
-
Tabs.TabPanel,
|
|
155
|
-
{
|
|
156
|
-
tabId: "html",
|
|
157
|
-
focusable: false,
|
|
158
|
-
className: "block-library-html__modal-tab",
|
|
159
|
-
children: /* @__PURE__ */ jsx(
|
|
160
|
-
PlainText,
|
|
161
|
-
{
|
|
162
|
-
value: editedHtml,
|
|
163
|
-
onChange: handleHtmlChange,
|
|
164
|
-
placeholder: __("Write HTML\u2026"),
|
|
165
|
-
"aria-label": __("HTML"),
|
|
166
|
-
className: "block-library-html__modal-editor"
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
}
|
|
170
|
-
),
|
|
171
|
-
canUserUseUnfilteredHTML && /* @__PURE__ */ jsx(
|
|
172
|
-
Tabs.TabPanel,
|
|
173
|
-
{
|
|
174
|
-
tabId: "css",
|
|
175
|
-
focusable: false,
|
|
176
|
-
className: "block-library-html__modal-tab",
|
|
177
|
-
children: /* @__PURE__ */ jsx(
|
|
178
|
-
PlainText,
|
|
179
|
-
{
|
|
180
|
-
value: editedCss,
|
|
181
|
-
onChange: handleCssChange,
|
|
182
|
-
placeholder: __("Write CSS\u2026"),
|
|
183
|
-
"aria-label": __("CSS"),
|
|
184
|
-
className: "block-library-html__modal-editor"
|
|
185
|
-
}
|
|
186
|
-
)
|
|
187
|
-
}
|
|
60
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
61
|
+
Modal,
|
|
62
|
+
{
|
|
63
|
+
title: __("Edit HTML"),
|
|
64
|
+
onRequestClose,
|
|
65
|
+
className: "block-library-html__modal",
|
|
66
|
+
size: "large",
|
|
67
|
+
isDismissible: false,
|
|
68
|
+
shouldCloseOnClickOutside: false,
|
|
69
|
+
isFullScreen: isFullscreen,
|
|
70
|
+
__experimentalHideHeader: true,
|
|
71
|
+
children: /* @__PURE__ */ jsx(Tabs, { orientation: "horizontal", defaultTabId: "html", children: /* @__PURE__ */ jsxs(VStack, { expanded: true, children: [
|
|
72
|
+
/* @__PURE__ */ jsxs(
|
|
73
|
+
HStack,
|
|
74
|
+
{
|
|
75
|
+
justify: "space-between",
|
|
76
|
+
className: "block-library-html__modal-header",
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(Tabs.TabList, { children: [
|
|
79
|
+
/* @__PURE__ */ jsx(Tabs.Tab, { tabId: "html", children: "HTML" }),
|
|
80
|
+
canUserUseUnfilteredHTML && /* @__PURE__ */ jsx(Tabs.Tab, { tabId: "css", children: "CSS" }),
|
|
81
|
+
canUserUseUnfilteredHTML && /* @__PURE__ */ jsx(Tabs.Tab, { tabId: "js", children: __("JavaScript") })
|
|
82
|
+
] }) }),
|
|
83
|
+
!isMobileViewport && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
84
|
+
Button,
|
|
85
|
+
{
|
|
86
|
+
__next40pxDefaultSize: true,
|
|
87
|
+
icon: isFullscreen ? square : fullscreen,
|
|
88
|
+
label: __(
|
|
89
|
+
"Enable/disable fullscreen"
|
|
188
90
|
),
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
91
|
+
onClick: toggleFullscreen,
|
|
92
|
+
variant: "tertiary"
|
|
93
|
+
}
|
|
94
|
+
) })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
hasRestrictedContent && /* @__PURE__ */ jsx(
|
|
99
|
+
Notice,
|
|
100
|
+
{
|
|
101
|
+
status: "warning",
|
|
102
|
+
isDismissible: false,
|
|
103
|
+
className: "block-library-html__modal-notice",
|
|
104
|
+
children: __(
|
|
105
|
+
"This block contains CSS or JavaScript that will be removed when you save because you do not have permission to use unfiltered HTML."
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
/* @__PURE__ */ jsxs(
|
|
110
|
+
Flex,
|
|
111
|
+
{
|
|
112
|
+
direction: isMobileViewport ? "column" : "row",
|
|
113
|
+
className: "block-library-html__modal-tabs",
|
|
114
|
+
align: "stretch",
|
|
115
|
+
gap: 8,
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ jsxs("div", { className: "block-library-html__modal-content", children: [
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
Tabs.TabPanel,
|
|
212
120
|
{
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
121
|
+
tabId: "html",
|
|
122
|
+
focusable: false,
|
|
123
|
+
className: "block-library-html__modal-tab",
|
|
124
|
+
children: /* @__PURE__ */ jsx(
|
|
125
|
+
PlainText,
|
|
126
|
+
{
|
|
127
|
+
value: editedHtml,
|
|
128
|
+
onChange: setEditedHtml,
|
|
129
|
+
placeholder: __("Write HTML\u2026"),
|
|
130
|
+
"aria-label": __("HTML"),
|
|
131
|
+
className: "block-library-html__modal-editor"
|
|
132
|
+
}
|
|
133
|
+
)
|
|
218
134
|
}
|
|
219
|
-
)
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
),
|
|
223
|
-
/* @__PURE__ */ jsxs(
|
|
224
|
-
HStack,
|
|
225
|
-
{
|
|
226
|
-
alignment: "center",
|
|
227
|
-
justify: "flex-end",
|
|
228
|
-
spacing: 4,
|
|
229
|
-
className: "block-library-html__modal-footer",
|
|
230
|
-
children: [
|
|
231
|
-
/* @__PURE__ */ jsx(
|
|
232
|
-
Button,
|
|
135
|
+
),
|
|
136
|
+
canUserUseUnfilteredHTML && /* @__PURE__ */ jsx(
|
|
137
|
+
Tabs.TabPanel,
|
|
233
138
|
{
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
children:
|
|
139
|
+
tabId: "css",
|
|
140
|
+
focusable: false,
|
|
141
|
+
className: "block-library-html__modal-tab",
|
|
142
|
+
children: /* @__PURE__ */ jsx(
|
|
143
|
+
PlainText,
|
|
144
|
+
{
|
|
145
|
+
value: editedCss,
|
|
146
|
+
onChange: setEditedCss,
|
|
147
|
+
placeholder: __("Write CSS\u2026"),
|
|
148
|
+
"aria-label": __("CSS"),
|
|
149
|
+
className: "block-library-html__modal-editor"
|
|
150
|
+
}
|
|
151
|
+
)
|
|
238
152
|
}
|
|
239
153
|
),
|
|
240
|
-
/* @__PURE__ */ jsx(
|
|
241
|
-
|
|
154
|
+
canUserUseUnfilteredHTML && /* @__PURE__ */ jsx(
|
|
155
|
+
Tabs.TabPanel,
|
|
242
156
|
{
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
children:
|
|
157
|
+
tabId: "js",
|
|
158
|
+
focusable: false,
|
|
159
|
+
className: "block-library-html__modal-tab",
|
|
160
|
+
children: /* @__PURE__ */ jsx(
|
|
161
|
+
PlainText,
|
|
162
|
+
{
|
|
163
|
+
value: editedJs,
|
|
164
|
+
onChange: setEditedJs,
|
|
165
|
+
placeholder: __(
|
|
166
|
+
"Write JavaScript\u2026"
|
|
167
|
+
),
|
|
168
|
+
"aria-label": __("JavaScript"),
|
|
169
|
+
className: "block-library-html__modal-editor"
|
|
170
|
+
}
|
|
171
|
+
)
|
|
247
172
|
}
|
|
248
173
|
)
|
|
249
|
-
]
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
)
|
|
297
|
-
] });
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ jsx("div", { className: "block-library-html__preview", children: /* @__PURE__ */ jsx(
|
|
176
|
+
Preview,
|
|
177
|
+
{
|
|
178
|
+
content: serializeContent({
|
|
179
|
+
html: editedHtml,
|
|
180
|
+
css: editedCss,
|
|
181
|
+
js: editedJs
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
) })
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
),
|
|
188
|
+
/* @__PURE__ */ jsxs(
|
|
189
|
+
HStack,
|
|
190
|
+
{
|
|
191
|
+
alignment: "center",
|
|
192
|
+
justify: "flex-end",
|
|
193
|
+
spacing: 4,
|
|
194
|
+
className: "block-library-html__modal-footer",
|
|
195
|
+
children: [
|
|
196
|
+
/* @__PURE__ */ jsx(
|
|
197
|
+
Button,
|
|
198
|
+
{
|
|
199
|
+
__next40pxDefaultSize: true,
|
|
200
|
+
variant: "tertiary",
|
|
201
|
+
onClick: onRequestClose,
|
|
202
|
+
children: __("Cancel")
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
/* @__PURE__ */ jsx(
|
|
206
|
+
Button,
|
|
207
|
+
{
|
|
208
|
+
__next40pxDefaultSize: true,
|
|
209
|
+
variant: "primary",
|
|
210
|
+
onClick: handleUpdateAndClose,
|
|
211
|
+
children: __("Update")
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
] }) })
|
|
218
|
+
}
|
|
219
|
+
) });
|
|
298
220
|
}
|
|
299
221
|
export {
|
|
300
222
|
HTMLEditModal as default
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/html/modal.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tModal,\n\tButton,\n\tFlex,\n\tNotice,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { PlainText, store as blockEditorStore } from '@wordpress/block-editor';\nimport { fullscreen, square } from '@wordpress/icons';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport Preview from './preview';\nimport { parseContent, serializeContent } from './utils';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nexport default function HTMLEditModal( {\n\tisOpen,\n\tonRequestClose,\n\tcontent,\n\tsetAttributes,\n} ) {\n\t// Parse content into separate sections and use as initial state\n\tconst { html, css, js } = parseContent( content );\n\tconst [ editedHtml, setEditedHtml ] = useState( html );\n\tconst [ editedCss, setEditedCss ] = useState( css );\n\tconst [ editedJs, setEditedJs ] = useState( js );\n\tconst [
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,OAClB;AACP,SAAS,WAAW,SAAS,wBAAwB;AACrD,SAAS,YAAY,cAAc;AACnC,SAAS,wBAAwB;AAKjC,SAAS,cAAc;AACvB,OAAO,aAAa;AACpB,SAAS,cAAc,wBAAwB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tModal,\n\tButton,\n\tFlex,\n\tNotice,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { PlainText, store as blockEditorStore } from '@wordpress/block-editor';\nimport { fullscreen, square } from '@wordpress/icons';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport Preview from './preview';\nimport { parseContent, serializeContent } from './utils';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nexport default function HTMLEditModal( {\n\tisOpen,\n\tonRequestClose,\n\tcontent,\n\tsetAttributes,\n} ) {\n\t// Parse content into separate sections and use as initial state\n\tconst { html, css, js } = parseContent( content );\n\tconst [ editedHtml, setEditedHtml ] = useState( html );\n\tconst [ editedCss, setEditedCss ] = useState( css );\n\tconst [ editedJs, setEditedJs ] = useState( js );\n\tconst [ isFullscreen, setIsFullscreen ] = useState( false );\n\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\n\t// Check if user has permission to save scripts and get editor styles\n\tconst { canUserUseUnfilteredHTML } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tcanUserUseUnfilteredHTML:\n\t\t\t\tsettings.__experimentalCanUserUseUnfilteredHTML,\n\t\t};\n\t}, [] );\n\n\t// Determine if we should show a warning about CSS/JS content being stripped\n\tconst hasRestrictedContent =\n\t\t! canUserUseUnfilteredHTML && ( css.trim() || js.trim() );\n\n\tif ( ! isOpen ) {\n\t\treturn null;\n\t}\n\n\tconst handleUpdate = () => {\n\t\t// For users without unfiltered_html capability, strip CSS and JS content\n\t\t// to prevent kses from leaving broken content\n\t\tsetAttributes( {\n\t\t\tcontent: serializeContent( {\n\t\t\t\thtml: editedHtml,\n\t\t\t\tcss: canUserUseUnfilteredHTML ? editedCss : '',\n\t\t\t\tjs: canUserUseUnfilteredHTML ? editedJs : '',\n\t\t\t} ),\n\t\t} );\n\t};\n\tconst handleUpdateAndClose = () => {\n\t\thandleUpdate();\n\t\tonRequestClose();\n\t};\n\tconst toggleFullscreen = () => {\n\t\tsetIsFullscreen( ( prevState ) => ! prevState );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Modal\n\t\t\t\ttitle={ __( 'Edit HTML' ) }\n\t\t\t\tonRequestClose={ onRequestClose }\n\t\t\t\tclassName=\"block-library-html__modal\"\n\t\t\t\tsize=\"large\"\n\t\t\t\tisDismissible={ false }\n\t\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\t\tisFullScreen={ isFullscreen }\n\t\t\t\t__experimentalHideHeader\n\t\t\t>\n\t\t\t\t<Tabs orientation=\"horizontal\" defaultTabId=\"html\">\n\t\t\t\t\t<VStack expanded>\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t\t\t\tclassName=\"block-library-html__modal-header\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t\t\t\t<Tabs.Tab tabId=\"html\">HTML</Tabs.Tab>\n\t\t\t\t\t\t\t\t\t{ canUserUseUnfilteredHTML && (\n\t\t\t\t\t\t\t\t\t\t<Tabs.Tab tabId=\"css\">CSS</Tabs.Tab>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ canUserUseUnfilteredHTML && (\n\t\t\t\t\t\t\t\t\t\t<Tabs.Tab tabId=\"js\">\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'JavaScript' ) }\n\t\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t\t<div>\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\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisFullscreen ? square : fullscreen\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Enable/disable fullscreen'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tonClick={ toggleFullscreen }\n\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t{ hasRestrictedContent && (\n\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\tclassName=\"block-library-html__modal-notice\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'This block contains CSS or JavaScript that will be removed when you save because you do not have permission to use unfiltered HTML.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tdirection={ isMobileViewport ? 'column' : 'row' }\n\t\t\t\t\t\t\tclassName=\"block-library-html__modal-tabs\"\n\t\t\t\t\t\t\talign=\"stretch\"\n\t\t\t\t\t\t\tgap={ 8 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"block-library-html__modal-content\">\n\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\ttabId=\"html\"\n\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t\tclassName=\"block-library-html__modal-tab\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<PlainText\n\t\t\t\t\t\t\t\t\t\tvalue={ editedHtml }\n\t\t\t\t\t\t\t\t\t\tonChange={ setEditedHtml }\n\t\t\t\t\t\t\t\t\t\tplaceholder={ __( 'Write HTML\u2026' ) }\n\t\t\t\t\t\t\t\t\t\taria-label={ __( 'HTML' ) }\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-library-html__modal-editor\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t\t{ canUserUseUnfilteredHTML && (\n\t\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\t\ttabId=\"css\"\n\t\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-library-html__modal-tab\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<PlainText\n\t\t\t\t\t\t\t\t\t\t\tvalue={ editedCss }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ setEditedCss }\n\t\t\t\t\t\t\t\t\t\t\tplaceholder={ __( 'Write CSS\u2026' ) }\n\t\t\t\t\t\t\t\t\t\t\taria-label={ __( 'CSS' ) }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-library-html__modal-editor\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ canUserUseUnfilteredHTML && (\n\t\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\t\ttabId=\"js\"\n\t\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-library-html__modal-tab\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<PlainText\n\t\t\t\t\t\t\t\t\t\t\tvalue={ editedJs }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ setEditedJs }\n\t\t\t\t\t\t\t\t\t\t\tplaceholder={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Write JavaScript\u2026'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\taria-label={ __( 'JavaScript' ) }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-library-html__modal-editor\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"block-library-html__preview\">\n\t\t\t\t\t\t\t\t<Preview\n\t\t\t\t\t\t\t\t\tcontent={ serializeContent( {\n\t\t\t\t\t\t\t\t\t\thtml: editedHtml,\n\t\t\t\t\t\t\t\t\t\tcss: editedCss,\n\t\t\t\t\t\t\t\t\t\tjs: editedJs,\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\t\tclassName=\"block-library-html__modal-footer\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\tonClick={ onRequestClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ handleUpdateAndClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Update' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</VStack>\n\t\t\t\t</Tabs>\n\t\t\t</Modal>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,OAClB;AACP,SAAS,WAAW,SAAS,wBAAwB;AACrD,SAAS,YAAY,cAAc;AACnC,SAAS,wBAAwB;AAKjC,SAAS,cAAc;AACvB,OAAO,aAAa;AACpB,SAAS,cAAc,wBAA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D;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -64,7 +64,9 @@ import {
|
|
|
64
64
|
} from "./constants.mjs";
|
|
65
65
|
import { evalAspectRatio, mediaPosition } from "./utils.mjs";
|
|
66
66
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
67
|
-
var { DimensionsTool, ResolutionTool } = unlock(
|
|
67
|
+
var { DimensionsTool, ResolutionTool, mediaEditKey } = unlock(
|
|
68
|
+
blockEditorPrivateApis
|
|
69
|
+
);
|
|
68
70
|
var scaleOptions = [
|
|
69
71
|
{
|
|
70
72
|
value: "cover",
|
|
@@ -301,7 +303,13 @@ function Image({
|
|
|
301
303
|
},
|
|
302
304
|
[id, isSingleSelected]
|
|
303
305
|
);
|
|
304
|
-
const {
|
|
306
|
+
const {
|
|
307
|
+
canInsertCover,
|
|
308
|
+
imageEditing,
|
|
309
|
+
imageSizes,
|
|
310
|
+
maxWidth,
|
|
311
|
+
editMediaEntity
|
|
312
|
+
} = useSelect(
|
|
305
313
|
(select) => {
|
|
306
314
|
const { getBlockRootClientId, canInsertBlockType, getSettings: getSettings2 } = select(blockEditorStore);
|
|
307
315
|
const rootClientId = getBlockRootClientId(clientId);
|
|
@@ -310,6 +318,7 @@ function Image({
|
|
|
310
318
|
imageEditing: settings.imageEditing,
|
|
311
319
|
imageSizes: settings.imageSizes,
|
|
312
320
|
maxWidth: settings.maxWidth,
|
|
321
|
+
editMediaEntity: settings?.[mediaEditKey],
|
|
313
322
|
canInsertCover: canInsertBlockType(
|
|
314
323
|
"core/cover",
|
|
315
324
|
rootClientId
|
|
@@ -451,7 +460,7 @@ function Image({
|
|
|
451
460
|
setIsEditingImage(false);
|
|
452
461
|
}
|
|
453
462
|
}, [isSingleSelected]);
|
|
454
|
-
const canEditImage = id && naturalWidth && naturalHeight && imageEditing;
|
|
463
|
+
const canEditImage = id && naturalWidth && naturalHeight && imageEditing && !!editMediaEntity;
|
|
455
464
|
const allowCrop = isSingleSelected && canEditImage && !isEditingImage && !isContentOnlyMode;
|
|
456
465
|
function switchToCover() {
|
|
457
466
|
replaceBlocks(
|
|
@@ -609,7 +618,7 @@ function Image({
|
|
|
609
618
|
}
|
|
610
619
|
) });
|
|
611
620
|
const hasDataFormBlockFields = window?.__experimentalContentOnlyInspectorFields;
|
|
612
|
-
const editMediaButton = window?.__experimentalMediaEditor && id && isSingleSelected && canUserEdit && !isExternalImage(id, url) && !isEditingImage && onNavigateToEntityRecord && /* @__PURE__ */ jsx(BlockControls, { group: "other", children: /* @__PURE__ */ jsx(
|
|
621
|
+
const editMediaButton = window?.__experimentalMediaEditor && id && isSingleSelected && canUserEdit && !!editMediaEntity && !isExternalImage(id, url) && !isEditingImage && onNavigateToEntityRecord && /* @__PURE__ */ jsx(BlockControls, { group: "other", children: /* @__PURE__ */ jsx(
|
|
613
622
|
ToolbarButton,
|
|
614
623
|
{
|
|
615
624
|
onClick: () => {
|