eddyter 1.4.16 → 1.4.17
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/AIChatPlugin-2pIKhzIw.js +871 -0
- package/dist/{CommentBubblePlugin-DZQW1ibY.js → CommentBubblePlugin-J3r4kNGK.js} +1 -1
- package/dist/CommentPlugin-BbuE8_Aj.js +154 -0
- package/dist/LazyCodeMirror-DdCIk-83.js +21374 -0
- package/dist/{LazySignatureCanvas-FKl1mD-T.js → LazySignatureCanvas-D1t8oQDK.js} +1 -1
- package/dist/NotePanelPlugin-C16G36Jd.js +31 -0
- package/dist/TextEnhancePlugin-BShY1r5J.js +198 -0
- package/dist/components/AiPlugin/commands.d.ts +4 -0
- package/dist/components/AiPlugin/index.d.ts +0 -4
- package/dist/{generateDocxThumbnail-DJlPLsdY.js → generateDocxThumbnail-Ve0zlObJ.js} +1 -1
- package/dist/{generatePdfThumbnail-CfDAh39b.js → generatePdfThumbnail-EuSjdwzm.js} +1 -1
- package/dist/{generateXlsxThumbnail-cRIT4Jyf.js → generateXlsxThumbnail-C10kl6qh.js} +1 -1
- package/dist/{html2pdf.bundle.min-BW3dolOS.js → html2pdf.bundle.min-BQaO0VTp.js} +1 -1
- package/dist/{index-W6_ogglw.js → index-B8zPtmsK.js} +24 -24
- package/dist/{index-gjz4wieB.js → index-BSgLtgyt.js} +36 -36
- package/dist/{index-BydXFu_2.js → index-ClsuXAKJ.js} +1 -1
- package/dist/index-CoLO4gm_.js +719 -0
- package/dist/{index-BDDjWwK4.js → index-CxOOJD40.js} +14869 -18049
- package/dist/{index-BmfQcIrc.js → index-D25uusM-.js} +127 -126
- package/dist/{index-BEepnYCf.js → index-gPq4n7_a.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/marked.esm-Tjr8Gfse.js +1114 -0
- package/dist/plugins/AIChatPlugin.commands.d.ts +7 -0
- package/dist/plugins/AIChatPlugin.d.ts +0 -7
- package/dist/plugins/CommentPlugin.commands.d.ts +5 -0
- package/dist/plugins/CommentPlugin.d.ts +0 -5
- package/dist/plugins/NotePanelPlugin.commands.d.ts +6 -0
- package/dist/plugins/NotePanelPlugin.d.ts +0 -6
- package/dist/plugins/TextEnhancePlugin.commands.d.ts +1 -0
- package/dist/plugins/TextEnhancePlugin.d.ts +0 -1
- package/dist/square-DrMKkLmP.js +7 -0
- package/dist/useVoiceToText-DCddJzYF.js +153 -0
- package/package.json +5 -2
- package/dist/LazyCodeMirror-C1bW4mVF.js +0 -44822
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as j } from "react/jsx-runtime";
|
|
2
2
|
import A, { Component as q, forwardRef as I } from "react";
|
|
3
3
|
import { _ as V, a as $ } from "./objectWithoutPropertiesLoose-DiWPeE4c.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ao as N } from "./index-CxOOJD40.js";
|
|
5
5
|
function H(e, n) {
|
|
6
6
|
if (e == null) return {};
|
|
7
7
|
var r, t, o = V(e, n);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useLexicalComposerContext as a } from "@lexical/react/LexicalComposerContext";
|
|
2
|
+
import { $insertNodes as s, COMMAND_PRIORITY_EDITOR as i } from "lexical";
|
|
3
|
+
import { useEffect as l } from "react";
|
|
4
|
+
import { aj as N, ak as u, al as d } from "./index-CxOOJD40.js";
|
|
5
|
+
function p() {
|
|
6
|
+
const [e] = a();
|
|
7
|
+
return l(() => {
|
|
8
|
+
if (!e.hasNode(N))
|
|
9
|
+
throw console.error("NotePanelPlugin: NotePanelNode not registered on editor"), new Error(
|
|
10
|
+
"NotePanelPlugin: NotePanelNode not registered on editor"
|
|
11
|
+
);
|
|
12
|
+
return e.registerCommand(
|
|
13
|
+
u,
|
|
14
|
+
(o) => {
|
|
15
|
+
try {
|
|
16
|
+
e.update(() => {
|
|
17
|
+
const { type: r, title: t = "" } = o, n = d({ type: r, title: t });
|
|
18
|
+
s([n]);
|
|
19
|
+
});
|
|
20
|
+
} catch (r) {
|
|
21
|
+
return console.error("Error inserting note panel:", r), !1;
|
|
22
|
+
}
|
|
23
|
+
return !0;
|
|
24
|
+
},
|
|
25
|
+
i
|
|
26
|
+
);
|
|
27
|
+
}, [e]), null;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
p as default
|
|
31
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { jsx as t, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { useLexicalComposerContext as R } from "@lexical/react/LexicalComposerContext";
|
|
3
|
+
import { COMMAND_PRIORITY_LOW as O, $getSelection as C, $isRangeSelection as w } from "lexical";
|
|
4
|
+
import { forwardRef as M, useState as l, useImperativeHandle as P, useRef as D, useEffect as H } from "react";
|
|
5
|
+
import { c as L, D as _, a as z, b as j, d as W, S as b, e as B, am as K, g as $, B as E, an as q, t as d, p as F } from "./index-CxOOJD40.js";
|
|
6
|
+
const U = L("ArrowRight", [
|
|
7
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
8
|
+
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
9
|
+
]), I = M(({ onEnhance: f }, s) => {
|
|
10
|
+
const [h, r] = l(!1), [m, u] = l(""), [c, n] = l(""), [i, e] = l(""), [p, v] = l(!1), [g, y] = l(!1), [k, N] = l(null);
|
|
11
|
+
P(s, () => ({
|
|
12
|
+
openDialog: (a, A) => {
|
|
13
|
+
u(a), n(""), e(""), y(!1), N(() => A), r(!0);
|
|
14
|
+
},
|
|
15
|
+
closeDialog: () => {
|
|
16
|
+
r(!1), setTimeout(() => {
|
|
17
|
+
u(""), n(""), e(""), y(!1), N(null);
|
|
18
|
+
}, 300);
|
|
19
|
+
}
|
|
20
|
+
}));
|
|
21
|
+
const x = () => {
|
|
22
|
+
r(!1), setTimeout(() => {
|
|
23
|
+
u(""), n(""), e(""), y(!1), N(null);
|
|
24
|
+
}, 300);
|
|
25
|
+
}, T = async () => {
|
|
26
|
+
if (c.trim()) {
|
|
27
|
+
v(!0);
|
|
28
|
+
try {
|
|
29
|
+
await f(m, c), x();
|
|
30
|
+
} catch (a) {
|
|
31
|
+
console.error("Enhancement error:", a);
|
|
32
|
+
} finally {
|
|
33
|
+
v(!1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, S = () => {
|
|
37
|
+
k && i && k(i), x();
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ t(_, { open: h, onOpenChange: x, children: /* @__PURE__ */ o(z, { className: "sm:cteditor-max-w-[500px] cteditor-max-h-[650px]", children: [
|
|
40
|
+
/* @__PURE__ */ o(j, { children: [
|
|
41
|
+
/* @__PURE__ */ o(W, { className: "cteditor-flex cteditor-items-center cteditor-gap-2", children: [
|
|
42
|
+
/* @__PURE__ */ t(b, { className: "cteditor-size-5" }),
|
|
43
|
+
"Enhance Text"
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ t(B, { children: "Enhance your selected text with AI assistance." })
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ o("div", { className: "cteditor-space-y-4 cteditor-overflow-y-auto cteditor-max-h-[400px] cteditor-pr-2", children: [
|
|
48
|
+
/* @__PURE__ */ o("div", { className: "cteditor-space-y-1.5", children: [
|
|
49
|
+
/* @__PURE__ */ t("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "Selected Text" }),
|
|
50
|
+
/* @__PURE__ */ t("div", { className: "cteditor-p-3 cteditor-bg-accent/50 cteditor-rounded-lg cteditor-border cteditor-border-border cteditor-max-h-24 cteditor-overflow-y-auto", children: /* @__PURE__ */ t("p", { className: "cteditor-text-sm cteditor-text-foreground cteditor-leading-relaxed", children: m }) })
|
|
51
|
+
] }),
|
|
52
|
+
!g && /* @__PURE__ */ o("div", { className: "cteditor-space-y-1.5", children: [
|
|
53
|
+
/* @__PURE__ */ t("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "How to enhance?" }),
|
|
54
|
+
/* @__PURE__ */ t(
|
|
55
|
+
"textarea",
|
|
56
|
+
{
|
|
57
|
+
value: c,
|
|
58
|
+
onChange: (a) => n(a.target.value),
|
|
59
|
+
placeholder: "E.g., Make it professional, Add details, Simplify...",
|
|
60
|
+
className: "cteditor-w-full cteditor-h-20 cteditor-p-3 cteditor-bg-background cteditor-rounded-lg cteditor-border cteditor-border-border focus:cteditor-border-foreground cteditor-outline-none cteditor-text-sm cteditor-text-foreground cteditor-placeholder-muted-foreground cteditor-resize-none",
|
|
61
|
+
disabled: p,
|
|
62
|
+
onKeyDown: (a) => {
|
|
63
|
+
a.key === "Enter" && (a.ctrlKey || a.metaKey) && T();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ t("p", { className: "cteditor-text-xs cteditor-text-muted-foreground", children: "Ctrl+Enter to enhance" })
|
|
68
|
+
] }),
|
|
69
|
+
p && /* @__PURE__ */ o("div", { className: "cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-py-0 cteditor-space-y-3", children: [
|
|
70
|
+
/* @__PURE__ */ o("div", { className: "cteditor-relative cteditor-w-14 cteditor-h-14", children: [
|
|
71
|
+
/* @__PURE__ */ t(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
className: "cteditor-absolute cteditor-inset-0 cteditor-rounded-full cteditor-opacity-75",
|
|
75
|
+
style: {
|
|
76
|
+
background: "linear-gradient(to right, #a855f7, #ec4899, #a855f7)",
|
|
77
|
+
animation: "spin 2s linear infinite",
|
|
78
|
+
padding: "2px",
|
|
79
|
+
WebkitMask: "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",
|
|
80
|
+
WebkitMaskComposite: "xor",
|
|
81
|
+
maskComposite: "exclude"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ t("div", { className: "cteditor-absolute cteditor-inset-0 cteditor-rounded-full cteditor-bg-background cteditor-flex cteditor-items-center cteditor-justify-center cteditor-m-[2px]", children: /* @__PURE__ */ t(b, { className: "cteditor-w-6 cteditor-h-6 cteditor-text-purple-500 cteditor-animate-pulse" }) })
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ t("div", { className: "cteditor-text-center", children: /* @__PURE__ */ t("p", { className: "cteditor-text-sm cteditor-font-medium cteditor-text-foreground", children: "Enhancing text..." }) })
|
|
88
|
+
] }),
|
|
89
|
+
g && !p && /* @__PURE__ */ o("div", { className: "cteditor-space-y-1.5 cteditor-animate-in cteditor-fade-in cteditor-slide-in-from-bottom-4", children: [
|
|
90
|
+
/* @__PURE__ */ o("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-1.5", children: [
|
|
91
|
+
/* @__PURE__ */ t(K, { className: "cteditor-w-3.5 cteditor-h-3.5 cteditor-text-green-500" }),
|
|
92
|
+
/* @__PURE__ */ t("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "Enhanced Text" })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ t("div", { className: "cteditor-p-3 cteditor-bg-gradient-to-br cteditor-from-purple-500/5 cteditor-to-pink-500/5 cteditor-rounded-lg cteditor-border cteditor-border-purple-500/20 cteditor-max-h-48 cteditor-overflow-y-auto", children: /* @__PURE__ */ t("p", { className: "cteditor-text-sm cteditor-text-foreground cteditor-leading-relaxed", children: i }) })
|
|
95
|
+
] })
|
|
96
|
+
] }),
|
|
97
|
+
/* @__PURE__ */ o($, { children: [
|
|
98
|
+
/* @__PURE__ */ t(E, { variant: "outline", onClick: x, children: "Cancel" }),
|
|
99
|
+
!g && /* @__PURE__ */ o(
|
|
100
|
+
E,
|
|
101
|
+
{
|
|
102
|
+
onClick: T,
|
|
103
|
+
disabled: !c.trim() || p,
|
|
104
|
+
className: "cteditor-gap-2",
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ t(b, { className: "cteditor-size-5" }),
|
|
107
|
+
"Enhance"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
g && /* @__PURE__ */ o(E, { onClick: S, className: "cteditor-gap-2", children: [
|
|
112
|
+
"Insert",
|
|
113
|
+
/* @__PURE__ */ t(U, { className: "cteditor-size-5" })
|
|
114
|
+
] })
|
|
115
|
+
] })
|
|
116
|
+
] }) });
|
|
117
|
+
});
|
|
118
|
+
I.displayName = "TextEnhanceDialog";
|
|
119
|
+
const V = ({ apiKey: f }) => {
|
|
120
|
+
const [s] = R(), h = D(null), r = D(void 0), m = async (c, n) => {
|
|
121
|
+
let i = null;
|
|
122
|
+
s.getEditorState().read(() => {
|
|
123
|
+
const e = C();
|
|
124
|
+
w(e) && (i = {
|
|
125
|
+
anchor: {
|
|
126
|
+
key: e.anchor.key,
|
|
127
|
+
offset: e.anchor.offset,
|
|
128
|
+
type: e.anchor.type
|
|
129
|
+
},
|
|
130
|
+
focus: {
|
|
131
|
+
key: e.focus.key,
|
|
132
|
+
offset: e.focus.offset,
|
|
133
|
+
type: e.focus.type
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
try {
|
|
138
|
+
await F({
|
|
139
|
+
editor: s,
|
|
140
|
+
selectedText: c,
|
|
141
|
+
transformationType: "ENHANCE_WITH_AI",
|
|
142
|
+
apiKey: f,
|
|
143
|
+
savedSelection: i,
|
|
144
|
+
secondaryPrompt: n,
|
|
145
|
+
// User's instruction
|
|
146
|
+
onLoadingChange: (e) => {
|
|
147
|
+
if (e) {
|
|
148
|
+
if (r.current) return;
|
|
149
|
+
r.current = d.loading("Enhancing your text...", {
|
|
150
|
+
description: "This may take a few seconds. Please wait.",
|
|
151
|
+
duration: 1 / 0
|
|
152
|
+
});
|
|
153
|
+
} else
|
|
154
|
+
r.current && (d.dismiss(r.current), r.current = void 0);
|
|
155
|
+
},
|
|
156
|
+
onSuccess: (e) => {
|
|
157
|
+
r.current && (d.dismiss(r.current), r.current = void 0), d.success("Text enhanced successfully!");
|
|
158
|
+
},
|
|
159
|
+
onError: (e) => {
|
|
160
|
+
r.current && (d.dismiss(r.current), r.current = void 0), d.error("Enhancement failed", {
|
|
161
|
+
description: e
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
} catch (e) {
|
|
166
|
+
r.current && (d.dismiss(r.current), r.current = void 0), console.error("Error enhancing text:", e), d.error("Enhancement failed", {
|
|
167
|
+
description: e instanceof Error ? e.message : "An error occurred"
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}, u = (c) => (s.getEditorState().read(() => {
|
|
171
|
+
const n = C();
|
|
172
|
+
if (!w(n)) return;
|
|
173
|
+
const i = c || n.getTextContent().trim();
|
|
174
|
+
if (!i) {
|
|
175
|
+
d.error("No text selected", {
|
|
176
|
+
description: "Please select some text to enhance"
|
|
177
|
+
});
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
h.current?.openDialog(i, async (e) => {
|
|
181
|
+
await m(i, e);
|
|
182
|
+
});
|
|
183
|
+
}), !0);
|
|
184
|
+
return H(() => s.registerCommand(
|
|
185
|
+
q,
|
|
186
|
+
(c) => (u(c), !0),
|
|
187
|
+
O
|
|
188
|
+
), [s, f]), /* @__PURE__ */ t(
|
|
189
|
+
I,
|
|
190
|
+
{
|
|
191
|
+
ref: h,
|
|
192
|
+
onEnhance: m
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
};
|
|
196
|
+
export {
|
|
197
|
+
V as default
|
|
198
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const AI_REPHRASE_COMMAND: import('../../../node_modules/lexical').LexicalCommand<unknown>;
|
|
2
|
+
export declare const AI_IMAGE_COMMAND: import('../../../node_modules/lexical').LexicalCommand<string | undefined>;
|
|
3
|
+
export declare const AI_TRANSLATE_COMMAND: import('../../../node_modules/lexical').LexicalCommand<string | undefined>;
|
|
4
|
+
export declare const AI_ADJUST_TONE_COMMAND: import('../../../node_modules/lexical').LexicalCommand<string | undefined>;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export declare const AI_REPHRASE_COMMAND: import('../../../node_modules/lexical').LexicalCommand<unknown>;
|
|
2
|
-
export declare const AI_IMAGE_COMMAND: import('../../../node_modules/lexical').LexicalCommand<string | undefined>;
|
|
3
|
-
export declare const AI_TRANSLATE_COMMAND: import('../../../node_modules/lexical').LexicalCommand<string | undefined>;
|
|
4
|
-
export declare const AI_ADJUST_TONE_COMMAND: import('../../../node_modules/lexical').LexicalCommand<string | undefined>;
|
|
5
1
|
declare const AIRephrasePlugin: () => import("react/jsx-runtime").JSX.Element;
|
|
6
2
|
export default AIRephrasePlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { au as Tt, ao as Se, aI as Ce, ay as xe } from "./index-CxOOJD40.js";
|
|
2
2
|
import { h as Ee } from "./html2canvas.esm-BD_Vwvv8.js";
|
|
3
3
|
function Ft(c) {
|
|
4
4
|
throw new Error('Could not dynamically require "' + c + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as Ci } from "./html2canvas.esm-BD_Vwvv8.js";
|
|
2
|
-
import {
|
|
2
|
+
import { aI as yi, ay as Di } from "./index-CxOOJD40.js";
|
|
3
3
|
var In = 1252, Oi = [874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1e4], Zt = {
|
|
4
4
|
/*::[*/
|
|
5
5
|
0: 1252,
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
|
-
import { useLexicalComposerContext as
|
|
2
|
+
import { useLexicalComposerContext as B } from "@lexical/react/LexicalComposerContext";
|
|
3
3
|
import { $getNodeByKey as g } from "lexical";
|
|
4
|
-
import { useState as
|
|
5
|
-
import { k,
|
|
4
|
+
import { useState as E, useEffect as N } from "react";
|
|
5
|
+
import { ap as k, aq as y, ae as I, ar as h, as as T, at as W } from "./index-CxOOJD40.js";
|
|
6
6
|
function $(e, t) {
|
|
7
7
|
const d = e.split(".").pop()?.toLowerCase();
|
|
8
8
|
return d === "pdf" || t.startsWith("data:application/pdf") ? "pdf" : d === "docx" || t.startsWith("data:application/vnd.openxmlformats") && e.toLowerCase().endsWith(".docx") ? "docx" : d === "xlsx" || d === "xls" || t.startsWith("data:application/vnd.openxmlformats-officedocument.spreadsheetml") || t.startsWith("data:application/vnd.ms-excel") ? "xlsx" : null;
|
|
9
9
|
}
|
|
10
10
|
function z(e, t) {
|
|
11
|
-
const [d, n] =
|
|
12
|
-
return
|
|
11
|
+
const [d, n] = E(null);
|
|
12
|
+
return N(() => {
|
|
13
13
|
const c = e && t ? $(t, e) : null;
|
|
14
14
|
if (!e || !t || !c) {
|
|
15
15
|
n(null);
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
let l = !1;
|
|
19
|
-
return c === "pdf" ? import("./generatePdfThumbnail-
|
|
19
|
+
return c === "pdf" ? import("./generatePdfThumbnail-EuSjdwzm.js").then(({ generatePdfThumbnail: o }) => o(e)).then((o) => {
|
|
20
20
|
l || n(o);
|
|
21
21
|
}).catch(() => {
|
|
22
22
|
l || n(null);
|
|
23
|
-
}) : c === "docx" ? import("./generateDocxThumbnail-
|
|
23
|
+
}) : c === "docx" ? import("./generateDocxThumbnail-Ve0zlObJ.js").then(({ generateDocxThumbnail: o }) => o(e)).then((o) => {
|
|
24
24
|
l || n(o);
|
|
25
25
|
}).catch(() => {
|
|
26
26
|
l || n(null);
|
|
27
|
-
}) : c === "xlsx" && import("./generateXlsxThumbnail-
|
|
27
|
+
}) : c === "xlsx" && import("./generateXlsxThumbnail-C10kl6qh.js").then(({ generateXlsxThumbnail: o }) => o(e)).then((o) => {
|
|
28
28
|
l || n(o);
|
|
29
29
|
}).catch(() => {
|
|
30
30
|
l || n(null);
|
|
@@ -33,15 +33,15 @@ function z(e, t) {
|
|
|
33
33
|
};
|
|
34
34
|
}, [e, t]), d;
|
|
35
35
|
}
|
|
36
|
-
const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : e < 1024 * 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(1)} MB` : `${(e / (1024 * 1024 * 1024)).toFixed(1)} GB` : "",
|
|
36
|
+
const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : e < 1024 * 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(1)} MB` : `${(e / (1024 * 1024 * 1024)).toFixed(1)} GB` : "", D = (e) => {
|
|
37
37
|
const t = e.split(".");
|
|
38
38
|
return t.length > 1 ? t[t.length - 1].toLowerCase() : "";
|
|
39
|
-
}, F = (e) => {
|
|
40
|
-
const t = N(e);
|
|
41
|
-
return t === "pdf" || t === "docx" || t === "xlsx" || t === "xls";
|
|
42
39
|
}, C = (e) => {
|
|
43
|
-
const t =
|
|
44
|
-
return
|
|
40
|
+
const t = D(e);
|
|
41
|
+
return t === "pdf" || t === "docx" || t === "xlsx" || t === "xls";
|
|
42
|
+
}, F = (e) => {
|
|
43
|
+
const t = D(e);
|
|
44
|
+
return ["pdf", "doc", "docx", "txt", "odt"].includes(t) ? /* @__PURE__ */ r(h, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-blue-600" }) : ["xls", "xlsx", "csv"].includes(t) ? /* @__PURE__ */ r(h, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-green-600" }) : ["ppt", "pptx"].includes(t) ? /* @__PURE__ */ r(h, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-red-600" }) : ["zip", "rar", "7z", "tar", "gz"].includes(t) ? /* @__PURE__ */ r(T, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-orange-500" }) : /* @__PURE__ */ r(W, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-gray-500" });
|
|
45
45
|
}, H = ({
|
|
46
46
|
src: e,
|
|
47
47
|
fileName: t,
|
|
@@ -49,15 +49,15 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
|
|
|
49
49
|
displayType: n = "card",
|
|
50
50
|
nodeKey: c
|
|
51
51
|
}) => {
|
|
52
|
-
const l = n === "inline" ? "inline" : "card", [o] =
|
|
53
|
-
if (
|
|
52
|
+
const l = n === "inline" ? "inline" : "card", [o] = B(), u = z(C(t) ? e : void 0, t);
|
|
53
|
+
if (N(() => {
|
|
54
54
|
u && o.update(() => {
|
|
55
55
|
const a = g(c);
|
|
56
56
|
k(a) && a.setPreviewDataUrl(u);
|
|
57
57
|
});
|
|
58
58
|
}, [o, c, u]), !e || !t)
|
|
59
59
|
return console.error("FileView: Missing required props", { src: e, fileName: t, fileSize: d, nodeKey: c }), /* @__PURE__ */ r("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__ */ r("div", { className: "cteditor-text-sm cteditor-text-destructive", children: "Error loading file" }) });
|
|
60
|
-
const
|
|
60
|
+
const m = (a) => {
|
|
61
61
|
a.preventDefault(), a.stopPropagation();
|
|
62
62
|
try {
|
|
63
63
|
if (e.startsWith("data:")) {
|
|
@@ -66,7 +66,7 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
|
|
|
66
66
|
const w = new Uint8Array(x);
|
|
67
67
|
for (; x--; )
|
|
68
68
|
w[x] = b.charCodeAt(x);
|
|
69
|
-
const
|
|
69
|
+
const j = new Blob([w], { type: L }), v = URL.createObjectURL(j), s = document.createElement("a");
|
|
70
70
|
s.href = v, s.download = t, s.style.display = "none", document.body.appendChild(s), s.click(), document.body.removeChild(s), setTimeout(() => URL.revokeObjectURL(v), 100);
|
|
71
71
|
} else {
|
|
72
72
|
const i = document.createElement("a");
|
|
@@ -80,7 +80,7 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
|
|
|
80
80
|
const i = g(c);
|
|
81
81
|
k(i) && i.remove();
|
|
82
82
|
});
|
|
83
|
-
}, U =
|
|
83
|
+
}, U = C(t) && u;
|
|
84
84
|
return l === "inline" ? /* @__PURE__ */ p(
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
@@ -89,13 +89,13 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
|
|
|
89
89
|
tabIndex: 0,
|
|
90
90
|
"data-lexical-node-key": c,
|
|
91
91
|
children: [
|
|
92
|
-
/* @__PURE__ */ r("span", { className: "cteditor-flex-shrink-0 *:cteditor-size-5", children:
|
|
92
|
+
/* @__PURE__ */ r("span", { className: "cteditor-flex-shrink-0 *:cteditor-size-5", children: F(t) }),
|
|
93
93
|
/* @__PURE__ */ r("span", { className: "cteditor-flex-1 cteditor-min-w-0 cteditor-text-sm cteditor-font-medium cteditor-text-black cteditor-truncate", children: t }),
|
|
94
94
|
/* @__PURE__ */ r(
|
|
95
95
|
"button",
|
|
96
96
|
{
|
|
97
97
|
type: "button",
|
|
98
|
-
onClick:
|
|
98
|
+
onClick: m,
|
|
99
99
|
className: "cteditor-p-1 cteditor-rounded-md hover:cteditor-bg-accent cteditor-transition-colors cteditor-flex-shrink-0",
|
|
100
100
|
"aria-label": "Download file",
|
|
101
101
|
title: "Download file",
|
|
@@ -119,7 +119,7 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
|
|
|
119
119
|
alt: "",
|
|
120
120
|
className: "cteditor-w-full cteditor-h-full cteditor-object-cover"
|
|
121
121
|
}
|
|
122
|
-
) : /* @__PURE__ */ r("div", { className: "*:cteditor-size-8", children:
|
|
122
|
+
) : /* @__PURE__ */ r("div", { className: "*:cteditor-size-8", children: F(t) }) }),
|
|
123
123
|
/* @__PURE__ */ p("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-w-full", children: [
|
|
124
124
|
/* @__PURE__ */ p("div", { className: "cteditor-flex-1 cteditor-min-w-0", children: [
|
|
125
125
|
/* @__PURE__ */ r("div", { className: "cteditor-font-medium cteditor-text-xs cteditor-text-black cteditor-truncate", children: t }),
|
|
@@ -130,7 +130,7 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
|
|
|
130
130
|
"button",
|
|
131
131
|
{
|
|
132
132
|
type: "button",
|
|
133
|
-
onClick:
|
|
133
|
+
onClick: m,
|
|
134
134
|
className: "cteditor-p-1 cteditor-rounded-md cteditor-text-black/80 hover:cteditor-bg-black/10 cteditor-transition-colors",
|
|
135
135
|
"aria-label": "Download file",
|
|
136
136
|
title: "Download file",
|
|
@@ -145,7 +145,7 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
|
|
|
145
145
|
className: "cteditor-p-1 cteditor-rounded-md cteditor-text-black/80 hover:cteditor-bg-black/10 cteditor-transition-colors",
|
|
146
146
|
"aria-label": "Delete file",
|
|
147
147
|
title: "Delete file",
|
|
148
|
-
children: /* @__PURE__ */ r(
|
|
148
|
+
children: /* @__PURE__ */ r(I, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-current" })
|
|
149
149
|
}
|
|
150
150
|
)
|
|
151
151
|
] })
|
|
@@ -3,8 +3,8 @@ import { I as it } from "./ImageResizer-BVwxL4Eh.js";
|
|
|
3
3
|
import { CodeNode as ot } from "@lexical/code";
|
|
4
4
|
import { LinkNode as nt } from "@lexical/link";
|
|
5
5
|
import { AutoFocusPlugin as ct } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
6
|
-
import { useLexicalComposerContext as
|
|
7
|
-
import { ContentEditable as
|
|
6
|
+
import { useLexicalComposerContext as at } from "@lexical/react/LexicalComposerContext";
|
|
7
|
+
import { ContentEditable as lt } from "@lexical/react/LexicalContentEditable";
|
|
8
8
|
import { LexicalErrorBoundary as dt } from "@lexical/react/LexicalErrorBoundary";
|
|
9
9
|
import { HistoryPlugin as st } from "@lexical/react/LexicalHistoryPlugin";
|
|
10
10
|
import { LexicalNestedComposer as ut } from "@lexical/react/LexicalNestedComposer";
|
|
@@ -15,7 +15,7 @@ import { useLexicalNodeSelection as pt } from "@lexical/react/useLexicalNodeSele
|
|
|
15
15
|
import { mergeRegister as ht } from "@lexical/utils";
|
|
16
16
|
import { $getSelection as P, $isNodeSelection as p, $setSelection as W, SELECTION_CHANGE_COMMAND as bt, COMMAND_PRIORITY_LOW as f, CLICK_COMMAND as Ct, DRAGSTART_COMMAND as Nt, KEY_DELETE_COMMAND as xt, KEY_BACKSPACE_COMMAND as vt, KEY_ENTER_COMMAND as Et, KEY_ESCAPE_COMMAND as yt, RootNode as Rt, TextNode as At, LineBreakNode as kt, ParagraphNode as St, $getNodeByKey as A, $isParagraphNode as T } from "lexical";
|
|
17
17
|
import { useRef as L, useState as w, useCallback as x, useEffect as Dt } from "react";
|
|
18
|
-
import {
|
|
18
|
+
import { aH as v, a8 as Pt, a9 as Lt, aa as Mt, ab as _t, ac as $t, aA as zt, ae as It, aD as Ot, aE as Wt } from "./index-CxOOJD40.js";
|
|
19
19
|
function ie({
|
|
20
20
|
src: j,
|
|
21
21
|
nodeKey: g,
|
|
@@ -25,24 +25,24 @@ function ie({
|
|
|
25
25
|
resizable: Y,
|
|
26
26
|
showCaption: E,
|
|
27
27
|
caption: b,
|
|
28
|
-
captionsEnabled:
|
|
29
|
-
controls:
|
|
28
|
+
captionsEnabled: F,
|
|
29
|
+
controls: V = !0,
|
|
30
30
|
position: n = "none"
|
|
31
31
|
}) {
|
|
32
|
-
const
|
|
32
|
+
const l = L(null), S = L(null), [a, d, C] = pt(g), [s, M] = w(!1), [o] = at(), [y, H] = w(null), _ = L(null), K = mt(), D = x(
|
|
33
33
|
(t) => {
|
|
34
34
|
const r = P();
|
|
35
|
-
return
|
|
35
|
+
return a && p(r) && (t.preventDefault(), o.update(() => {
|
|
36
36
|
r.getNodes().forEach((c) => {
|
|
37
37
|
v(c) && c.remove();
|
|
38
38
|
});
|
|
39
39
|
})), !1;
|
|
40
40
|
},
|
|
41
|
-
[o,
|
|
41
|
+
[o, a]
|
|
42
42
|
), $ = x(
|
|
43
43
|
(t) => {
|
|
44
44
|
const r = P(), e = S.current;
|
|
45
|
-
if (
|
|
45
|
+
if (a && p(r) && r.getNodes().length === 1) {
|
|
46
46
|
if (E)
|
|
47
47
|
return W(null), t.preventDefault(), b.focus(), !0;
|
|
48
48
|
if (e !== null && e !== document.activeElement)
|
|
@@ -50,7 +50,7 @@ function ie({
|
|
|
50
50
|
}
|
|
51
51
|
return !1;
|
|
52
52
|
},
|
|
53
|
-
[b,
|
|
53
|
+
[b, a, E]
|
|
54
54
|
), z = x(
|
|
55
55
|
(t) => _.current === b || S.current === t.target ? (W(null), o.update(() => {
|
|
56
56
|
d(!0);
|
|
@@ -64,17 +64,17 @@ function ie({
|
|
|
64
64
|
if (s)
|
|
65
65
|
return !0;
|
|
66
66
|
const e = r.target;
|
|
67
|
-
if (e.closest("button") &&
|
|
67
|
+
if (e.closest("button") && l.current && e.closest(".editor-image") === l.current.closest(".editor-image"))
|
|
68
68
|
return !0;
|
|
69
|
-
const c = e ===
|
|
69
|
+
const c = e === l.current;
|
|
70
70
|
let u = !1;
|
|
71
|
-
if (!c &&
|
|
72
|
-
const R =
|
|
71
|
+
if (!c && l.current) {
|
|
72
|
+
const R = l.current.getBoundingClientRect();
|
|
73
73
|
u = r.clientX >= R.left && r.clientX <= R.right && r.clientY >= R.top && r.clientY <= R.bottom;
|
|
74
74
|
}
|
|
75
|
-
return c || u ? (r.shiftKey ? d(!
|
|
75
|
+
return c || u ? (r.shiftKey ? d(!a) : (C(), d(!0)), !0) : !1;
|
|
76
76
|
},
|
|
77
|
-
[s,
|
|
77
|
+
[s, a, d, C]
|
|
78
78
|
);
|
|
79
79
|
Dt(() => {
|
|
80
80
|
let t = !0;
|
|
@@ -94,7 +94,7 @@ function ie({
|
|
|
94
94
|
),
|
|
95
95
|
o.registerCommand(
|
|
96
96
|
Nt,
|
|
97
|
-
(e) => e.target ===
|
|
97
|
+
(e) => e.target === l.current ? (e.preventDefault(), !0) : !1,
|
|
98
98
|
f
|
|
99
99
|
),
|
|
100
100
|
o.registerCommand(
|
|
@@ -121,7 +121,7 @@ function ie({
|
|
|
121
121
|
C,
|
|
122
122
|
o,
|
|
123
123
|
s,
|
|
124
|
-
|
|
124
|
+
a,
|
|
125
125
|
g,
|
|
126
126
|
D,
|
|
127
127
|
$,
|
|
@@ -141,9 +141,9 @@ function ie({
|
|
|
141
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
148
|
const r = A(g);
|
|
149
149
|
if (v(r)) {
|
|
@@ -160,20 +160,20 @@ function ie({
|
|
|
160
160
|
c && T(c) && (r === "left" ? c.setFormat("left") : r === "right" ? c.setFormat("right") : c.setFormat(""));
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
|
-
},
|
|
163
|
+
}, J = x(
|
|
164
164
|
(t) => {
|
|
165
165
|
if (s || t.target.closest("button"))
|
|
166
166
|
return;
|
|
167
|
-
const e = t.target ===
|
|
167
|
+
const e = t.target === l.current;
|
|
168
168
|
let c = !1;
|
|
169
|
-
if (!e &&
|
|
170
|
-
const u =
|
|
169
|
+
if (!e && l.current) {
|
|
170
|
+
const u = l.current.getBoundingClientRect();
|
|
171
171
|
c = t.clientX >= u.left && t.clientX <= u.right && t.clientY >= u.top && t.clientY <= u.bottom;
|
|
172
172
|
}
|
|
173
|
-
!e && !c || (t.stopPropagation(), t.shiftKey ? d(!
|
|
173
|
+
!e && !c || (t.stopPropagation(), t.shiftKey ? d(!a) : (C(), d(!0)));
|
|
174
174
|
},
|
|
175
|
-
[s,
|
|
176
|
-
), Q =
|
|
175
|
+
[s, a, d, C]
|
|
176
|
+
), Q = a && p(y) && !s, O = (a || s) && K, Z = typeof h == "number" && typeof k == "number", tt = typeof h == "number" ? h : "auto", et = typeof k == "number" ? k : "auto";
|
|
177
177
|
return /* @__PURE__ */ N(rt, { children: [
|
|
178
178
|
/* @__PURE__ */ N(
|
|
179
179
|
"div",
|
|
@@ -207,14 +207,14 @@ function ie({
|
|
|
207
207
|
position: "relative",
|
|
208
208
|
display: "inline-block"
|
|
209
209
|
},
|
|
210
|
-
onClick:
|
|
210
|
+
onClick: J,
|
|
211
211
|
children: [
|
|
212
212
|
/* @__PURE__ */ i(
|
|
213
213
|
"video",
|
|
214
214
|
{
|
|
215
|
-
ref:
|
|
215
|
+
ref: l,
|
|
216
216
|
src: j,
|
|
217
|
-
controls:
|
|
217
|
+
controls: V,
|
|
218
218
|
preload: "metadata",
|
|
219
219
|
className: O ? `focused ${p(y) ? "draggable" : ""}` : void 0,
|
|
220
220
|
style: Z ? {
|
|
@@ -228,7 +228,7 @@ function ie({
|
|
|
228
228
|
draggable: "false"
|
|
229
229
|
}
|
|
230
230
|
),
|
|
231
|
-
|
|
231
|
+
a && p(y) && /* @__PURE__ */ N("div", { className: "cteditor-absolute cteditor-top-2 cteditor-right-2 cteditor-flex cteditor-gap-1 cteditor-z-10", children: [
|
|
232
232
|
/* @__PURE__ */ N("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-0.5 cteditor-bg-background/80 cteditor-rounded-md cteditor-shadow-md cteditor-border cteditor-border-border cteditor-p-0.5", children: [
|
|
233
233
|
/* @__PURE__ */ i(
|
|
234
234
|
"button",
|
|
@@ -304,7 +304,7 @@ function ie({
|
|
|
304
304
|
{
|
|
305
305
|
type: "button",
|
|
306
306
|
onClick: (t) => {
|
|
307
|
-
t.stopPropagation(),
|
|
307
|
+
t.stopPropagation(), q(t);
|
|
308
308
|
},
|
|
309
309
|
className: "cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
|
|
310
310
|
"aria-label": "Delete video",
|
|
@@ -320,11 +320,11 @@ function ie({
|
|
|
320
320
|
setShowCaption: X,
|
|
321
321
|
editor: o,
|
|
322
322
|
buttonRef: S,
|
|
323
|
-
imageRef:
|
|
323
|
+
imageRef: l,
|
|
324
324
|
maxWidth: B,
|
|
325
|
-
onResizeStart:
|
|
325
|
+
onResizeStart: U,
|
|
326
326
|
onResizeEnd: G,
|
|
327
|
-
captionsEnabled:
|
|
327
|
+
captionsEnabled: F
|
|
328
328
|
}
|
|
329
329
|
)
|
|
330
330
|
]
|
|
@@ -357,7 +357,7 @@ function ie({
|
|
|
357
357
|
gt,
|
|
358
358
|
{
|
|
359
359
|
contentEditable: /* @__PURE__ */ i(
|
|
360
|
-
|
|
360
|
+
lt,
|
|
361
361
|
{
|
|
362
362
|
"aria-placeholder": "Enter a caption...",
|
|
363
363
|
placeholder: () => /* @__PURE__ */ i("span", { className: "cteditor-text-xs", children: "Enter a caption..." }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as i, jsxs as b } from "react/jsx-runtime";
|
|
2
2
|
import { useLexicalComposerContext as k } from "@lexical/react/LexicalComposerContext";
|
|
3
|
-
import { c as L,
|
|
3
|
+
import { c as L, ah as I, ai as w } from "./index-CxOOJD40.js";
|
|
4
4
|
import { useBasicTypeaheadTriggerMatch as C, LexicalTypeaheadMenuPlugin as S, MenuOption as R } from "@lexical/react/LexicalTypeaheadMenuPlugin";
|
|
5
5
|
import { useState as y, useMemo as v, useCallback as g, useEffect as O } from "react";
|
|
6
6
|
import * as E from "react-dom";
|