@uxf/wysiwyg 14.0.0 → 14.1.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/hooks.js +21 -7
- package/package.json +8 -8
- package/plugins/link/floating-link-wrapper.js +111 -8
- package/plugins/link/hooks/use-floating-link-selectors.js +67 -7
- package/plugins/link/hooks/use-link-actions.js +127 -31
- package/plugins/link/hooks/use-link-submit-on-enter.js +58 -12
- package/ui/button/button-element.js +72 -48
- package/ui/button/insert-button-modal-content.js +183 -40
- package/ui/components/modal/modal-button-cancel.js +46 -44
- package/ui/floating-link.js +381 -46
- package/ui/image/image-element.js +72 -48
- package/ui/image/insert-image-modal-content.js +268 -45
- package/ui/toolbar/buttons/button-toolbar-button.js +37 -2
- package/ui/toolbar/buttons/element-toolbar-button.js +53 -8
- package/ui/toolbar/buttons/image-toolbar-button.js +37 -2
- package/ui/toolbar/buttons/link-toolbar-button.js +53 -9
- package/ui/toolbar/buttons/list-toolbar-button.js +50 -9
- package/ui/toolbar/buttons/mark-toolbar-button.js +49 -9
- package/ui/toolbar/buttons/toolbar-button.js +56 -14
- package/ui/toolbar/buttons/undo-redo-button-group.js +132 -58
- package/ui/toolbar/buttons/video-toolbar-button.js +37 -2
- package/ui/toolbar/toolbar.js +162 -38
- package/ui/video/insert-video-modal-content.js +160 -36
- package/ui/video/video-element.js +83 -48
- package/wysiwyg-editor.js +184 -36
- package/wysiwyg-editor.stories.js +288 -118
package/ui/floating-link.js
CHANGED
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.FloatingLink = void 0;
|
|
37
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
38
|
const floating_1 = require("@platejs/floating");
|
|
38
39
|
const react_1 = require("@platejs/link/react");
|
|
39
40
|
const translations_1 = require("@uxf/core-react/translations");
|
|
@@ -53,68 +54,402 @@ const CLASS_NAME = "uxf-wysiwyg__floating-link";
|
|
|
53
54
|
const EDIT_CLASS_NAME = `${CLASS_NAME}-edit`;
|
|
54
55
|
const Edit = () => {
|
|
55
56
|
var _a, _b;
|
|
57
|
+
const $ = (0, compiler_runtime_1.c)(26);
|
|
56
58
|
const editor = (0, hooks_1.useUxfEditorRef)();
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
let T0;
|
|
60
|
+
let T1;
|
|
61
|
+
let t0;
|
|
62
|
+
let t1;
|
|
63
|
+
let t2;
|
|
64
|
+
let t3;
|
|
65
|
+
if ($[0] !== editor) {
|
|
66
|
+
const url = (_b = (_a = (0, get_active_link_1.getActiveLink)(editor)) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : "";
|
|
67
|
+
T1 = button_group_1.ButtonGroup;
|
|
68
|
+
t2 = EDIT_CLASS_NAME;
|
|
69
|
+
const t4 = () => (0, react_1.triggerFloatingLinkEdit)(editor);
|
|
70
|
+
let t5;
|
|
71
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
72
|
+
t5 = react_2.default.createElement(icon_1.Icon, { name: "edit", size: 15 });
|
|
73
|
+
$[7] = t5;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
t5 = $[7];
|
|
77
|
+
}
|
|
78
|
+
if ($[8] !== t4) {
|
|
79
|
+
t3 = react_2.default.createElement(button_1.Button, { className: `${EDIT_CLASS_NAME}__button ${EDIT_CLASS_NAME}__button-edit`, isIconButton: true, onClick: t4, variant: "secondary" }, t5);
|
|
80
|
+
$[8] = t4;
|
|
81
|
+
$[9] = t3;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
t3 = $[9];
|
|
85
|
+
}
|
|
86
|
+
T0 = button_1.Button;
|
|
87
|
+
t0 = `${EDIT_CLASS_NAME}__button ${EDIT_CLASS_NAME}__button-open`;
|
|
88
|
+
t1 = !url_helper_1.UrlHelper.hasProtocol(url) ? `https://${url}` : url;
|
|
89
|
+
$[0] = editor;
|
|
90
|
+
$[1] = T0;
|
|
91
|
+
$[2] = T1;
|
|
92
|
+
$[3] = t0;
|
|
93
|
+
$[4] = t1;
|
|
94
|
+
$[5] = t2;
|
|
95
|
+
$[6] = t3;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
T0 = $[1];
|
|
99
|
+
T1 = $[2];
|
|
100
|
+
t0 = $[3];
|
|
101
|
+
t1 = $[4];
|
|
102
|
+
t2 = $[5];
|
|
103
|
+
t3 = $[6];
|
|
104
|
+
}
|
|
105
|
+
let t4;
|
|
106
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
107
|
+
t4 = react_2.default.createElement(icon_1.Icon, { name: "open-link-in-new-tab", size: 15 });
|
|
108
|
+
$[10] = t4;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
t4 = $[10];
|
|
112
|
+
}
|
|
113
|
+
let t5;
|
|
114
|
+
if ($[11] !== T0 || $[12] !== t0 || $[13] !== t1) {
|
|
115
|
+
t5 = react_2.default.createElement(T0, { className: t0, href: t1, isIconButton: true, target: "_blank", variant: "secondary" }, t4);
|
|
116
|
+
$[11] = T0;
|
|
117
|
+
$[12] = t0;
|
|
118
|
+
$[13] = t1;
|
|
119
|
+
$[14] = t5;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
t5 = $[14];
|
|
123
|
+
}
|
|
124
|
+
let t6;
|
|
125
|
+
if ($[15] !== editor) {
|
|
126
|
+
t6 = () => (0, unwrap_link_1.removeLink)(editor);
|
|
127
|
+
$[15] = editor;
|
|
128
|
+
$[16] = t6;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
t6 = $[16];
|
|
132
|
+
}
|
|
133
|
+
let t7;
|
|
134
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
135
|
+
t7 = react_2.default.createElement(icon_1.Icon, { name: "delete", size: 15 });
|
|
136
|
+
$[17] = t7;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
t7 = $[17];
|
|
140
|
+
}
|
|
141
|
+
let t8;
|
|
142
|
+
if ($[18] !== t6) {
|
|
143
|
+
t8 = react_2.default.createElement(button_1.Button, { className: `${EDIT_CLASS_NAME}__button ${EDIT_CLASS_NAME}__button-delete`, isIconButton: true, onClick: t6, variant: "secondary" }, t7);
|
|
144
|
+
$[18] = t6;
|
|
145
|
+
$[19] = t8;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
t8 = $[19];
|
|
149
|
+
}
|
|
150
|
+
let t9;
|
|
151
|
+
if ($[20] !== T1 || $[21] !== t2 || $[22] !== t3 || $[23] !== t5 || $[24] !== t8) {
|
|
152
|
+
t9 = react_2.default.createElement(T1, { className: t2 },
|
|
153
|
+
t3,
|
|
154
|
+
t5,
|
|
155
|
+
t8);
|
|
156
|
+
$[20] = T1;
|
|
157
|
+
$[21] = t2;
|
|
158
|
+
$[22] = t3;
|
|
159
|
+
$[23] = t5;
|
|
160
|
+
$[24] = t8;
|
|
161
|
+
$[25] = t9;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
t9 = $[25];
|
|
165
|
+
}
|
|
166
|
+
return t9;
|
|
65
167
|
};
|
|
66
168
|
function useInsertLinkFormAutoFocus() {
|
|
169
|
+
const $ = (0, compiler_runtime_1.c)(3);
|
|
67
170
|
const id = (0, react_2.useId)();
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
171
|
+
let t0;
|
|
172
|
+
let t1;
|
|
173
|
+
if ($[0] !== id) {
|
|
174
|
+
t0 = () => {
|
|
175
|
+
let timer;
|
|
176
|
+
const firstInput = document.querySelector(`#${CSS.escape(id)}`);
|
|
177
|
+
if (firstInput instanceof HTMLElement) {
|
|
178
|
+
timer = window.setTimeout(() => firstInput.focus(), 0);
|
|
179
|
+
}
|
|
180
|
+
return () => {
|
|
181
|
+
clearTimeout(timer);
|
|
182
|
+
};
|
|
77
183
|
};
|
|
78
|
-
|
|
184
|
+
t1 = [id];
|
|
185
|
+
$[0] = id;
|
|
186
|
+
$[1] = t0;
|
|
187
|
+
$[2] = t1;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
t0 = $[1];
|
|
191
|
+
t1 = $[2];
|
|
192
|
+
}
|
|
193
|
+
(0, react_2.useEffect)(t0, t1);
|
|
79
194
|
return id;
|
|
80
195
|
}
|
|
81
196
|
const INSERT_CLASS_NAME = `${CLASS_NAME}-insert`;
|
|
82
197
|
const Insert = () => {
|
|
198
|
+
const $ = (0, compiler_runtime_1.c)(58);
|
|
83
199
|
const t = (0, translations_1.useUxfTranslation)();
|
|
84
200
|
const linkActions = (0, hooks_2.useLinkActions)();
|
|
85
201
|
const editor = (0, hooks_1.useUxfEditorRef)();
|
|
86
202
|
const [isSubmitted, setIsSubmitted] = (0, react_2.useState)(false);
|
|
87
203
|
const firstInputId = useInsertLinkFormAutoFocus();
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
e
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
204
|
+
let t0;
|
|
205
|
+
if ($[0] !== editor || $[1] !== linkActions.getUrl) {
|
|
206
|
+
t0 = e => {
|
|
207
|
+
e.preventDefault();
|
|
208
|
+
e.stopPropagation();
|
|
209
|
+
setIsSubmitted(true);
|
|
210
|
+
if (!linkActions.getUrl || !url_helper_1.UrlHelper.isValid(linkActions.getUrl)) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
(0, react_1.submitFloatingLink)(editor);
|
|
214
|
+
};
|
|
215
|
+
$[0] = editor;
|
|
216
|
+
$[1] = linkActions.getUrl;
|
|
217
|
+
$[2] = t0;
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
t0 = $[2];
|
|
221
|
+
}
|
|
222
|
+
const onSubmit = t0;
|
|
97
223
|
const emptyUrl = isSubmitted && !linkActions.getUrl;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
224
|
+
let t1;
|
|
225
|
+
if ($[3] !== isSubmitted || $[4] !== linkActions.getUrl) {
|
|
226
|
+
t1 = isSubmitted && !url_helper_1.UrlHelper.isValid(linkActions.getUrl);
|
|
227
|
+
$[3] = isSubmitted;
|
|
228
|
+
$[4] = linkActions.getUrl;
|
|
229
|
+
$[5] = t1;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
t1 = $[5];
|
|
233
|
+
}
|
|
234
|
+
const invalidUrl = t1;
|
|
235
|
+
let t2;
|
|
236
|
+
if ($[6] !== emptyUrl || $[7] !== invalidUrl || $[8] !== t) {
|
|
237
|
+
t2 = emptyUrl ? t("uxf-wysiwyg:plugins.link.url-address.required") : invalidUrl ? t("uxf-wysiwyg:plugins.link.url-address.invalid") : undefined;
|
|
238
|
+
$[6] = emptyUrl;
|
|
239
|
+
$[7] = invalidUrl;
|
|
240
|
+
$[8] = t;
|
|
241
|
+
$[9] = t2;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
t2 = $[9];
|
|
245
|
+
}
|
|
246
|
+
const t3 = emptyUrl || invalidUrl;
|
|
247
|
+
let t4;
|
|
248
|
+
if ($[10] !== t) {
|
|
249
|
+
t4 = t("uxf-wysiwyg:plugins.link.url-address.label");
|
|
250
|
+
$[10] = t;
|
|
251
|
+
$[11] = t4;
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
t4 = $[11];
|
|
255
|
+
}
|
|
256
|
+
let t5;
|
|
257
|
+
if ($[12] !== t) {
|
|
258
|
+
t5 = t("uxf-wysiwyg:plugins.link.url-address.label");
|
|
259
|
+
$[12] = t;
|
|
260
|
+
$[13] = t5;
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
t5 = $[13];
|
|
264
|
+
}
|
|
265
|
+
const t6 = linkActions.setUrl;
|
|
266
|
+
let t7;
|
|
267
|
+
if ($[14] !== t) {
|
|
268
|
+
t7 = t("uxf-wysiwyg:plugins.link.url-address.placeholder");
|
|
269
|
+
$[14] = t;
|
|
270
|
+
$[15] = t7;
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
t7 = $[15];
|
|
274
|
+
}
|
|
275
|
+
let t8;
|
|
276
|
+
if ($[16] !== firstInputId || $[17] !== linkActions.getUrl || $[18] !== linkActions.setUrl || $[19] !== t2 || $[20] !== t3 || $[21] !== t4 || $[22] !== t5 || $[23] !== t7) {
|
|
277
|
+
t8 = react_2.default.createElement(text_input_1.TextInput, { helperText: t2, hiddenLabel: true, id: firstInputId, isInvalid: t3, isRequired: true, label: t4, leftAddon: t5, name: "url-address", onChange: t6, placeholder: t7, value: linkActions.getUrl });
|
|
278
|
+
$[16] = firstInputId;
|
|
279
|
+
$[17] = linkActions.getUrl;
|
|
280
|
+
$[18] = linkActions.setUrl;
|
|
281
|
+
$[19] = t2;
|
|
282
|
+
$[20] = t3;
|
|
283
|
+
$[21] = t4;
|
|
284
|
+
$[22] = t5;
|
|
285
|
+
$[23] = t7;
|
|
286
|
+
$[24] = t8;
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
t8 = $[24];
|
|
290
|
+
}
|
|
291
|
+
let t9;
|
|
292
|
+
if ($[25] !== t) {
|
|
293
|
+
t9 = t("uxf-wysiwyg:plugins.link.link-text.label");
|
|
294
|
+
$[25] = t;
|
|
295
|
+
$[26] = t9;
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
t9 = $[26];
|
|
299
|
+
}
|
|
300
|
+
let t10;
|
|
301
|
+
if ($[27] !== t) {
|
|
302
|
+
t10 = t("uxf-wysiwyg:plugins.link.link-text.label");
|
|
303
|
+
$[27] = t;
|
|
304
|
+
$[28] = t10;
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
t10 = $[28];
|
|
308
|
+
}
|
|
309
|
+
const t11 = linkActions.setText;
|
|
310
|
+
let t12;
|
|
311
|
+
if ($[29] !== t) {
|
|
312
|
+
t12 = t("uxf-wysiwyg:plugins.link.link-text.placeholder");
|
|
313
|
+
$[29] = t;
|
|
314
|
+
$[30] = t12;
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
t12 = $[30];
|
|
318
|
+
}
|
|
319
|
+
let t13;
|
|
320
|
+
if ($[31] !== linkActions.getText || $[32] !== linkActions.setText || $[33] !== t10 || $[34] !== t12 || $[35] !== t9) {
|
|
321
|
+
t13 = react_2.default.createElement(text_input_1.TextInput, { hiddenLabel: true, label: t9, leftAddon: t10, name: "link-text", onChange: t11, placeholder: t12, value: linkActions.getText });
|
|
322
|
+
$[31] = linkActions.getText;
|
|
323
|
+
$[32] = linkActions.setText;
|
|
324
|
+
$[33] = t10;
|
|
325
|
+
$[34] = t12;
|
|
326
|
+
$[35] = t9;
|
|
327
|
+
$[36] = t13;
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
t13 = $[36];
|
|
331
|
+
}
|
|
332
|
+
let t14;
|
|
333
|
+
if ($[37] !== t) {
|
|
334
|
+
t14 = t("uxf-wysiwyg:plugins.link.open-in-new-tab");
|
|
335
|
+
$[37] = t;
|
|
336
|
+
$[38] = t14;
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
t14 = $[38];
|
|
340
|
+
}
|
|
341
|
+
let t15;
|
|
342
|
+
if ($[39] !== linkActions) {
|
|
343
|
+
t15 = checked => linkActions.setTarget(checked ? "_blank" : "_self");
|
|
344
|
+
$[39] = linkActions;
|
|
345
|
+
$[40] = t15;
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
t15 = $[40];
|
|
349
|
+
}
|
|
350
|
+
const t16 = linkActions.getTarget === "_blank";
|
|
351
|
+
let t17;
|
|
352
|
+
if ($[41] !== t14 || $[42] !== t15 || $[43] !== t16) {
|
|
353
|
+
t17 = react_2.default.createElement(checkbox_input_1.CheckboxInput, { label: t14, name: "open-in-new-tab", onChange: t15, value: t16 });
|
|
354
|
+
$[41] = t14;
|
|
355
|
+
$[42] = t15;
|
|
356
|
+
$[43] = t16;
|
|
357
|
+
$[44] = t17;
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
t17 = $[44];
|
|
361
|
+
}
|
|
362
|
+
let t18;
|
|
363
|
+
if ($[45] !== t13 || $[46] !== t17 || $[47] !== t8) {
|
|
364
|
+
t18 = react_2.default.createElement("div", { className: `${INSERT_CLASS_NAME}__form-inputs` },
|
|
365
|
+
t8,
|
|
366
|
+
t13,
|
|
367
|
+
t17);
|
|
368
|
+
$[45] = t13;
|
|
369
|
+
$[46] = t17;
|
|
370
|
+
$[47] = t8;
|
|
371
|
+
$[48] = t18;
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
t18 = $[48];
|
|
375
|
+
}
|
|
376
|
+
let t19;
|
|
377
|
+
if ($[49] !== t) {
|
|
378
|
+
t19 = t("uxf-wysiwyg:plugins.link.button-save");
|
|
379
|
+
$[49] = t;
|
|
380
|
+
$[50] = t19;
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
t19 = $[50];
|
|
384
|
+
}
|
|
385
|
+
let t20;
|
|
386
|
+
if ($[51] !== t19) {
|
|
387
|
+
t20 = react_2.default.createElement("div", { className: `${INSERT_CLASS_NAME}__form-buttons` },
|
|
388
|
+
react_2.default.createElement(button_1.Button, { className: `${INSERT_CLASS_NAME}__form-submit-button`, type: "submit" }, t19));
|
|
389
|
+
$[51] = t19;
|
|
390
|
+
$[52] = t20;
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
t20 = $[52];
|
|
394
|
+
}
|
|
395
|
+
let t21;
|
|
396
|
+
if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
|
|
397
|
+
t21 = react_2.default.createElement("button", { hidden: true, type: "submit" });
|
|
398
|
+
$[53] = t21;
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
t21 = $[53];
|
|
402
|
+
}
|
|
403
|
+
let t22;
|
|
404
|
+
if ($[54] !== onSubmit || $[55] !== t18 || $[56] !== t20) {
|
|
405
|
+
t22 = react_2.default.createElement("div", { className: INSERT_CLASS_NAME },
|
|
406
|
+
react_2.default.createElement("form", { className: `${INSERT_CLASS_NAME}__form`, id: "insert-link-form", onSubmit: onSubmit },
|
|
407
|
+
t18,
|
|
408
|
+
t20,
|
|
409
|
+
t21));
|
|
410
|
+
$[54] = onSubmit;
|
|
411
|
+
$[55] = t18;
|
|
412
|
+
$[56] = t20;
|
|
413
|
+
$[57] = t22;
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
t22 = $[57];
|
|
417
|
+
}
|
|
418
|
+
return t22;
|
|
112
419
|
};
|
|
113
420
|
const FloatingLink = () => {
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
421
|
+
const $ = (0, compiler_runtime_1.c)(5);
|
|
422
|
+
const t0 = (0, hooks_2.useFloatingLinkSelectors)();
|
|
423
|
+
let t1;
|
|
424
|
+
if ($[0] !== t0) {
|
|
425
|
+
t1 = t0.isEditing();
|
|
426
|
+
$[0] = t0;
|
|
427
|
+
$[1] = t1;
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
t1 = $[1];
|
|
431
|
+
}
|
|
432
|
+
const isEditing = t1;
|
|
433
|
+
let t2;
|
|
434
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
435
|
+
t2 = react_2.default.createElement(floating_link_wrapper_1.FloatingLinkWrapper.InsertRoot, null,
|
|
436
|
+
react_2.default.createElement(Insert, null));
|
|
437
|
+
$[2] = t2;
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
t2 = $[2];
|
|
441
|
+
}
|
|
442
|
+
let t3;
|
|
443
|
+
if ($[3] !== isEditing) {
|
|
444
|
+
t3 = react_2.default.createElement(floating_1.FloatingPortal, null,
|
|
445
|
+
t2,
|
|
446
|
+
react_2.default.createElement(floating_link_wrapper_1.FloatingLinkWrapper.EditRoot, null, !isEditing ? react_2.default.createElement(Edit, null) : react_2.default.createElement(Insert, null)));
|
|
447
|
+
$[3] = isEditing;
|
|
448
|
+
$[4] = t3;
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
t3 = $[4];
|
|
452
|
+
}
|
|
453
|
+
return t3;
|
|
119
454
|
};
|
|
120
455
|
exports.FloatingLink = FloatingLink;
|
|
@@ -1,64 +1,88 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
35
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
6
|
exports.ImageElement = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
8
|
const dialog_panel_1 = require("@uxf/ui/dialog/dialog-panel");
|
|
38
9
|
const modal_service_1 = require("@uxf/ui/modal/modal-service");
|
|
39
|
-
const react_1 =
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
40
11
|
const hooks_1 = require("../../hooks");
|
|
41
12
|
const get_active_image_1 = require("../../plugins/image/transforms/get-active-image");
|
|
42
13
|
const remove_selected_image_1 = require("../../plugins/image/transforms/remove-selected-image");
|
|
43
14
|
const element_with_action_buttons_1 = require("../components/element/element-with-action-buttons");
|
|
44
15
|
const insert_image_modal_content_1 = require("./insert-image-modal-content");
|
|
45
16
|
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
46
|
-
const ImageElement =
|
|
17
|
+
const ImageElement = props => {
|
|
47
18
|
var _a;
|
|
19
|
+
const $ = (0, compiler_runtime_1.c)(17);
|
|
48
20
|
const isSelected = (0, hooks_1.useSelected)();
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
21
|
+
let t0;
|
|
22
|
+
if ($[0] !== props.editor) {
|
|
23
|
+
t0 = () => {
|
|
24
|
+
(0, modal_service_1.openModal)({
|
|
25
|
+
children: react_1.default.createElement(dialog_panel_1.DialogPanel, { width: "lg" },
|
|
26
|
+
react_1.default.createElement(insert_image_modal_content_1.InsertImageModalContent, { editor: props.editor, imageToEdit: (0, get_active_image_1.getActiveImage)(props.editor) }))
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
$[0] = props.editor;
|
|
30
|
+
$[1] = t0;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
t0 = $[1];
|
|
34
|
+
}
|
|
35
|
+
const onEdit = t0;
|
|
36
|
+
let t1;
|
|
37
|
+
if ($[2] !== props.editor) {
|
|
38
|
+
t1 = () => {
|
|
39
|
+
(0, remove_selected_image_1.removeSelectedImage)(props.editor);
|
|
40
|
+
};
|
|
41
|
+
$[2] = props.editor;
|
|
42
|
+
$[3] = t1;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
t1 = $[3];
|
|
46
|
+
}
|
|
47
|
+
const onDelete = t1;
|
|
58
48
|
const element = props.element;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
const t2 = `${CLASS_NAME} ${CLASS_NAME}-image ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`;
|
|
50
|
+
let t3;
|
|
51
|
+
if ($[4] !== element.alt || $[5] !== element.url) {
|
|
52
|
+
t3 = react_1.default.createElement("img", { alt: element.alt, className: `${CLASS_NAME}-image__img`, src: element.url });
|
|
53
|
+
$[4] = element.alt;
|
|
54
|
+
$[5] = element.url;
|
|
55
|
+
$[6] = t3;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
t3 = $[6];
|
|
59
|
+
}
|
|
60
|
+
let t4;
|
|
61
|
+
if ($[7] !== isSelected || $[8] !== onDelete || $[9] !== onEdit || $[10] !== t3) {
|
|
62
|
+
t4 = react_1.default.createElement(element_with_action_buttons_1.ElementWithActionButtons, { className: `${CLASS_NAME}-image__action-buttons`, isSelected: isSelected, onDelete: onDelete, onEdit: onEdit }, t3);
|
|
63
|
+
$[7] = isSelected;
|
|
64
|
+
$[8] = onDelete;
|
|
65
|
+
$[9] = onEdit;
|
|
66
|
+
$[10] = t3;
|
|
67
|
+
$[11] = t4;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
t4 = $[11];
|
|
71
|
+
}
|
|
72
|
+
let t5;
|
|
73
|
+
if ($[12] !== props.attributes || $[13] !== props.children || $[14] !== t2 || $[15] !== t4) {
|
|
74
|
+
t5 = react_1.default.createElement("div", { ...props.attributes, className: t2 },
|
|
75
|
+
t4,
|
|
76
|
+
props.children);
|
|
77
|
+
$[12] = props.attributes;
|
|
78
|
+
$[13] = props.children;
|
|
79
|
+
$[14] = t2;
|
|
80
|
+
$[15] = t4;
|
|
81
|
+
$[16] = t5;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
t5 = $[16];
|
|
85
|
+
}
|
|
86
|
+
return t5;
|
|
63
87
|
};
|
|
64
88
|
exports.ImageElement = ImageElement;
|