eddyter 1.3.74 → 1.3.76
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/api/config/endpoints.d.ts +1 -0
- package/dist/assets/style.css +1 -1
- package/dist/components/EddyterLogo/EddyterLogo.d.ts +2 -1
- package/dist/components/HtmlCodeEditor.d.ts +9 -0
- package/dist/components/Placeholder/styles.d.ts +2 -0
- package/dist/components/Toast/EditorToast.d.ts +2 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/config/env.d.ts +8 -0
- package/dist/constants.d.ts +2 -1
- package/dist/generateDocxThumbnail-BbSs-3CJ.js +5876 -0
- package/dist/generatePdfThumbnail-U8R2yu3J.js +53 -0
- package/dist/generateXlsxThumbnail-BUwuqsXR.js +21707 -0
- package/dist/hooks/useBlockFormat.d.ts +1 -0
- package/dist/hooks/useFeedbackEligibility.d.ts +2 -2
- package/dist/hooks/usePdfPreview.d.ts +6 -0
- package/dist/html2canvas.esm-C2wu93Kq.js +4867 -0
- package/dist/{html2pdf.bundle.min-IddXSdmD.js → html2pdf.bundle.min-Css6bHHm.js} +1 -1
- package/dist/{index-DXkAwL6K.js → index-CCVZobcV.js} +1 -1
- package/dist/index-CVEa0GRe.js +131 -0
- package/dist/{index-DeaVZP-3.js → index-DTkM3xiE.js} +1 -1
- package/dist/{index-CnJbZHIU.js → index-DjD3NbU0.js} +13839 -13261
- package/dist/index.js +1 -1
- package/dist/lib/toast.d.ts +39 -0
- package/dist/nodes/EmbedNode.d.ts +7 -2
- package/dist/nodes/FileNode.d.ts +3 -0
- package/dist/nodes/GeneratingImageNode.d.ts +30 -0
- package/dist/store/tableFullWidthStore.d.ts +6 -0
- package/dist/types.d.ts +2 -0
- package/dist/ui/Icons.d.ts +2 -1
- package/dist/utils/editorStyleConverter.d.ts +3 -1
- package/dist/utils/generateDocxThumbnail.d.ts +5 -0
- package/dist/utils/generatePdfThumbnail.d.ts +1 -0
- package/dist/utils/generateXlsxThumbnail.d.ts +5 -0
- package/dist/utils/helper.d.ts +2 -0
- package/dist/utils/htmlFormat.d.ts +5 -0
- package/dist/utils/index.d.ts +4 -4
- package/package.json +6 -12
- package/dist/html2pdf.bundle-Bqwrc-rt.js +0 -33980
- package/dist/index-CUha-eOU.js +0 -83
|
@@ -15,7 +15,7 @@ import { useLexicalNodeSelection as ht } from "@lexical/react/useLexicalNodeSele
|
|
|
15
15
|
import { mergeRegister as pt } from "@lexical/utils";
|
|
16
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 kt, TextNode as yt, LineBreakNode as At, ParagraphNode as St, $getNodeByKey as y, $isParagraphNode as T } from "lexical";
|
|
17
17
|
import { useRef as P, useState as j, useCallback as N, useEffect as Dt } from "react";
|
|
18
|
-
import { x as v, W as Lt, j as Pt, A as Mt, k as _t, l as $t, T as zt,
|
|
18
|
+
import { x as v, W as Lt, j as Pt, A as Mt, k as _t, l as $t, T as zt, s as It, L as Wt, i as Ot } from "./index-DjD3NbU0.js";
|
|
19
19
|
function ie({
|
|
20
20
|
src: w,
|
|
21
21
|
nodeKey: g,
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { jsx as i, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { useLexicalComposerContext as U } from "@lexical/react/LexicalComposerContext";
|
|
3
|
+
import { $getNodeByKey as v } from "lexical";
|
|
4
|
+
import { useState as N, useEffect as k } from "react";
|
|
5
|
+
import { q as w, r as L, s as E, F as g, v as j, w as B } from "./index-DjD3NbU0.js";
|
|
6
|
+
function W(t, e) {
|
|
7
|
+
const l = t.split(".").pop()?.toLowerCase();
|
|
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
|
+
}
|
|
10
|
+
function $(t, e) {
|
|
11
|
+
const [l, d] = N(null);
|
|
12
|
+
return k(() => {
|
|
13
|
+
const s = t && e ? W(e, t) : null;
|
|
14
|
+
if (!t || !e || !s) {
|
|
15
|
+
d(null);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let c = !1;
|
|
19
|
+
return s === "pdf" ? import("./generatePdfThumbnail-U8R2yu3J.js").then(({ generatePdfThumbnail: r }) => r(t)).then((r) => {
|
|
20
|
+
c || d(r);
|
|
21
|
+
}).catch(() => {
|
|
22
|
+
c || d(null);
|
|
23
|
+
}) : s === "docx" ? import("./generateDocxThumbnail-BbSs-3CJ.js").then(({ generateDocxThumbnail: r }) => r(t)).then((r) => {
|
|
24
|
+
c || d(r);
|
|
25
|
+
}).catch(() => {
|
|
26
|
+
c || d(null);
|
|
27
|
+
}) : s === "xlsx" && import("./generateXlsxThumbnail-BUwuqsXR.js").then(({ generateXlsxThumbnail: r }) => r(t)).then((r) => {
|
|
28
|
+
c || d(r);
|
|
29
|
+
}).catch(() => {
|
|
30
|
+
c || d(null);
|
|
31
|
+
}), () => {
|
|
32
|
+
c = !0, d(null);
|
|
33
|
+
};
|
|
34
|
+
}, [t, e]), l;
|
|
35
|
+
}
|
|
36
|
+
const R = (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` : "", y = (t) => {
|
|
37
|
+
const e = t.split(".");
|
|
38
|
+
return e.length > 1 ? e[e.length - 1].toLowerCase() : "";
|
|
39
|
+
}, b = (t) => {
|
|
40
|
+
const e = y(t);
|
|
41
|
+
return e === "pdf" || e === "docx" || e === "xlsx" || e === "xls";
|
|
42
|
+
}, T = (t) => {
|
|
43
|
+
const e = y(t);
|
|
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
|
+
}, V = ({ src: t, fileName: e, fileSize: l, nodeKey: d }) => {
|
|
46
|
+
const [s] = U(), c = $(b(e) ? t : void 0, e);
|
|
47
|
+
if (k(() => {
|
|
48
|
+
c && s.update(() => {
|
|
49
|
+
const n = v(d);
|
|
50
|
+
w(n) && n.setPreviewDataUrl(c);
|
|
51
|
+
});
|
|
52
|
+
}, [s, d, c]), !t || !e)
|
|
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 r = (n) => {
|
|
55
|
+
n.preventDefault(), n.stopPropagation();
|
|
56
|
+
try {
|
|
57
|
+
if (t.startsWith("data:")) {
|
|
58
|
+
const o = t.split(","), f = o[0].match(/:(.*?);/), D = f ? f[1] : "application/octet-stream", m = atob(o[1]);
|
|
59
|
+
let u = m.length;
|
|
60
|
+
const x = new Uint8Array(u);
|
|
61
|
+
for (; u--; )
|
|
62
|
+
x[u] = m.charCodeAt(u);
|
|
63
|
+
const P = new Blob([x], { type: D }), h = URL.createObjectURL(P), a = document.createElement("a");
|
|
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
|
+
} else {
|
|
66
|
+
const o = document.createElement("a");
|
|
67
|
+
o.href = t, o.download = e, o.style.display = "none", o.target = "_blank", document.body.appendChild(o), o.click(), document.body.removeChild(o);
|
|
68
|
+
}
|
|
69
|
+
} catch (o) {
|
|
70
|
+
console.error("Error downloading file:", o), window.open(t, "_blank");
|
|
71
|
+
}
|
|
72
|
+
}, F = (n) => {
|
|
73
|
+
n.preventDefault(), n.stopPropagation(), s.update(() => {
|
|
74
|
+
const o = v(d);
|
|
75
|
+
w(o) && o.remove();
|
|
76
|
+
});
|
|
77
|
+
}, C = b(e) && c;
|
|
78
|
+
return /* @__PURE__ */ p(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
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: r,
|
|
83
|
+
role: "button",
|
|
84
|
+
tabIndex: 0,
|
|
85
|
+
onKeyDown: (n) => {
|
|
86
|
+
(n.key === "Enter" || n.key === " ") && (n.preventDefault(), r(n));
|
|
87
|
+
},
|
|
88
|
+
children: [
|
|
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(
|
|
90
|
+
"img",
|
|
91
|
+
{
|
|
92
|
+
src: c,
|
|
93
|
+
alt: "",
|
|
94
|
+
className: "cteditor-w-full cteditor-h-full cteditor-object-cover"
|
|
95
|
+
}
|
|
96
|
+
) : /* @__PURE__ */ i("div", { className: "*:cteditor-size-8", children: T(e) }) }),
|
|
97
|
+
/* @__PURE__ */ p("div", { className: "cteditor-flex cteditor-items-start cteditor-gap-2 cteditor-w-full", children: [
|
|
98
|
+
/* @__PURE__ */ p("div", { className: "cteditor-flex-1 cteditor-min-w-0", children: [
|
|
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: R(l) })
|
|
101
|
+
] }),
|
|
102
|
+
/* @__PURE__ */ p("div", { className: "cteditor-flex cteditor-gap-1 cteditor-flex-shrink-0", children: [
|
|
103
|
+
/* @__PURE__ */ i(
|
|
104
|
+
"button",
|
|
105
|
+
{
|
|
106
|
+
onClick: r,
|
|
107
|
+
className: "cteditor-p-1 cteditor-rounded-md hover:cteditor-bg-accent cteditor-transition-colors",
|
|
108
|
+
"aria-label": "Download file",
|
|
109
|
+
title: "Download file",
|
|
110
|
+
children: /* @__PURE__ */ i(L, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground" })
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ i(
|
|
114
|
+
"button",
|
|
115
|
+
{
|
|
116
|
+
onClick: F,
|
|
117
|
+
className: "cteditor-p-1 cteditor-rounded-md hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground cteditor-transition-colors",
|
|
118
|
+
"aria-label": "Delete file",
|
|
119
|
+
title: "Delete file",
|
|
120
|
+
children: /* @__PURE__ */ i(E, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground" })
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] })
|
|
124
|
+
] })
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
export {
|
|
130
|
+
V as default
|
|
131
|
+
};
|
|
@@ -16,7 +16,7 @@ import { useLexicalNodeSelection as lt } from "@lexical/react/useLexicalNodeSele
|
|
|
16
16
|
import { mergeRegister as mt } from "@lexical/utils";
|
|
17
17
|
import { RootNode as Re, TextNode as Pe, LineBreakNode as De, ParagraphNode as Se, $getSelection as O, $isNodeSelection as L, $isParagraphNode as Z, $setSelection as ee, $isRangeSelection as ut, SELECTION_CHANGE_COMMAND as gt, COMMAND_PRIORITY_LOW as v, CLICK_COMMAND as ft, DRAGSTART_COMMAND as pt, KEY_DELETE_COMMAND as ht, KEY_BACKSPACE_COMMAND as bt, KEY_ENTER_COMMAND as yt, KEY_ESCAPE_COMMAND as xt, createCommand as Ct, $getNodeByKey as _ } from "lexical";
|
|
18
18
|
import { useRef as z, useState as p, useEffect as te, useLayoutEffect as Nt, useCallback as x, Suspense as wt } from "react";
|
|
19
|
-
import { a as vt, D as Et, b as kt, d as It, e as Rt, f as Pt, h as Dt, B as be, L as Ae, i as Le, u as St, $ as M, W as At, j as Lt, A as Mt, k as $t, l as Ot, T as _t, m as zt, S as Wt, E as jt, n as Kt, t as E, o as Bt, p as Tt, C as Ft } from "./index-
|
|
19
|
+
import { a as vt, D as Et, b as kt, d as It, e as Rt, f as Pt, h as Dt, B as be, L as Ae, i as Le, u as St, $ as M, W as At, j as Lt, A as Mt, k as $t, l as Ot, T as _t, m as zt, S as Wt, E as jt, n as Kt, t as E, o as Bt, p as Tt, C as Ft } from "./index-DjD3NbU0.js";
|
|
20
20
|
const Gt = vt("Link2", [
|
|
21
21
|
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
22
22
|
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|