@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
|
@@ -37,167 +37,337 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
37
37
|
exports.initialValue = void 0;
|
|
38
38
|
exports.Playground = Playground;
|
|
39
39
|
exports.SelectedPlugins = SelectedPlugins;
|
|
40
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
40
41
|
const show_1 = require("@uxf/core-react/components/show");
|
|
41
42
|
const use_is_hydrated_1 = require("@uxf/core-react/hooks/use-is-hydrated");
|
|
42
43
|
const react_1 = __importStar(require("react"));
|
|
43
44
|
const wysiwyg_1 = require("@uxf/wysiwyg");
|
|
44
|
-
exports.initialValue = [
|
|
45
|
-
{
|
|
45
|
+
exports.initialValue = [{
|
|
46
46
|
type: "h1",
|
|
47
47
|
id: "mnlt6",
|
|
48
|
-
children: [{
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
children: [{
|
|
49
|
+
text: "Nadpis H1"
|
|
50
|
+
}]
|
|
51
|
+
}, {
|
|
51
52
|
type: "h2",
|
|
52
53
|
id: "feu6s",
|
|
53
|
-
children: [{
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
children: [{
|
|
55
|
+
text: "Nadpis H2"
|
|
56
|
+
}]
|
|
57
|
+
}, {
|
|
56
58
|
type: "h3",
|
|
57
59
|
id: "i9cb4",
|
|
58
|
-
children: [{
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
children: [{
|
|
61
|
+
text: "Nadpis H3"
|
|
62
|
+
}]
|
|
63
|
+
}, {
|
|
61
64
|
type: "h4",
|
|
62
65
|
id: "967c7",
|
|
63
|
-
children: [{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
children: [{
|
|
67
|
+
text: "Nadpis H4"
|
|
68
|
+
}]
|
|
69
|
+
}, {
|
|
66
70
|
type: "h5",
|
|
67
71
|
id: "4kyki",
|
|
68
|
-
children: [{
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
children: [{
|
|
73
|
+
text: "Nadpis H5"
|
|
74
|
+
}]
|
|
75
|
+
}, {
|
|
71
76
|
type: "h6",
|
|
72
77
|
id: "ximag",
|
|
73
|
-
children: [{
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
children: [{
|
|
79
|
+
text: "Nadpis H6"
|
|
80
|
+
}]
|
|
81
|
+
}, {
|
|
76
82
|
type: "paragraph",
|
|
77
83
|
id: "xnws3",
|
|
78
|
-
children: [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
children: [{
|
|
85
|
+
text: "Toto je odstavec. "
|
|
86
|
+
}, {
|
|
87
|
+
type: "link",
|
|
88
|
+
id: "j4bh1",
|
|
89
|
+
url: "https://uxf.cz",
|
|
90
|
+
target: "_blank",
|
|
91
|
+
children: [{
|
|
92
|
+
text: "uxf.cz"
|
|
93
|
+
}]
|
|
94
|
+
}, {
|
|
95
|
+
text: " "
|
|
96
|
+
}, {
|
|
97
|
+
text: "tučné ",
|
|
98
|
+
bold: true
|
|
99
|
+
}, {
|
|
100
|
+
text: "kurzíva ",
|
|
101
|
+
italic: true
|
|
102
|
+
}, {
|
|
103
|
+
text: "podtržení",
|
|
104
|
+
underline: true
|
|
105
|
+
}, {
|
|
106
|
+
text: " kód",
|
|
107
|
+
code: true
|
|
108
|
+
}, {
|
|
109
|
+
text: " "
|
|
110
|
+
}, {
|
|
111
|
+
text: "zvýraznění",
|
|
112
|
+
highlight: true
|
|
113
|
+
}]
|
|
114
|
+
}, {
|
|
91
115
|
type: "blockquote",
|
|
92
116
|
id: "imx33",
|
|
93
|
-
children: [{
|
|
94
|
-
|
|
95
|
-
|
|
117
|
+
children: [{
|
|
118
|
+
text: "Toto je citace."
|
|
119
|
+
}]
|
|
120
|
+
}, {
|
|
96
121
|
type: "ul",
|
|
97
122
|
id: "aq7rl",
|
|
98
|
-
children: [
|
|
99
|
-
{
|
|
123
|
+
children: [{
|
|
100
124
|
type: "li",
|
|
101
125
|
id: "b8ljb",
|
|
102
|
-
children: [
|
|
103
|
-
{
|
|
126
|
+
children: [{
|
|
104
127
|
type: "lic",
|
|
105
128
|
id: "az5v2",
|
|
106
|
-
children: [{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
{
|
|
129
|
+
children: [{
|
|
130
|
+
text: "Položka nečíslovaného seznamu"
|
|
131
|
+
}]
|
|
132
|
+
}]
|
|
133
|
+
}, {
|
|
111
134
|
type: "li",
|
|
112
135
|
id: "nq1e3",
|
|
113
|
-
children: [{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
136
|
+
children: [{
|
|
137
|
+
type: "lic",
|
|
138
|
+
id: "dp5er",
|
|
139
|
+
children: [{
|
|
140
|
+
text: "Druhá položka"
|
|
141
|
+
}]
|
|
142
|
+
}]
|
|
143
|
+
}]
|
|
144
|
+
}, {
|
|
118
145
|
type: "ol",
|
|
119
146
|
id: "hioy1",
|
|
120
|
-
children: [
|
|
121
|
-
{
|
|
147
|
+
children: [{
|
|
122
148
|
type: "li",
|
|
123
149
|
id: "wm2vd",
|
|
124
|
-
children: [{
|
|
125
|
-
|
|
126
|
-
|
|
150
|
+
children: [{
|
|
151
|
+
type: "lic",
|
|
152
|
+
id: "q5ynx",
|
|
153
|
+
children: [{
|
|
154
|
+
text: "Položka číslovaného seznamu"
|
|
155
|
+
}]
|
|
156
|
+
}]
|
|
157
|
+
}, {
|
|
127
158
|
type: "li",
|
|
128
159
|
id: "5qjr0",
|
|
129
|
-
children: [{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
160
|
+
children: [{
|
|
161
|
+
type: "lic",
|
|
162
|
+
id: "8u41x",
|
|
163
|
+
children: [{
|
|
164
|
+
text: "Druhá položka"
|
|
165
|
+
}]
|
|
166
|
+
}]
|
|
167
|
+
}]
|
|
168
|
+
}, {
|
|
134
169
|
type: "paragraph",
|
|
135
170
|
id: "9013p",
|
|
136
|
-
children: [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
|
-
];
|
|
171
|
+
children: [{
|
|
172
|
+
text: "Pokud vypneš nějaký plugin, zobrazení je nefunkční, ale v JSONu pořád je, protože je v initial values."
|
|
173
|
+
}]
|
|
174
|
+
}];
|
|
143
175
|
function Playground() {
|
|
176
|
+
const $ = (0, compiler_runtime_1.c)(11);
|
|
144
177
|
const [value, setValue] = (0, react_1.useState)(exports.initialValue);
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
(0, wysiwyg_1.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
]);
|
|
178
|
+
let t0;
|
|
179
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
180
|
+
t0 = (0, wysiwyg_1.createPluginsWithUi)([(0, wysiwyg_1.createHeadingsPluginWithUi)({
|
|
181
|
+
disabledLevels: [1]
|
|
182
|
+
}), (0, wysiwyg_1.createBoldPluginWithUi)(), (0, wysiwyg_1.createImagePluginWithUi)({
|
|
183
|
+
uploadImage: _temp,
|
|
184
|
+
getImageUrl: _temp2
|
|
185
|
+
}), (0, wysiwyg_1.createHighlightPluginWithUi)("red")]);
|
|
186
|
+
$[0] = t0;
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
t0 = $[0];
|
|
190
|
+
}
|
|
191
|
+
const plugins = t0;
|
|
160
192
|
const isHydrated = (0, use_is_hydrated_1.useIsHydrated)();
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
react_1.default.createElement(
|
|
164
|
-
|
|
165
|
-
|
|
193
|
+
let t1;
|
|
194
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
195
|
+
t1 = react_1.default.createElement(wysiwyg_1.WysiwygEditor, { id: "editor", initialValue: exports.initialValue, onChange: setValue, plugins: plugins });
|
|
196
|
+
$[1] = t1;
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
t1 = $[1];
|
|
200
|
+
}
|
|
201
|
+
let t2;
|
|
202
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
203
|
+
t2 = react_1.default.createElement("div", { "aria-hidden": "true", className: "absolute inset-0 flex items-center" },
|
|
204
|
+
react_1.default.createElement("div", { className: "w-full border-t border-gray-300" }));
|
|
205
|
+
$[2] = t2;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
t2 = $[2];
|
|
209
|
+
}
|
|
210
|
+
let t3;
|
|
211
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
212
|
+
t3 = react_1.default.createElement("div", { className: "relative mt-4" },
|
|
213
|
+
t2,
|
|
166
214
|
react_1.default.createElement("div", { className: "relative flex justify-center" },
|
|
167
|
-
react_1.default.createElement("span", { className: "bg-white px-2 text-sm text-gray-500" }, "Value")))
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
215
|
+
react_1.default.createElement("span", { className: "bg-white px-2 text-sm text-gray-500" }, "Value")));
|
|
216
|
+
$[3] = t3;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
t3 = $[3];
|
|
220
|
+
}
|
|
221
|
+
let t4;
|
|
222
|
+
if ($[4] !== value) {
|
|
223
|
+
t4 = JSON.stringify(value, null, " ");
|
|
224
|
+
$[4] = value;
|
|
225
|
+
$[5] = t4;
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
t4 = $[5];
|
|
229
|
+
}
|
|
230
|
+
let t5;
|
|
231
|
+
if ($[6] !== t4) {
|
|
232
|
+
t5 = react_1.default.createElement("pre", null,
|
|
233
|
+
react_1.default.createElement("code", null, t4));
|
|
234
|
+
$[6] = t4;
|
|
235
|
+
$[7] = t5;
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
t5 = $[7];
|
|
239
|
+
}
|
|
240
|
+
let t6;
|
|
241
|
+
if ($[8] !== isHydrated || $[9] !== t5) {
|
|
242
|
+
t6 = react_1.default.createElement(react_1.default.Fragment, null,
|
|
243
|
+
t1,
|
|
244
|
+
t3,
|
|
245
|
+
react_1.default.createElement(show_1.Show, { when: isHydrated }, t5));
|
|
246
|
+
$[8] = isHydrated;
|
|
247
|
+
$[9] = t5;
|
|
248
|
+
$[10] = t6;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
t6 = $[10];
|
|
252
|
+
}
|
|
253
|
+
return t6;
|
|
254
|
+
}
|
|
255
|
+
function _temp2(file_0) {
|
|
256
|
+
return file_0.name;
|
|
257
|
+
}
|
|
258
|
+
async function _temp(file) {
|
|
259
|
+
return {
|
|
260
|
+
id: 1,
|
|
261
|
+
name: URL.createObjectURL(file),
|
|
262
|
+
extension: ".ext",
|
|
263
|
+
namespace: "wysiwyg",
|
|
264
|
+
uuid: "this-should-be-some-random-uuid"
|
|
265
|
+
};
|
|
171
266
|
}
|
|
172
267
|
function SelectedPlugins() {
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
]
|
|
268
|
+
const $ = (0, compiler_runtime_1.c)(12);
|
|
269
|
+
let t0;
|
|
270
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
271
|
+
t0 = [{
|
|
272
|
+
type: "paragraph",
|
|
273
|
+
id: "mnlt6",
|
|
274
|
+
children: [{
|
|
275
|
+
text: "Pou\u017Eit\xED pouze vybran\xFDch plugin\u016F"
|
|
276
|
+
}]
|
|
277
|
+
}];
|
|
278
|
+
$[0] = t0;
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
t0 = $[0];
|
|
282
|
+
}
|
|
283
|
+
const _initialValues = t0;
|
|
176
284
|
const [value, setValue] = (0, react_1.useState)(_initialValues);
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
(0, wysiwyg_1.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
]);
|
|
285
|
+
let t1;
|
|
286
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
287
|
+
t1 = (0, wysiwyg_1.createPluginsWithUi)([(0, wysiwyg_1.createHeadingsPluginWithUi)({
|
|
288
|
+
disabledLevels: [1]
|
|
289
|
+
}), (0, wysiwyg_1.createBoldPluginWithUi)(), (0, wysiwyg_1.createImagePluginWithUi)({
|
|
290
|
+
uploadImage: _temp3,
|
|
291
|
+
getImageUrl: _temp4
|
|
292
|
+
}), (0, wysiwyg_1.createHighlightPluginWithUi)("red")]);
|
|
293
|
+
$[1] = t1;
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
t1 = $[1];
|
|
297
|
+
}
|
|
298
|
+
const plugins = t1;
|
|
192
299
|
const isHydrated = (0, use_is_hydrated_1.useIsHydrated)();
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
react_1.default.createElement(
|
|
196
|
-
|
|
197
|
-
|
|
300
|
+
let t2;
|
|
301
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
302
|
+
t2 = react_1.default.createElement(wysiwyg_1.WysiwygEditor, { id: "editor", initialValue: _initialValues, onChange: setValue, plugins: plugins });
|
|
303
|
+
$[2] = t2;
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
t2 = $[2];
|
|
307
|
+
}
|
|
308
|
+
let t3;
|
|
309
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
310
|
+
t3 = react_1.default.createElement("div", { "aria-hidden": "true", className: "absolute inset-0 flex items-center" },
|
|
311
|
+
react_1.default.createElement("div", { className: "w-full border-t border-gray-300" }));
|
|
312
|
+
$[3] = t3;
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
t3 = $[3];
|
|
316
|
+
}
|
|
317
|
+
let t4;
|
|
318
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
319
|
+
t4 = react_1.default.createElement("div", { className: "relative mt-4" },
|
|
320
|
+
t3,
|
|
198
321
|
react_1.default.createElement("div", { className: "relative flex justify-center" },
|
|
199
|
-
react_1.default.createElement("span", { className: "bg-white px-2 text-sm text-gray-500" }, "Value")))
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
322
|
+
react_1.default.createElement("span", { className: "bg-white px-2 text-sm text-gray-500" }, "Value")));
|
|
323
|
+
$[4] = t4;
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
t4 = $[4];
|
|
327
|
+
}
|
|
328
|
+
let t5;
|
|
329
|
+
if ($[5] !== value) {
|
|
330
|
+
t5 = JSON.stringify(value, null, " ");
|
|
331
|
+
$[5] = value;
|
|
332
|
+
$[6] = t5;
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
t5 = $[6];
|
|
336
|
+
}
|
|
337
|
+
let t6;
|
|
338
|
+
if ($[7] !== t5) {
|
|
339
|
+
t6 = react_1.default.createElement("pre", null,
|
|
340
|
+
react_1.default.createElement("code", null, t5));
|
|
341
|
+
$[7] = t5;
|
|
342
|
+
$[8] = t6;
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
t6 = $[8];
|
|
346
|
+
}
|
|
347
|
+
let t7;
|
|
348
|
+
if ($[9] !== isHydrated || $[10] !== t6) {
|
|
349
|
+
t7 = react_1.default.createElement(react_1.default.Fragment, null,
|
|
350
|
+
t2,
|
|
351
|
+
t4,
|
|
352
|
+
react_1.default.createElement(show_1.Show, { when: isHydrated }, t6));
|
|
353
|
+
$[9] = isHydrated;
|
|
354
|
+
$[10] = t6;
|
|
355
|
+
$[11] = t7;
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
t7 = $[11];
|
|
359
|
+
}
|
|
360
|
+
return t7;
|
|
361
|
+
}
|
|
362
|
+
function _temp4(file_0) {
|
|
363
|
+
return file_0.name;
|
|
364
|
+
}
|
|
365
|
+
async function _temp3(file) {
|
|
366
|
+
return {
|
|
367
|
+
id: 1,
|
|
368
|
+
name: URL.createObjectURL(file),
|
|
369
|
+
extension: ".ext",
|
|
370
|
+
namespace: "wysiwyg",
|
|
371
|
+
uuid: "this-should-be-some-random-uuid"
|
|
372
|
+
};
|
|
203
373
|
}
|