@layers-app/editor 0.5.8-optimization → 0.5.10-optimization
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/README.md +0 -19
- package/dist/ExcalidrawComponent-D7Z_2awF.cjs +1 -0
- package/dist/ExcalidrawComponent-Re4zFgLg.js +283 -0
- package/dist/InlineImageComponent-DHgCaPNk.cjs +1 -0
- package/dist/InlineImageComponent-kXhZcmF6.js +265 -0
- package/dist/collaboration-C7xVk0Zj.cjs +4 -0
- package/dist/collaboration-Cn7KizEJ.js +5997 -0
- package/dist/excalidraw-C-6bid_P.js +16497 -0
- package/dist/excalidraw-DpwKTNBz.cjs +574 -0
- package/dist/index-B4yOqKUQ.cjs +1 -0
- package/dist/index-BZu8Qnrg.cjs +1 -0
- package/dist/index-CFA9Drk2.cjs +16 -0
- package/dist/index-CX5msaMB.js +296 -0
- package/dist/index-CbQX0N2c.js +136 -0
- package/dist/index-DEC5JR_F.js +60 -0
- package/dist/index-Dan3tqoj.cjs +1 -0
- package/dist/index-WCOc4LNL.js +16600 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +12 -13
- package/dist/lexical-2rxs76dr.cjs +41 -0
- package/dist/lexical-C60GkwxR.js +13122 -0
- package/dist/lexical-code-DKIWiZdJ.js +604 -0
- package/dist/lexical-code-VafvPacU.cjs +9 -0
- package/dist/lexical-collab-1tX9tFVC.js +1025 -0
- package/dist/lexical-collab-Nk2LVpJv.cjs +1 -0
- package/dist/lexical-file-C52Mze5k.cjs +1 -0
- package/dist/lexical-file-DjHP4vVw.js +43 -0
- package/dist/lexical-markdown-BSl_ahWw.cjs +12 -0
- package/dist/lexical-markdown-DcEwQQba.js +488 -0
- package/dist/lodash-3PEMjFQT.cjs +1 -0
- package/dist/lodash-jftOdrxX.js +711 -0
- package/dist/stats.html +4949 -0
- package/dist/vendor-BrXDSyZX.js +136433 -0
- package/dist/vendor-Bt6Lma3y.cjs +2469 -0
- package/package.json +42 -74
- package/dist/layers.8yssqxrI.js +0 -6774
- package/dist/layers.B8z-e4Vg.js +0 -7
- package/dist/layers.BQLznd92.js +0 -4
- package/dist/layers.BVRvG1mv.js +0 -3
- package/dist/layers.BjCQNcdJ.js +0 -341
- package/dist/layers.BnVn2uMi.js +0 -7723
- package/dist/layers.CLcioDq5.js +0 -2511
- package/dist/layers.CTSBFg3j.js +0 -1
- package/dist/layers.CoCZDINv.js +0 -864
- package/dist/layers.D0ZtUpST.js +0 -2
- package/dist/layers.D2zjLyjP.js +0 -6
- package/dist/layers.DNCgFYS7.js +0 -27
- package/dist/layers.Dt_Jdn4Y.js +0 -2227
- package/dist/layers.DwX5sVtx.js +0 -1
- package/dist/layers.QjAkD17S.js +0 -3677
- package/dist/layers.pre7B8K-.js +0 -530
package/dist/layers.BjCQNcdJ.js
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { useContext as c, useEffect as m, useMemo as S } from "react";
|
|
2
|
-
import { useTranslation as l } from "react-i18next";
|
|
3
|
-
import { useLexicalComposerContext as h } from "@lexical/react/LexicalComposerContext";
|
|
4
|
-
import { createCommand as d, COMMAND_PRIORITY_LOW as p, $isRootNode as x, $isElementNode as A, $getRoot as E, ParagraphNode as O } from "lexical";
|
|
5
|
-
import { showMessageNotification as g, showErrorNotification as M, FilePicker as D } from "@layers-app/shared";
|
|
6
|
-
import { C as u } from "./layers.Dt_Jdn4Y.js";
|
|
7
|
-
import { h as T, i as w, V as P, j as y, I as L, k as U, l as z, L as V, m as $, n as R, F as W, o as G } from "./layers.BnVn2uMi.js";
|
|
8
|
-
import "@lexical/code";
|
|
9
|
-
import "@lexical/hashtag";
|
|
10
|
-
import "@lexical/link";
|
|
11
|
-
import "@lexical/mark";
|
|
12
|
-
import "@lexical/overflow";
|
|
13
|
-
import "@lexical/react/LexicalHorizontalRuleNode";
|
|
14
|
-
import "@lexical/rich-text";
|
|
15
|
-
import { i as Z } from "./layers.pre7B8K-.js";
|
|
16
|
-
import { jsx as j } from "react/jsx-runtime";
|
|
17
|
-
const v = d(
|
|
18
|
-
"INSERT_MUSIC_COMMAND"
|
|
19
|
-
), Y = d("UPLOAD_MUSIC_COMMAND");
|
|
20
|
-
function pe() {
|
|
21
|
-
const [e] = h(), { t } = l(), { imperativeHandleRef: o, maxFileSize: n } = c(u);
|
|
22
|
-
return m(() => {
|
|
23
|
-
if (!e.hasNodes([T]))
|
|
24
|
-
throw new Error("MusicPlugin: MusicNode not registered on editor");
|
|
25
|
-
const i = (r) => {
|
|
26
|
-
const a = r.filter((s) => s.type.includes("Music/"));
|
|
27
|
-
if (r.length > 1) {
|
|
28
|
-
g({
|
|
29
|
-
message: t("editor.validation.doNotUploadMoreThanSingleFile")
|
|
30
|
-
});
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (a[0].size > n * 1024 * 1024) {
|
|
34
|
-
M({
|
|
35
|
-
message: t("editor.validation.shouldNotExceed", {
|
|
36
|
-
maxSize: n
|
|
37
|
-
})
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
e.dispatchCommand(v, "upload"), setTimeout(() => {
|
|
42
|
-
e.dispatchCommand(Y, r);
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
return o != null && o.current && (o.current.insertMusics = i), e.registerCommand(
|
|
46
|
-
v,
|
|
47
|
-
(r) => {
|
|
48
|
-
const s = w(r === "upload" ? "" : r, r !== "upload");
|
|
49
|
-
return f(s), !1;
|
|
50
|
-
},
|
|
51
|
-
p
|
|
52
|
-
);
|
|
53
|
-
}, [e]), null;
|
|
54
|
-
}
|
|
55
|
-
function ge(e, t = !1) {
|
|
56
|
-
const o = e.match(
|
|
57
|
-
/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/
|
|
58
|
-
);
|
|
59
|
-
if (o && o[2].length === 11)
|
|
60
|
-
return { platform: "youtube", id: o[2] };
|
|
61
|
-
const n = e.match(
|
|
62
|
-
/vk\.com\/video(?:_ext\.php\?oid=-?(\d+)&id=(\d+)|-(\d+)_(\d+))/
|
|
63
|
-
);
|
|
64
|
-
if (n) {
|
|
65
|
-
const a = n[1] || n[3], s = n[2] || n[4];
|
|
66
|
-
return { platform: "vk", id: `${a}-${s}` };
|
|
67
|
-
}
|
|
68
|
-
const i = e.match(
|
|
69
|
-
/rutube\.ru\/(?:play\/embed|video)\/([a-zA-Z0-9]+)/
|
|
70
|
-
);
|
|
71
|
-
if (i)
|
|
72
|
-
return { platform: "rutube", id: i[1] };
|
|
73
|
-
if (e === "upload")
|
|
74
|
-
return {
|
|
75
|
-
platform: "upload",
|
|
76
|
-
id: null
|
|
77
|
-
};
|
|
78
|
-
if (t)
|
|
79
|
-
return {
|
|
80
|
-
platform: "link",
|
|
81
|
-
id: e
|
|
82
|
-
};
|
|
83
|
-
const r = e.split("/").pop();
|
|
84
|
-
return r ? { platform: "download", id: r } : { platform: "unknown", id: null };
|
|
85
|
-
}
|
|
86
|
-
function q(e, t) {
|
|
87
|
-
let o = "";
|
|
88
|
-
switch (e) {
|
|
89
|
-
case "youtube":
|
|
90
|
-
o = `https://www.youtube-nocookie.com/embed/${t}`;
|
|
91
|
-
break;
|
|
92
|
-
case "download":
|
|
93
|
-
o = `${t}`;
|
|
94
|
-
break;
|
|
95
|
-
case "vk":
|
|
96
|
-
const n = t.split("-");
|
|
97
|
-
o = `https://vk.com/video_ext.php?oid=-${n[0]}&id=${n[1]}`;
|
|
98
|
-
break;
|
|
99
|
-
case "link":
|
|
100
|
-
o = t;
|
|
101
|
-
break;
|
|
102
|
-
case "rutube":
|
|
103
|
-
o = `https://rutube.ru/play/embed/${t}`;
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
return o;
|
|
107
|
-
}
|
|
108
|
-
function Me(e, t) {
|
|
109
|
-
const o = q(e, t);
|
|
110
|
-
return o.startsWith("http://") || o.startsWith("https://") ? { src: o } : { attachmentId: o };
|
|
111
|
-
}
|
|
112
|
-
function fe(e) {
|
|
113
|
-
const t = e.match(
|
|
114
|
-
/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/
|
|
115
|
-
);
|
|
116
|
-
return !!(t && t[2].length === 11 || e.match(
|
|
117
|
-
/vk\.com\/video(?:_ext\.php\?oid=-?(\d+)&id=(\d+)|-(\d+)_(\d+))/
|
|
118
|
-
) || e.match(
|
|
119
|
-
/rutube\.ru\/(?:play\/embed|video)\/([a-zA-Z0-9]+)/
|
|
120
|
-
) || e.match(/\.(mp4|webm|ogg|mov|avi|mkv)(\?.*)?$/i));
|
|
121
|
-
}
|
|
122
|
-
const k = d(
|
|
123
|
-
"INSERT_VIDEO_COMMAND"
|
|
124
|
-
), B = d("UPLOAD_VIDEO_COMMAND");
|
|
125
|
-
function Ce() {
|
|
126
|
-
const [e] = h(), { t } = l(), { imperativeHandleRef: o, maxFileSize: n } = c(u);
|
|
127
|
-
return m(() => {
|
|
128
|
-
if (!e.hasNodes([P]))
|
|
129
|
-
throw new Error("VideoPlugin: VideoNode not registered on editor");
|
|
130
|
-
const i = (r) => {
|
|
131
|
-
const a = r.filter((s) => s.type.includes("video/"));
|
|
132
|
-
if (r.length > 1) {
|
|
133
|
-
g({
|
|
134
|
-
message: t("editor.validation.doNotUploadMoreThanSingleFile")
|
|
135
|
-
});
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (a[0].size > n * 1024 * 1024) {
|
|
139
|
-
M({
|
|
140
|
-
message: t("editor.validation.shouldNotExceed", {
|
|
141
|
-
maxSize: n
|
|
142
|
-
})
|
|
143
|
-
});
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
e.dispatchCommand(k, "upload"), setTimeout(() => {
|
|
147
|
-
e.dispatchCommand(B, r);
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
return o != null && o.current && (o.current.insertVideos = i), e.registerCommand(
|
|
151
|
-
k,
|
|
152
|
-
(r) => {
|
|
153
|
-
const a = y(
|
|
154
|
-
r,
|
|
155
|
-
"100%",
|
|
156
|
-
"100%",
|
|
157
|
-
"left",
|
|
158
|
-
r !== "upload"
|
|
159
|
-
);
|
|
160
|
-
return f(a), !1;
|
|
161
|
-
},
|
|
162
|
-
p
|
|
163
|
-
);
|
|
164
|
-
}, [e]), null;
|
|
165
|
-
}
|
|
166
|
-
const I = d("INSERT_IMAGE_COMMAND"), J = d("UPLOAD_IMAGE_COMMAND");
|
|
167
|
-
function Ne() {
|
|
168
|
-
const [e] = h(), { t } = l(), { imperativeHandleRef: o } = c(u), { maxFileSize: n } = c(u);
|
|
169
|
-
return m(() => {
|
|
170
|
-
if (!e.hasNodes([L]))
|
|
171
|
-
throw new Error("ImageOlugin: FileNode not registered on editor");
|
|
172
|
-
const i = (r) => {
|
|
173
|
-
if (r.length > 1) {
|
|
174
|
-
g({
|
|
175
|
-
message: t("editor.validation.doNotUploadMoreThanSingleFile")
|
|
176
|
-
});
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (r[0].size > n * 1024 * 1024) {
|
|
180
|
-
M({
|
|
181
|
-
message: t("editor.validation.shouldNotExceed", {
|
|
182
|
-
maxSize: n
|
|
183
|
-
})
|
|
184
|
-
});
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
e.dispatchCommand(I, {
|
|
188
|
-
src: "upload",
|
|
189
|
-
create: !1,
|
|
190
|
-
altText: ""
|
|
191
|
-
}), setTimeout(() => {
|
|
192
|
-
e.dispatchCommand(J, r);
|
|
193
|
-
}, 100);
|
|
194
|
-
};
|
|
195
|
-
return o != null && o.current && (o.current.insertImages = i), e.registerCommand(
|
|
196
|
-
I,
|
|
197
|
-
(r) => {
|
|
198
|
-
const a = U(r);
|
|
199
|
-
return f(a), !1;
|
|
200
|
-
},
|
|
201
|
-
p
|
|
202
|
-
);
|
|
203
|
-
}, [e]), null;
|
|
204
|
-
}
|
|
205
|
-
const f = (e) => {
|
|
206
|
-
var a;
|
|
207
|
-
const t = Z();
|
|
208
|
-
if (x(t))
|
|
209
|
-
return t.append(e), !0;
|
|
210
|
-
let o = t == null ? void 0 : t.getParent();
|
|
211
|
-
const n = o instanceof O || o instanceof $ || o instanceof R, i = t instanceof z && !!t.__text, r = A(t) && (t == null ? void 0 : t.getChildrenSize()) > 0;
|
|
212
|
-
if (r && (o = t), n && i || n || r)
|
|
213
|
-
return o.insertAfter(e), !0;
|
|
214
|
-
if (t && o)
|
|
215
|
-
return t instanceof V ? ((a = t.getPreviousSibling()) == null || a.replace(e), !0) : (t == null || t.replace(e), !0);
|
|
216
|
-
if (!t)
|
|
217
|
-
return E().append(e), !0;
|
|
218
|
-
}, b = d(
|
|
219
|
-
"INSERT_FILE_COMMAND"
|
|
220
|
-
), K = d("UPLOAD_FILE_COMMAND");
|
|
221
|
-
function ve() {
|
|
222
|
-
const [e] = h(), { t } = l(), { imperativeHandleRef: o, maxFileSize: n } = c(u);
|
|
223
|
-
return m(() => {
|
|
224
|
-
if (!e.hasNodes([W]))
|
|
225
|
-
throw new Error("FilePlugin: FileNode not registered on editor");
|
|
226
|
-
const i = (r) => {
|
|
227
|
-
if (r.length > 1) {
|
|
228
|
-
g({
|
|
229
|
-
message: t("editor.validation.doNotUploadMoreThanSingleFile")
|
|
230
|
-
});
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
if (r[0].size > n * 1024 * 1024) {
|
|
234
|
-
M({
|
|
235
|
-
message: t("editor.validation.shouldNotExceed", {
|
|
236
|
-
maxSize: n
|
|
237
|
-
})
|
|
238
|
-
});
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
e.dispatchCommand(b, "upload"), setTimeout(() => {
|
|
242
|
-
e.dispatchCommand(K, r);
|
|
243
|
-
});
|
|
244
|
-
};
|
|
245
|
-
return o != null && o.current && (o.current.insertFiles = i), e.registerCommand(
|
|
246
|
-
b,
|
|
247
|
-
(r) => {
|
|
248
|
-
const a = G(
|
|
249
|
-
r,
|
|
250
|
-
"100%",
|
|
251
|
-
"100%",
|
|
252
|
-
"left",
|
|
253
|
-
r !== "upload"
|
|
254
|
-
);
|
|
255
|
-
return f(a), !1;
|
|
256
|
-
},
|
|
257
|
-
p
|
|
258
|
-
);
|
|
259
|
-
}, [e]), null;
|
|
260
|
-
}
|
|
261
|
-
const ke = ({
|
|
262
|
-
children: e,
|
|
263
|
-
...t
|
|
264
|
-
}) => {
|
|
265
|
-
const { imagePickerSettings: o, maxFileSize: n } = c(u), { t: i } = l("ui"), { giphyToken: r, unsplashClientId: a, link: s, download: N, maxUploadFiles: _ } = o, F = S(() => [
|
|
266
|
-
{ key: "gallery", enabled: !0 },
|
|
267
|
-
{ key: "giphy", enabled: r },
|
|
268
|
-
{
|
|
269
|
-
key: "unsplash",
|
|
270
|
-
enabled: a
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
key: "link",
|
|
274
|
-
enabled: s === void 0 ? !0 : s
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
key: "upload",
|
|
278
|
-
enabled: N === void 0 ? !0 : N
|
|
279
|
-
}
|
|
280
|
-
].filter((C) => C.enabled).map((C) => C.key), [o]);
|
|
281
|
-
return /* @__PURE__ */ j(
|
|
282
|
-
D,
|
|
283
|
-
{
|
|
284
|
-
showTabs: F,
|
|
285
|
-
dropZoneProps: {
|
|
286
|
-
maxFiles: _ || 1,
|
|
287
|
-
maxSize: n * 1024 * 1024
|
|
288
|
-
},
|
|
289
|
-
giphyToken: r,
|
|
290
|
-
unsplashClientId: a,
|
|
291
|
-
locales: {
|
|
292
|
-
gallery: i("changeCover.gallery"),
|
|
293
|
-
link: i("changeCover.link"),
|
|
294
|
-
search: i("changeCover.searchImage"),
|
|
295
|
-
upload: i("changeCover.upload"),
|
|
296
|
-
uploadFile: i("changeCover.uploadFile"),
|
|
297
|
-
change: i("changeCover.change"),
|
|
298
|
-
remove: i("remove"),
|
|
299
|
-
error: i("errorMessage"),
|
|
300
|
-
dragOrClickToChoose: i("changeCover.dragOrClickToChoose"),
|
|
301
|
-
// loadMore: t('changeCover.loadMore'),
|
|
302
|
-
maxFileSize: i("changeCover.maxFileSize", { maxSize: n }),
|
|
303
|
-
pasteLink: i("changeCover.pasteLink"),
|
|
304
|
-
submitLink: i("changeCover.submitLink"),
|
|
305
|
-
worksWithAnyImage: i("changeCover.worksWithAnyImage"),
|
|
306
|
-
noImages: i("changeCover.noResult"),
|
|
307
|
-
errors: {
|
|
308
|
-
typeIsNotAllowed: "This file type is not supported",
|
|
309
|
-
shouldNotExceed: i("changeCover.maxFileSize", {
|
|
310
|
-
maxSize: n
|
|
311
|
-
}),
|
|
312
|
-
doNotUploadMoreThanSingleFile: i(
|
|
313
|
-
"dropZone.errors.doNotUploadMoreThanSingleFile"
|
|
314
|
-
),
|
|
315
|
-
invalidLink: i("changeCover.invalidLink")
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
|
-
...t,
|
|
319
|
-
children: e
|
|
320
|
-
}
|
|
321
|
-
);
|
|
322
|
-
};
|
|
323
|
-
export {
|
|
324
|
-
ve as F,
|
|
325
|
-
ke as I,
|
|
326
|
-
pe as M,
|
|
327
|
-
Y as U,
|
|
328
|
-
Ce as V,
|
|
329
|
-
Ne as a,
|
|
330
|
-
B as b,
|
|
331
|
-
q as c,
|
|
332
|
-
K as d,
|
|
333
|
-
J as e,
|
|
334
|
-
I as f,
|
|
335
|
-
Me as g,
|
|
336
|
-
k as h,
|
|
337
|
-
fe as i,
|
|
338
|
-
v as j,
|
|
339
|
-
b as k,
|
|
340
|
-
ge as p
|
|
341
|
-
};
|