@layers-app/editor 0.5.4-optimization → 0.5.5-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.
Files changed (137) hide show
  1. package/dist/index.cjs +2 -0
  2. package/dist/index.js +12 -10
  3. package/dist/layers.B10sB-Vy.js +1 -0
  4. package/dist/layers.BDsvvINb.js +6774 -0
  5. package/dist/layers.BFJ7oQiY.js +7723 -0
  6. package/dist/layers.BwyONivc.js +864 -0
  7. package/dist/layers.C2lacXcg.js +2511 -0
  8. package/dist/layers.C69TrYD7.js +7 -0
  9. package/dist/layers.CEMW9z_P.js +4 -0
  10. package/dist/layers.Cwao1pOZ.js +6 -0
  11. package/dist/layers.CzNz0Zya.js +1 -0
  12. package/dist/layers.D0Z-zLAV.js +530 -0
  13. package/dist/layers.DNCgFYS7.js +27 -0
  14. package/dist/layers.EKDSoJm1.js +2227 -0
  15. package/dist/layers.QjAkD17S.js +3677 -0
  16. package/dist/layers.ahDFHQXD.js +341 -0
  17. package/dist/layers.eLiGm-eZ.js +3 -0
  18. package/dist/layers.hgliNTDV.js +2 -0
  19. package/package.json +74 -17
  20. package/dist/layers.0EAb8Ajx.js +0 -65
  21. package/dist/layers.1Mvzm38Y.js +0 -501
  22. package/dist/layers.2wIERhxO.js +0 -41
  23. package/dist/layers.694DrE1_.js +0 -931
  24. package/dist/layers.7JqFgE4-.js +0 -15
  25. package/dist/layers.B-5aeeDH.js +0 -1359
  26. package/dist/layers.B0winug5.js +0 -59
  27. package/dist/layers.B1S8ufDn.js +0 -40
  28. package/dist/layers.B3JNY9Km.js +0 -42
  29. package/dist/layers.B6W2tqC0.js +0 -40
  30. package/dist/layers.B7Olyhe8.js +0 -1089
  31. package/dist/layers.BCuuRSaf.js +0 -37
  32. package/dist/layers.BESPlBGC.js +0 -32
  33. package/dist/layers.BJDrjORS.js +0 -244
  34. package/dist/layers.BJTh7mUo.js +0 -1265
  35. package/dist/layers.BLL-019k.js +0 -39
  36. package/dist/layers.BNJiP8Pw.js +0 -2966
  37. package/dist/layers.BNvAl5dS.js +0 -14
  38. package/dist/layers.BThP74aw.js +0 -32
  39. package/dist/layers.BZ4laUeR.js +0 -40
  40. package/dist/layers.BZByPNdY.js +0 -37
  41. package/dist/layers.B_5zMrI3.js +0 -38
  42. package/dist/layers.B_7N5yjX.js +0 -32
  43. package/dist/layers.BbCfEXyj.js +0 -55
  44. package/dist/layers.BdvfoI4U.js +0 -44
  45. package/dist/layers.BiJ8hfRt.js +0 -1510
  46. package/dist/layers.BiJBOHr0.js +0 -84
  47. package/dist/layers.Bk3_8qR9.js +0 -48146
  48. package/dist/layers.BkPPOKBy.js +0 -32
  49. package/dist/layers.BnZcjRLr.js +0 -32
  50. package/dist/layers.BpilXLfW.js +0 -6
  51. package/dist/layers.BqpcWKH6.js +0 -2479
  52. package/dist/layers.Br7D0wMN.js +0 -39
  53. package/dist/layers.BsAu1GXs.js +0 -42
  54. package/dist/layers.Bv5sK47C.js +0 -769
  55. package/dist/layers.BxEdkUpI.js +0 -1088
  56. package/dist/layers.BxUBbVsO.js +0 -41
  57. package/dist/layers.Bzalhqz_.js +0 -39
  58. package/dist/layers.C-dS7ntQ.js +0 -41
  59. package/dist/layers.C0Lgw_Sx.js +0 -11688
  60. package/dist/layers.C5BFsvzI.js +0 -803
  61. package/dist/layers.C5WLg9ed.js +0 -21763
  62. package/dist/layers.C6lAFlKZ.js +0 -186
  63. package/dist/layers.C8_lu5UH.js +0 -23
  64. package/dist/layers.CGwNL7dH.js +0 -791
  65. package/dist/layers.CI739wqN.js +0 -39
  66. package/dist/layers.CKaj4dG4.js +0 -41
  67. package/dist/layers.CLRiSwgi.js +0 -904
  68. package/dist/layers.CN1QkD6D.js +0 -38
  69. package/dist/layers.CPY6U3g-.js +0 -1034
  70. package/dist/layers.CRSjdIG6.js +0 -1619
  71. package/dist/layers.CUHkTCid.js +0 -6
  72. package/dist/layers.CUPMw0sy.js +0 -40
  73. package/dist/layers.CWb6LiAY.js +0 -40
  74. package/dist/layers.C_XsSNQo.js +0 -42
  75. package/dist/layers.CbmlFoXt.js +0 -33
  76. package/dist/layers.CfGeHh-g.js +0 -36
  77. package/dist/layers.CiJxVu9b.js +0 -36
  78. package/dist/layers.Cj4ezyVr.js +0 -33
  79. package/dist/layers.Cpb-MRZn.js +0 -960
  80. package/dist/layers.CqVTtuYm.js +0 -6
  81. package/dist/layers.CskURloi.js +0 -39
  82. package/dist/layers.CtTD47i4.js +0 -41
  83. package/dist/layers.CxcvEfKe.js +0 -36
  84. package/dist/layers.D-U9uIsP.js +0 -40
  85. package/dist/layers.D10WeKck.js +0 -2235
  86. package/dist/layers.D4T8fTcj.js +0 -1223
  87. package/dist/layers.D4jK2Tet.js +0 -39
  88. package/dist/layers.D7jGxypv.js +0 -8
  89. package/dist/layers.DBosqi2D.js +0 -19
  90. package/dist/layers.DGtETOVJ.js +0 -304
  91. package/dist/layers.DKENAsMv.js +0 -220
  92. package/dist/layers.DLwuMfdd.js +0 -84
  93. package/dist/layers.DN9HoVxI.js +0 -18
  94. package/dist/layers.DOBSfaUM.js +0 -35
  95. package/dist/layers.DOKLQ6A3.js +0 -373
  96. package/dist/layers.DPuVWH3L.js +0 -40
  97. package/dist/layers.DQVXh43C.js +0 -42
  98. package/dist/layers.DSTh89J8.js +0 -42
  99. package/dist/layers.DUsIfvNt.js +0 -46859
  100. package/dist/layers.DVfpGIrv.js +0 -41
  101. package/dist/layers.DWSkLlGf.js +0 -41
  102. package/dist/layers.DX1RI3m3.js +0 -32
  103. package/dist/layers.DdMwmP4m.js +0 -37
  104. package/dist/layers.DhkyREpW.js +0 -793
  105. package/dist/layers.Dj-f1_6N.js +0 -34
  106. package/dist/layers.DjUOC4st.js +0 -16
  107. package/dist/layers.DjhJT1nZ.js +0 -21938
  108. package/dist/layers.Djl9Gz6s.js +0 -282
  109. package/dist/layers.Dn2AP7iE.js +0 -1283
  110. package/dist/layers.Dqbek_0L.js +0 -40
  111. package/dist/layers.DsDjOLHs.js +0 -437
  112. package/dist/layers.DsOaqGXW.js +0 -8
  113. package/dist/layers.DuE1l7lR.js +0 -41
  114. package/dist/layers.DxA6ocdw.js +0 -70
  115. package/dist/layers.DxHlP7Pb.js +0 -39
  116. package/dist/layers.Dy1naDTQ.js +0 -14
  117. package/dist/layers.DyZ5R-vS.js +0 -37
  118. package/dist/layers.H2Kl_PC2.js +0 -40
  119. package/dist/layers.IW4NBP9k.js +0 -39
  120. package/dist/layers.LGx1jmqd.js +0 -40
  121. package/dist/layers.NABwYdw5.js +0 -35
  122. package/dist/layers.NtwvbkGN.js +0 -1580
  123. package/dist/layers.O-bFTk-n.js +0 -268
  124. package/dist/layers.R_udKe_N.js +0 -38
  125. package/dist/layers.TdTDbIzb.js +0 -1126
  126. package/dist/layers.WLeJl9el.js +0 -202
  127. package/dist/layers.b0h5ZBmD.js +0 -61
  128. package/dist/layers.dEHKcy8J.js +0 -320
  129. package/dist/layers.eTredPK_.js +0 -36
  130. package/dist/layers.gIdzfQAa.js +0 -5
  131. package/dist/layers.huV95Ipe.js +0 -295
  132. package/dist/layers.jU4W5PG5.js +0 -9166
  133. package/dist/layers.lCpg7dOn.js +0 -21
  134. package/dist/layers.mQcENPPW.js +0 -802
  135. package/dist/layers.nPQCmYXI.js +0 -423
  136. package/dist/layers.ntC1foLT.js +0 -39
  137. package/dist/layers.uHy1yMbq.js +0 -6
@@ -0,0 +1,341 @@
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.EKDSoJm1.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.BFJ7oQiY.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.D0Z-zLAV.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
+ };