eddyter 1.3.75 → 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.
Files changed (54) hide show
  1. package/LICENSE +24 -24
  2. package/README.md +478 -478
  3. package/dist/EddyterIcon.svg +24 -24
  4. package/dist/Provider/EditorProvider.d.ts +12 -0
  5. package/dist/api/auth.d.ts +10 -0
  6. package/dist/api/bugReport.d.ts +2 -0
  7. package/dist/api/config/endpoints.d.ts +1 -0
  8. package/dist/assets/style.css +1 -1
  9. package/dist/{babel-B9hn44Wo.js → babel-CCPWkrf4.js} +1302 -726
  10. package/dist/components/EddyterLogo/EddyterLogo.d.ts +2 -1
  11. package/dist/components/HtmlCodeEditor.d.ts +9 -0
  12. package/dist/components/ImageView/ImageCropDialog.d.ts +18 -0
  13. package/dist/components/LockedFeature/LockedFeature.d.ts +4 -0
  14. package/dist/components/Placeholder/styles.d.ts +2 -0
  15. package/dist/components/Toast/EditorToast.d.ts +2 -0
  16. package/dist/components/ui/button.d.ts +1 -1
  17. package/dist/config/env.d.ts +9 -0
  18. package/dist/editorConfig.d.ts +1 -0
  19. package/dist/{estree-CocPn_Md.js → estree-CxUPh9wa.js} +917 -529
  20. package/dist/generateDocxThumbnail-Du6zd_sv.js +5876 -0
  21. package/dist/generatePdfThumbnail-DdNHlnr8.js +53 -0
  22. package/dist/generateXlsxThumbnail-VFzuEJln.js +21707 -0
  23. package/dist/hooks/useFeedbackEligibility.d.ts +2 -2
  24. package/dist/hooks/usePdfPreview.d.ts +6 -0
  25. package/dist/{html-CxCicOef.js → html-CmniStvG.js} +589 -350
  26. package/dist/html2canvas.esm-C2wu93Kq.js +4867 -0
  27. package/dist/{html2pdf.bundle.min-BxzIoi3T.js → html2pdf.bundle.min-4S-fQVxW.js} +5223 -3407
  28. package/dist/index-BUrH5xJk.js +1498 -0
  29. package/dist/index-DCBdbL8A.js +131 -0
  30. package/dist/{index-Cuv9ugJL.js → index-DSNo50FN.js} +17 -17
  31. package/dist/{index-DxEP36zG.js → index-Dh3DFyBT.js} +16269 -15166
  32. package/dist/index.js +1 -1
  33. package/dist/lib/toast.d.ts +39 -0
  34. package/dist/{markdown-BUjgWFLu.js → markdown-B0mEGGfQ.js} +1015 -578
  35. package/dist/nodes/EmbedNode.d.ts +9 -3
  36. package/dist/nodes/FileNode.d.ts +3 -0
  37. package/dist/{postcss-CGIcwj_g.js → postcss-B0bxXf7u.js} +1065 -615
  38. package/dist/{standalone-C0qguT38.js → standalone-DmuJV5rn.js} +596 -350
  39. package/dist/store/tableFullWidthStore.d.ts +6 -0
  40. package/dist/types.d.ts +4 -0
  41. package/dist/{typescript-BM7wk6k-.js → typescript-DZlC_9M8.js} +1805 -1113
  42. package/dist/utils/cropUrl.d.ts +28 -0
  43. package/dist/utils/editorStyleConverter.d.ts +3 -1
  44. package/dist/utils/export.d.ts +5 -0
  45. package/dist/utils/generateDocxThumbnail.d.ts +5 -0
  46. package/dist/utils/generatePdfThumbnail.d.ts +1 -0
  47. package/dist/utils/generateXlsxThumbnail.d.ts +5 -0
  48. package/dist/utils/helper.d.ts +2 -0
  49. package/dist/utils/htmlFormat.d.ts +5 -0
  50. package/dist/utils/index.d.ts +4 -4
  51. package/package.json +148 -150
  52. package/dist/html2pdf.bundle-CVq-OpZt.js +0 -32961
  53. package/dist/index-CtPRZTab.js +0 -845
  54. package/dist/index-eRyVFO7x.js +0 -83
@@ -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 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
+ 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 y(() => {
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-DdNHlnr8.js").then(({ generatePdfThumbnail: o }) => o(t)).then((o) => {
20
+ c || d(o);
21
+ }).catch(() => {
22
+ c || d(null);
23
+ }) : s === "docx" ? import("./generateDocxThumbnail-Du6zd_sv.js").then(({ generateDocxThumbnail: o }) => o(t)).then((o) => {
24
+ c || d(o);
25
+ }).catch(() => {
26
+ c || d(null);
27
+ }) : s === "xlsx" && import("./generateXlsxThumbnail-VFzuEJln.js").then(({ generateXlsxThumbnail: o }) => o(t)).then((o) => {
28
+ c || d(o);
29
+ }).catch(() => {
30
+ c || d(null);
31
+ }), () => {
32
+ c = !0, d(null);
33
+ };
34
+ }, [t, e]), l;
35
+ }
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
+ const e = t.split(".");
38
+ return e.length > 1 ? e[e.length - 1].toLowerCase() : "";
39
+ }, b = (t) => {
40
+ const e = k(t);
41
+ return e === "pdf" || e === "docx" || e === "xlsx" || e === "xls";
42
+ }, R = (t) => {
43
+ const e = k(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
+ }, _ = ({ src: t, fileName: e, fileSize: l, nodeKey: d }) => {
46
+ const [s] = U(), c = $(b(e) ? t : void 0, e);
47
+ if (y(() => {
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 o = (n) => {
55
+ n.preventDefault(), n.stopPropagation();
56
+ try {
57
+ if (t.startsWith("data:")) {
58
+ const r = t.split(","), f = r[0].match(/:(.*?);/), D = f ? f[1] : "application/octet-stream", m = atob(r[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 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
+ }
69
+ } catch (r) {
70
+ console.error("Error downloading file:", r), window.open(t, "_blank");
71
+ }
72
+ }, F = (n) => {
73
+ n.preventDefault(), n.stopPropagation(), s.update(() => {
74
+ const r = v(d);
75
+ w(r) && r.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: o,
83
+ role: "button",
84
+ tabIndex: 0,
85
+ onKeyDown: (n) => {
86
+ (n.key === "Enter" || n.key === " ") && (n.preventDefault(), o(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: R(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: z(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: o,
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
+ _ as default
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 kt, TextNode as yt, LineBreakNode as At, ParagraphNode as St, $getNodeByKey as y, $isParagraphNode as T } from "lexical";
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, r as It, L as Wt, i as Ot } from "./index-DxEP36zG.js";
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: w,
20
+ src: j,
21
21
  nodeKey: g,
22
22
  width: p,
23
- height: A,
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] = j(!1), [o] = lt(), [R, H] = j(null), _ = P(null), K = mt(), D = N(
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 k = a.current.getBoundingClientRect();
73
- u = r.clientX >= k.left && r.clientX <= k.right && r.clientY >= k.top && r.clientY <= k.bottom;
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 = y(g);
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 = y(g);
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 = y(g);
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 = y(g);
156
+ const e = A(g);
157
157
  if (v(e)) {
158
158
  e.setPosition(r);
159
159
  const c = e.getParent();
@@ -173,13 +173,13 @@ 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 A == "number", tt = typeof p == "number" ? p : "auto", et = typeof A == "number" ? A : "auto";
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",
180
180
  {
181
181
  draggable: Q,
182
- style: n === "left" || n === "right" ? {
182
+ style: (() => n === "left" || n === "right" ? {
183
183
  position: "relative",
184
184
  display: "block",
185
185
  width: "100%"
@@ -206,14 +206,14 @@ function ie({
206
206
  } : {
207
207
  position: "relative",
208
208
  display: "inline-block"
209
- },
209
+ })(),
210
210
  onClick: J,
211
211
  children: [
212
212
  /* @__PURE__ */ i(
213
213
  "video",
214
214
  {
215
215
  ref: a,
216
- src: w,
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