eddyter 1.4.18 → 1.4.19
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-BUWq8ixX.js +1042 -0
- package/dist/{CombinedAutocompletGrammarPlugin-BXOz6IRb.js → CombinedAutocompletGrammarPlugin-Dq25w8tq.js} +388 -337
- package/dist/{CommentBubblePlugin-kiMehQkL.js → CommentBubblePlugin-B77d3Qq6.js} +4 -4
- package/dist/CommentPlugin-BJQyKmrN.js +212 -0
- package/dist/{NotePanelPlugin-FirMseLu.js → NotePanelPlugin-BqOdcg07.js} +3 -3
- package/dist/{TextEnhancePlugin-oXbL_F1i.js → TextEnhancePlugin-BnmdRgUu.js} +2 -2
- package/dist/assets/style.css +1 -1
- package/dist/components/AnimatedPlaceholderText.d.ts +2 -0
- package/dist/components/DividerPicker/DividerPicker.d.ts +17 -0
- package/dist/components/EditorialDivider/EditorialDividerView.d.ts +23 -0
- package/dist/components/EmojiPickerWidget/EmojiPickerWidget.d.ts +1 -1
- package/dist/components/LockedFeature/LockedFeature.d.ts +4 -0
- package/dist/components/Toolbar/styles.d.ts +19 -1
- package/dist/components/UnifiedColorPicker/UnifiedColorPicker.d.ts +1 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/separator.d.ts +4 -1
- package/dist/constants.d.ts +12 -1
- package/dist/editorConfig.d.ts +7 -0
- package/dist/{generateDocxThumbnail-RE7yNAXP.js → generateDocxThumbnail-DBMxjZ83.js} +1 -1
- package/dist/{generatePdfThumbnail-CnldK2yE.js → generatePdfThumbnail-Cv2-ZCzh.js} +4 -4
- package/dist/{generateXlsxThumbnail-BpBB4ePK.js → generateXlsxThumbnail-UHmNc7Fa.js} +1 -1
- package/dist/hooks/useEditorToolbar.d.ts +1 -1
- package/dist/{index-CL0adQ5R.js → index-BaWQzoL2.js} +11 -11
- package/dist/{index-CXyZgoBl.js → index-Bex3G_eE.js} +18704 -15777
- package/dist/index-C_mjLQUF.js +796 -0
- package/dist/{index-C8ZUqYRj.js → index-ChSepytp.js} +26 -26
- package/dist/index-Cl_A9eof.js +1508 -0
- package/dist/{index-B4W_mfNI.js → index-DcHU8PlQ.js} +120 -123
- package/dist/{index-CKRp6axU.js → index-q_TW8dU1.js} +19 -19
- package/dist/index.js +7 -7
- package/dist/nodes/AsterismNode.d.ts +22 -0
- package/dist/nodes/ButtonNode.d.ts +37 -0
- package/dist/nodes/ColumnNode.d.ts +44 -0
- package/dist/nodes/ColumnsNode.d.ts +45 -0
- package/dist/nodes/EditorialFieldNode.d.ts +32 -0
- package/dist/nodes/FaqNode.d.ts +28 -0
- package/dist/nodes/ImagePlaceholderNode.d.ts +15 -0
- package/dist/nodes/LabeledRuleNode.d.ts +33 -0
- package/dist/nodes/OrnamentDividerNode.d.ts +22 -0
- package/dist/nodes/PullQuoteRulesNode.d.ts +32 -0
- package/dist/nodes/SectionNumberHeadingNode.d.ts +42 -0
- package/dist/plugins/BlockLayoutPlugin.d.ts +29 -0
- package/dist/plugins/ColumnAddButtonPlugin.d.ts +12 -0
- package/dist/plugins/CommentPlugin.commands.d.ts +1 -0
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRuleNode.d.ts +12 -2
- package/dist/plugins/CustomHorizontalRulePlugin/HorizontalRuleCustomizationDialog.d.ts +2 -1
- package/dist/plugins/CustomHorizontalRulePlugin/styles.d.ts +38 -0
- package/dist/plugins/EditorialFloatingToolbarPlugin.d.ts +8 -0
- package/dist/plugins/EditorialTypographyPlugin.d.ts +18 -0
- package/dist/plugins/PatternsPlugin.d.ts +12 -0
- package/dist/{sparkles-CTAYmQOE.js → sparkles-C-XoMho5.js} +1 -1
- package/dist/types.d.ts +11 -0
- package/dist/ui/Icons.d.ts +34 -9
- package/dist/{useVoiceToText-U0yKgS5Q.js → useVoiceToText-BzaLSbRi.js} +17 -17
- package/package.json +1 -1
- package/dist/AIChatPlugin-DsUPycjT.js +0 -872
- package/dist/CommentPlugin-DIuM-Jao.js +0 -154
- package/dist/index-DZAvLKar.js +0 -1431
- package/dist/index-F2-F96Nx.js +0 -720
- package/dist/square-CupR-YWR.js +0 -7
|
@@ -1,51 +1,48 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
1
|
+
import { jsx as o, jsxs as j, Fragment as re } from "react/jsx-runtime";
|
|
2
2
|
import { $insertDataTransferForRichText as se } from "@lexical/clipboard";
|
|
3
3
|
import { useLexicalComposerContext as ee } from "@lexical/react/LexicalComposerContext";
|
|
4
|
-
import { mergeRegister as
|
|
5
|
-
import { $isTableCellNode as
|
|
4
|
+
import { mergeRegister as ae, $wrapNodeInElement as J } from "@lexical/utils";
|
|
5
|
+
import { $isTableCellNode as ce } from "@lexical/table";
|
|
6
6
|
import { $getNodeByKey as T, $createNodeSelection as G, $setSelection as H, $getSelection as S, $isNodeSelection as te, SELECTION_CHANGE_COMMAND as de, COMMAND_PRIORITY_LOW as ne, KEY_ENTER_COMMAND as le, $createParagraphNode as W, $isRootOrShadowRoot as V, PASTE_COMMAND as ue, $isRangeSelection as U, COMMAND_PRIORITY_CRITICAL as me } from "lexical";
|
|
7
7
|
import { useState as M, useEffect as E, useCallback as _, useRef as Q } from "react";
|
|
8
|
-
import {
|
|
8
|
+
import { al as k, am as fe, a3 as N, an as pe, ao as ge, ap as be, aq as he, ar as ye, as as xe, at as Ee, au as ve, av as Ce, aw as Ne, ax as ke, ay as Z } from "./index-Bex3G_eE.js";
|
|
9
9
|
import { createPortal as Ae } from "react-dom";
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
]), K = "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", P = "cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors cteditor-text-foreground", w = "cteditor-bg-accent", Y = "cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 cteditor-shadow-md cteditor-border cteditor-border-border hover:cteditor-bg-accent cteditor-transition-colors cteditor-text-foreground";
|
|
14
|
-
function we({
|
|
15
|
-
editor: c,
|
|
10
|
+
const K = "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", P = "cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors cteditor-text-foreground", w = "cteditor-bg-accent", Y = "cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 cteditor-shadow-md cteditor-border cteditor-border-border hover:cteditor-bg-accent cteditor-transition-colors cteditor-text-foreground";
|
|
11
|
+
function Pe({
|
|
12
|
+
editor: a,
|
|
16
13
|
anchorElem: y,
|
|
17
14
|
nodeKey: n,
|
|
18
15
|
url: f,
|
|
19
16
|
onClose: u
|
|
20
17
|
}) {
|
|
21
|
-
const
|
|
18
|
+
const c = Q(null), d = Q(), [g, i] = M(
|
|
22
19
|
"embed"
|
|
23
20
|
), [A, t] = M(
|
|
24
21
|
"left"
|
|
25
|
-
), [p, m] = M("none"), [r, l] = M(!1),
|
|
26
|
-
const e =
|
|
22
|
+
), [p, m] = M("none"), [r, l] = M(!1), b = _(() => {
|
|
23
|
+
const e = c.current;
|
|
27
24
|
if (!e) return;
|
|
28
|
-
const R =
|
|
25
|
+
const R = a.getRootElement()?.querySelector(
|
|
29
26
|
`[data-lexical-node-key="${n}"]`
|
|
30
27
|
);
|
|
31
28
|
if (R) {
|
|
32
|
-
const
|
|
33
|
-
let
|
|
34
|
-
O < 10 && (O = 10), O + I.width > window.innerWidth - 10 && (O = window.innerWidth - I.width - 10),
|
|
29
|
+
const C = R.getBoundingClientRect(), I = e.getBoundingClientRect(), X = y.getBoundingClientRect(), oe = C.left + C.width / 2, ie = I.width / 2;
|
|
30
|
+
let F = C.top - I.height - 15, O = oe - ie;
|
|
31
|
+
O < 10 && (O = 10), O + I.width > window.innerWidth - 10 && (O = window.innerWidth - I.width - 10), F < 10 && (F = C.bottom + 15), F -= X.top, O -= X.left, e.style.opacity = "1", e.style.transform = `translate(${O}px, ${F}px)`, r || (e.style.display = "flex", e.style.visibility = "visible", e.style.zIndex = "9999", l(!0));
|
|
35
32
|
} else
|
|
36
33
|
e.style.opacity = "0", e.style.visibility = "hidden";
|
|
37
|
-
}, [
|
|
34
|
+
}, [a, n, y, r]), x = _(() => {
|
|
38
35
|
const e = () => {
|
|
39
|
-
|
|
36
|
+
b(), d.current = requestAnimationFrame(e);
|
|
40
37
|
};
|
|
41
38
|
d.current = requestAnimationFrame(e);
|
|
42
|
-
}, [
|
|
39
|
+
}, [b]), D = _(() => {
|
|
43
40
|
d.current && (cancelAnimationFrame(d.current), d.current = void 0);
|
|
44
41
|
}, []);
|
|
45
42
|
E(() => (x(), () => {
|
|
46
|
-
|
|
47
|
-
}), [x,
|
|
48
|
-
const e =
|
|
43
|
+
D();
|
|
44
|
+
}), [x, D]), E(() => {
|
|
45
|
+
const e = c.current;
|
|
49
46
|
if (e) {
|
|
50
47
|
const s = setTimeout(() => {
|
|
51
48
|
e.style.display = "flex", e.style.opacity = "1", e.style.visibility = "visible", e.style.zIndex = "9999", l(!0);
|
|
@@ -54,8 +51,8 @@ function we({
|
|
|
54
51
|
}
|
|
55
52
|
}, []), E(() => {
|
|
56
53
|
const e = (s) => {
|
|
57
|
-
const R = s, { nodeKey:
|
|
58
|
-
|
|
54
|
+
const R = s, { nodeKey: C } = R.detail;
|
|
55
|
+
C === n && l(!0);
|
|
59
56
|
};
|
|
60
57
|
return document.addEventListener("embedNodeSelected", e), () => {
|
|
61
58
|
document.removeEventListener(
|
|
@@ -64,51 +61,51 @@ function we({
|
|
|
64
61
|
);
|
|
65
62
|
};
|
|
66
63
|
}, [n]), E(() => {
|
|
67
|
-
|
|
64
|
+
a.getEditorState().read(() => {
|
|
68
65
|
const e = T(n);
|
|
69
66
|
e instanceof k && (typeof e.getDisplayType == "function" && i(e.getDisplayType()), typeof e.getAlignment == "function" && t(e.getAlignment()), typeof e.getPosition == "function" && m(e.getPosition()));
|
|
70
67
|
});
|
|
71
|
-
}, [
|
|
72
|
-
const
|
|
73
|
-
i(e),
|
|
68
|
+
}, [a, n]);
|
|
69
|
+
const v = (e) => {
|
|
70
|
+
i(e), a.update(() => {
|
|
74
71
|
const s = T(n);
|
|
75
72
|
s instanceof k && typeof s.setDisplayType == "function" && s.setDisplayType(e);
|
|
76
73
|
});
|
|
77
74
|
}, $ = (e) => {
|
|
78
|
-
t(e),
|
|
75
|
+
t(e), a.update(() => {
|
|
79
76
|
const s = T(n);
|
|
80
77
|
s instanceof k && typeof s.setAlignment == "function" && s.setAlignment(e);
|
|
81
78
|
});
|
|
82
|
-
},
|
|
83
|
-
m(e),
|
|
79
|
+
}, q = (e) => {
|
|
80
|
+
m(e), a.update(() => {
|
|
84
81
|
const s = T(n);
|
|
85
82
|
s instanceof k && typeof s.setPosition == "function" && s.setPosition(e);
|
|
86
83
|
});
|
|
87
84
|
}, z = (e) => {
|
|
88
85
|
e.stopPropagation(), window.open(f, "_blank");
|
|
89
|
-
},
|
|
90
|
-
e.stopPropagation(),
|
|
86
|
+
}, L = (e) => {
|
|
87
|
+
e.stopPropagation(), a.update(() => {
|
|
91
88
|
const s = T(n);
|
|
92
89
|
s && s.remove();
|
|
93
90
|
}), u();
|
|
94
|
-
},
|
|
91
|
+
}, h = (e) => {
|
|
95
92
|
e.stopPropagation(), navigator.clipboard.writeText(f).then(() => {
|
|
96
93
|
});
|
|
97
94
|
};
|
|
98
95
|
return E(() => {
|
|
99
96
|
const e = (s) => {
|
|
100
|
-
|
|
97
|
+
c.current && !c.current.contains(s.target) && (s.target.closest("[data-embed-type]") || u());
|
|
101
98
|
};
|
|
102
99
|
return r && setTimeout(() => {
|
|
103
100
|
document.addEventListener("mousedown", e);
|
|
104
101
|
}, 100), () => {
|
|
105
102
|
document.removeEventListener("mousedown", e);
|
|
106
103
|
};
|
|
107
|
-
}, [u, r]), /* @__PURE__ */
|
|
104
|
+
}, [u, r]), /* @__PURE__ */ j(
|
|
108
105
|
"div",
|
|
109
106
|
{
|
|
110
107
|
className: "floating-embed-menu cteditor-flex cteditor-gap-1 cteditor-z-10",
|
|
111
|
-
ref:
|
|
108
|
+
ref: c,
|
|
112
109
|
onClick: (e) => {
|
|
113
110
|
e.stopPropagation();
|
|
114
111
|
},
|
|
@@ -122,7 +119,7 @@ function we({
|
|
|
122
119
|
transition: "opacity 0.15s ease-in-out"
|
|
123
120
|
},
|
|
124
121
|
children: [
|
|
125
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ j("div", { className: K, children: [
|
|
126
123
|
/* @__PURE__ */ o(
|
|
127
124
|
"button",
|
|
128
125
|
{
|
|
@@ -132,10 +129,10 @@ function we({
|
|
|
132
129
|
g === "url" && w
|
|
133
130
|
),
|
|
134
131
|
onClick: (e) => {
|
|
135
|
-
e.stopPropagation(),
|
|
132
|
+
e.stopPropagation(), v("url");
|
|
136
133
|
},
|
|
137
134
|
title: "Link",
|
|
138
|
-
children: /* @__PURE__ */ o(
|
|
135
|
+
children: /* @__PURE__ */ o(fe, {})
|
|
139
136
|
}
|
|
140
137
|
),
|
|
141
138
|
/* @__PURE__ */ o(
|
|
@@ -147,10 +144,10 @@ function we({
|
|
|
147
144
|
g === "card" && w
|
|
148
145
|
),
|
|
149
146
|
onClick: (e) => {
|
|
150
|
-
e.stopPropagation(),
|
|
147
|
+
e.stopPropagation(), v("card");
|
|
151
148
|
},
|
|
152
149
|
title: "Card",
|
|
153
|
-
children: /* @__PURE__ */ o(
|
|
150
|
+
children: /* @__PURE__ */ o(pe, { className: "cteditor-size-3.5" })
|
|
154
151
|
}
|
|
155
152
|
),
|
|
156
153
|
/* @__PURE__ */ o(
|
|
@@ -162,15 +159,15 @@ function we({
|
|
|
162
159
|
g === "embed" && w
|
|
163
160
|
),
|
|
164
161
|
onClick: (e) => {
|
|
165
|
-
e.stopPropagation(),
|
|
162
|
+
e.stopPropagation(), v("embed");
|
|
166
163
|
},
|
|
167
164
|
title: "Embed",
|
|
168
|
-
children: /* @__PURE__ */ o(
|
|
165
|
+
children: /* @__PURE__ */ o(ge, {})
|
|
169
166
|
}
|
|
170
167
|
)
|
|
171
168
|
] }),
|
|
172
169
|
/* @__PURE__ */ o("div", { className: "cteditor-w-px cteditor-h-6 cteditor-bg-border cteditor-flex-shrink-0" }),
|
|
173
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ j("div", { className: K, children: [
|
|
174
171
|
/* @__PURE__ */ o(
|
|
175
172
|
"button",
|
|
176
173
|
{
|
|
@@ -180,7 +177,7 @@ function we({
|
|
|
180
177
|
p === "left" && w
|
|
181
178
|
),
|
|
182
179
|
onClick: (e) => {
|
|
183
|
-
e.stopPropagation(),
|
|
180
|
+
e.stopPropagation(), q(p === "left" ? "none" : "left");
|
|
184
181
|
},
|
|
185
182
|
title: "Wrap text left (text beside card)",
|
|
186
183
|
children: /* @__PURE__ */ o(be, {})
|
|
@@ -195,15 +192,15 @@ function we({
|
|
|
195
192
|
p === "right" && w
|
|
196
193
|
),
|
|
197
194
|
onClick: (e) => {
|
|
198
|
-
e.stopPropagation(),
|
|
195
|
+
e.stopPropagation(), q(p === "right" ? "none" : "right");
|
|
199
196
|
},
|
|
200
197
|
title: "Wrap text right (text beside card)",
|
|
201
|
-
children: /* @__PURE__ */ o(
|
|
198
|
+
children: /* @__PURE__ */ o(he, {})
|
|
202
199
|
}
|
|
203
200
|
)
|
|
204
201
|
] }),
|
|
205
202
|
/* @__PURE__ */ o("div", { className: "cteditor-w-px cteditor-h-6 cteditor-bg-border cteditor-flex-shrink-0" }),
|
|
206
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ j("div", { className: K, children: [
|
|
207
204
|
/* @__PURE__ */ o(
|
|
208
205
|
"button",
|
|
209
206
|
{
|
|
@@ -216,7 +213,7 @@ function we({
|
|
|
216
213
|
e.stopPropagation(), $("left");
|
|
217
214
|
},
|
|
218
215
|
title: "Align left",
|
|
219
|
-
children: /* @__PURE__ */ o(
|
|
216
|
+
children: /* @__PURE__ */ o(ye, {})
|
|
220
217
|
}
|
|
221
218
|
),
|
|
222
219
|
/* @__PURE__ */ o(
|
|
@@ -231,7 +228,7 @@ function we({
|
|
|
231
228
|
e.stopPropagation(), $("center");
|
|
232
229
|
},
|
|
233
230
|
title: "Align center",
|
|
234
|
-
children: /* @__PURE__ */ o(
|
|
231
|
+
children: /* @__PURE__ */ o(xe, {})
|
|
235
232
|
}
|
|
236
233
|
),
|
|
237
234
|
/* @__PURE__ */ o(
|
|
@@ -246,7 +243,7 @@ function we({
|
|
|
246
243
|
e.stopPropagation(), $("right");
|
|
247
244
|
},
|
|
248
245
|
title: "Align right",
|
|
249
|
-
children: /* @__PURE__ */ o(
|
|
246
|
+
children: /* @__PURE__ */ o(Ee, {})
|
|
250
247
|
}
|
|
251
248
|
)
|
|
252
249
|
] }),
|
|
@@ -269,9 +266,9 @@ function we({
|
|
|
269
266
|
Y,
|
|
270
267
|
"hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground"
|
|
271
268
|
),
|
|
272
|
-
onClick:
|
|
269
|
+
onClick: L,
|
|
273
270
|
title: "Remove",
|
|
274
|
-
children: /* @__PURE__ */ o(
|
|
271
|
+
children: /* @__PURE__ */ o(Ce, { className: "cteditor-size-4" })
|
|
275
272
|
}
|
|
276
273
|
),
|
|
277
274
|
/* @__PURE__ */ o(
|
|
@@ -279,21 +276,21 @@ function we({
|
|
|
279
276
|
{
|
|
280
277
|
type: "button",
|
|
281
278
|
className: Y,
|
|
282
|
-
onClick:
|
|
279
|
+
onClick: h,
|
|
283
280
|
title: "Copy",
|
|
284
|
-
children: /* @__PURE__ */ o(
|
|
281
|
+
children: /* @__PURE__ */ o(Ne, { className: "cteditor-size-4" })
|
|
285
282
|
}
|
|
286
283
|
)
|
|
287
284
|
]
|
|
288
285
|
}
|
|
289
286
|
);
|
|
290
287
|
}
|
|
291
|
-
function
|
|
292
|
-
const [n, f] = M(null), [u,
|
|
288
|
+
function we(a, y) {
|
|
289
|
+
const [n, f] = M(null), [u, c] = M(""), d = (t) => t.includes("youtube.com") || t.includes("youtu.be") || t.includes("loom.com") || t.includes("vimeo.com") || t.includes("supercut.video") || t.includes("jam.dev") || t.includes("figma.com");
|
|
293
290
|
E(() => {
|
|
294
291
|
const t = (p) => {
|
|
295
292
|
const m = p, { nodeKey: r, url: l } = m.detail;
|
|
296
|
-
r && l && d(l) && (f(r),
|
|
293
|
+
r && l && d(l) && (f(r), c(l));
|
|
297
294
|
};
|
|
298
295
|
return document.addEventListener("embedNodeSelected", t), () => {
|
|
299
296
|
document.removeEventListener(
|
|
@@ -308,49 +305,49 @@ function Te(c, y) {
|
|
|
308
305
|
const p = t.closest("[data-lexical-node-key]");
|
|
309
306
|
if (!p) return;
|
|
310
307
|
const m = p.getAttribute("data-lexical-node-key");
|
|
311
|
-
m &&
|
|
308
|
+
m && a.update(() => {
|
|
312
309
|
const r = T(m);
|
|
313
310
|
if (r instanceof k) {
|
|
314
311
|
const l = typeof r.getURL == "function" ? r.getURL() : r.__url;
|
|
315
312
|
if (d(l)) {
|
|
316
|
-
const
|
|
317
|
-
|
|
313
|
+
const b = G();
|
|
314
|
+
b.add(m), H(b), f(m), c(l);
|
|
318
315
|
}
|
|
319
316
|
}
|
|
320
317
|
});
|
|
321
318
|
},
|
|
322
|
-
[
|
|
319
|
+
[a]
|
|
323
320
|
), i = _(() => {
|
|
324
|
-
|
|
321
|
+
a.getEditorState().read(() => {
|
|
325
322
|
const t = S();
|
|
326
323
|
if (te(t)) {
|
|
327
324
|
const m = t.getNodes()[0];
|
|
328
325
|
if (m instanceof k) {
|
|
329
326
|
const r = typeof m.getURL == "function" ? m.getURL() : m.__url;
|
|
330
327
|
if (d(r)) {
|
|
331
|
-
f(m.getKey()),
|
|
328
|
+
f(m.getKey()), c(r);
|
|
332
329
|
return;
|
|
333
330
|
}
|
|
334
331
|
}
|
|
335
332
|
}
|
|
336
333
|
f(null);
|
|
337
334
|
});
|
|
338
|
-
}, [
|
|
335
|
+
}, [a]);
|
|
339
336
|
E(() => {
|
|
340
|
-
const t =
|
|
337
|
+
const t = a.getRootElement();
|
|
341
338
|
if (!t) return;
|
|
342
339
|
const p = (m) => {
|
|
343
340
|
const r = m.target, l = r.closest(
|
|
344
341
|
'[data-embed-type="youtube"], [data-embed-type="loom"], [data-embed-type="vimeo"], [data-embed-type="figma"]'
|
|
345
342
|
);
|
|
346
343
|
if (l) {
|
|
347
|
-
const
|
|
348
|
-
if (
|
|
349
|
-
|
|
350
|
-
const x = T(
|
|
344
|
+
const b = l.getAttribute("data-lexical-node-key");
|
|
345
|
+
if (b) {
|
|
346
|
+
a.update(() => {
|
|
347
|
+
const x = T(b);
|
|
351
348
|
if (x instanceof k) {
|
|
352
|
-
const
|
|
353
|
-
|
|
349
|
+
const D = typeof x.getURL == "function" ? x.getURL() : x.__url, v = G();
|
|
350
|
+
v.add(b), H(v), f(b), c(D);
|
|
354
351
|
}
|
|
355
352
|
});
|
|
356
353
|
return;
|
|
@@ -361,24 +358,24 @@ function Te(c, y) {
|
|
|
361
358
|
return t.addEventListener("mousedown", p), () => {
|
|
362
359
|
t.removeEventListener("mousedown", p);
|
|
363
360
|
};
|
|
364
|
-
}, [
|
|
365
|
-
|
|
361
|
+
}, [a, g]), E(() => ae(
|
|
362
|
+
a.registerUpdateListener(() => {
|
|
366
363
|
i();
|
|
367
364
|
}),
|
|
368
|
-
|
|
365
|
+
a.registerCommand(
|
|
369
366
|
de,
|
|
370
367
|
() => (i(), !1),
|
|
371
368
|
ne
|
|
372
369
|
)
|
|
373
|
-
), [
|
|
370
|
+
), [a, i]);
|
|
374
371
|
const A = _(() => {
|
|
375
372
|
f(null);
|
|
376
373
|
}, []);
|
|
377
374
|
return n ? Ae(
|
|
378
375
|
/* @__PURE__ */ o(
|
|
379
|
-
|
|
376
|
+
Pe,
|
|
380
377
|
{
|
|
381
|
-
editor:
|
|
378
|
+
editor: a,
|
|
382
379
|
anchorElem: y,
|
|
383
380
|
nodeKey: n,
|
|
384
381
|
url: u,
|
|
@@ -388,13 +385,13 @@ function Te(c, y) {
|
|
|
388
385
|
y
|
|
389
386
|
) : null;
|
|
390
387
|
}
|
|
391
|
-
function
|
|
392
|
-
anchorElem:
|
|
388
|
+
function Te({
|
|
389
|
+
anchorElem: a
|
|
393
390
|
}) {
|
|
394
|
-
const [y] = ee(), n =
|
|
395
|
-
return n ?
|
|
391
|
+
const [y] = ee(), n = a ?? (typeof document < "u" ? document.body : null);
|
|
392
|
+
return n ? we(y, n) : null;
|
|
396
393
|
}
|
|
397
|
-
const
|
|
394
|
+
const Re = [
|
|
398
395
|
"youtube.com",
|
|
399
396
|
"youtu.be",
|
|
400
397
|
"vimeo.com",
|
|
@@ -402,38 +399,38 @@ const Se = [
|
|
|
402
399
|
"supercut.video",
|
|
403
400
|
"jam.dev"
|
|
404
401
|
];
|
|
405
|
-
function
|
|
402
|
+
function Se(a, y) {
|
|
406
403
|
try {
|
|
407
|
-
const u = new DOMParser().parseFromString(
|
|
408
|
-
return
|
|
404
|
+
const u = new DOMParser().parseFromString(a, "text/html").body, c = (u.textContent || "").trim().replace(/\s+/g, " "), d = y.trim().replace(/\s+/g, " ");
|
|
405
|
+
return c && c !== d || !!u.querySelector(
|
|
409
406
|
"img,iframe,video,table,blockquote,figure,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code"
|
|
410
|
-
) ? !1 : u.querySelectorAll("a[href]").length === 1 ? !0 :
|
|
407
|
+
) ? !1 : u.querySelectorAll("a[href]").length === 1 ? !0 : c === d;
|
|
411
408
|
} catch {
|
|
412
409
|
return !1;
|
|
413
410
|
}
|
|
414
411
|
}
|
|
415
412
|
const qe = ({
|
|
416
|
-
floatingAnchorElem:
|
|
413
|
+
floatingAnchorElem: a
|
|
417
414
|
}) => {
|
|
418
|
-
const y =
|
|
415
|
+
const y = a ?? (typeof document < "u" ? document.body : void 0), [n] = ee();
|
|
419
416
|
return E(() => {
|
|
420
417
|
const f = n.getRootElement();
|
|
421
418
|
if (!f) return;
|
|
422
|
-
const u = (
|
|
423
|
-
const d =
|
|
419
|
+
const u = (c) => {
|
|
420
|
+
const d = c.target;
|
|
424
421
|
if (d.closest('a[download], a[href*=".mp4"], a[href*=".webm"], a[href*=".ogg"], a[href*=".pdf"], a[href*=".doc"], a[href*=".docx"], a[href*=".xls"], a[href*=".xlsx"], a[href*=".ppt"], a[href*=".pptx"], a[href*=".zip"], a[href*=".rar"], a[href*=".txt"], a[href*=".csv"], a[href*=".json"], a[href*=".png"], a[href*=".jpg"], a[href*=".jpeg"], a[href*=".gif"], a[href*=".webp"], a[href*=".svg"]')) return;
|
|
425
422
|
const i = d.closest("[data-lexical-node-key]");
|
|
426
423
|
if (!i || !(i.querySelector("iframe") || i.querySelector("video") || i.getAttribute("data-embed-type"))) return;
|
|
427
424
|
const t = i.getAttribute("data-lexical-node-key");
|
|
428
425
|
if (!t) return;
|
|
429
|
-
|
|
426
|
+
c.preventDefault(), c.stopPropagation();
|
|
430
427
|
const p = i.getBoundingClientRect();
|
|
431
428
|
n.update(() => {
|
|
432
429
|
const m = T(t);
|
|
433
430
|
if (m instanceof k) {
|
|
434
431
|
const r = m.__url, l = G();
|
|
435
432
|
l.add(t), H(l);
|
|
436
|
-
const
|
|
433
|
+
const b = new CustomEvent("embedNodeSelected", {
|
|
437
434
|
detail: {
|
|
438
435
|
nodeKey: t,
|
|
439
436
|
url: r,
|
|
@@ -441,7 +438,7 @@ const qe = ({
|
|
|
441
438
|
},
|
|
442
439
|
bubbles: !0
|
|
443
440
|
});
|
|
444
|
-
document.dispatchEvent(
|
|
441
|
+
document.dispatchEvent(b);
|
|
445
442
|
}
|
|
446
443
|
});
|
|
447
444
|
};
|
|
@@ -453,9 +450,9 @@ const qe = ({
|
|
|
453
450
|
(f) => {
|
|
454
451
|
const u = S();
|
|
455
452
|
if (!u || !te(u)) return !1;
|
|
456
|
-
const
|
|
457
|
-
if (
|
|
458
|
-
const d =
|
|
453
|
+
const c = u.getNodes();
|
|
454
|
+
if (c.length !== 1) return !1;
|
|
455
|
+
const d = c[0];
|
|
459
456
|
if (!(d instanceof k)) return !1;
|
|
460
457
|
f.preventDefault();
|
|
461
458
|
const g = W(), i = d.getParent();
|
|
@@ -468,8 +465,8 @@ const qe = ({
|
|
|
468
465
|
const u = f.clipboardData;
|
|
469
466
|
if (!u || ke(f.target))
|
|
470
467
|
return !1;
|
|
471
|
-
const
|
|
472
|
-
if (!U(
|
|
468
|
+
const c = S();
|
|
469
|
+
if (!U(c)) return !1;
|
|
473
470
|
const d = u.getData("application/x-lexical-editor");
|
|
474
471
|
if (d)
|
|
475
472
|
try {
|
|
@@ -477,8 +474,8 @@ const qe = ({
|
|
|
477
474
|
if (l && Array.isArray(l.nodes) && l.nodes.length > 0)
|
|
478
475
|
return f.preventDefault(), n.update(
|
|
479
476
|
() => {
|
|
480
|
-
const
|
|
481
|
-
U(
|
|
477
|
+
const b = S();
|
|
478
|
+
U(b) && se(u, b, n);
|
|
482
479
|
},
|
|
483
480
|
{ tag: "paste" }
|
|
484
481
|
), !0;
|
|
@@ -487,37 +484,37 @@ const qe = ({
|
|
|
487
484
|
const g = u.getData("text/html");
|
|
488
485
|
if (g && g.includes("data-lexical-embed-node"))
|
|
489
486
|
try {
|
|
490
|
-
const
|
|
487
|
+
const b = new DOMParser().parseFromString(g, "text/html"), x = b.querySelectorAll('[data-lexical-embed-node="1"]');
|
|
491
488
|
if (x.length > 0) {
|
|
492
|
-
const
|
|
493
|
-
let
|
|
489
|
+
const D = (b.body.textContent || "").trim();
|
|
490
|
+
let v = "";
|
|
494
491
|
x.forEach((z) => {
|
|
495
|
-
|
|
492
|
+
v += z.textContent || "";
|
|
496
493
|
});
|
|
497
|
-
const $ =
|
|
494
|
+
const $ = D.replace(v, "").trim(), q = !!b.body.querySelector(
|
|
498
495
|
"p,h1,h2,h3,h4,h5,h6,ul,ol,li,blockquote,table,pre"
|
|
499
496
|
);
|
|
500
|
-
if ($.length === 0 && !
|
|
497
|
+
if ($.length === 0 && !q)
|
|
501
498
|
return f.preventDefault(), n.update(
|
|
502
499
|
() => {
|
|
503
500
|
const z = S();
|
|
504
501
|
if (!U(z)) return;
|
|
505
|
-
const
|
|
506
|
-
x.forEach((
|
|
507
|
-
const B =
|
|
508
|
-
B &&
|
|
502
|
+
const L = [];
|
|
503
|
+
x.forEach((h) => {
|
|
504
|
+
const B = h.getAttribute("data-embed-url"), e = h.getAttribute("data-embed-display-type") || "embed", s = h.getAttribute("data-embed-alignment") || "left", R = h.getAttribute("data-embed-position") || "none", C = Number(h.getAttribute("data-embed-width")) || 560, I = Number(h.getAttribute("data-embed-height")) || 315;
|
|
505
|
+
B && L.push(
|
|
509
506
|
Z(
|
|
510
507
|
B,
|
|
511
508
|
e,
|
|
512
509
|
s,
|
|
513
|
-
|
|
510
|
+
C,
|
|
514
511
|
I,
|
|
515
512
|
R
|
|
516
513
|
)
|
|
517
514
|
);
|
|
518
|
-
}),
|
|
515
|
+
}), L.length > 0 && L.forEach((h, B) => {
|
|
519
516
|
const e = S();
|
|
520
|
-
if (U(e) && (e.insertNodes([
|
|
517
|
+
if (U(e) && (e.insertNodes([h]), V(h.getParentOrThrow()) && J(h, W).selectEnd(), B < L.length - 1)) {
|
|
521
518
|
const s = S();
|
|
522
519
|
U(s) && s.insertParagraph();
|
|
523
520
|
}
|
|
@@ -529,24 +526,24 @@ const qe = ({
|
|
|
529
526
|
} catch {
|
|
530
527
|
}
|
|
531
528
|
const i = u.getData("text/plain").trim();
|
|
532
|
-
if (!i.match(/^https?:\/\//) || g && !
|
|
529
|
+
if (!i.match(/^https?:\/\//) || g && !Se(g, i))
|
|
533
530
|
return !1;
|
|
534
|
-
const A =
|
|
531
|
+
const A = c.anchor.getNode();
|
|
535
532
|
let t = !1, p = A;
|
|
536
533
|
for (; p; ) {
|
|
537
|
-
if (
|
|
534
|
+
if (ce(p)) {
|
|
538
535
|
t = !0;
|
|
539
536
|
break;
|
|
540
537
|
}
|
|
541
538
|
p = p.getParent();
|
|
542
539
|
}
|
|
543
540
|
if (t)
|
|
544
|
-
return
|
|
545
|
-
const m =
|
|
546
|
-
return m ? r.setDisplayType("embed") : i.match(/\.(pdf|docx?|xlsx?|pptx?|zip|rar|txt)$/) || i.includes("figma.com") ? r.setDisplayType("card") : r.setDisplayType("url"),
|
|
541
|
+
return c.insertText(i), !0;
|
|
542
|
+
const m = Re.some((l) => i.includes(l)), r = Z(i);
|
|
543
|
+
return m ? r.setDisplayType("embed") : i.match(/\.(pdf|docx?|xlsx?|pptx?|zip|rar|txt)$/) || i.includes("figma.com") ? r.setDisplayType("card") : r.setDisplayType("url"), c.insertNodes([r]), V(r.getParentOrThrow()) && J(r, W).selectEnd(), !0;
|
|
547
544
|
},
|
|
548
545
|
me
|
|
549
|
-
), [n]), /* @__PURE__ */ o(re, { children: /* @__PURE__ */ o(
|
|
546
|
+
), [n]), /* @__PURE__ */ o(re, { children: /* @__PURE__ */ o(Te, { anchorElem: y }) });
|
|
550
547
|
};
|
|
551
548
|
export {
|
|
552
549
|
qe as default
|