eddyter 1.3.76 → 1.3.77
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/dist/Provider/EditorProvider.d.ts +12 -0
- package/dist/api/auth.d.ts +10 -0
- package/dist/api/bugReport.d.ts +2 -0
- package/dist/assets/style.css +1 -1
- package/dist/components/ImageView/ImageCropDialog.d.ts +18 -0
- package/dist/components/LockedFeature/LockedFeature.d.ts +4 -0
- package/dist/config/env.d.ts +1 -0
- package/dist/editorConfig.d.ts +1 -0
- package/dist/{generateDocxThumbnail-BbSs-3CJ.js → generateDocxThumbnail-Du6zd_sv.js} +1 -1
- package/dist/{generatePdfThumbnail-U8R2yu3J.js → generatePdfThumbnail-DdNHlnr8.js} +3 -3
- package/dist/{generateXlsxThumbnail-BUwuqsXR.js → generateXlsxThumbnail-VFzuEJln.js} +1 -1
- package/dist/{html2pdf.bundle.min-Css6bHHm.js → html2pdf.bundle.min-4S-fQVxW.js} +1 -1
- package/dist/index-BUrH5xJk.js +1498 -0
- package/dist/{index-CVEa0GRe.js → index-DCBdbL8A.js} +29 -29
- package/dist/{index-CCVZobcV.js → index-DSNo50FN.js} +15 -15
- package/dist/{index-DjD3NbU0.js → index-Dh3DFyBT.js} +11690 -11381
- package/dist/index.js +1 -1
- package/dist/nodes/EmbedNode.d.ts +2 -1
- package/dist/types.d.ts +2 -0
- package/dist/utils/cropUrl.d.ts +28 -0
- package/dist/utils/export.d.ts +5 -0
- package/package.json +6 -5
- package/dist/index-DTkM3xiE.js +0 -848
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { jsx as i, jsxs as p } from "react/jsx-runtime";
|
|
2
2
|
import { useLexicalComposerContext as U } from "@lexical/react/LexicalComposerContext";
|
|
3
3
|
import { $getNodeByKey as v } from "lexical";
|
|
4
|
-
import { useState as N, useEffect as
|
|
5
|
-
import {
|
|
4
|
+
import { useState as N, useEffect as y } from "react";
|
|
5
|
+
import { v as w, w as L, x as E, F as g, y as j, z as B } from "./index-Dh3DFyBT.js";
|
|
6
6
|
function W(t, e) {
|
|
7
7
|
const l = t.split(".").pop()?.toLowerCase();
|
|
8
8
|
return l === "pdf" || e.startsWith("data:application/pdf") ? "pdf" : l === "docx" || e.startsWith("data:application/vnd.openxmlformats") && t.toLowerCase().endsWith(".docx") ? "docx" : l === "xlsx" || l === "xls" || e.startsWith("data:application/vnd.openxmlformats-officedocument.spreadsheetml") || e.startsWith("data:application/vnd.ms-excel") ? "xlsx" : null;
|
|
9
9
|
}
|
|
10
10
|
function $(t, e) {
|
|
11
11
|
const [l, d] = N(null);
|
|
12
|
-
return
|
|
12
|
+
return y(() => {
|
|
13
13
|
const s = t && e ? W(e, t) : null;
|
|
14
14
|
if (!t || !e || !s) {
|
|
15
15
|
d(null);
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
let c = !1;
|
|
19
|
-
return s === "pdf" ? import("./generatePdfThumbnail-
|
|
20
|
-
c || d(
|
|
19
|
+
return s === "pdf" ? import("./generatePdfThumbnail-DdNHlnr8.js").then(({ generatePdfThumbnail: o }) => o(t)).then((o) => {
|
|
20
|
+
c || d(o);
|
|
21
21
|
}).catch(() => {
|
|
22
22
|
c || d(null);
|
|
23
|
-
}) : s === "docx" ? import("./generateDocxThumbnail-
|
|
24
|
-
c || d(
|
|
23
|
+
}) : s === "docx" ? import("./generateDocxThumbnail-Du6zd_sv.js").then(({ generateDocxThumbnail: o }) => o(t)).then((o) => {
|
|
24
|
+
c || d(o);
|
|
25
25
|
}).catch(() => {
|
|
26
26
|
c || d(null);
|
|
27
|
-
}) : s === "xlsx" && import("./generateXlsxThumbnail-
|
|
28
|
-
c || d(
|
|
27
|
+
}) : s === "xlsx" && import("./generateXlsxThumbnail-VFzuEJln.js").then(({ generateXlsxThumbnail: o }) => o(t)).then((o) => {
|
|
28
|
+
c || d(o);
|
|
29
29
|
}).catch(() => {
|
|
30
30
|
c || d(null);
|
|
31
31
|
}), () => {
|
|
@@ -33,29 +33,29 @@ function $(t, e) {
|
|
|
33
33
|
};
|
|
34
34
|
}, [t, e]), l;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const z = (t) => t ? t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : t < 1024 * 1024 * 1024 ? `${(t / (1024 * 1024)).toFixed(1)} MB` : `${(t / (1024 * 1024 * 1024)).toFixed(1)} GB` : "", k = (t) => {
|
|
37
37
|
const e = t.split(".");
|
|
38
38
|
return e.length > 1 ? e[e.length - 1].toLowerCase() : "";
|
|
39
39
|
}, b = (t) => {
|
|
40
|
-
const e =
|
|
40
|
+
const e = k(t);
|
|
41
41
|
return e === "pdf" || e === "docx" || e === "xlsx" || e === "xls";
|
|
42
|
-
},
|
|
43
|
-
const e =
|
|
42
|
+
}, R = (t) => {
|
|
43
|
+
const e = k(t);
|
|
44
44
|
return ["pdf", "doc", "docx", "txt", "odt"].includes(e) ? /* @__PURE__ */ i(g, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-blue-500" }) : ["xls", "xlsx", "csv"].includes(e) ? /* @__PURE__ */ i(g, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-green-600" }) : ["zip", "rar", "7z", "tar", "gz"].includes(e) ? /* @__PURE__ */ i(j, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-orange-500" }) : /* @__PURE__ */ i(B, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-gray-500" });
|
|
45
|
-
},
|
|
45
|
+
}, _ = ({ src: t, fileName: e, fileSize: l, nodeKey: d }) => {
|
|
46
46
|
const [s] = U(), c = $(b(e) ? t : void 0, e);
|
|
47
|
-
if (
|
|
47
|
+
if (y(() => {
|
|
48
48
|
c && s.update(() => {
|
|
49
49
|
const n = v(d);
|
|
50
50
|
w(n) && n.setPreviewDataUrl(c);
|
|
51
51
|
});
|
|
52
52
|
}, [s, d, c]), !t || !e)
|
|
53
53
|
return console.error("FileView: Missing required props", { src: t, fileName: e, fileSize: l, nodeKey: d }), /* @__PURE__ */ i("div", { className: "cteditor-inline-flex cteditor-items-center cteditor-gap-3 cteditor-px-4 cteditor-py-3 cteditor-my-2 cteditor-border cteditor-border-destructive cteditor-rounded-lg cteditor-bg-destructive/10", children: /* @__PURE__ */ i("div", { className: "cteditor-text-sm cteditor-text-destructive", children: "Error loading file" }) });
|
|
54
|
-
const
|
|
54
|
+
const o = (n) => {
|
|
55
55
|
n.preventDefault(), n.stopPropagation();
|
|
56
56
|
try {
|
|
57
57
|
if (t.startsWith("data:")) {
|
|
58
|
-
const
|
|
58
|
+
const r = t.split(","), f = r[0].match(/:(.*?);/), D = f ? f[1] : "application/octet-stream", m = atob(r[1]);
|
|
59
59
|
let u = m.length;
|
|
60
60
|
const x = new Uint8Array(u);
|
|
61
61
|
for (; u--; )
|
|
@@ -63,27 +63,27 @@ const R = (t) => t ? t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFix
|
|
|
63
63
|
const P = new Blob([x], { type: D }), h = URL.createObjectURL(P), a = document.createElement("a");
|
|
64
64
|
a.href = h, a.download = e, a.style.display = "none", document.body.appendChild(a), a.click(), document.body.removeChild(a), setTimeout(() => URL.revokeObjectURL(h), 100);
|
|
65
65
|
} else {
|
|
66
|
-
const
|
|
67
|
-
|
|
66
|
+
const r = document.createElement("a");
|
|
67
|
+
r.href = t, r.download = e, r.style.display = "none", r.target = "_blank", document.body.appendChild(r), r.click(), document.body.removeChild(r);
|
|
68
68
|
}
|
|
69
|
-
} catch (
|
|
70
|
-
console.error("Error downloading file:",
|
|
69
|
+
} catch (r) {
|
|
70
|
+
console.error("Error downloading file:", r), window.open(t, "_blank");
|
|
71
71
|
}
|
|
72
72
|
}, F = (n) => {
|
|
73
73
|
n.preventDefault(), n.stopPropagation(), s.update(() => {
|
|
74
|
-
const
|
|
75
|
-
w(
|
|
74
|
+
const r = v(d);
|
|
75
|
+
w(r) && r.remove();
|
|
76
76
|
});
|
|
77
77
|
}, C = b(e) && c;
|
|
78
78
|
return /* @__PURE__ */ p(
|
|
79
79
|
"div",
|
|
80
80
|
{
|
|
81
81
|
className: "cteditor-inline-flex cteditor-flex-col cteditor-gap-2 cteditor-py-2 cteditor-px-2 cteditor-my-2 cteditor-border cteditor-border-border cteditor-rounded-lg cteditor-bg-background hover:cteditor-bg-accent/50 cteditor-transition-colors cteditor-cursor-pointer cteditor-max-w-[240px]",
|
|
82
|
-
onClick:
|
|
82
|
+
onClick: o,
|
|
83
83
|
role: "button",
|
|
84
84
|
tabIndex: 0,
|
|
85
85
|
onKeyDown: (n) => {
|
|
86
|
-
(n.key === "Enter" || n.key === " ") && (n.preventDefault(),
|
|
86
|
+
(n.key === "Enter" || n.key === " ") && (n.preventDefault(), o(n));
|
|
87
87
|
},
|
|
88
88
|
children: [
|
|
89
89
|
/* @__PURE__ */ i("div", { className: "cteditor-w-full cteditor-aspect-[120/88] cteditor-rounded cteditor-overflow-hidden cteditor-bg-muted cteditor-flex cteditor-items-center cteditor-justify-center", children: C ? /* @__PURE__ */ i(
|
|
@@ -93,17 +93,17 @@ const R = (t) => t ? t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFix
|
|
|
93
93
|
alt: "",
|
|
94
94
|
className: "cteditor-w-full cteditor-h-full cteditor-object-cover"
|
|
95
95
|
}
|
|
96
|
-
) : /* @__PURE__ */ i("div", { className: "*:cteditor-size-8", children:
|
|
96
|
+
) : /* @__PURE__ */ i("div", { className: "*:cteditor-size-8", children: R(e) }) }),
|
|
97
97
|
/* @__PURE__ */ p("div", { className: "cteditor-flex cteditor-items-start cteditor-gap-2 cteditor-w-full", children: [
|
|
98
98
|
/* @__PURE__ */ p("div", { className: "cteditor-flex-1 cteditor-min-w-0", children: [
|
|
99
99
|
/* @__PURE__ */ i("div", { className: "cteditor-font-medium cteditor-text-xs cteditor-text-foreground cteditor-truncate", children: e }),
|
|
100
|
-
l && /* @__PURE__ */ i("div", { className: "cteditor-text-xs cteditor-text-muted-foreground", children:
|
|
100
|
+
l && /* @__PURE__ */ i("div", { className: "cteditor-text-xs cteditor-text-muted-foreground", children: z(l) })
|
|
101
101
|
] }),
|
|
102
102
|
/* @__PURE__ */ p("div", { className: "cteditor-flex cteditor-gap-1 cteditor-flex-shrink-0", children: [
|
|
103
103
|
/* @__PURE__ */ i(
|
|
104
104
|
"button",
|
|
105
105
|
{
|
|
106
|
-
onClick:
|
|
106
|
+
onClick: o,
|
|
107
107
|
className: "cteditor-p-1 cteditor-rounded-md hover:cteditor-bg-accent cteditor-transition-colors",
|
|
108
108
|
"aria-label": "Download file",
|
|
109
109
|
title: "Download file",
|
|
@@ -127,5 +127,5 @@ const R = (t) => t ? t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFix
|
|
|
127
127
|
);
|
|
128
128
|
};
|
|
129
129
|
export {
|
|
130
|
-
|
|
130
|
+
_ as default
|
|
131
131
|
};
|
|
@@ -13,14 +13,14 @@ import { RichTextPlugin as gt } from "@lexical/react/LexicalRichTextPlugin";
|
|
|
13
13
|
import { useLexicalEditable as mt } from "@lexical/react/useLexicalEditable";
|
|
14
14
|
import { useLexicalNodeSelection as ht } from "@lexical/react/useLexicalNodeSelection";
|
|
15
15
|
import { mergeRegister as pt } from "@lexical/utils";
|
|
16
|
-
import { $getSelection as L, $isNodeSelection as h, $setSelection as O, SELECTION_CHANGE_COMMAND as bt, COMMAND_PRIORITY_LOW as f, CLICK_COMMAND as Ct, DRAGSTART_COMMAND as xt, KEY_DELETE_COMMAND as Nt, KEY_BACKSPACE_COMMAND as vt, KEY_ENTER_COMMAND as Et, KEY_ESCAPE_COMMAND as Rt, RootNode as
|
|
17
|
-
import { useRef as P, useState as
|
|
18
|
-
import {
|
|
16
|
+
import { $getSelection as L, $isNodeSelection as h, $setSelection as O, SELECTION_CHANGE_COMMAND as bt, COMMAND_PRIORITY_LOW as f, CLICK_COMMAND as Ct, DRAGSTART_COMMAND as xt, KEY_DELETE_COMMAND as Nt, KEY_BACKSPACE_COMMAND as vt, KEY_ENTER_COMMAND as Et, KEY_ESCAPE_COMMAND as Rt, RootNode as yt, TextNode as At, LineBreakNode as kt, ParagraphNode as St, $getNodeByKey as A, $isParagraphNode as T } from "lexical";
|
|
17
|
+
import { useRef as P, useState as w, useCallback as N, useEffect as Dt } from "react";
|
|
18
|
+
import { G as v, W as Lt, l as Pt, A as Mt, m as _t, n as $t, T as zt, x as It, L as Wt, i as Ot } from "./index-Dh3DFyBT.js";
|
|
19
19
|
function ie({
|
|
20
|
-
src:
|
|
20
|
+
src: j,
|
|
21
21
|
nodeKey: g,
|
|
22
22
|
width: p,
|
|
23
|
-
height:
|
|
23
|
+
height: k,
|
|
24
24
|
maxWidth: B,
|
|
25
25
|
resizable: Y,
|
|
26
26
|
showCaption: E,
|
|
@@ -29,7 +29,7 @@ function ie({
|
|
|
29
29
|
controls: V = !0,
|
|
30
30
|
position: n = "none"
|
|
31
31
|
}) {
|
|
32
|
-
const a = P(null), S = P(null), [l, d, C] = ht(g), [s, M] =
|
|
32
|
+
const a = P(null), S = P(null), [l, d, C] = ht(g), [s, M] = w(!1), [o] = lt(), [R, H] = w(null), _ = P(null), K = mt(), D = N(
|
|
33
33
|
(t) => {
|
|
34
34
|
const r = L();
|
|
35
35
|
return l && h(r) && (t.preventDefault(), o.update(() => {
|
|
@@ -69,8 +69,8 @@ function ie({
|
|
|
69
69
|
const c = e === a.current;
|
|
70
70
|
let u = !1;
|
|
71
71
|
if (!c && a.current) {
|
|
72
|
-
const
|
|
73
|
-
u = r.clientX >=
|
|
72
|
+
const y = a.current.getBoundingClientRect();
|
|
73
|
+
u = r.clientX >= y.left && r.clientX <= y.right && r.clientY >= y.top && r.clientY <= y.bottom;
|
|
74
74
|
}
|
|
75
75
|
return c || u ? (r.shiftKey ? d(!l) : (C(), d(!0)), !0) : !1;
|
|
76
76
|
},
|
|
@@ -131,21 +131,21 @@ function ie({
|
|
|
131
131
|
]);
|
|
132
132
|
const X = () => {
|
|
133
133
|
o.update(() => {
|
|
134
|
-
const t =
|
|
134
|
+
const t = A(g);
|
|
135
135
|
v(t) && t.setShowCaption(!0);
|
|
136
136
|
});
|
|
137
137
|
}, G = (t, r) => {
|
|
138
138
|
setTimeout(() => {
|
|
139
139
|
M(!1);
|
|
140
140
|
}, 200), o.update(() => {
|
|
141
|
-
const e =
|
|
141
|
+
const e = A(g);
|
|
142
142
|
v(e) && e.setWidthAndHeight(t, r);
|
|
143
143
|
});
|
|
144
144
|
}, U = () => {
|
|
145
145
|
M(!0);
|
|
146
146
|
}, q = (t) => {
|
|
147
147
|
t.preventDefault(), t.stopPropagation(), o.update(() => {
|
|
148
|
-
const r =
|
|
148
|
+
const r = A(g);
|
|
149
149
|
if (v(r)) {
|
|
150
150
|
const e = r.getParent();
|
|
151
151
|
r.remove(), e && T(e) && e.getChildrenSize() === 0 && e.setFormat("left");
|
|
@@ -153,7 +153,7 @@ function ie({
|
|
|
153
153
|
});
|
|
154
154
|
}, m = (t, r) => {
|
|
155
155
|
t.preventDefault(), t.stopPropagation(), o.update(() => {
|
|
156
|
-
const e =
|
|
156
|
+
const e = A(g);
|
|
157
157
|
if (v(e)) {
|
|
158
158
|
e.setPosition(r);
|
|
159
159
|
const c = e.getParent();
|
|
@@ -173,7 +173,7 @@ function ie({
|
|
|
173
173
|
!e && !c || (t.stopPropagation(), t.shiftKey ? d(!l) : (C(), d(!0)));
|
|
174
174
|
},
|
|
175
175
|
[s, l, d, C]
|
|
176
|
-
), Q = l && h(R) && !s, W = (l || s) && K, Z = typeof p == "number" && typeof
|
|
176
|
+
), Q = l && h(R) && !s, W = (l || s) && K, Z = typeof p == "number" && typeof k == "number", tt = typeof p == "number" ? p : "auto", et = typeof k == "number" ? k : "auto";
|
|
177
177
|
return /* @__PURE__ */ x(rt, { children: [
|
|
178
178
|
/* @__PURE__ */ x(
|
|
179
179
|
"div",
|
|
@@ -213,7 +213,7 @@ function ie({
|
|
|
213
213
|
"video",
|
|
214
214
|
{
|
|
215
215
|
ref: a,
|
|
216
|
-
src:
|
|
216
|
+
src: j,
|
|
217
217
|
controls: V,
|
|
218
218
|
preload: "metadata",
|
|
219
219
|
className: W ? `focused ${h(R) ? "draggable" : ""}` : void 0,
|
|
@@ -337,9 +337,9 @@ function ie({
|
|
|
337
337
|
{
|
|
338
338
|
initialEditor: b,
|
|
339
339
|
initialNodes: [
|
|
340
|
-
kt,
|
|
341
340
|
yt,
|
|
342
341
|
At,
|
|
342
|
+
kt,
|
|
343
343
|
St,
|
|
344
344
|
nt,
|
|
345
345
|
ot
|