@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
|
@@ -1,65 +1,89 @@
|
|
|
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.ButtonElement = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
8
|
const button_1 = require("@uxf/ui/button");
|
|
38
9
|
const dialog_panel_1 = require("@uxf/ui/dialog/dialog-panel");
|
|
39
10
|
const modal_service_1 = require("@uxf/ui/modal/modal-service");
|
|
40
|
-
const react_1 =
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
41
12
|
const hooks_1 = require("../../hooks");
|
|
42
13
|
const button_2 = require("../../plugins/button");
|
|
43
14
|
const remove_selected_button_1 = require("../../plugins/button/transforms/remove-selected-button");
|
|
44
15
|
const element_with_action_buttons_1 = require("../components/element/element-with-action-buttons");
|
|
45
16
|
const insert_button_modal_content_1 = require("./insert-button-modal-content");
|
|
46
17
|
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
47
|
-
const ButtonElement =
|
|
18
|
+
const ButtonElement = props => {
|
|
48
19
|
var _a;
|
|
20
|
+
const $ = (0, compiler_runtime_1.c)(17);
|
|
49
21
|
const isSelected = (0, hooks_1.useSelected)();
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
22
|
+
let t0;
|
|
23
|
+
if ($[0] !== props.editor) {
|
|
24
|
+
t0 = () => {
|
|
25
|
+
(0, modal_service_1.openModal)({
|
|
26
|
+
children: react_1.default.createElement(dialog_panel_1.DialogPanel, { width: "lg" },
|
|
27
|
+
react_1.default.createElement(insert_button_modal_content_1.InsertButtonModalContent, { buttonToEdit: (0, button_2.getActiveButton)(props.editor), editor: props.editor }))
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
$[0] = props.editor;
|
|
31
|
+
$[1] = t0;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
t0 = $[1];
|
|
35
|
+
}
|
|
36
|
+
const onEdit = t0;
|
|
37
|
+
let t1;
|
|
38
|
+
if ($[2] !== props.editor) {
|
|
39
|
+
t1 = () => {
|
|
40
|
+
(0, remove_selected_button_1.removeSelectedButton)(props.editor);
|
|
41
|
+
};
|
|
42
|
+
$[2] = props.editor;
|
|
43
|
+
$[3] = t1;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
t1 = $[3];
|
|
47
|
+
}
|
|
48
|
+
const onRemove = t1;
|
|
59
49
|
const element = props.element;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
const t2 = `${CLASS_NAME} ${CLASS_NAME}-button ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`;
|
|
51
|
+
let t3;
|
|
52
|
+
if ($[4] !== element.buttonText || $[5] !== element.buttonUrl) {
|
|
53
|
+
t3 = react_1.default.createElement(button_1.Button, { className: `${CLASS_NAME}-button__action-button`, href: element.buttonUrl, isDisabled: true, variant: "secondary" }, element.buttonText);
|
|
54
|
+
$[4] = element.buttonText;
|
|
55
|
+
$[5] = element.buttonUrl;
|
|
56
|
+
$[6] = t3;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
t3 = $[6];
|
|
60
|
+
}
|
|
61
|
+
let t4;
|
|
62
|
+
if ($[7] !== isSelected || $[8] !== onEdit || $[9] !== onRemove || $[10] !== t3) {
|
|
63
|
+
t4 = react_1.default.createElement(element_with_action_buttons_1.ElementWithActionButtons, { className: `${CLASS_NAME}-button__action-buttons`, isSelected: isSelected, onDelete: onRemove, onEdit: onEdit, padding: isSelected }, t3);
|
|
64
|
+
$[7] = isSelected;
|
|
65
|
+
$[8] = onEdit;
|
|
66
|
+
$[9] = onRemove;
|
|
67
|
+
$[10] = t3;
|
|
68
|
+
$[11] = t4;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
t4 = $[11];
|
|
72
|
+
}
|
|
73
|
+
let t5;
|
|
74
|
+
if ($[12] !== props.attributes || $[13] !== props.children || $[14] !== t2 || $[15] !== t4) {
|
|
75
|
+
t5 = react_1.default.createElement("div", { ...props.attributes, className: t2 },
|
|
76
|
+
t4,
|
|
77
|
+
props.children);
|
|
78
|
+
$[12] = props.attributes;
|
|
79
|
+
$[13] = props.children;
|
|
80
|
+
$[14] = t2;
|
|
81
|
+
$[15] = t4;
|
|
82
|
+
$[16] = t5;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
t5 = $[16];
|
|
86
|
+
}
|
|
87
|
+
return t5;
|
|
64
88
|
};
|
|
65
89
|
exports.ButtonElement = ButtonElement;
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.InsertButtonModalContent = void 0;
|
|
37
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
38
|
const translations_1 = require("@uxf/core-react/translations");
|
|
38
39
|
const text_input_1 = require("@uxf/ui/text-input");
|
|
39
40
|
const react_1 = __importStar(require("react"));
|
|
@@ -42,50 +43,192 @@ const modal_buttons_1 = require("../components/modal/modal-buttons");
|
|
|
42
43
|
const modal_content_1 = require("../components/modal/modal-content");
|
|
43
44
|
const utils_1 = require("../utils");
|
|
44
45
|
const CLASS_NAME = "uxf-wysiwyg__insert-modal-button";
|
|
45
|
-
const InsertButtonModalContent =
|
|
46
|
-
var _a, _b,
|
|
46
|
+
const InsertButtonModalContent = props => {
|
|
47
|
+
var _a, _b, _d, _e;
|
|
48
|
+
const $ = (0, compiler_runtime_1.c)(44);
|
|
47
49
|
const t = (0, translations_1.useUxfTranslation)();
|
|
48
50
|
const [buttonText, setButtonText] = (0, react_1.useState)((_b = (_a = props.buttonToEdit) === null || _a === void 0 ? void 0 : _a.buttonText) !== null && _b !== void 0 ? _b : "");
|
|
49
|
-
const [buttonUrl, setButtonUrl] = (0, react_1.useState)((
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
const [buttonUrl, setButtonUrl] = (0, react_1.useState)((_e = (_d = props.buttonToEdit) === null || _d === void 0 ? void 0 : _d.buttonUrl) !== null && _e !== void 0 ? _e : "");
|
|
52
|
+
let t0;
|
|
53
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
54
|
+
t0 = {
|
|
55
|
+
text: undefined,
|
|
56
|
+
url: undefined
|
|
57
|
+
};
|
|
58
|
+
$[0] = t0;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
t0 = $[0];
|
|
62
|
+
}
|
|
63
|
+
const [error, setError] = (0, react_1.useState)(t0);
|
|
64
|
+
let t1;
|
|
65
|
+
if ($[1] !== props.buttonToEdit || $[2] !== t) {
|
|
66
|
+
t1 = props.buttonToEdit ? t("uxf-wysiwyg:plugins.button.button-edit") : t("uxf-wysiwyg:plugins.button.button-insert");
|
|
67
|
+
$[1] = props.buttonToEdit;
|
|
68
|
+
$[2] = t;
|
|
69
|
+
$[3] = t1;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
t1 = $[3];
|
|
73
|
+
}
|
|
74
|
+
const title = t1;
|
|
75
|
+
let t2;
|
|
76
|
+
if ($[4] !== buttonText || $[5] !== buttonUrl || $[6] !== props.buttonToEdit || $[7] !== props.editor || $[8] !== t) {
|
|
77
|
+
t2 = async (e) => {
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
if (buttonText.length === 0) {
|
|
80
|
+
setError(prevError => ({
|
|
68
81
|
...prevError,
|
|
69
|
-
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
text: t("uxf-wysiwyg:plugins.button.button-text.required")
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
if (buttonUrl.length === 0) {
|
|
86
|
+
setError(prevError_0 => ({
|
|
87
|
+
...prevError_0,
|
|
88
|
+
url: t("uxf-wysiwyg:plugins.button.url-address.required")
|
|
89
|
+
}));
|
|
76
90
|
}
|
|
77
|
-
|
|
78
|
-
|
|
91
|
+
if (buttonText.length !== 0 && buttonUrl.length !== 0) {
|
|
92
|
+
if (props.buttonToEdit) {
|
|
93
|
+
(0, button_1.updateButton)(props.editor, buttonText, buttonUrl);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
(0, button_1.insertButton)(props.editor, buttonText, buttonUrl);
|
|
97
|
+
}
|
|
98
|
+
(0, utils_1.closeModalWithFocus)(props.editor);
|
|
79
99
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
};
|
|
101
|
+
$[4] = buttonText;
|
|
102
|
+
$[5] = buttonUrl;
|
|
103
|
+
$[6] = props.buttonToEdit;
|
|
104
|
+
$[7] = props.editor;
|
|
105
|
+
$[8] = t;
|
|
106
|
+
$[9] = t2;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
t2 = $[9];
|
|
110
|
+
}
|
|
111
|
+
const onSubmit = t2;
|
|
112
|
+
const t3 = error.text;
|
|
113
|
+
const t4 = Boolean(error.text);
|
|
114
|
+
let t5;
|
|
115
|
+
if ($[10] !== t) {
|
|
116
|
+
t5 = t("uxf-wysiwyg:plugins.button.button-text.label");
|
|
117
|
+
$[10] = t;
|
|
118
|
+
$[11] = t5;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
t5 = $[11];
|
|
122
|
+
}
|
|
123
|
+
let t6;
|
|
124
|
+
if ($[12] !== t) {
|
|
125
|
+
t6 = t("uxf-wysiwyg:plugins.button.button-text.placeholder");
|
|
126
|
+
$[12] = t;
|
|
127
|
+
$[13] = t6;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
t6 = $[13];
|
|
131
|
+
}
|
|
132
|
+
let t7;
|
|
133
|
+
if ($[14] !== buttonText || $[15] !== error.text || $[16] !== t4 || $[17] !== t5 || $[18] !== t6) {
|
|
134
|
+
t7 = react_1.default.createElement(text_input_1.TextInput, { helperText: t3, isInvalid: t4, isRequired: true, label: t5, name: "button-text", onChange: setButtonText, placeholder: t6, type: "text", value: buttonText });
|
|
135
|
+
$[14] = buttonText;
|
|
136
|
+
$[15] = error.text;
|
|
137
|
+
$[16] = t4;
|
|
138
|
+
$[17] = t5;
|
|
139
|
+
$[18] = t6;
|
|
140
|
+
$[19] = t7;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
t7 = $[19];
|
|
144
|
+
}
|
|
145
|
+
const t8 = error.url;
|
|
146
|
+
const t9 = Boolean(error.url);
|
|
147
|
+
let t10;
|
|
148
|
+
if ($[20] !== t) {
|
|
149
|
+
t10 = t("uxf-wysiwyg:plugins.button.url-address.label");
|
|
150
|
+
$[20] = t;
|
|
151
|
+
$[21] = t10;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
t10 = $[21];
|
|
155
|
+
}
|
|
156
|
+
let t11;
|
|
157
|
+
if ($[22] !== t) {
|
|
158
|
+
t11 = t("uxf-wysiwyg:plugins.button.url-address.placeholder");
|
|
159
|
+
$[22] = t;
|
|
160
|
+
$[23] = t11;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
t11 = $[23];
|
|
164
|
+
}
|
|
165
|
+
let t12;
|
|
166
|
+
if ($[24] !== buttonUrl || $[25] !== error.url || $[26] !== t10 || $[27] !== t11 || $[28] !== t9) {
|
|
167
|
+
t12 = react_1.default.createElement(text_input_1.TextInput, { helperText: t8, isInvalid: t9, isRequired: true, label: t10, name: "url-address", onChange: setButtonUrl, placeholder: t11, type: "text", value: buttonUrl });
|
|
168
|
+
$[24] = buttonUrl;
|
|
169
|
+
$[25] = error.url;
|
|
170
|
+
$[26] = t10;
|
|
171
|
+
$[27] = t11;
|
|
172
|
+
$[28] = t9;
|
|
173
|
+
$[29] = t12;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
t12 = $[29];
|
|
177
|
+
}
|
|
178
|
+
let t13;
|
|
179
|
+
if ($[30] !== t12 || $[31] !== t7) {
|
|
180
|
+
t13 = react_1.default.createElement("div", { className: `${CLASS_NAME}__form-inputs` },
|
|
181
|
+
t7,
|
|
182
|
+
t12);
|
|
183
|
+
$[30] = t12;
|
|
184
|
+
$[31] = t7;
|
|
185
|
+
$[32] = t13;
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
t13 = $[32];
|
|
189
|
+
}
|
|
190
|
+
let t14;
|
|
191
|
+
if ($[33] !== props.editor || $[34] !== title) {
|
|
192
|
+
t14 = react_1.default.createElement(modal_buttons_1.ModalButtons, { className: `${CLASS_NAME}__form-buttons`, editor: props.editor, submitText: title });
|
|
193
|
+
$[33] = props.editor;
|
|
194
|
+
$[34] = title;
|
|
195
|
+
$[35] = t14;
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
t14 = $[35];
|
|
199
|
+
}
|
|
200
|
+
let t15;
|
|
201
|
+
if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
|
|
202
|
+
t15 = react_1.default.createElement("button", { hidden: true, type: "submit" });
|
|
203
|
+
$[36] = t15;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
t15 = $[36];
|
|
207
|
+
}
|
|
208
|
+
let t16;
|
|
209
|
+
if ($[37] !== onSubmit || $[38] !== t13 || $[39] !== t14) {
|
|
210
|
+
t16 = react_1.default.createElement("form", { className: `${CLASS_NAME}__form`, id: "insert-button-form", onSubmit: onSubmit },
|
|
211
|
+
t13,
|
|
212
|
+
t14,
|
|
213
|
+
t15);
|
|
214
|
+
$[37] = onSubmit;
|
|
215
|
+
$[38] = t13;
|
|
216
|
+
$[39] = t14;
|
|
217
|
+
$[40] = t16;
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
t16 = $[40];
|
|
221
|
+
}
|
|
222
|
+
let t17;
|
|
223
|
+
if ($[41] !== t16 || $[42] !== title) {
|
|
224
|
+
t17 = react_1.default.createElement(modal_content_1.ModalContent, { title: title }, t16);
|
|
225
|
+
$[41] = t16;
|
|
226
|
+
$[42] = title;
|
|
227
|
+
$[43] = t17;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
t17 = $[43];
|
|
231
|
+
}
|
|
232
|
+
return t17;
|
|
90
233
|
};
|
|
91
234
|
exports.InsertButtonModalContent = InsertButtonModalContent;
|
|
@@ -1,55 +1,57 @@
|
|
|
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.ModalButtonCancel = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
8
|
const translations_1 = require("@uxf/core-react/translations");
|
|
38
9
|
const button_1 = require("@uxf/ui/button");
|
|
39
|
-
const react_1 =
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
40
11
|
const utils_1 = require("../../utils");
|
|
41
|
-
const ModalButtonCancel =
|
|
12
|
+
const ModalButtonCancel = props => {
|
|
42
13
|
var _a;
|
|
14
|
+
const $ = (0, compiler_runtime_1.c)(9);
|
|
43
15
|
const t = (0, translations_1.useUxfTranslation)();
|
|
44
16
|
const onCancel = props.onCancel;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
17
|
+
let t0;
|
|
18
|
+
if ($[0] !== onCancel || $[1] !== props.editor) {
|
|
19
|
+
t0 = () => {
|
|
20
|
+
if (onCancel) {
|
|
21
|
+
onCancel();
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
(0, utils_1.closeModalWithFocus)(props.editor);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
$[0] = onCancel;
|
|
28
|
+
$[1] = props.editor;
|
|
29
|
+
$[2] = t0;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
t0 = $[2];
|
|
33
|
+
}
|
|
34
|
+
const cancelHandler = t0;
|
|
35
|
+
let t1;
|
|
36
|
+
if ($[3] !== props.cancelText || $[4] !== t) {
|
|
37
|
+
t1 = (_a = props.cancelText) !== null && _a !== void 0 ? _a : t("uxf-wysiwyg:components.modal.button-cancel");
|
|
38
|
+
$[3] = props.cancelText;
|
|
39
|
+
$[4] = t;
|
|
40
|
+
$[5] = t1;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
t1 = $[5];
|
|
44
|
+
}
|
|
45
|
+
let t2;
|
|
46
|
+
if ($[6] !== cancelHandler || $[7] !== t1) {
|
|
47
|
+
t2 = react_1.default.createElement(button_1.Button, { className: "uxf-wysiwyg__modal-button-cancel", color: "default", onClick: cancelHandler, variant: "secondary" }, t1);
|
|
48
|
+
$[6] = cancelHandler;
|
|
49
|
+
$[7] = t1;
|
|
50
|
+
$[8] = t2;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
t2 = $[8];
|
|
54
|
+
}
|
|
55
|
+
return t2;
|
|
54
56
|
};
|
|
55
57
|
exports.ModalButtonCancel = ModalButtonCancel;
|