@wordpress/block-library 9.41.1-next.v.202603102151.0 → 9.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/cover/edit/cover-placeholder.cjs +7 -0
- package/build/cover/edit/cover-placeholder.cjs.map +2 -2
- package/build/html/modal.cjs +151 -229
- package/build/html/modal.cjs.map +2 -2
- package/build/image/edit.cjs +7 -0
- package/build/image/edit.cjs.map +2 -2
- package/build/media-text/media-container.cjs +6 -0
- package/build/media-text/media-container.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +5 -4
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation-link/shared/use-link-preview.cjs +29 -0
- package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
- package/build/nextpage/block.json +0 -1
- package/build/playlist-track/block.json +0 -0
- 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 +1 -3
- package/build/site-logo/edit.cjs.map +2 -2
- package/build/site-title/index.cjs +5 -1
- package/build/site-title/index.cjs.map +2 -2
- package/build/tab/add-tab-toolbar-control.cjs +22 -5
- package/build/tab/add-tab-toolbar-control.cjs.map +2 -2
- package/build/tab/remove-tab-toolbar-control.cjs +19 -1
- package/build/tab/remove-tab-toolbar-control.cjs.map +2 -2
- package/build/tabs/edit.cjs +85 -7
- package/build/tabs/edit.cjs.map +2 -2
- package/build/tabs/index.cjs +12 -2
- package/build/tabs/index.cjs.map +2 -2
- package/build/tabs-menu/block.json +1 -6
- package/build/tabs-menu/edit.cjs +11 -151
- package/build/tabs-menu/edit.cjs.map +3 -3
- package/build/tabs-menu/save.cjs.map +2 -2
- package/build/tabs-menu-item/block.json +14 -11
- package/build/tabs-menu-item/controls.cjs +2 -133
- package/build/tabs-menu-item/controls.cjs.map +3 -3
- package/build/tabs-menu-item/edit.cjs +44 -56
- package/build/tabs-menu-item/edit.cjs.map +3 -3
- package/build/tabs-menu-item/save.cjs +0 -1
- package/build/tabs-menu-item/save.cjs.map +2 -2
- package/build/utils/media-control.cjs +72 -29
- package/build/utils/media-control.cjs.map +3 -3
- package/build-module/cover/edit/cover-placeholder.mjs +7 -0
- package/build-module/cover/edit/cover-placeholder.mjs.map +2 -2
- package/build-module/html/modal.mjs +151 -229
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/image/edit.mjs +7 -0
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/media-text/media-container.mjs +7 -1
- package/build-module/media-text/media-container.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +5 -4
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-link-preview.mjs +28 -0
- package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
- package/build-module/nextpage/block.json +0 -1
- package/build-module/playlist-track/block.json +0 -0
- 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 +1 -3
- package/build-module/site-logo/edit.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/add-tab-toolbar-control.mjs +22 -5
- package/build-module/tab/add-tab-toolbar-control.mjs.map +2 -2
- package/build-module/tab/remove-tab-toolbar-control.mjs +19 -1
- package/build-module/tab/remove-tab-toolbar-control.mjs.map +2 -2
- package/build-module/tabs/edit.mjs +87 -9
- package/build-module/tabs/edit.mjs.map +2 -2
- package/build-module/tabs/index.mjs +12 -2
- package/build-module/tabs/index.mjs.map +2 -2
- package/build-module/tabs-menu/block.json +1 -6
- package/build-module/tabs-menu/edit.mjs +13 -162
- package/build-module/tabs-menu/edit.mjs.map +2 -2
- package/build-module/tabs-menu/save.mjs.map +2 -2
- package/build-module/tabs-menu-item/block.json +14 -11
- package/build-module/tabs-menu-item/controls.mjs +4 -143
- package/build-module/tabs-menu-item/controls.mjs.map +2 -2
- package/build-module/tabs-menu-item/edit.mjs +45 -57
- package/build-module/tabs-menu-item/edit.mjs.map +3 -3
- package/build-module/tabs-menu-item/save.mjs +0 -1
- package/build-module/tabs-menu-item/save.mjs.map +2 -2
- package/build-module/utils/media-control.mjs +73 -30
- package/build-module/utils/media-control.mjs.map +2 -2
- package/build-style/editor-rtl.css +45 -11
- package/build-style/editor.css +45 -11
- package/build-style/navigation/style-rtl.css +4 -0
- package/build-style/navigation/style.css +4 -0
- package/build-style/navigation-overlay-close/style-rtl.css +3 -3
- package/build-style/navigation-overlay-close/style.css +3 -3
- package/build-style/style-rtl.css +7 -3
- package/build-style/style.css +7 -3
- package/build-style/tabs-menu/editor-rtl.css +5 -3
- package/build-style/tabs-menu/editor.css +5 -3
- package/package.json +38 -38
- package/src/cover/edit/cover-placeholder.js +8 -0
- package/src/html/modal.js +6 -77
- package/src/image/edit.js +8 -0
- package/src/media-text/media-container.js +8 -1
- package/src/navigation/edit/index.js +6 -4
- package/src/navigation/index.php +24 -17
- package/src/navigation/style.scss +10 -0
- package/src/navigation-link/index.php +9 -9
- package/src/navigation-link/shared/test/use-link-preview.test.js +149 -0
- package/src/navigation-link/shared/use-link-preview.js +43 -1
- package/src/navigation-overlay-close/style.scss +3 -3
- package/src/navigation-submenu/index.php +17 -11
- package/src/nextpage/block.json +0 -1
- package/src/playlist-track/block.json +0 -0
- package/src/playlist-track/edit.js +0 -0
- package/src/playlist-track/index.js +0 -0
- package/src/playlist-track/index.php +0 -0
- package/src/playlist-track/init.js +0 -0
- package/src/playlist-track/style.scss +0 -0
- 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 +1 -3
- package/src/site-title/index.js +5 -1
- package/src/tab/add-tab-toolbar-control.js +48 -23
- package/src/tab/remove-tab-toolbar-control.js +30 -10
- package/src/tabs/edit.js +133 -10
- package/src/tabs/index.js +12 -2
- package/src/tabs-menu/block.json +1 -6
- package/src/tabs-menu/edit.js +13 -214
- package/src/tabs-menu/editor.scss +7 -3
- package/src/tabs-menu/index.php +42 -27
- package/src/tabs-menu/save.js +0 -4
- package/src/tabs-menu-item/block.json +14 -11
- package/src/tabs-menu-item/controls.js +4 -167
- package/src/tabs-menu-item/edit.js +60 -69
- package/src/tabs-menu-item/index.php +11 -23
- package/src/tabs-menu-item/save.js +0 -1
- package/src/utils/media-control.js +61 -21
- package/src/utils/media-control.scss +54 -18
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,7 @@ module.exports = __toCommonJS(cover_placeholder_exports);
|
|
|
26
26
|
var import_block_editor = require("@wordpress/block-editor");
|
|
27
27
|
var import_i18n = require("@wordpress/i18n");
|
|
28
28
|
var import_icons = require("@wordpress/icons");
|
|
29
|
+
var import_blob = require("@wordpress/blob");
|
|
29
30
|
var import_shared = require("../shared.cjs");
|
|
30
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
32
|
function CoverPlaceholder({
|
|
@@ -36,6 +37,11 @@ function CoverPlaceholder({
|
|
|
36
37
|
style,
|
|
37
38
|
toggleUseFeaturedImage
|
|
38
39
|
}) {
|
|
40
|
+
const onFilesPreUpload = (files) => {
|
|
41
|
+
if (files.length === 1) {
|
|
42
|
+
onSelectMedia({ url: (0, import_blob.createBlobURL)(files[0]) });
|
|
43
|
+
}
|
|
44
|
+
};
|
|
39
45
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
40
46
|
import_block_editor.MediaPlaceholder,
|
|
41
47
|
{
|
|
@@ -47,6 +53,7 @@ function CoverPlaceholder({
|
|
|
47
53
|
allowedTypes: import_shared.ALLOWED_MEDIA_TYPES,
|
|
48
54
|
disableMediaButtons,
|
|
49
55
|
onToggleFeaturedImage: toggleUseFeaturedImage,
|
|
56
|
+
onFilesPreUpload,
|
|
50
57
|
onError,
|
|
51
58
|
style,
|
|
52
59
|
children
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cover/edit/cover-placeholder.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { BlockIcon, MediaPlaceholder } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { cover as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { ALLOWED_MEDIA_TYPES } from '../shared';\n\nexport default function CoverPlaceholder( {\n\tdisableMediaButtons = false,\n\tchildren,\n\tonSelectMedia,\n\tonError,\n\tstyle,\n\ttoggleUseFeaturedImage,\n} ) {\n\treturn (\n\t\t<MediaPlaceholder\n\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\tlabels={ {\n\t\t\t\ttitle: __( 'Cover' ),\n\t\t\t} }\n\t\t\tonSelect={ onSelectMedia }\n\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\tdisableMediaButtons={ disableMediaButtons }\n\t\t\tonToggleFeaturedImage={ toggleUseFeaturedImage }\n\t\t\tonError={ onError }\n\t\t\tstyle={ style }\n\t\t>\n\t\t\t{ children }\n\t\t</MediaPlaceholder>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA4C;AAC5C,kBAAmB;AACnB,mBAA8B;AAK9B,oBAAoC;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { BlockIcon, MediaPlaceholder } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { cover as icon } from '@wordpress/icons';\nimport { createBlobURL } from '@wordpress/blob';\n\n/**\n * Internal dependencies\n */\nimport { ALLOWED_MEDIA_TYPES } from '../shared';\n\nexport default function CoverPlaceholder( {\n\tdisableMediaButtons = false,\n\tchildren,\n\tonSelectMedia,\n\tonError,\n\tstyle,\n\ttoggleUseFeaturedImage,\n} ) {\n\tconst onFilesPreUpload = ( files ) => {\n\t\tif ( files.length === 1 ) {\n\t\t\tonSelectMedia( { url: createBlobURL( files[ 0 ] ) } );\n\t\t}\n\t};\n\n\treturn (\n\t\t<MediaPlaceholder\n\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\tlabels={ {\n\t\t\t\ttitle: __( 'Cover' ),\n\t\t\t} }\n\t\t\tonSelect={ onSelectMedia }\n\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\tdisableMediaButtons={ disableMediaButtons }\n\t\t\tonToggleFeaturedImage={ toggleUseFeaturedImage }\n\t\t\tonFilesPreUpload={ onFilesPreUpload }\n\t\t\tonError={ onError }\n\t\t\tstyle={ style }\n\t\t>\n\t\t\t{ children }\n\t\t</MediaPlaceholder>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA4C;AAC5C,kBAAmB;AACnB,mBAA8B;AAC9B,kBAA8B;AAK9B,oBAAoC;AAkB1B;AAhBK,SAAR,iBAAmC;AAAA,EACzC,sBAAsB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,mBAAmB,CAAE,UAAW;AACrC,QAAK,MAAM,WAAW,GAAI;AACzB,oBAAe,EAAE,SAAK,2BAAe,MAAO,CAAE,CAAE,EAAE,CAAE;AAAA,IACrD;AAAA,EACD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO,4CAAC,iCAAU,MAAO,aAAAA,OAAO;AAAA,MAChC,QAAS;AAAA,QACR,WAAO,gBAAI,OAAQ;AAAA,MACpB;AAAA,MACA,UAAW;AAAA,MACX,cAAe;AAAA,MACf;AAAA,MACA,uBAAwB;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,MAEE;AAAA;AAAA,EACH;AAEF;",
|
|
6
6
|
"names": ["icon"]
|
|
7
7
|
}
|
package/build/html/modal.cjs
CHANGED
|
@@ -55,8 +55,6 @@ function HTMLEditModal({
|
|
|
55
55
|
const [editedHtml, setEditedHtml] = (0, import_element.useState)(html);
|
|
56
56
|
const [editedCss, setEditedCss] = (0, import_element.useState)(css);
|
|
57
57
|
const [editedJs, setEditedJs] = (0, import_element.useState)(js);
|
|
58
|
-
const [isDirty, setIsDirty] = (0, import_element.useState)(false);
|
|
59
|
-
const [showUnsavedWarning, setShowUnsavedWarning] = (0, import_element.useState)(false);
|
|
60
58
|
const [isFullscreen, setIsFullscreen] = (0, import_element.useState)(false);
|
|
61
59
|
const isMobileViewport = (0, import_compose.useViewportMatch)("small", "<");
|
|
62
60
|
const { canUserUseUnfilteredHTML } = (0, import_data.useSelect)((select) => {
|
|
@@ -69,18 +67,6 @@ function HTMLEditModal({
|
|
|
69
67
|
if (!isOpen) {
|
|
70
68
|
return null;
|
|
71
69
|
}
|
|
72
|
-
const handleHtmlChange = (value) => {
|
|
73
|
-
setEditedHtml(value);
|
|
74
|
-
setIsDirty(true);
|
|
75
|
-
};
|
|
76
|
-
const handleCssChange = (value) => {
|
|
77
|
-
setEditedCss(value);
|
|
78
|
-
setIsDirty(true);
|
|
79
|
-
};
|
|
80
|
-
const handleJsChange = (value) => {
|
|
81
|
-
setEditedJs(value);
|
|
82
|
-
setIsDirty(true);
|
|
83
|
-
};
|
|
84
70
|
const handleUpdate = () => {
|
|
85
71
|
setAttributes({
|
|
86
72
|
content: (0, import_utils.serializeContent)({
|
|
@@ -89,25 +75,6 @@ function HTMLEditModal({
|
|
|
89
75
|
js: canUserUseUnfilteredHTML ? editedJs : ""
|
|
90
76
|
})
|
|
91
77
|
});
|
|
92
|
-
setIsDirty(false);
|
|
93
|
-
};
|
|
94
|
-
const handleCancel = () => {
|
|
95
|
-
setIsDirty(false);
|
|
96
|
-
onRequestClose();
|
|
97
|
-
};
|
|
98
|
-
const handleRequestClose = () => {
|
|
99
|
-
if (isDirty) {
|
|
100
|
-
setShowUnsavedWarning(true);
|
|
101
|
-
} else {
|
|
102
|
-
onRequestClose();
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
const handleDiscardChanges = () => {
|
|
106
|
-
setShowUnsavedWarning(false);
|
|
107
|
-
onRequestClose();
|
|
108
|
-
};
|
|
109
|
-
const handleContinueEditing = () => {
|
|
110
|
-
setShowUnsavedWarning(false);
|
|
111
78
|
};
|
|
112
79
|
const handleUpdateAndClose = () => {
|
|
113
80
|
handleUpdate();
|
|
@@ -116,210 +83,165 @@ function HTMLEditModal({
|
|
|
116
83
|
const toggleFullscreen = () => {
|
|
117
84
|
setIsFullscreen((prevState) => !prevState);
|
|
118
85
|
};
|
|
119
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
label: (0, import_i18n.__)(
|
|
150
|
-
"Enable/disable fullscreen"
|
|
151
|
-
),
|
|
152
|
-
onClick: toggleFullscreen,
|
|
153
|
-
variant: "tertiary"
|
|
154
|
-
}
|
|
155
|
-
) })
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
),
|
|
159
|
-
hasRestrictedContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
160
|
-
import_components.Notice,
|
|
161
|
-
{
|
|
162
|
-
status: "warning",
|
|
163
|
-
isDismissible: false,
|
|
164
|
-
className: "block-library-html__modal-notice",
|
|
165
|
-
children: (0, import_i18n.__)(
|
|
166
|
-
"This block contains CSS or JavaScript that will be removed when you save because you do not have permission to use unfiltered HTML."
|
|
167
|
-
)
|
|
168
|
-
}
|
|
169
|
-
),
|
|
170
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
171
|
-
import_components.Flex,
|
|
172
|
-
{
|
|
173
|
-
direction: isMobileViewport ? "column" : "row",
|
|
174
|
-
className: "block-library-html__modal-tabs",
|
|
175
|
-
align: "stretch",
|
|
176
|
-
gap: 8,
|
|
177
|
-
children: [
|
|
178
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "block-library-html__modal-content", children: [
|
|
179
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
180
|
-
Tabs.TabPanel,
|
|
181
|
-
{
|
|
182
|
-
tabId: "html",
|
|
183
|
-
focusable: false,
|
|
184
|
-
className: "block-library-html__modal-tab",
|
|
185
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
186
|
-
import_block_editor.PlainText,
|
|
187
|
-
{
|
|
188
|
-
value: editedHtml,
|
|
189
|
-
onChange: handleHtmlChange,
|
|
190
|
-
placeholder: (0, import_i18n.__)("Write HTML\u2026"),
|
|
191
|
-
"aria-label": (0, import_i18n.__)("HTML"),
|
|
192
|
-
className: "block-library-html__modal-editor"
|
|
193
|
-
}
|
|
194
|
-
)
|
|
195
|
-
}
|
|
196
|
-
),
|
|
197
|
-
canUserUseUnfilteredHTML && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
198
|
-
Tabs.TabPanel,
|
|
199
|
-
{
|
|
200
|
-
tabId: "css",
|
|
201
|
-
focusable: false,
|
|
202
|
-
className: "block-library-html__modal-tab",
|
|
203
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
204
|
-
import_block_editor.PlainText,
|
|
205
|
-
{
|
|
206
|
-
value: editedCss,
|
|
207
|
-
onChange: handleCssChange,
|
|
208
|
-
placeholder: (0, import_i18n.__)("Write CSS\u2026"),
|
|
209
|
-
"aria-label": (0, import_i18n.__)("CSS"),
|
|
210
|
-
className: "block-library-html__modal-editor"
|
|
211
|
-
}
|
|
212
|
-
)
|
|
213
|
-
}
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
+
import_components.Modal,
|
|
88
|
+
{
|
|
89
|
+
title: (0, import_i18n.__)("Edit HTML"),
|
|
90
|
+
onRequestClose,
|
|
91
|
+
className: "block-library-html__modal",
|
|
92
|
+
size: "large",
|
|
93
|
+
isDismissible: false,
|
|
94
|
+
shouldCloseOnClickOutside: false,
|
|
95
|
+
isFullScreen: isFullscreen,
|
|
96
|
+
__experimentalHideHeader: true,
|
|
97
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs, { orientation: "horizontal", defaultTabId: "html", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { expanded: true, children: [
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
99
|
+
import_components.__experimentalHStack,
|
|
100
|
+
{
|
|
101
|
+
justify: "space-between",
|
|
102
|
+
className: "block-library-html__modal-header",
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tabs.TabList, { children: [
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.Tab, { tabId: "html", children: "HTML" }),
|
|
106
|
+
canUserUseUnfilteredHTML && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.Tab, { tabId: "css", children: "CSS" }),
|
|
107
|
+
canUserUseUnfilteredHTML && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.Tab, { tabId: "js", children: (0, import_i18n.__)("JavaScript") })
|
|
108
|
+
] }) }),
|
|
109
|
+
!isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
110
|
+
import_components.Button,
|
|
111
|
+
{
|
|
112
|
+
__next40pxDefaultSize: true,
|
|
113
|
+
icon: isFullscreen ? import_icons.square : import_icons.fullscreen,
|
|
114
|
+
label: (0, import_i18n.__)(
|
|
115
|
+
"Enable/disable fullscreen"
|
|
214
116
|
),
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
117
|
+
onClick: toggleFullscreen,
|
|
118
|
+
variant: "tertiary"
|
|
119
|
+
}
|
|
120
|
+
) })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
hasRestrictedContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
125
|
+
import_components.Notice,
|
|
126
|
+
{
|
|
127
|
+
status: "warning",
|
|
128
|
+
isDismissible: false,
|
|
129
|
+
className: "block-library-html__modal-notice",
|
|
130
|
+
children: (0, import_i18n.__)(
|
|
131
|
+
"This block contains CSS or JavaScript that will be removed when you save because you do not have permission to use unfiltered HTML."
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
136
|
+
import_components.Flex,
|
|
137
|
+
{
|
|
138
|
+
direction: isMobileViewport ? "column" : "row",
|
|
139
|
+
className: "block-library-html__modal-tabs",
|
|
140
|
+
align: "stretch",
|
|
141
|
+
gap: 8,
|
|
142
|
+
children: [
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "block-library-html__modal-content", children: [
|
|
144
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
145
|
+
Tabs.TabPanel,
|
|
238
146
|
{
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
147
|
+
tabId: "html",
|
|
148
|
+
focusable: false,
|
|
149
|
+
className: "block-library-html__modal-tab",
|
|
150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
151
|
+
import_block_editor.PlainText,
|
|
152
|
+
{
|
|
153
|
+
value: editedHtml,
|
|
154
|
+
onChange: setEditedHtml,
|
|
155
|
+
placeholder: (0, import_i18n.__)("Write HTML\u2026"),
|
|
156
|
+
"aria-label": (0, import_i18n.__)("HTML"),
|
|
157
|
+
className: "block-library-html__modal-editor"
|
|
158
|
+
}
|
|
159
|
+
)
|
|
244
160
|
}
|
|
245
|
-
)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
),
|
|
249
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
250
|
-
import_components.__experimentalHStack,
|
|
251
|
-
{
|
|
252
|
-
alignment: "center",
|
|
253
|
-
justify: "flex-end",
|
|
254
|
-
spacing: 4,
|
|
255
|
-
className: "block-library-html__modal-footer",
|
|
256
|
-
children: [
|
|
257
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
258
|
-
import_components.Button,
|
|
161
|
+
),
|
|
162
|
+
canUserUseUnfilteredHTML && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
163
|
+
Tabs.TabPanel,
|
|
259
164
|
{
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
children: (0,
|
|
165
|
+
tabId: "css",
|
|
166
|
+
focusable: false,
|
|
167
|
+
className: "block-library-html__modal-tab",
|
|
168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
169
|
+
import_block_editor.PlainText,
|
|
170
|
+
{
|
|
171
|
+
value: editedCss,
|
|
172
|
+
onChange: setEditedCss,
|
|
173
|
+
placeholder: (0, import_i18n.__)("Write CSS\u2026"),
|
|
174
|
+
"aria-label": (0, import_i18n.__)("CSS"),
|
|
175
|
+
className: "block-library-html__modal-editor"
|
|
176
|
+
}
|
|
177
|
+
)
|
|
264
178
|
}
|
|
265
179
|
),
|
|
266
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
267
|
-
|
|
180
|
+
canUserUseUnfilteredHTML && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
181
|
+
Tabs.TabPanel,
|
|
268
182
|
{
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
children: (0,
|
|
183
|
+
tabId: "js",
|
|
184
|
+
focusable: false,
|
|
185
|
+
className: "block-library-html__modal-tab",
|
|
186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
187
|
+
import_block_editor.PlainText,
|
|
188
|
+
{
|
|
189
|
+
value: editedJs,
|
|
190
|
+
onChange: setEditedJs,
|
|
191
|
+
placeholder: (0, import_i18n.__)(
|
|
192
|
+
"Write JavaScript\u2026"
|
|
193
|
+
),
|
|
194
|
+
"aria-label": (0, import_i18n.__)("JavaScript"),
|
|
195
|
+
className: "block-library-html__modal-editor"
|
|
196
|
+
}
|
|
197
|
+
)
|
|
273
198
|
}
|
|
274
199
|
)
|
|
275
|
-
]
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
)
|
|
323
|
-
] });
|
|
200
|
+
] }),
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "block-library-html__preview", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
202
|
+
import_preview.default,
|
|
203
|
+
{
|
|
204
|
+
content: (0, import_utils.serializeContent)({
|
|
205
|
+
html: editedHtml,
|
|
206
|
+
css: editedCss,
|
|
207
|
+
js: editedJs
|
|
208
|
+
})
|
|
209
|
+
}
|
|
210
|
+
) })
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
215
|
+
import_components.__experimentalHStack,
|
|
216
|
+
{
|
|
217
|
+
alignment: "center",
|
|
218
|
+
justify: "flex-end",
|
|
219
|
+
spacing: 4,
|
|
220
|
+
className: "block-library-html__modal-footer",
|
|
221
|
+
children: [
|
|
222
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
223
|
+
import_components.Button,
|
|
224
|
+
{
|
|
225
|
+
__next40pxDefaultSize: true,
|
|
226
|
+
variant: "tertiary",
|
|
227
|
+
onClick: onRequestClose,
|
|
228
|
+
children: (0, import_i18n.__)("Cancel")
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
232
|
+
import_components.Button,
|
|
233
|
+
{
|
|
234
|
+
__next40pxDefaultSize: true,
|
|
235
|
+
variant: "primary",
|
|
236
|
+
onClick: handleUpdateAndClose,
|
|
237
|
+
children: (0, import_i18n.__)("Update")
|
|
238
|
+
}
|
|
239
|
+
)
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
)
|
|
243
|
+
] }) })
|
|
244
|
+
}
|
|
245
|
+
) });
|
|
324
246
|
}
|
|
325
247
|
//# sourceMappingURL=modal.cjs.map
|
package/build/html/modal.cjs.map
CHANGED
|
@@ -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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,qBAAyB;AACzB,kBAA0B;AAC1B,wBAQO;AACP,0BAAqD;AACrD,mBAAmC;AACnC,qBAAiC;AAKjC,yBAAuB;AACvB,qBAAoB;AACpB,mBAA+C;
|
|
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__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A,aAAU,+BAAkB;AAAA,oBAC3B,MAAM;AAAA,oBACN,KAAK;AAAA,oBACL,IAAI;AAAA,kBACL,CAAE;AAAA;AAAA,cACH,GACD;AAAA;AAAA;AAAA,QACD;AAAA,QACA;AAAA,UAAC,kBAAAD;AAAA,UAAA;AAAA,YACA,WAAU;AAAA,YACV,SAAQ;AAAA,YACR,SAAU;AAAA,YACV,WAAU;AAAA,YAEV;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,SAAQ;AAAA,kBACR,SAAU;AAAA,kBAER,8BAAI,QAAS;AAAA;AAAA,cAChB;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,SAAQ;AAAA,kBACR,SAAU;AAAA,kBAER,8BAAI,QAAS;AAAA;AAAA,cAChB;AAAA;AAAA;AAAA,QACD;AAAA,SACD,GACD;AAAA;AAAA,EACD,GACD;AAEF;",
|
|
6
6
|
"names": ["componentsPrivateApis", "blockEditorStore", "VStack", "HStack", "Preview"]
|
|
7
7
|
}
|
package/build/image/edit.cjs
CHANGED
|
@@ -124,6 +124,7 @@ function ImageEdit({
|
|
|
124
124
|
const { createErrorNotice } = (0, import_data.useDispatch)(import_notices.store);
|
|
125
125
|
function onUploadError(message) {
|
|
126
126
|
createErrorNotice(message, { type: "snackbar" });
|
|
127
|
+
setTemporaryURL();
|
|
127
128
|
setAttributes({
|
|
128
129
|
src: void 0,
|
|
129
130
|
id: void 0,
|
|
@@ -131,6 +132,11 @@ function ImageEdit({
|
|
|
131
132
|
blob: void 0
|
|
132
133
|
});
|
|
133
134
|
}
|
|
135
|
+
function onFilesPreUpload(files) {
|
|
136
|
+
if (files.length === 1) {
|
|
137
|
+
setTemporaryURL((0, import_blob.createBlobURL)(files[0]));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
134
140
|
function onSelectImagesList(images) {
|
|
135
141
|
const win = containerRef.current?.ownerDocument.defaultView;
|
|
136
142
|
if (images.every((file) => file instanceof win.File)) {
|
|
@@ -373,6 +379,7 @@ function ImageEdit({
|
|
|
373
379
|
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockIcon, { icon: import_icons.image }),
|
|
374
380
|
onSelect: onSelectImage,
|
|
375
381
|
onSelectURL,
|
|
382
|
+
onFilesPreUpload,
|
|
376
383
|
onError: onUploadError,
|
|
377
384
|
placeholder,
|
|
378
385
|
allowedTypes: import_constants.ALLOWED_MEDIA_TYPES,
|