@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.InsertVideoModalContent = 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"));
|
|
@@ -46,45 +47,168 @@ const modal_content_1 = require("../components/modal/modal-content");
|
|
|
46
47
|
const utils_2 = require("../utils");
|
|
47
48
|
const CLASS_NAME = "uxf-wysiwyg__insert-modal-video";
|
|
48
49
|
// eslint-disable-next-line react/destructuring-assignment
|
|
49
|
-
const InsertVideoModalContent =
|
|
50
|
+
const InsertVideoModalContent = t0 => {
|
|
50
51
|
var _a;
|
|
52
|
+
const $ = (0, compiler_runtime_1.c)(37);
|
|
53
|
+
const { editor, editedVideo } = t0;
|
|
51
54
|
const t = (0, translations_1.useUxfTranslation)();
|
|
52
55
|
const [url, setUrl] = (0, react_1.useState)((_a = editedVideo === null || editedVideo === void 0 ? void 0 : editedVideo.url) !== null && _a !== void 0 ? _a : "");
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
let t1;
|
|
57
|
+
if ($[0] !== editedVideo) {
|
|
58
|
+
t1 = editedVideo ? {
|
|
59
|
+
id: editedVideo.videoId,
|
|
60
|
+
provider: editedVideo.provider,
|
|
61
|
+
url: editedVideo.embeddedUrl
|
|
62
|
+
} : undefined;
|
|
63
|
+
$[0] = editedVideo;
|
|
64
|
+
$[1] = t1;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
t1 = $[1];
|
|
68
|
+
}
|
|
69
|
+
const [embedUrl, setEmbedUrl] = (0, react_1.useState)(t1);
|
|
56
70
|
const [error, setError] = (0, react_1.useState)();
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(0,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
71
|
+
let t2;
|
|
72
|
+
if ($[2] !== editedVideo || $[3] !== editor || $[4] !== embedUrl || $[5] !== t || $[6] !== url) {
|
|
73
|
+
t2 = async (event) => {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
setEmbedUrl((0, utils_1.parseVideoUrl)(url));
|
|
76
|
+
if (!((embedUrl === null || embedUrl === void 0 ? void 0 : embedUrl.url) && embedUrl.provider && embedUrl.id)) {
|
|
77
|
+
setError(t("uxf-wysiwyg:plugins.video.url-address.invalid"));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const metaData = await (0, get_video_meta_data_1.getVideoMetaData)(embedUrl.provider, embedUrl.id);
|
|
81
|
+
if (editedVideo) {
|
|
82
|
+
(0, update_video_1.updateVideo)(editor, url, embedUrl.url, embedUrl.provider, embedUrl.id, metaData);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
(0, insert_video_1.insertVideo)(editor, url, embedUrl.url, embedUrl.provider, embedUrl.id, metaData);
|
|
86
|
+
}
|
|
87
|
+
(0, utils_2.closeModalWithFocus)(editor);
|
|
88
|
+
};
|
|
89
|
+
$[2] = editedVideo;
|
|
90
|
+
$[3] = editor;
|
|
91
|
+
$[4] = embedUrl;
|
|
92
|
+
$[5] = t;
|
|
93
|
+
$[6] = url;
|
|
94
|
+
$[7] = t2;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
t2 = $[7];
|
|
98
|
+
}
|
|
99
|
+
const onSubmit = t2;
|
|
100
|
+
let t3;
|
|
101
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
102
|
+
t3 = v => {
|
|
103
|
+
setUrl(v);
|
|
104
|
+
setError(undefined);
|
|
105
|
+
setEmbedUrl((0, utils_1.parseVideoUrl)(v));
|
|
106
|
+
};
|
|
107
|
+
$[8] = t3;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
t3 = $[8];
|
|
111
|
+
}
|
|
112
|
+
const onChange = t3;
|
|
113
|
+
let t4;
|
|
114
|
+
if ($[9] !== editedVideo || $[10] !== t) {
|
|
115
|
+
t4 = editedVideo ? t("uxf-wysiwyg:plugins.video.button-edit") : t("uxf-wysiwyg:plugins.video.button-insert");
|
|
116
|
+
$[9] = editedVideo;
|
|
117
|
+
$[10] = t;
|
|
118
|
+
$[11] = t4;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
t4 = $[11];
|
|
122
|
+
}
|
|
123
|
+
const title = t4;
|
|
124
|
+
const t5 = Boolean(error);
|
|
125
|
+
let t6;
|
|
126
|
+
if ($[12] !== t) {
|
|
127
|
+
t6 = t("uxf-wysiwyg:plugins.video.url-address.label");
|
|
128
|
+
$[12] = t;
|
|
129
|
+
$[13] = t6;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
t6 = $[13];
|
|
133
|
+
}
|
|
134
|
+
let t7;
|
|
135
|
+
if ($[14] !== t) {
|
|
136
|
+
t7 = t("uxf-wysiwyg:plugins.video.url-address.placeholder");
|
|
137
|
+
$[14] = t;
|
|
138
|
+
$[15] = t7;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
t7 = $[15];
|
|
142
|
+
}
|
|
143
|
+
let t8;
|
|
144
|
+
if ($[16] !== error || $[17] !== t5 || $[18] !== t6 || $[19] !== t7 || $[20] !== url) {
|
|
145
|
+
t8 = react_1.default.createElement("div", { className: `${CLASS_NAME}__form-inputs` },
|
|
146
|
+
react_1.default.createElement(text_input_1.TextInput, { helperText: error, isInvalid: t5, label: t6, name: "url-address", onChange: onChange, placeholder: t7, type: "text", value: url }));
|
|
147
|
+
$[16] = error;
|
|
148
|
+
$[17] = t5;
|
|
149
|
+
$[18] = t6;
|
|
150
|
+
$[19] = t7;
|
|
151
|
+
$[20] = url;
|
|
152
|
+
$[21] = t8;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
t8 = $[21];
|
|
156
|
+
}
|
|
157
|
+
let t9;
|
|
158
|
+
if ($[22] !== embedUrl || $[23] !== t) {
|
|
159
|
+
t9 = (embedUrl === null || embedUrl === void 0 ? void 0 : embedUrl.url) && react_1.default.createElement("div", { className: `${CLASS_NAME}__iframe-wrapper` },
|
|
160
|
+
react_1.default.createElement("iframe", { className: `${CLASS_NAME}__iframe`, height: "100%", src: embedUrl.url, title: t("uxf-wysiwyg:plugins.video.iframe-title"), width: "100%" }));
|
|
161
|
+
$[22] = embedUrl;
|
|
162
|
+
$[23] = t;
|
|
163
|
+
$[24] = t9;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
t9 = $[24];
|
|
167
|
+
}
|
|
168
|
+
let t10;
|
|
169
|
+
if ($[25] !== editor || $[26] !== title) {
|
|
170
|
+
t10 = react_1.default.createElement(modal_buttons_1.ModalButtons, { className: `${CLASS_NAME}__form-buttons`, editor: editor, submitText: title });
|
|
171
|
+
$[25] = editor;
|
|
172
|
+
$[26] = title;
|
|
173
|
+
$[27] = t10;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
t10 = $[27];
|
|
177
|
+
}
|
|
178
|
+
let t11;
|
|
179
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
180
|
+
t11 = react_1.default.createElement("button", { hidden: true, type: "submit" });
|
|
181
|
+
$[28] = t11;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
t11 = $[28];
|
|
185
|
+
}
|
|
186
|
+
let t12;
|
|
187
|
+
if ($[29] !== onSubmit || $[30] !== t10 || $[31] !== t8 || $[32] !== t9) {
|
|
188
|
+
t12 = react_1.default.createElement("form", { className: `${CLASS_NAME}__form`, id: "insert-video-form", onSubmit: onSubmit },
|
|
189
|
+
t8,
|
|
190
|
+
t9,
|
|
191
|
+
t10,
|
|
192
|
+
t11);
|
|
193
|
+
$[29] = onSubmit;
|
|
194
|
+
$[30] = t10;
|
|
195
|
+
$[31] = t8;
|
|
196
|
+
$[32] = t9;
|
|
197
|
+
$[33] = t12;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
t12 = $[33];
|
|
201
|
+
}
|
|
202
|
+
let t13;
|
|
203
|
+
if ($[34] !== t12 || $[35] !== title) {
|
|
204
|
+
t13 = react_1.default.createElement(modal_content_1.ModalContent, { title: title }, t12);
|
|
205
|
+
$[34] = t12;
|
|
206
|
+
$[35] = title;
|
|
207
|
+
$[36] = t13;
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
t13 = $[36];
|
|
211
|
+
}
|
|
212
|
+
return t13;
|
|
89
213
|
};
|
|
90
214
|
exports.InsertVideoModalContent = InsertVideoModalContent;
|
|
@@ -1,66 +1,101 @@
|
|
|
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.VideoElement = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
8
|
const translations_1 = require("@uxf/core-react/translations");
|
|
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 get_active_video_1 = require("../../plugins/embedded/video/get-active-video");
|
|
43
14
|
const utils_1 = require("../../utils");
|
|
44
15
|
const element_with_action_buttons_1 = require("../components/element/element-with-action-buttons");
|
|
45
16
|
const insert_video_modal_content_1 = require("./insert-video-modal-content");
|
|
46
17
|
const CLASS_NAME = "uxf-wysiwyg__element";
|
|
47
|
-
const VideoElement =
|
|
18
|
+
const VideoElement = props => {
|
|
48
19
|
var _a;
|
|
20
|
+
const $ = (0, compiler_runtime_1.c)(19);
|
|
49
21
|
const t = (0, translations_1.useUxfTranslation)();
|
|
50
22
|
const isSelected = (0, hooks_1.useSelected)();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
23
|
+
let t0;
|
|
24
|
+
if ($[0] !== props.editor) {
|
|
25
|
+
t0 = () => {
|
|
26
|
+
(0, modal_service_1.openModal)({
|
|
27
|
+
children: react_1.default.createElement(dialog_panel_1.DialogPanel, { width: "lg" },
|
|
28
|
+
react_1.default.createElement(insert_video_modal_content_1.InsertVideoModalContent, { editedVideo: (0, get_active_video_1.getActiveVideo)(props.editor), editor: props.editor }))
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
$[0] = props.editor;
|
|
32
|
+
$[1] = t0;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
t0 = $[1];
|
|
36
|
+
}
|
|
37
|
+
const onEdit = t0;
|
|
38
|
+
let t1;
|
|
39
|
+
if ($[2] !== props.editor) {
|
|
40
|
+
t1 = () => {
|
|
41
|
+
(0, utils_1.removeSelectedNode)(props.editor);
|
|
42
|
+
};
|
|
43
|
+
$[2] = props.editor;
|
|
44
|
+
$[3] = t1;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
t1 = $[3];
|
|
48
|
+
}
|
|
49
|
+
const onDelete = t1;
|
|
60
50
|
const element = props.element;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
const t2 = props.attributes;
|
|
52
|
+
const t3 = `${CLASS_NAME} ${CLASS_NAME}-video ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`;
|
|
53
|
+
const t4 = element.embeddedUrl;
|
|
54
|
+
let t5;
|
|
55
|
+
if ($[4] !== t) {
|
|
56
|
+
t5 = t("uxf-wysiwyg:plugins.video.iframe-title");
|
|
57
|
+
$[4] = t;
|
|
58
|
+
$[5] = t5;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
t5 = $[5];
|
|
62
|
+
}
|
|
63
|
+
let t6;
|
|
64
|
+
if ($[6] !== element.embeddedUrl || $[7] !== t5) {
|
|
65
|
+
t6 = react_1.default.createElement("iframe", { className: `${CLASS_NAME}-video__iframe`, src: t4, tabIndex: -1, title: t5 });
|
|
66
|
+
$[6] = element.embeddedUrl;
|
|
67
|
+
$[7] = t5;
|
|
68
|
+
$[8] = t6;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
t6 = $[8];
|
|
72
|
+
}
|
|
73
|
+
let t7;
|
|
74
|
+
if ($[9] !== isSelected || $[10] !== onDelete || $[11] !== onEdit || $[12] !== t6) {
|
|
75
|
+
t7 = react_1.default.createElement(element_with_action_buttons_1.ElementWithActionButtons, { className: `${CLASS_NAME}-video__action-buttons`, isSelected: isSelected, onDelete: onDelete, onEdit: onEdit }, t6);
|
|
76
|
+
$[9] = isSelected;
|
|
77
|
+
$[10] = onDelete;
|
|
78
|
+
$[11] = onEdit;
|
|
79
|
+
$[12] = t6;
|
|
80
|
+
$[13] = t7;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
t7 = $[13];
|
|
84
|
+
}
|
|
85
|
+
let t8;
|
|
86
|
+
if ($[14] !== props.attributes || $[15] !== props.children || $[16] !== t3 || $[17] !== t7) {
|
|
87
|
+
t8 = react_1.default.createElement("div", { ...t2, className: t3 },
|
|
88
|
+
t7,
|
|
89
|
+
props.children);
|
|
90
|
+
$[14] = props.attributes;
|
|
91
|
+
$[15] = props.children;
|
|
92
|
+
$[16] = t3;
|
|
93
|
+
$[17] = t7;
|
|
94
|
+
$[18] = t8;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
t8 = $[18];
|
|
98
|
+
}
|
|
99
|
+
return t8;
|
|
65
100
|
};
|
|
66
101
|
exports.VideoElement = VideoElement;
|
package/wysiwyg-editor.js
CHANGED
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.WysiwygEditor = void 0;
|
|
38
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
38
39
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
39
40
|
const use_is_hydrated_1 = require("@uxf/core-react/hooks/use-is-hydrated");
|
|
40
41
|
const translations_1 = require("@uxf/core-react/translations");
|
|
@@ -50,52 +51,199 @@ const CLASS_NAME = "uxf-wysiwyg";
|
|
|
50
51
|
* Must be rendered inside Plate component
|
|
51
52
|
*/
|
|
52
53
|
function EditorRefHandler(props) {
|
|
54
|
+
const $ = (0, compiler_runtime_1.c)(2);
|
|
55
|
+
const { ref } = props;
|
|
53
56
|
const editor = (0, hooks_1.useUxfEditorRef)();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
let t0;
|
|
58
|
+
if ($[0] !== editor) {
|
|
59
|
+
t0 = () => ({
|
|
60
|
+
focus: () => {
|
|
61
|
+
editor.tf.select(editor.api.end([]));
|
|
62
|
+
(0, utils_1.focusEditor)(editor);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
$[0] = editor;
|
|
66
|
+
$[1] = t0;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
t0 = $[1];
|
|
70
|
+
}
|
|
71
|
+
(0, react_2.useImperativeHandle)(ref, t0);
|
|
62
72
|
return null;
|
|
63
73
|
}
|
|
64
74
|
EditorRefHandler.displayName = "EditorRefHandler";
|
|
65
|
-
const Editor =
|
|
75
|
+
const Editor = props => {
|
|
66
76
|
var _a, _b;
|
|
77
|
+
const $ = (0, compiler_runtime_1.c)(29);
|
|
78
|
+
const { ref } = props;
|
|
67
79
|
const t = (0, translations_1.useUxfTranslation)();
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
let t0;
|
|
81
|
+
if ($[0] !== props.id || $[1] !== props.initialValue || $[2] !== props.plugins) {
|
|
82
|
+
t0 = {
|
|
83
|
+
id: props.id,
|
|
84
|
+
plugins: props.plugins,
|
|
85
|
+
shouldNormalizeEditor: true,
|
|
86
|
+
value: props.initialValue
|
|
87
|
+
};
|
|
88
|
+
$[0] = props.id;
|
|
89
|
+
$[1] = props.initialValue;
|
|
90
|
+
$[2] = props.plugins;
|
|
91
|
+
$[3] = t0;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
t0 = $[3];
|
|
95
|
+
}
|
|
96
|
+
let t1;
|
|
97
|
+
if ($[4] !== props.plugins) {
|
|
98
|
+
t1 = [props.plugins];
|
|
99
|
+
$[4] = props.plugins;
|
|
100
|
+
$[5] = t1;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
t1 = $[5];
|
|
104
|
+
}
|
|
105
|
+
const editor = (0, react_1.usePlateEditor)(t0, t1);
|
|
106
|
+
let t2;
|
|
107
|
+
if ($[6] !== props) {
|
|
108
|
+
t2 = t3 => {
|
|
109
|
+
const { value } = t3;
|
|
110
|
+
return props.onChange(value);
|
|
111
|
+
};
|
|
112
|
+
$[6] = props;
|
|
113
|
+
$[7] = t2;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
t2 = $[7];
|
|
117
|
+
}
|
|
118
|
+
let t3;
|
|
119
|
+
if ($[8] !== props.customPluginsToolbarButtons || $[9] !== props.id || $[10] !== props.toolbarLeftElement || $[11] !== props.toolbarRightElement) {
|
|
120
|
+
t3 = react_2.default.createElement(toolbar_1.Toolbar, { customPluginsButtons: props.customPluginsToolbarButtons, leftElement: props.toolbarLeftElement, plateId: props.id, rightElement: props.toolbarRightElement });
|
|
121
|
+
$[8] = props.customPluginsToolbarButtons;
|
|
122
|
+
$[9] = props.id;
|
|
123
|
+
$[10] = props.toolbarLeftElement;
|
|
124
|
+
$[11] = props.toolbarRightElement;
|
|
125
|
+
$[12] = t3;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
t3 = $[12];
|
|
129
|
+
}
|
|
130
|
+
let t4;
|
|
131
|
+
if ($[13] !== t) {
|
|
132
|
+
t4 = t("uxf-wysiwyg:common.placeholder");
|
|
133
|
+
$[13] = t;
|
|
134
|
+
$[14] = t4;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
t4 = $[14];
|
|
138
|
+
}
|
|
139
|
+
const t5 = `${CLASS_NAME}__editable ${(_b = (_a = props.editableProps) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ""}`;
|
|
140
|
+
let t6;
|
|
141
|
+
if ($[15] !== props.editableProps || $[16] !== t4 || $[17] !== t5) {
|
|
142
|
+
t6 = react_2.default.createElement(react_1.PlateContent, { autoFocus: false,
|
|
143
|
+
placeholder: t4,
|
|
144
|
+
readOnly: false,
|
|
145
|
+
spellCheck: false,
|
|
146
|
+
...props.editableProps,
|
|
147
|
+
className: t5 });
|
|
148
|
+
$[15] = props.editableProps;
|
|
149
|
+
$[16] = t4;
|
|
150
|
+
$[17] = t5;
|
|
151
|
+
$[18] = t6;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
t6 = $[18];
|
|
155
|
+
}
|
|
156
|
+
let t7;
|
|
157
|
+
if ($[19] !== ref) {
|
|
158
|
+
t7 = ref && react_2.default.createElement(EditorRefHandler, { ref: ref });
|
|
159
|
+
$[19] = ref;
|
|
160
|
+
$[20] = t7;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
t7 = $[20];
|
|
164
|
+
}
|
|
165
|
+
let t8;
|
|
166
|
+
if ($[21] !== t6 || $[22] !== t7) {
|
|
167
|
+
t8 = react_2.default.createElement("div", { className: `${CLASS_NAME}__content` },
|
|
168
|
+
t6,
|
|
169
|
+
t7);
|
|
170
|
+
$[21] = t6;
|
|
171
|
+
$[22] = t7;
|
|
172
|
+
$[23] = t8;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
t8 = $[23];
|
|
176
|
+
}
|
|
177
|
+
let t9;
|
|
178
|
+
if ($[24] !== editor || $[25] !== t2 || $[26] !== t3 || $[27] !== t8) {
|
|
179
|
+
t9 = react_2.default.createElement(react_1.Plate, { editor: editor, onChange: t2 },
|
|
180
|
+
t3,
|
|
181
|
+
t8);
|
|
182
|
+
$[24] = editor;
|
|
183
|
+
$[25] = t2;
|
|
184
|
+
$[26] = t3;
|
|
185
|
+
$[27] = t8;
|
|
186
|
+
$[28] = t9;
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
t9 = $[28];
|
|
190
|
+
}
|
|
191
|
+
return t9;
|
|
88
192
|
};
|
|
89
|
-
const WysiwygEditor =
|
|
193
|
+
const WysiwygEditor = props => {
|
|
90
194
|
var _a, _b;
|
|
91
|
-
|
|
92
|
-
|
|
195
|
+
const $ = (0, compiler_runtime_1.c)(16);
|
|
196
|
+
const { ref } = props;
|
|
93
197
|
const isHydrated = (0, use_is_hydrated_1.useIsHydrated)();
|
|
94
198
|
if (!isHydrated) {
|
|
95
|
-
|
|
96
|
-
|
|
199
|
+
const t0 = `${CLASS_NAME} ${CLASS_NAME}--${classes_1.CLASSES.IS_LOADING} ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`;
|
|
200
|
+
let t1;
|
|
201
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
202
|
+
t1 = react_2.default.createElement(loader_1.Loader, { className: `${CLASS_NAME}__loader` });
|
|
203
|
+
$[0] = t1;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
t1 = $[0];
|
|
207
|
+
}
|
|
208
|
+
let t2;
|
|
209
|
+
if ($[1] !== t0) {
|
|
210
|
+
t2 = react_2.default.createElement("div", { className: t0 }, t1);
|
|
211
|
+
$[1] = t0;
|
|
212
|
+
$[2] = t2;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
t2 = $[2];
|
|
216
|
+
}
|
|
217
|
+
return t2;
|
|
218
|
+
}
|
|
219
|
+
const t0 = `${CLASS_NAME} ${(_b = props.className) !== null && _b !== void 0 ? _b : ""}`;
|
|
220
|
+
let t1;
|
|
221
|
+
if ($[3] !== props.customPluginsToolbarButtons || $[4] !== props.editableProps || $[5] !== props.id || $[6] !== props.initialValue || $[7] !== props.onChange || $[8] !== props.plugins || $[9] !== props.toolbarLeftElement || $[10] !== props.toolbarRightElement || $[11] !== ref) {
|
|
222
|
+
t1 = react_2.default.createElement(Editor, { customPluginsToolbarButtons: props.customPluginsToolbarButtons, editableProps: props.editableProps, id: props.id, initialValue: props.initialValue, onChange: props.onChange, plugins: props.plugins, ref: ref, toolbarLeftElement: props.toolbarLeftElement, toolbarRightElement: props.toolbarRightElement });
|
|
223
|
+
$[3] = props.customPluginsToolbarButtons;
|
|
224
|
+
$[4] = props.editableProps;
|
|
225
|
+
$[5] = props.id;
|
|
226
|
+
$[6] = props.initialValue;
|
|
227
|
+
$[7] = props.onChange;
|
|
228
|
+
$[8] = props.plugins;
|
|
229
|
+
$[9] = props.toolbarLeftElement;
|
|
230
|
+
$[10] = props.toolbarRightElement;
|
|
231
|
+
$[11] = ref;
|
|
232
|
+
$[12] = t1;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
t1 = $[12];
|
|
236
|
+
}
|
|
237
|
+
let t2;
|
|
238
|
+
if ($[13] !== t0 || $[14] !== t1) {
|
|
239
|
+
t2 = react_2.default.createElement("div", { className: t0 }, t1);
|
|
240
|
+
$[13] = t0;
|
|
241
|
+
$[14] = t1;
|
|
242
|
+
$[15] = t2;
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
t2 = $[15];
|
|
97
246
|
}
|
|
98
|
-
return
|
|
99
|
-
react_2.default.createElement(Editor, { customPluginsToolbarButtons: props.customPluginsToolbarButtons, editableProps: props.editableProps, id: props.id, initialValue: props.initialValue, onChange: props.onChange, plugins: props.plugins, ref: props.ref, toolbarLeftElement: props.toolbarLeftElement, toolbarRightElement: props.toolbarRightElement })));
|
|
247
|
+
return t2;
|
|
100
248
|
};
|
|
101
249
|
exports.WysiwygEditor = WysiwygEditor;
|