@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
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.InsertImageModalContent = void 0;
|
|
37
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
38
|
const translations_1 = require("@uxf/core-react/translations");
|
|
38
39
|
const file_input_1 = require("@uxf/ui/file-input");
|
|
39
40
|
const modal_service_1 = require("@uxf/ui/modal/modal-service");
|
|
@@ -46,54 +47,276 @@ const modal_buttons_1 = require("../components/modal/modal-buttons");
|
|
|
46
47
|
const modal_content_1 = require("../components/modal/modal-content");
|
|
47
48
|
const utils_1 = require("../utils");
|
|
48
49
|
const CLASS_NAME = "uxf-wysiwyg__insert-modal";
|
|
49
|
-
const InsertImageModalContent =
|
|
50
|
-
var _a, _b,
|
|
50
|
+
const InsertImageModalContent = props => {
|
|
51
|
+
var _a, _b, _d, _e, _f, _g, _h, _j;
|
|
52
|
+
const $ = (0, compiler_runtime_1.c)(68);
|
|
51
53
|
const t = (0, translations_1.useUxfTranslation)();
|
|
52
54
|
const imageHandlers = (0, use_image_handlers_1.useImageHandlers)(props.editor);
|
|
53
55
|
const [selectedFile, setSelectedFile] = (0, react_1.useState)((_b = (_a = props.imageToEdit) === null || _a === void 0 ? void 0 : _a.file) !== null && _b !== void 0 ? _b : null);
|
|
54
|
-
const [alt, setAlt] = (0, react_1.useState)((
|
|
55
|
-
const [caption, setCaption] = (0, react_1.useState)((
|
|
56
|
-
const [source, setSource] = (0, react_1.useState)((
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
: t("uxf-wysiwyg:plugins.image.button-insert");
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
56
|
+
const [alt, setAlt] = (0, react_1.useState)((_e = (_d = props.imageToEdit) === null || _d === void 0 ? void 0 : _d.alt) !== null && _e !== void 0 ? _e : "");
|
|
57
|
+
const [caption, setCaption] = (0, react_1.useState)((_g = (_f = props.imageToEdit) === null || _f === void 0 ? void 0 : _f.caption) !== null && _g !== void 0 ? _g : "");
|
|
58
|
+
const [source, setSource] = (0, react_1.useState)((_j = (_h = props.imageToEdit) === null || _h === void 0 ? void 0 : _h.source) !== null && _j !== void 0 ? _j : "");
|
|
59
|
+
let t0;
|
|
60
|
+
if ($[0] !== props.imageToEdit || $[1] !== t) {
|
|
61
|
+
t0 = props.imageToEdit ? t("uxf-wysiwyg:plugins.image.button-edit") : t("uxf-wysiwyg:plugins.image.button-insert");
|
|
62
|
+
$[0] = props.imageToEdit;
|
|
63
|
+
$[1] = t;
|
|
64
|
+
$[2] = t0;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
t0 = $[2];
|
|
68
|
+
}
|
|
69
|
+
const title = t0;
|
|
70
|
+
let t1;
|
|
71
|
+
if ($[3] !== imageHandlers) {
|
|
72
|
+
t1 = async (file) => {
|
|
73
|
+
const fileResponse = await imageHandlers.uploadImage(file);
|
|
74
|
+
setSelectedFile(fileResponse);
|
|
75
|
+
return fileResponse;
|
|
76
|
+
};
|
|
77
|
+
$[3] = imageHandlers;
|
|
78
|
+
$[4] = t1;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
t1 = $[4];
|
|
82
|
+
}
|
|
83
|
+
const fileUploadHandler = t1;
|
|
84
|
+
let t2;
|
|
85
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
86
|
+
t2 = () => {
|
|
87
|
+
setSelectedFile(null);
|
|
88
|
+
setAlt("");
|
|
89
|
+
setCaption("");
|
|
90
|
+
setSource("");
|
|
91
|
+
};
|
|
92
|
+
$[5] = t2;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
t2 = $[5];
|
|
96
|
+
}
|
|
97
|
+
const reset = t2;
|
|
98
|
+
let t3;
|
|
99
|
+
if ($[6] !== props.editor) {
|
|
100
|
+
t3 = () => {
|
|
84
101
|
reset();
|
|
85
|
-
(0,
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
(0, utils_1.closeModalWithFocus)(props.editor);
|
|
103
|
+
};
|
|
104
|
+
$[6] = props.editor;
|
|
105
|
+
$[7] = t3;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
t3 = $[7];
|
|
109
|
+
}
|
|
110
|
+
const onCloseHandler = t3;
|
|
111
|
+
let t4;
|
|
112
|
+
if ($[8] !== alt || $[9] !== caption || $[10] !== imageHandlers || $[11] !== props.editor || $[12] !== props.imageToEdit || $[13] !== selectedFile || $[14] !== source) {
|
|
113
|
+
t4 = event => {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
if (selectedFile && !props.imageToEdit) {
|
|
116
|
+
(0, insert_image_1.insertImage)(props.editor, selectedFile, alt !== "" ? alt : undefined, caption !== "" ? caption : undefined, source !== "" ? source : undefined, imageHandlers.getImageUrl(selectedFile));
|
|
117
|
+
reset();
|
|
118
|
+
(0, modal_service_1.closeModal)();
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
if (selectedFile && props.imageToEdit) {
|
|
122
|
+
(0, update_image_1.updateImage)(props.editor, selectedFile, alt !== "" ? alt : undefined, caption !== "" ? caption : undefined, source !== "" ? source : undefined, imageHandlers.getImageUrl(selectedFile));
|
|
123
|
+
reset();
|
|
124
|
+
(0, modal_service_1.closeModal)();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
$[8] = alt;
|
|
129
|
+
$[9] = caption;
|
|
130
|
+
$[10] = imageHandlers;
|
|
131
|
+
$[11] = props.editor;
|
|
132
|
+
$[12] = props.imageToEdit;
|
|
133
|
+
$[13] = selectedFile;
|
|
134
|
+
$[14] = source;
|
|
135
|
+
$[15] = t4;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
t4 = $[15];
|
|
139
|
+
}
|
|
140
|
+
const onAddHandler = t4;
|
|
141
|
+
let t5;
|
|
142
|
+
if ($[16] !== t) {
|
|
143
|
+
t5 = t("uxf-wysiwyg:plugins.image.file-upload.label");
|
|
144
|
+
$[16] = t;
|
|
145
|
+
$[17] = t5;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
t5 = $[17];
|
|
149
|
+
}
|
|
150
|
+
let t6;
|
|
151
|
+
if ($[18] !== fileUploadHandler || $[19] !== selectedFile || $[20] !== t5) {
|
|
152
|
+
t6 = react_1.default.createElement(file_input_1.FileInput, { label: t5, name: "image", onChange: setSelectedFile, onUploadFile: fileUploadHandler, value: selectedFile });
|
|
153
|
+
$[18] = fileUploadHandler;
|
|
154
|
+
$[19] = selectedFile;
|
|
155
|
+
$[20] = t5;
|
|
156
|
+
$[21] = t6;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
t6 = $[21];
|
|
160
|
+
}
|
|
161
|
+
let t7;
|
|
162
|
+
if ($[22] !== t) {
|
|
163
|
+
t7 = t("uxf-wysiwyg:plugins.image.alt.label");
|
|
164
|
+
$[22] = t;
|
|
165
|
+
$[23] = t7;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
t7 = $[23];
|
|
169
|
+
}
|
|
170
|
+
let t8;
|
|
171
|
+
if ($[24] !== t) {
|
|
172
|
+
t8 = t("uxf-wysiwyg:plugins.image.alt.placeholder");
|
|
173
|
+
$[24] = t;
|
|
174
|
+
$[25] = t8;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
t8 = $[25];
|
|
178
|
+
}
|
|
179
|
+
let t9;
|
|
180
|
+
if ($[26] !== alt || $[27] !== t7 || $[28] !== t8) {
|
|
181
|
+
t9 = react_1.default.createElement(text_input_1.TextInput, { className: `${CLASS_NAME}-image__optional-input`, label: t7, name: "alt", onChange: setAlt, placeholder: t8, type: "text", value: alt });
|
|
182
|
+
$[26] = alt;
|
|
183
|
+
$[27] = t7;
|
|
184
|
+
$[28] = t8;
|
|
185
|
+
$[29] = t9;
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
t9 = $[29];
|
|
189
|
+
}
|
|
190
|
+
let t10;
|
|
191
|
+
if ($[30] !== t) {
|
|
192
|
+
t10 = t("uxf-wysiwyg:plugins.image.caption.label");
|
|
193
|
+
$[30] = t;
|
|
194
|
+
$[31] = t10;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
t10 = $[31];
|
|
198
|
+
}
|
|
199
|
+
let t11;
|
|
200
|
+
if ($[32] !== t) {
|
|
201
|
+
t11 = t("uxf-wysiwyg:plugins.image.caption.placeholder");
|
|
202
|
+
$[32] = t;
|
|
203
|
+
$[33] = t11;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
t11 = $[33];
|
|
207
|
+
}
|
|
208
|
+
let t12;
|
|
209
|
+
if ($[34] !== caption || $[35] !== t10 || $[36] !== t11) {
|
|
210
|
+
t12 = react_1.default.createElement(text_input_1.TextInput, { className: `${CLASS_NAME}-image__optional-input`, label: t10, name: "caption", onChange: setCaption, placeholder: t11, type: "text", value: caption });
|
|
211
|
+
$[34] = caption;
|
|
212
|
+
$[35] = t10;
|
|
213
|
+
$[36] = t11;
|
|
214
|
+
$[37] = t12;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
t12 = $[37];
|
|
218
|
+
}
|
|
219
|
+
let t13;
|
|
220
|
+
if ($[38] !== t) {
|
|
221
|
+
t13 = t("uxf-wysiwyg:plugins.image.source.label");
|
|
222
|
+
$[38] = t;
|
|
223
|
+
$[39] = t13;
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
t13 = $[39];
|
|
227
|
+
}
|
|
228
|
+
let t14;
|
|
229
|
+
if ($[40] !== t) {
|
|
230
|
+
t14 = t("uxf-wysiwyg:plugins.image.source.placeholder");
|
|
231
|
+
$[40] = t;
|
|
232
|
+
$[41] = t14;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
t14 = $[41];
|
|
236
|
+
}
|
|
237
|
+
let t15;
|
|
238
|
+
if ($[42] !== source || $[43] !== t13 || $[44] !== t14) {
|
|
239
|
+
t15 = react_1.default.createElement(text_input_1.TextInput, { className: `${CLASS_NAME}-image__optional-input`, label: t13, name: "source", onChange: setSource, placeholder: t14, type: "text", value: source });
|
|
240
|
+
$[42] = source;
|
|
241
|
+
$[43] = t13;
|
|
242
|
+
$[44] = t14;
|
|
243
|
+
$[45] = t15;
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
t15 = $[45];
|
|
247
|
+
}
|
|
248
|
+
let t16;
|
|
249
|
+
if ($[46] !== t12 || $[47] !== t15 || $[48] !== t6 || $[49] !== t9) {
|
|
250
|
+
t16 = react_1.default.createElement("div", { className: `${CLASS_NAME}-image__form-inputs` },
|
|
251
|
+
t6,
|
|
252
|
+
t9,
|
|
253
|
+
t12,
|
|
254
|
+
t15);
|
|
255
|
+
$[46] = t12;
|
|
256
|
+
$[47] = t15;
|
|
257
|
+
$[48] = t6;
|
|
258
|
+
$[49] = t9;
|
|
259
|
+
$[50] = t16;
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
t16 = $[50];
|
|
263
|
+
}
|
|
264
|
+
let t17;
|
|
265
|
+
if ($[51] !== alt || $[52] !== imageHandlers || $[53] !== selectedFile) {
|
|
266
|
+
t17 = selectedFile && react_1.default.createElement("img", { alt: alt, className: `${CLASS_NAME}-image__selected-img`, src: imageHandlers.getImageUrl(selectedFile) });
|
|
267
|
+
$[51] = alt;
|
|
268
|
+
$[52] = imageHandlers;
|
|
269
|
+
$[53] = selectedFile;
|
|
270
|
+
$[54] = t17;
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
t17 = $[54];
|
|
274
|
+
}
|
|
275
|
+
let t18;
|
|
276
|
+
if ($[55] !== onCloseHandler || $[56] !== props.editor || $[57] !== title) {
|
|
277
|
+
t18 = react_1.default.createElement(modal_buttons_1.ModalButtons, { className: `${CLASS_NAME}__form-buttons`, editor: props.editor, onCancel: onCloseHandler, submitText: title });
|
|
278
|
+
$[55] = onCloseHandler;
|
|
279
|
+
$[56] = props.editor;
|
|
280
|
+
$[57] = title;
|
|
281
|
+
$[58] = t18;
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
t18 = $[58];
|
|
285
|
+
}
|
|
286
|
+
let t19;
|
|
287
|
+
if ($[59] === Symbol.for("react.memo_cache_sentinel")) {
|
|
288
|
+
t19 = react_1.default.createElement("button", { hidden: true, type: "submit" });
|
|
289
|
+
$[59] = t19;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
t19 = $[59];
|
|
293
|
+
}
|
|
294
|
+
let t20;
|
|
295
|
+
if ($[60] !== onAddHandler || $[61] !== t16 || $[62] !== t17 || $[63] !== t18) {
|
|
296
|
+
t20 = react_1.default.createElement("form", { className: `${CLASS_NAME}-image__form`, id: "insert-image-form", onSubmit: onAddHandler },
|
|
297
|
+
t16,
|
|
298
|
+
t17,
|
|
299
|
+
t18,
|
|
300
|
+
t19);
|
|
301
|
+
$[60] = onAddHandler;
|
|
302
|
+
$[61] = t16;
|
|
303
|
+
$[62] = t17;
|
|
304
|
+
$[63] = t18;
|
|
305
|
+
$[64] = t20;
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
t20 = $[64];
|
|
309
|
+
}
|
|
310
|
+
let t21;
|
|
311
|
+
if ($[65] !== t20 || $[66] !== title) {
|
|
312
|
+
t21 = react_1.default.createElement(modal_content_1.ModalContent, { title: title }, t20);
|
|
313
|
+
$[65] = t20;
|
|
314
|
+
$[66] = title;
|
|
315
|
+
$[67] = t21;
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
t21 = $[67];
|
|
319
|
+
}
|
|
320
|
+
return t21;
|
|
98
321
|
};
|
|
99
322
|
exports.InsertImageModalContent = InsertImageModalContent;
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ButtonToolbarButton = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
7
8
|
const translations_1 = require("@uxf/core-react/translations");
|
|
8
9
|
const react_1 = __importDefault(require("react"));
|
|
9
10
|
const hooks_1 = require("../../../hooks");
|
|
@@ -11,10 +12,44 @@ const button_1 = require("../../../plugins/button");
|
|
|
11
12
|
const insert_button_modal_content_1 = require("../../button/insert-button-modal-content");
|
|
12
13
|
const modal_toolbar_button_1 = require("./modal-toolbar-button");
|
|
13
14
|
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
14
|
-
const ButtonToolbarButton =
|
|
15
|
+
const ButtonToolbarButton = props => {
|
|
15
16
|
var _a, _b;
|
|
17
|
+
const $ = (0, compiler_runtime_1.c)(10);
|
|
16
18
|
const t = (0, translations_1.useUxfTranslation)();
|
|
17
19
|
const editor = (0, hooks_1.useUxfPlateEditorState)(props.plateId);
|
|
18
|
-
|
|
20
|
+
let t0;
|
|
21
|
+
if ($[0] !== editor) {
|
|
22
|
+
t0 = react_1.default.createElement(insert_button_modal_content_1.InsertButtonModalContent, { editor: editor });
|
|
23
|
+
$[0] = editor;
|
|
24
|
+
$[1] = t0;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
t0 = $[1];
|
|
28
|
+
}
|
|
29
|
+
const t1 = `${CLASS_NAME} ${CLASS_NAME}-button ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`;
|
|
30
|
+
const t2 = (_b = props.iconName) !== null && _b !== void 0 ? _b : "rectangle-wide";
|
|
31
|
+
let t3;
|
|
32
|
+
if ($[2] !== t) {
|
|
33
|
+
t3 = t("uxf-wysiwyg:plugins.button.tooltip");
|
|
34
|
+
$[2] = t;
|
|
35
|
+
$[3] = t3;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
t3 = $[3];
|
|
39
|
+
}
|
|
40
|
+
let t4;
|
|
41
|
+
if ($[4] !== editor || $[5] !== t0 || $[6] !== t1 || $[7] !== t2 || $[8] !== t3) {
|
|
42
|
+
t4 = react_1.default.createElement(modal_toolbar_button_1.ModalToolbarButton, { Modal: t0, className: t1, editor: editor, iconName: t2, pluginKey: button_1.PLUGIN_BUTTON_KEY, tooltipText: t3 });
|
|
43
|
+
$[4] = editor;
|
|
44
|
+
$[5] = t0;
|
|
45
|
+
$[6] = t1;
|
|
46
|
+
$[7] = t2;
|
|
47
|
+
$[8] = t3;
|
|
48
|
+
$[9] = t4;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
t4 = $[9];
|
|
52
|
+
}
|
|
53
|
+
return t4;
|
|
19
54
|
};
|
|
20
55
|
exports.ButtonToolbarButton = ButtonToolbarButton;
|
|
@@ -4,22 +4,67 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ElementToolbarButton = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
7
8
|
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
8
9
|
const react_1 = __importDefault(require("react"));
|
|
9
10
|
const hooks_1 = require("../../../hooks");
|
|
10
11
|
const utils_1 = require("../../../utils");
|
|
11
12
|
const toolbar_button_1 = require("./toolbar-button");
|
|
12
13
|
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
13
|
-
const ElementToolbarButton =
|
|
14
|
+
const ElementToolbarButton = props => {
|
|
14
15
|
var _a;
|
|
16
|
+
const $ = (0, compiler_runtime_1.c)(15);
|
|
15
17
|
const editor = (0, hooks_1.useUxfPlateEditorState)(props.plateId);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(0, utils_1.
|
|
20
|
-
|
|
18
|
+
let t0;
|
|
19
|
+
let type;
|
|
20
|
+
if ($[0] !== editor || $[1] !== props.pluginKey) {
|
|
21
|
+
type = (0, utils_1.getPluginType)(editor, props.pluginKey);
|
|
22
|
+
t0 = (0, is_not_nil_1.isNotNil)(editor.selection) && (0, utils_1.isRangeInSingleText)(editor) && (0, utils_1.someNode)(editor, {
|
|
23
|
+
match: {
|
|
24
|
+
type
|
|
25
|
+
}
|
|
21
26
|
});
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
$[0] = editor;
|
|
28
|
+
$[1] = props.pluginKey;
|
|
29
|
+
$[2] = t0;
|
|
30
|
+
$[3] = type;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
t0 = $[2];
|
|
34
|
+
type = $[3];
|
|
35
|
+
}
|
|
36
|
+
const isActive = t0;
|
|
37
|
+
let t1;
|
|
38
|
+
if ($[4] !== editor || $[5] !== type) {
|
|
39
|
+
t1 = () => {
|
|
40
|
+
(0, utils_1.toggleNodeType)(editor, {
|
|
41
|
+
activeType: type
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
$[4] = editor;
|
|
45
|
+
$[5] = type;
|
|
46
|
+
$[6] = t1;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
t1 = $[6];
|
|
50
|
+
}
|
|
51
|
+
const onMouseDown = t1;
|
|
52
|
+
const t2 = `${CLASS_NAME} ${CLASS_NAME}-element ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`;
|
|
53
|
+
let t3;
|
|
54
|
+
if ($[7] !== editor || $[8] !== isActive || $[9] !== onMouseDown || $[10] !== props.iconName || $[11] !== props.pluginKey || $[12] !== props.tooltipText || $[13] !== t2) {
|
|
55
|
+
t3 = react_1.default.createElement(toolbar_button_1.ToolbarButton, { className: t2, editor: editor, iconName: props.iconName, isActive: isActive, onMouseDown: onMouseDown, pluginKey: props.pluginKey, tooltipText: props.tooltipText });
|
|
56
|
+
$[7] = editor;
|
|
57
|
+
$[8] = isActive;
|
|
58
|
+
$[9] = onMouseDown;
|
|
59
|
+
$[10] = props.iconName;
|
|
60
|
+
$[11] = props.pluginKey;
|
|
61
|
+
$[12] = props.tooltipText;
|
|
62
|
+
$[13] = t2;
|
|
63
|
+
$[14] = t3;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
t3 = $[14];
|
|
67
|
+
}
|
|
68
|
+
return t3;
|
|
24
69
|
};
|
|
25
70
|
exports.ElementToolbarButton = ElementToolbarButton;
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ImageToolbarButton = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
7
8
|
const translations_1 = require("@uxf/core-react/translations");
|
|
8
9
|
const react_1 = __importDefault(require("react"));
|
|
9
10
|
const hooks_1 = require("../../../hooks");
|
|
@@ -11,10 +12,44 @@ const types_1 = require("../../../plugins/image/types");
|
|
|
11
12
|
const insert_image_modal_content_1 = require("../../image/insert-image-modal-content");
|
|
12
13
|
const modal_toolbar_button_1 = require("./modal-toolbar-button");
|
|
13
14
|
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
14
|
-
const ImageToolbarButton =
|
|
15
|
+
const ImageToolbarButton = props => {
|
|
15
16
|
var _a, _b;
|
|
17
|
+
const $ = (0, compiler_runtime_1.c)(10);
|
|
16
18
|
const t = (0, translations_1.useUxfTranslation)();
|
|
17
19
|
const editor = (0, hooks_1.useUxfPlateEditorRef)(props.plateId);
|
|
18
|
-
|
|
20
|
+
let t0;
|
|
21
|
+
if ($[0] !== editor) {
|
|
22
|
+
t0 = react_1.default.createElement(insert_image_modal_content_1.InsertImageModalContent, { editor: editor });
|
|
23
|
+
$[0] = editor;
|
|
24
|
+
$[1] = t0;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
t0 = $[1];
|
|
28
|
+
}
|
|
29
|
+
const t1 = `${CLASS_NAME} ${CLASS_NAME}-image ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`;
|
|
30
|
+
const t2 = (_b = props.iconName) !== null && _b !== void 0 ? _b : "image";
|
|
31
|
+
let t3;
|
|
32
|
+
if ($[2] !== t) {
|
|
33
|
+
t3 = t("uxf-wysiwyg:plugins.image.tooltip");
|
|
34
|
+
$[2] = t;
|
|
35
|
+
$[3] = t3;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
t3 = $[3];
|
|
39
|
+
}
|
|
40
|
+
let t4;
|
|
41
|
+
if ($[4] !== editor || $[5] !== t0 || $[6] !== t1 || $[7] !== t2 || $[8] !== t3) {
|
|
42
|
+
t4 = react_1.default.createElement(modal_toolbar_button_1.ModalToolbarButton, { Modal: t0, className: t1, editor: editor, iconName: t2, pluginKey: types_1.IMAGE_PLUGIN_KEY, tooltipText: t3 });
|
|
43
|
+
$[4] = editor;
|
|
44
|
+
$[5] = t0;
|
|
45
|
+
$[6] = t1;
|
|
46
|
+
$[7] = t2;
|
|
47
|
+
$[8] = t3;
|
|
48
|
+
$[9] = t4;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
t4 = $[9];
|
|
52
|
+
}
|
|
53
|
+
return t4;
|
|
19
54
|
};
|
|
20
55
|
exports.ImageToolbarButton = ImageToolbarButton;
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.LinkToolbarButton = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
7
8
|
const translations_1 = require("@uxf/core-react/translations");
|
|
8
9
|
const react_1 = __importDefault(require("react"));
|
|
9
10
|
const hooks_1 = require("../../../hooks");
|
|
@@ -13,17 +14,60 @@ const trigger_link_insert_or_edit_1 = require("../../../plugins/link/transforms/
|
|
|
13
14
|
const utils_1 = require("../../../utils");
|
|
14
15
|
const toolbar_button_1 = require("./toolbar-button");
|
|
15
16
|
const CLASS_NAME = "uxf-wysiwyg__toolbar-button";
|
|
16
|
-
const LinkToolbarButton =
|
|
17
|
+
const LinkToolbarButton = props => {
|
|
17
18
|
var _a, _b;
|
|
19
|
+
const $ = (0, compiler_runtime_1.c)(13);
|
|
18
20
|
const t = (0, translations_1.useUxfTranslation)();
|
|
19
21
|
const editor = (0, hooks_1.useUxfPlateEditorState)(props.plateId);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
let t0;
|
|
23
|
+
if ($[0] !== editor) {
|
|
24
|
+
t0 = (0, is_link_selected_1.isLinkSelected)(editor);
|
|
25
|
+
$[0] = editor;
|
|
26
|
+
$[1] = t0;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
t0 = $[1];
|
|
30
|
+
}
|
|
31
|
+
const isLink = t0;
|
|
32
|
+
let t1;
|
|
33
|
+
if ($[2] !== editor) {
|
|
34
|
+
t1 = () => {
|
|
35
|
+
var _a;
|
|
36
|
+
(0, utils_1.focusEditor)(editor, (_a = editor.selection) !== null && _a !== void 0 ? _a : editor.dom.prevSelection);
|
|
37
|
+
(0, trigger_link_insert_or_edit_1.triggerLinkInsertOrEdit)(editor, true);
|
|
38
|
+
};
|
|
39
|
+
$[2] = editor;
|
|
40
|
+
$[3] = t1;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
t1 = $[3];
|
|
44
|
+
}
|
|
45
|
+
const onMouseDown = t1;
|
|
46
|
+
const t2 = `${CLASS_NAME} ${CLASS_NAME}-link ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`;
|
|
47
|
+
const t3 = (_b = props.iconName) !== null && _b !== void 0 ? _b : "link";
|
|
48
|
+
let t4;
|
|
49
|
+
if ($[4] !== t) {
|
|
50
|
+
t4 = t("uxf-wysiwyg:plugins.link.tooltip");
|
|
51
|
+
$[4] = t;
|
|
52
|
+
$[5] = t4;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
t4 = $[5];
|
|
56
|
+
}
|
|
57
|
+
let t5;
|
|
58
|
+
if ($[6] !== editor || $[7] !== isLink || $[8] !== onMouseDown || $[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
|
|
59
|
+
t5 = react_1.default.createElement(toolbar_button_1.ToolbarButton, { className: t2, editor: editor, iconName: t3, isActive: isLink, onMouseDown: onMouseDown, pluginKey: constants_1.ELEMENT_LINK, tooltipText: t4 });
|
|
60
|
+
$[6] = editor;
|
|
61
|
+
$[7] = isLink;
|
|
62
|
+
$[8] = onMouseDown;
|
|
63
|
+
$[9] = t2;
|
|
64
|
+
$[10] = t3;
|
|
65
|
+
$[11] = t4;
|
|
66
|
+
$[12] = t5;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
t5 = $[12];
|
|
70
|
+
}
|
|
71
|
+
return t5;
|
|
28
72
|
};
|
|
29
73
|
exports.LinkToolbarButton = LinkToolbarButton;
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ListToolbarButton = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
7
8
|
const is_nil_1 = require("@uxf/core/utils/is-nil");
|
|
8
9
|
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
9
10
|
const react_1 = __importDefault(require("react"));
|
|
@@ -20,16 +21,56 @@ function getIsListElementActive(editor, type) {
|
|
|
20
21
|
const [listElement] = res.list;
|
|
21
22
|
return listElement.type === type;
|
|
22
23
|
}
|
|
23
|
-
const ListToolbarButton =
|
|
24
|
+
const ListToolbarButton = props => {
|
|
24
25
|
var _a;
|
|
26
|
+
const $ = (0, compiler_runtime_1.c)(15);
|
|
25
27
|
const editor = (0, hooks_1.useUxfPlateEditorState)(props.plateId);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(0,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
let t0;
|
|
29
|
+
let type;
|
|
30
|
+
if ($[0] !== editor || $[1] !== props.pluginKey) {
|
|
31
|
+
type = (0, utils_1.getPluginType)(editor, props.pluginKey);
|
|
32
|
+
t0 = getIsListElementActive(editor, type);
|
|
33
|
+
$[0] = editor;
|
|
34
|
+
$[1] = props.pluginKey;
|
|
35
|
+
$[2] = t0;
|
|
36
|
+
$[3] = type;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
t0 = $[2];
|
|
40
|
+
type = $[3];
|
|
41
|
+
}
|
|
42
|
+
const isActive = t0;
|
|
43
|
+
let t1;
|
|
44
|
+
if ($[4] !== editor || $[5] !== type) {
|
|
45
|
+
t1 = () => {
|
|
46
|
+
(0, constants_1.toggleList)(editor, {
|
|
47
|
+
type
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
$[4] = editor;
|
|
51
|
+
$[5] = type;
|
|
52
|
+
$[6] = t1;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
t1 = $[6];
|
|
56
|
+
}
|
|
57
|
+
const onMouseDown = t1;
|
|
58
|
+
const t2 = `${CLASS_NAME} ${CLASS_NAME}-list ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`;
|
|
59
|
+
let t3;
|
|
60
|
+
if ($[7] !== editor || $[8] !== isActive || $[9] !== onMouseDown || $[10] !== props.iconName || $[11] !== props.pluginKey || $[12] !== props.tooltipText || $[13] !== t2) {
|
|
61
|
+
t3 = react_1.default.createElement(toolbar_button_1.ToolbarButton, { className: t2, editor: editor, iconName: props.iconName, isActive: isActive, onMouseDown: onMouseDown, pluginKey: props.pluginKey, tooltipText: props.tooltipText });
|
|
62
|
+
$[7] = editor;
|
|
63
|
+
$[8] = isActive;
|
|
64
|
+
$[9] = onMouseDown;
|
|
65
|
+
$[10] = props.iconName;
|
|
66
|
+
$[11] = props.pluginKey;
|
|
67
|
+
$[12] = props.tooltipText;
|
|
68
|
+
$[13] = t2;
|
|
69
|
+
$[14] = t3;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
t3 = $[14];
|
|
73
|
+
}
|
|
74
|
+
return t3;
|
|
34
75
|
};
|
|
35
76
|
exports.ListToolbarButton = ListToolbarButton;
|