eddyter 1.4.8 → 1.4.9
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/{ImageResizer-C5luyjPa.js → ImageResizer-BVwxL4Eh.js} +20 -19
- package/dist/assets/style.css +1 -1
- package/dist/{generateDocxThumbnail-Bg1t0PrM.js → generateDocxThumbnail-C-ncaF7K.js} +1 -1
- package/dist/{generatePdfThumbnail-DAlYprsR.js → generatePdfThumbnail-3ltsGn6c.js} +8 -8
- package/dist/{generateXlsxThumbnail-CQTndahy.js → generateXlsxThumbnail-D7WwiJyR.js} +1 -1
- package/dist/{html2pdf.bundle.min-CDGSMyz-.js → html2pdf.bundle.min-clbInSdL.js} +1 -1
- package/dist/{index-BiSbWE5S.js → index-BoaegKBH.js} +43 -36
- package/dist/{index-bcmxAWk7.js → index-C2wTHo-G.js} +54 -52
- package/dist/{index-0q0ojIJJ.js → index-DvjIQ7q3.js} +349 -364
- package/dist/{index-DIH7BtWD.js → index-oIJfc57t.js} +14302 -14136
- package/dist/index.js +1 -1
- package/dist/ui/Icons.d.ts +2 -1
- package/package.json +3 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as Tt, H as Se, K as Ce, l as xe } from "./index-oIJfc57t.js";
|
|
2
2
|
import { h as Ee } from "./html2canvas.esm-C2wu93Kq.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,4 +1,4 @@
|
|
|
1
|
-
import { K as u,
|
|
1
|
+
import { K as u, l as b } from "./index-oIJfc57t.js";
|
|
2
2
|
const m = "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174";
|
|
3
3
|
let w = null;
|
|
4
4
|
async function C() {
|
|
@@ -30,25 +30,25 @@ async function j(t) {
|
|
|
30
30
|
const a = await o.arrayBuffer();
|
|
31
31
|
return new Uint8Array(a);
|
|
32
32
|
}
|
|
33
|
-
const p = 240,
|
|
33
|
+
const p = 240, l = 176;
|
|
34
34
|
async function D(t) {
|
|
35
35
|
try {
|
|
36
36
|
const n = await C(), o = await j(t), r = await (await n.getDocument({ data: o }).promise).getPage(1), i = r.getViewport({ scale: 1 }), c = p / i.width, e = r.getViewport({ scale: c }), s = document.createElement("canvas");
|
|
37
37
|
s.width = e.width, s.height = e.height;
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
38
|
+
const h = s.getContext("2d");
|
|
39
|
+
if (!h)
|
|
40
40
|
throw new Error("Could not get 2d context");
|
|
41
41
|
await r.render({
|
|
42
|
-
canvasContext:
|
|
42
|
+
canvasContext: h,
|
|
43
43
|
viewport: e
|
|
44
44
|
}).promise;
|
|
45
45
|
const d = document.createElement("canvas");
|
|
46
|
-
d.width = p, d.height =
|
|
46
|
+
d.width = p, d.height = l;
|
|
47
47
|
const f = d.getContext("2d");
|
|
48
48
|
if (!f)
|
|
49
49
|
return s.toDataURL("image/png");
|
|
50
|
-
f.fillStyle = "#ffffff", f.fillRect(0, 0, p,
|
|
51
|
-
const g = Math.min(e.height,
|
|
50
|
+
f.fillStyle = "#ffffff", f.fillRect(0, 0, p, l);
|
|
51
|
+
const g = Math.min(e.height, l);
|
|
52
52
|
return f.drawImage(
|
|
53
53
|
s,
|
|
54
54
|
0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as Ci } from "./html2canvas.esm-C2wu93Kq.js";
|
|
2
|
-
import { K as yi,
|
|
2
|
+
import { K as yi, l as Di } from "./index-oIJfc57t.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,25 +1,25 @@
|
|
|
1
1
|
import { jsxs as x, Fragment as rt, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { I as it } from "./ImageResizer-
|
|
3
|
-
import { J as N, W as ot,
|
|
2
|
+
import { I as it } from "./ImageResizer-BVwxL4Eh.js";
|
|
3
|
+
import { J as N, W as ot, m as nt, A as ct, n as lt, o as at, p as dt, T as st, M as ut, v as ft, w as gt } from "./index-oIJfc57t.js";
|
|
4
4
|
import { LinkNode as mt } from "@lexical/link";
|
|
5
|
-
import { AutoFocusPlugin as
|
|
6
|
-
import { useLexicalComposerContext as
|
|
5
|
+
import { AutoFocusPlugin as pt } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
6
|
+
import { useLexicalComposerContext as ht } from "@lexical/react/LexicalComposerContext";
|
|
7
7
|
import { ContentEditable as bt } from "@lexical/react/LexicalContentEditable";
|
|
8
8
|
import { LexicalErrorBoundary as Ct } from "@lexical/react/LexicalErrorBoundary";
|
|
9
9
|
import { HistoryPlugin as xt } from "@lexical/react/LexicalHistoryPlugin";
|
|
10
10
|
import { LexicalNestedComposer as Nt } from "@lexical/react/LexicalNestedComposer";
|
|
11
11
|
import { OnChangePlugin as vt } from "@lexical/react/LexicalOnChangePlugin";
|
|
12
12
|
import { RichTextPlugin as Et } from "@lexical/react/LexicalRichTextPlugin";
|
|
13
|
-
import { useLexicalEditable as
|
|
14
|
-
import { useLexicalNodeSelection as
|
|
15
|
-
import { mergeRegister as
|
|
16
|
-
import { $getSelection as
|
|
17
|
-
import { useRef as
|
|
13
|
+
import { useLexicalEditable as yt } from "@lexical/react/useLexicalEditable";
|
|
14
|
+
import { useLexicalNodeSelection as Rt } from "@lexical/react/useLexicalNodeSelection";
|
|
15
|
+
import { mergeRegister as At } from "@lexical/utils";
|
|
16
|
+
import { $getSelection as M, $isNodeSelection as p, $setSelection as O, SELECTION_CHANGE_COMMAND as kt, COMMAND_PRIORITY_LOW as f, CLICK_COMMAND as St, DRAGSTART_COMMAND as Dt, KEY_DELETE_COMMAND as Mt, KEY_BACKSPACE_COMMAND as Pt, KEY_ENTER_COMMAND as Lt, KEY_ESCAPE_COMMAND as _t, RootNode as $t, TextNode as zt, LineBreakNode as It, ParagraphNode as Wt, $getNodeByKey as A, $isParagraphNode as T } from "lexical";
|
|
17
|
+
import { useRef as P, useState as w, useCallback as v, useEffect as Ot } from "react";
|
|
18
18
|
function re({
|
|
19
19
|
src: j,
|
|
20
20
|
nodeKey: g,
|
|
21
|
-
width:
|
|
22
|
-
height:
|
|
21
|
+
width: h,
|
|
22
|
+
height: k,
|
|
23
23
|
maxWidth: B,
|
|
24
24
|
resizable: Y,
|
|
25
25
|
showCaption: E,
|
|
@@ -28,10 +28,10 @@ function re({
|
|
|
28
28
|
controls: V = !0,
|
|
29
29
|
position: n = "none"
|
|
30
30
|
}) {
|
|
31
|
-
const a =
|
|
31
|
+
const a = P(null), S = P(null), [l, d, C] = Rt(g), [s, L] = w(!1), [o] = ht(), [y, H] = w(null), _ = P(null), K = yt(), D = v(
|
|
32
32
|
(t) => {
|
|
33
|
-
const r =
|
|
34
|
-
return l &&
|
|
33
|
+
const r = M();
|
|
34
|
+
return l && p(r) && (t.preventDefault(), o.update(() => {
|
|
35
35
|
r.getNodes().forEach((c) => {
|
|
36
36
|
N(c) && c.remove();
|
|
37
37
|
});
|
|
@@ -40,8 +40,8 @@ function re({
|
|
|
40
40
|
[o, l]
|
|
41
41
|
), $ = v(
|
|
42
42
|
(t) => {
|
|
43
|
-
const r =
|
|
44
|
-
if (l &&
|
|
43
|
+
const r = M(), e = S.current;
|
|
44
|
+
if (l && p(r) && r.getNodes().length === 1) {
|
|
45
45
|
if (E)
|
|
46
46
|
return O(null), t.preventDefault(), b.focus(), !0;
|
|
47
47
|
if (e !== null && e !== document.activeElement)
|
|
@@ -68,8 +68,8 @@ function re({
|
|
|
68
68
|
const c = e === a.current;
|
|
69
69
|
let u = !1;
|
|
70
70
|
if (!c && a.current) {
|
|
71
|
-
const
|
|
72
|
-
u = r.clientX >=
|
|
71
|
+
const R = a.current.getBoundingClientRect();
|
|
72
|
+
u = r.clientX >= R.left && r.clientX <= R.right && r.clientY >= R.top && r.clientY <= R.bottom;
|
|
73
73
|
}
|
|
74
74
|
return c || u ? (r.shiftKey ? d(!l) : (C(), d(!0)), !0) : !1;
|
|
75
75
|
},
|
|
@@ -77,12 +77,12 @@ function re({
|
|
|
77
77
|
);
|
|
78
78
|
Ot(() => {
|
|
79
79
|
let t = !0;
|
|
80
|
-
const r =
|
|
80
|
+
const r = At(
|
|
81
81
|
o.registerUpdateListener(({ editorState: e }) => {
|
|
82
|
-
t && H(e.read(() =>
|
|
82
|
+
t && H(e.read(() => M()));
|
|
83
83
|
}),
|
|
84
84
|
o.registerCommand(
|
|
85
|
-
|
|
85
|
+
kt,
|
|
86
86
|
(e, c) => (_.current = c, !1),
|
|
87
87
|
f
|
|
88
88
|
),
|
|
@@ -97,16 +97,16 @@ function re({
|
|
|
97
97
|
f
|
|
98
98
|
),
|
|
99
99
|
o.registerCommand(
|
|
100
|
-
|
|
100
|
+
Mt,
|
|
101
101
|
D,
|
|
102
102
|
f
|
|
103
103
|
),
|
|
104
104
|
o.registerCommand(
|
|
105
|
-
|
|
105
|
+
Pt,
|
|
106
106
|
D,
|
|
107
107
|
f
|
|
108
108
|
),
|
|
109
|
-
o.registerCommand(
|
|
109
|
+
o.registerCommand(Lt, $, f),
|
|
110
110
|
o.registerCommand(
|
|
111
111
|
_t,
|
|
112
112
|
z,
|
|
@@ -130,21 +130,21 @@ function re({
|
|
|
130
130
|
]);
|
|
131
131
|
const X = () => {
|
|
132
132
|
o.update(() => {
|
|
133
|
-
const t =
|
|
133
|
+
const t = A(g);
|
|
134
134
|
N(t) && t.setShowCaption(!0);
|
|
135
135
|
});
|
|
136
136
|
}, G = (t, r) => {
|
|
137
137
|
setTimeout(() => {
|
|
138
|
-
|
|
138
|
+
L(!1);
|
|
139
139
|
}, 200), o.update(() => {
|
|
140
|
-
const e =
|
|
140
|
+
const e = A(g);
|
|
141
141
|
N(e) && e.setWidthAndHeight(t, r);
|
|
142
142
|
});
|
|
143
143
|
}, J = () => {
|
|
144
|
-
|
|
144
|
+
L(!0);
|
|
145
145
|
}, U = (t) => {
|
|
146
146
|
t.preventDefault(), t.stopPropagation(), o.update(() => {
|
|
147
|
-
const r =
|
|
147
|
+
const r = A(g);
|
|
148
148
|
if (N(r)) {
|
|
149
149
|
const e = r.getParent();
|
|
150
150
|
r.remove(), e && T(e) && e.getChildrenSize() === 0 && e.setFormat("left");
|
|
@@ -152,7 +152,7 @@ function re({
|
|
|
152
152
|
});
|
|
153
153
|
}, m = (t, r) => {
|
|
154
154
|
t.preventDefault(), t.stopPropagation(), o.update(() => {
|
|
155
|
-
const e =
|
|
155
|
+
const e = A(g);
|
|
156
156
|
if (N(e)) {
|
|
157
157
|
e.setPosition(r);
|
|
158
158
|
const c = e.getParent();
|
|
@@ -172,7 +172,7 @@ function re({
|
|
|
172
172
|
!e && !c || (t.stopPropagation(), t.shiftKey ? d(!l) : (C(), d(!0)));
|
|
173
173
|
},
|
|
174
174
|
[s, l, d, C]
|
|
175
|
-
), Q = l &&
|
|
175
|
+
), Q = l && p(y) && !s, W = (l || s) && K, Z = typeof h == "number" && typeof k == "number", tt = typeof h == "number" ? h : "auto", et = typeof k == "number" ? k : "auto";
|
|
176
176
|
return /* @__PURE__ */ x(rt, { children: [
|
|
177
177
|
/* @__PURE__ */ x(
|
|
178
178
|
"div",
|
|
@@ -215,7 +215,7 @@ function re({
|
|
|
215
215
|
src: j,
|
|
216
216
|
controls: V,
|
|
217
217
|
preload: "metadata",
|
|
218
|
-
className: W ? `focused ${
|
|
218
|
+
className: W ? `focused ${p(y) ? "draggable" : ""}` : void 0,
|
|
219
219
|
style: Z ? {
|
|
220
220
|
width: tt,
|
|
221
221
|
height: et,
|
|
@@ -227,11 +227,12 @@ function re({
|
|
|
227
227
|
draggable: "false"
|
|
228
228
|
}
|
|
229
229
|
),
|
|
230
|
-
l &&
|
|
230
|
+
l && p(y) && /* @__PURE__ */ x("div", { className: "cteditor-absolute cteditor-top-2 cteditor-right-2 cteditor-flex cteditor-gap-1 cteditor-z-10", children: [
|
|
231
231
|
/* @__PURE__ */ x("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: [
|
|
232
232
|
/* @__PURE__ */ i(
|
|
233
233
|
"button",
|
|
234
234
|
{
|
|
235
|
+
type: "button",
|
|
235
236
|
onClick: (t) => m(t, "left"),
|
|
236
237
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${n === "left" ? "cteditor-bg-accent" : ""}`,
|
|
237
238
|
"aria-label": "Wrap text left",
|
|
@@ -242,6 +243,7 @@ function re({
|
|
|
242
243
|
/* @__PURE__ */ i(
|
|
243
244
|
"button",
|
|
244
245
|
{
|
|
246
|
+
type: "button",
|
|
245
247
|
onClick: (t) => m(t, "right"),
|
|
246
248
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${n === "right" ? "cteditor-bg-accent" : ""}`,
|
|
247
249
|
"aria-label": "Wrap text right",
|
|
@@ -253,6 +255,7 @@ function re({
|
|
|
253
255
|
/* @__PURE__ */ i(
|
|
254
256
|
"button",
|
|
255
257
|
{
|
|
258
|
+
type: "button",
|
|
256
259
|
onClick: (t) => m(t, "inline-left"),
|
|
257
260
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${n === "inline-left" ? "cteditor-bg-accent" : ""}`,
|
|
258
261
|
"aria-label": "Align left",
|
|
@@ -263,6 +266,7 @@ function re({
|
|
|
263
266
|
/* @__PURE__ */ i(
|
|
264
267
|
"button",
|
|
265
268
|
{
|
|
269
|
+
type: "button",
|
|
266
270
|
onClick: (t) => m(t, "inline-center"),
|
|
267
271
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${n === "inline-center" || n === "full" ? "cteditor-bg-accent" : ""}`,
|
|
268
272
|
"aria-label": "Align center",
|
|
@@ -273,6 +277,7 @@ function re({
|
|
|
273
277
|
/* @__PURE__ */ i(
|
|
274
278
|
"button",
|
|
275
279
|
{
|
|
280
|
+
type: "button",
|
|
276
281
|
onClick: (t) => m(t, "inline-right"),
|
|
277
282
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${n === "inline-right" ? "cteditor-bg-accent" : ""}`,
|
|
278
283
|
"aria-label": "Align right",
|
|
@@ -284,6 +289,7 @@ function re({
|
|
|
284
289
|
/* @__PURE__ */ i(
|
|
285
290
|
"button",
|
|
286
291
|
{
|
|
292
|
+
type: "button",
|
|
287
293
|
onClick: (t) => m(t, "none"),
|
|
288
294
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${n === "none" ? "cteditor-bg-accent" : ""}`,
|
|
289
295
|
"aria-label": "Inline",
|
|
@@ -295,6 +301,7 @@ function re({
|
|
|
295
301
|
/* @__PURE__ */ i(
|
|
296
302
|
"button",
|
|
297
303
|
{
|
|
304
|
+
type: "button",
|
|
298
305
|
onClick: (t) => {
|
|
299
306
|
t.stopPropagation(), U(t);
|
|
300
307
|
},
|
|
@@ -305,7 +312,7 @@ function re({
|
|
|
305
312
|
}
|
|
306
313
|
)
|
|
307
314
|
] }),
|
|
308
|
-
Y &&
|
|
315
|
+
Y && p(y) && W && /* @__PURE__ */ i(
|
|
309
316
|
it,
|
|
310
317
|
{
|
|
311
318
|
showCaption: E,
|
|
@@ -327,7 +334,7 @@ function re({
|
|
|
327
334
|
{
|
|
328
335
|
className: "image-caption-container",
|
|
329
336
|
style: {
|
|
330
|
-
width: typeof
|
|
337
|
+
width: typeof h == "number" ? `${h}px` : "100%",
|
|
331
338
|
maxWidth: "100%",
|
|
332
339
|
...n === "inline-center" || n === "full" ? { margin: "0 auto" } : n === "inline-right" ? { marginLeft: "auto" } : n === "left" ? { float: "left", clear: "left" } : n === "right" ? { float: "right", clear: "right" } : {}
|
|
333
340
|
},
|
|
@@ -344,7 +351,7 @@ function re({
|
|
|
344
351
|
ut
|
|
345
352
|
],
|
|
346
353
|
children: [
|
|
347
|
-
/* @__PURE__ */ i(
|
|
354
|
+
/* @__PURE__ */ i(pt, {}),
|
|
348
355
|
/* @__PURE__ */ i(
|
|
349
356
|
Et,
|
|
350
357
|
{
|
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
|
-
import { useLexicalComposerContext as
|
|
3
|
-
import { $getNodeByKey as
|
|
4
|
-
import { useState as
|
|
5
|
-
import {
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
return
|
|
2
|
+
import { useLexicalComposerContext as $ } from "@lexical/react/LexicalComposerContext";
|
|
3
|
+
import { $getNodeByKey as g } from "lexical";
|
|
4
|
+
import { useState as j, useEffect as D } from "react";
|
|
5
|
+
import { $ as k, D as y, T as B, F as h, a as E, b as I } from "./index-oIJfc57t.js";
|
|
6
|
+
function W(e, t) {
|
|
7
|
+
const d = e.split(".").pop()?.toLowerCase();
|
|
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 [
|
|
12
|
-
return
|
|
13
|
-
const
|
|
14
|
-
if (!e || !t || !
|
|
11
|
+
const [d, n] = j(null);
|
|
12
|
+
return D(() => {
|
|
13
|
+
const c = e && t ? W(t, e) : null;
|
|
14
|
+
if (!e || !t || !c) {
|
|
15
15
|
n(null);
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
let l = !1;
|
|
19
|
-
return
|
|
19
|
+
return c === "pdf" ? import("./generatePdfThumbnail-3ltsGn6c.js").then(({ generatePdfThumbnail: o }) => o(e)).then((o) => {
|
|
20
20
|
l || n(o);
|
|
21
21
|
}).catch(() => {
|
|
22
22
|
l || n(null);
|
|
23
|
-
}) :
|
|
23
|
+
}) : c === "docx" ? import("./generateDocxThumbnail-C-ncaF7K.js").then(({ generateDocxThumbnail: o }) => o(e)).then((o) => {
|
|
24
24
|
l || n(o);
|
|
25
25
|
}).catch(() => {
|
|
26
26
|
l || n(null);
|
|
27
|
-
}) :
|
|
27
|
+
}) : c === "xlsx" && import("./generateXlsxThumbnail-D7WwiJyR.js").then(({ generateXlsxThumbnail: o }) => o(e)).then((o) => {
|
|
28
28
|
l || n(o);
|
|
29
29
|
}).catch(() => {
|
|
30
30
|
l || n(null);
|
|
31
31
|
}), () => {
|
|
32
32
|
l = !0, n(null);
|
|
33
33
|
};
|
|
34
|
-
}, [e, t]),
|
|
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` : "", N = (e) => {
|
|
37
37
|
const t = e.split(".");
|
|
38
38
|
return t.length > 1 ? t[t.length - 1].toLowerCase() : "";
|
|
39
39
|
}, F = (e) => {
|
|
40
|
-
const t =
|
|
40
|
+
const t = N(e);
|
|
41
41
|
return t === "pdf" || t === "docx" || t === "xlsx" || t === "xls";
|
|
42
42
|
}, C = (e) => {
|
|
43
|
-
const t =
|
|
44
|
-
return ["pdf", "doc", "docx", "txt", "odt"].includes(t) ? /* @__PURE__ */ r(
|
|
43
|
+
const t = N(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(E, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-orange-500" }) : /* @__PURE__ */ r(I, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-gray-500" });
|
|
45
45
|
}, H = ({
|
|
46
46
|
src: e,
|
|
47
47
|
fileName: t,
|
|
48
|
-
fileSize:
|
|
48
|
+
fileSize: d,
|
|
49
49
|
displayType: n = "card",
|
|
50
|
-
nodeKey:
|
|
50
|
+
nodeKey: c
|
|
51
51
|
}) => {
|
|
52
|
-
const l = n === "inline" ? "inline" : "card", [o] =
|
|
53
|
-
if (
|
|
52
|
+
const l = n === "inline" ? "inline" : "card", [o] = $(), u = z(F(t) ? e : void 0, t);
|
|
53
|
+
if (D(() => {
|
|
54
54
|
u && o.update(() => {
|
|
55
|
-
const a =
|
|
56
|
-
|
|
55
|
+
const a = g(c);
|
|
56
|
+
k(a) && a.setPreviewDataUrl(u);
|
|
57
57
|
});
|
|
58
|
-
}, [o,
|
|
59
|
-
return console.error("FileView: Missing required props", { src: e, fileName: t, fileSize:
|
|
60
|
-
const
|
|
58
|
+
}, [o, c, u]), !e || !t)
|
|
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 m = (a) => {
|
|
61
61
|
a.preventDefault(), a.stopPropagation();
|
|
62
62
|
try {
|
|
63
63
|
if (e.startsWith("data:")) {
|
|
64
|
-
const i = e.split(","),
|
|
65
|
-
let
|
|
66
|
-
const
|
|
67
|
-
for (;
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
s.href =
|
|
64
|
+
const i = e.split(","), f = i[0].match(/:(.*?);/), L = f ? f[1] : "application/octet-stream", b = atob(i[1]);
|
|
65
|
+
let x = b.length;
|
|
66
|
+
const w = new Uint8Array(x);
|
|
67
|
+
for (; x--; )
|
|
68
|
+
w[x] = b.charCodeAt(x);
|
|
69
|
+
const T = new Blob([w], { type: L }), v = URL.createObjectURL(T), s = document.createElement("a");
|
|
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");
|
|
73
73
|
i.href = e, i.download = t, i.style.display = "none", i.target = "_blank", document.body.appendChild(i), i.click(), document.body.removeChild(i);
|
|
@@ -77,29 +77,29 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
|
|
|
77
77
|
}
|
|
78
78
|
}, P = (a) => {
|
|
79
79
|
a.preventDefault(), a.stopPropagation(), o.update(() => {
|
|
80
|
-
const i =
|
|
81
|
-
|
|
80
|
+
const i = g(c);
|
|
81
|
+
k(i) && i.remove();
|
|
82
82
|
});
|
|
83
83
|
}, U = F(t) && u;
|
|
84
84
|
return l === "inline" ? /* @__PURE__ */ p(
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
87
|
-
className: "cteditor-inline-flex cteditor-items-center cteditor-gap-2 cteditor-py-1.5 cteditor-px-3 cteditor-my-0.5 cteditor-rounded-full cteditor-bg-
|
|
87
|
+
className: "cteditor-inline-flex cteditor-items-center cteditor-gap-2 cteditor-py-1.5 cteditor-px-3 cteditor-my-0.5 cteditor-rounded-full cteditor-bg-white hover:cteditor-bg-white/90 cteditor-transition-colors cteditor-cursor-pointer cteditor-max-w-full cteditor-border cteditor-border-border",
|
|
88
88
|
role: "button",
|
|
89
89
|
tabIndex: 0,
|
|
90
|
-
"data-lexical-node-key":
|
|
90
|
+
"data-lexical-node-key": c,
|
|
91
91
|
children: [
|
|
92
92
|
/* @__PURE__ */ r("span", { className: "cteditor-flex-shrink-0 *:cteditor-size-5", children: C(t) }),
|
|
93
|
-
/* @__PURE__ */ r("span", { className: "cteditor-flex-1 cteditor-min-w-0 cteditor-text-sm cteditor-font-medium cteditor-text-
|
|
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",
|
|
102
|
-
children: /* @__PURE__ */ r(
|
|
102
|
+
children: /* @__PURE__ */ r(y, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground" })
|
|
103
103
|
}
|
|
104
104
|
)
|
|
105
105
|
]
|
|
@@ -107,12 +107,12 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
|
|
|
107
107
|
) : /* @__PURE__ */ p(
|
|
108
108
|
"div",
|
|
109
109
|
{
|
|
110
|
-
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-
|
|
110
|
+
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-white hover:cteditor-bg-white/90 cteditor-transition-colors cteditor-cursor-pointer cteditor-max-w-[240px] cteditor-mr-1.5",
|
|
111
111
|
role: "button",
|
|
112
112
|
tabIndex: 0,
|
|
113
|
-
"data-lexical-node-key":
|
|
113
|
+
"data-lexical-node-key": c,
|
|
114
114
|
children: [
|
|
115
|
-
/* @__PURE__ */ r("div", { className: "cteditor-w-full cteditor-aspect-[120/88] cteditor-rounded cteditor-overflow-hidden cteditor-bg-
|
|
115
|
+
/* @__PURE__ */ r("div", { className: "cteditor-w-full cteditor-aspect-[120/88] cteditor-rounded cteditor-overflow-hidden cteditor-bg-background/10 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-border cteditor-border-background/10", children: U ? /* @__PURE__ */ r(
|
|
116
116
|
"img",
|
|
117
117
|
{
|
|
118
118
|
src: u,
|
|
@@ -122,28 +122,30 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
|
|
|
122
122
|
) : /* @__PURE__ */ r("div", { className: "*:cteditor-size-8", children: C(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
|
-
/* @__PURE__ */ r("div", { className: "cteditor-font-medium cteditor-text-xs cteditor-text-
|
|
126
|
-
|
|
125
|
+
/* @__PURE__ */ r("div", { className: "cteditor-font-medium cteditor-text-xs cteditor-text-black cteditor-truncate", children: t }),
|
|
126
|
+
d && /* @__PURE__ */ r("div", { className: "cteditor-text-xs cteditor-text-black/50", children: R(d) })
|
|
127
127
|
] }),
|
|
128
128
|
/* @__PURE__ */ p("div", { className: "cteditor-flex cteditor-gap-1 cteditor-flex-shrink-0", children: [
|
|
129
129
|
/* @__PURE__ */ r(
|
|
130
130
|
"button",
|
|
131
131
|
{
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
type: "button",
|
|
133
|
+
onClick: m,
|
|
134
|
+
className: "cteditor-p-1 cteditor-rounded-md cteditor-text-black/80 hover:cteditor-bg-black/10 cteditor-transition-colors",
|
|
134
135
|
"aria-label": "Download file",
|
|
135
136
|
title: "Download file",
|
|
136
|
-
children: /* @__PURE__ */ r(
|
|
137
|
+
children: /* @__PURE__ */ r(y, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-current" })
|
|
137
138
|
}
|
|
138
139
|
),
|
|
139
140
|
/* @__PURE__ */ r(
|
|
140
141
|
"button",
|
|
141
142
|
{
|
|
143
|
+
type: "button",
|
|
142
144
|
onClick: P,
|
|
143
|
-
className: "cteditor-p-1 cteditor-rounded-md
|
|
145
|
+
className: "cteditor-p-1 cteditor-rounded-md cteditor-text-black/80 hover:cteditor-bg-black/10 cteditor-transition-colors",
|
|
144
146
|
"aria-label": "Delete file",
|
|
145
147
|
title: "Delete file",
|
|
146
|
-
children: /* @__PURE__ */ r(
|
|
148
|
+
children: /* @__PURE__ */ r(B, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-current" })
|
|
147
149
|
}
|
|
148
150
|
)
|
|
149
151
|
] })
|