reactjs-tiptap-editor 1.0.16 → 1.0.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/lib/ActionMenuButton-B_E2mbAW.cjs +1 -0
- package/lib/{ActionMenuButton-a8LhmHXe.js → ActionMenuButton-lsIBc9sU.js} +12 -16
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.js +28 -32
- package/lib/Blockquote.cjs +2 -2
- package/lib/Blockquote.js +11 -13
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +13 -15
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +15 -17
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +56 -62
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +12 -13
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +8 -10
- package/lib/CodeBlock.cjs +29 -29
- package/lib/CodeBlock.js +11 -14
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +9 -11
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +26 -29
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +7 -9
- package/lib/{Drawer-CbOJ1Igo.js → Drawer-DQ4CxBwG.js} +23 -29
- package/lib/Drawer-FUeUKshi.cjs +1 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +13 -15
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +276 -5
- package/lib/ExportPdf.cjs +2 -2
- package/lib/ExportPdf.js +19 -21
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +8 -10
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +9 -10
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +19 -20
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +27 -28
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +24 -27
- package/lib/History.cjs +1 -1
- package/lib/History.js +25 -28
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +8 -10
- package/lib/{Iframe-CmjbQQcz.js → Iframe-CTajPyzs.js} +34 -38
- package/lib/Iframe-EVWXCqe4.cjs +1 -0
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +4 -5
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +109 -114
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +15 -18
- package/lib/{Indent-BoG-vpIE.js → Indent-BGEHlRx_.js} +24 -26
- package/lib/Indent-q9cEWAa_.cjs +1 -0
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +11 -13
- package/lib/Katex-ClqcEnN_.cjs +4 -0
- package/lib/{Katex-ByL9snce.js → Katex-tMh4bfBb.js} +19 -24
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +17 -20
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-Ckih17pU.js → LinkEditBlock-CA5NhP-m.js} +19 -26
- package/lib/LinkEditBlock-DZXk4ln_.cjs +5 -0
- package/lib/Mention.js +3 -3
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +31 -36
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +25 -29
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +13 -15
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +62 -69
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +5 -5
- package/lib/SlashCommandNodeView-CZoM3ZlS.cjs +1 -0
- package/lib/{SlashCommandNodeView-B2g1MbgN.js → SlashCommandNodeView-DLuqbX2o.js} +64 -69
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +12 -14
- package/lib/{Table-BEwrZVup.js → Table-BC4Lbqzn.js} +27 -29
- package/lib/Table-BmDopO43.cjs +9 -0
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +18 -20
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +29 -33
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +16 -20
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +7 -9
- package/lib/Twitter-BbMD3Ybp.cjs +1 -0
- package/lib/{Twitter-4U_ZBhpv.js → Twitter-D8Cbgl7g.js} +17 -23
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +2 -2
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -270
- package/lib/bubble.cjs +4 -4
- package/lib/bubble.js +543 -552
- package/lib/{clsx-DSzxBzvL.js → clsx-DaPvp9ji.js} +23 -23
- package/lib/components/ReactBus.d.ts +11 -0
- package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -0
- package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -0
- package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +5 -0
- package/lib/{dropdown-menu-eUeBXQeA.cjs → dropdown-menu-C_F7LEy5.cjs} +1 -1
- package/lib/{dropdown-menu-CW3Kthwy.js → dropdown-menu-q6RL_fkA.js} +1 -1
- package/lib/{index-4bHF5ovf.js → index-BDYJ8Ph2.js} +1 -1
- package/lib/index-BnVcq33n.cjs +1 -0
- package/lib/{index-DR5tIdL7.js → index-Do_dsOGB.js} +1 -1
- package/lib/{index-CpTykZBR.js → index-DqruLhsu.js} +1 -1
- package/lib/{index-D8li6EQ4.js → index-Qcl3BG94.js} +1 -1
- package/lib/index-RcSPeQHn.js +4941 -0
- package/lib/index.cjs +3 -3
- package/lib/index.js +45 -49
- package/lib/{popover-CeY3RbI5.js → popover-CtinPbiy.js} +1 -1
- package/lib/{popover-C6Cya3Cz.cjs → popover-DIMT3pae.cjs} +1 -1
- package/lib/{renderNodeView-CSazLrKF.js → renderNodeView-BEkECnnY.js} +2 -2
- package/lib/{select-Doa_-jkZ.cjs → select-CYyIeImH.cjs} +1 -1
- package/lib/{select-F0ZZ3VZB.js → select-CmV5uTXr.js} +1 -1
- package/lib/separator-BLp6xpSY.cjs +1 -0
- package/lib/{separator-Cjn4YH8a.js → separator-C7luvaG8.js} +13 -15
- package/lib/store/store.d.ts +2 -22
- package/lib/style.css +1 -1
- package/lib/{textarea-tOsPnxHf.js → textarea-CkVKMPqK.js} +1 -1
- package/lib/{textarea-BAolHF_W.cjs → textarea-Cn75Cm2n.cjs} +1 -1
- package/lib/{updatePosition-CDK7OR0i.js → updatePosition-DRmKQBGm.js} +2 -2
- package/lib/utils/checkIsVideoUrl.d.ts +1 -0
- package/lib/utils/customEvents/events.constant.d.ts +1 -0
- package/lib/utils/mitt.d.ts +6 -3
- package/package.json +1 -1
- package/lib/ActionMenuButton-BYu0NyVo.cjs +0 -1
- package/lib/Drawer-DNaDMoAk.cjs +0 -1
- package/lib/Excalidraw-DnHTVOj8.js +0 -355
- package/lib/Excalidraw-DxfO1lQ_.cjs +0 -1
- package/lib/Icon-C0TJMAOm.js +0 -12
- package/lib/Icon-DzK0_ztP.cjs +0 -1
- package/lib/Iframe-BSNCsofW.cjs +0 -1
- package/lib/Image-BZEFuS0P.js +0 -925
- package/lib/Image-iKsGKjvg.cjs +0 -1
- package/lib/Indent-Bou16OcB.cjs +0 -1
- package/lib/Katex-BqDocr3a.cjs +0 -4
- package/lib/LinkEditBlock-B0I0EUrt.cjs +0 -5
- package/lib/SlashCommandNodeView-BEJhEzba.cjs +0 -1
- package/lib/Table-BclWwp6P.cjs +0 -9
- package/lib/Twitter-Dtq6PEMC.cjs +0 -1
- package/lib/button-Bwn6gUuS.js +0 -43
- package/lib/button-CqJztfH2.cjs +0 -1
- package/lib/checkbox-BAzbZY2Y.cjs +0 -1
- package/lib/checkbox-B_rpz5Xq.js +0 -27
- package/lib/dialog-CJvpoeMm.js +0 -101
- package/lib/dialog-CWYTvz5J.cjs +0 -1
- package/lib/events.constant-Dq21NPdV.cjs +0 -1
- package/lib/events.constant-do95b767.js +0 -21
- package/lib/extensions/Image/store.d.ts +0 -4
- package/lib/extensions/Video/store.d.ts +0 -4
- package/lib/file-BLas99n7.js +0 -43
- package/lib/file-i7e4nQY2.cjs +0 -1
- package/lib/index-CL7JP-Xz.js +0 -426
- package/lib/index-Cn-t3Zxw.cjs +0 -1
- package/lib/index-DoiuU6VA.js +0 -2315
- package/lib/index-VhKd73hZ.cjs +0 -1
- package/lib/input-B1egKb-t.js +0 -21
- package/lib/input-ZGRt7lWR.cjs +0 -1
- package/lib/isNumber-BTYSVlKo.cjs +0 -1
- package/lib/isNumber-ClwLypY2.js +0 -15
- package/lib/label-Cjrzc5H2.js +0 -19
- package/lib/label-tzSPdqui.cjs +0 -1
- package/lib/separator-CUh5Y7Rh.cjs +0 -1
- package/lib/store/fast-context.d.ts +0 -7
- package/lib/store-BsJz5QRC.js +0 -10
- package/lib/store-DjkMIIEN.cjs +0 -1
- package/lib/tabs-BP8ypR_m.cjs +0 -1
- package/lib/tabs-CBDjOLl_.js +0 -46
- package/lib/throttle-D040PfWL.js +0 -249
- package/lib/throttle-gTTvqDTW.cjs +0 -1
- package/lib/toggle-C_SSvDRy.cjs +0 -1
- package/lib/toggle-DEerYRil.js +0 -99
- package/lib/tooltip-BJIvosho.js +0 -24
- package/lib/tooltip-FS1rsvd3.cjs +0 -1
- package/lib/useButtonProps-CtZCbMQu.js +0 -136
- package/lib/useButtonProps-Cz4W5dC8.cjs +0 -1
- package/lib/utils/_event.d.ts +0 -13
- package/lib/utils/customEvents/customEvents.d.ts +0 -3
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import { h as V, j as Z, N as $, n as B, k as U, m as X } from "./clsx-DSzxBzvL.js";
|
|
2
|
-
import { jsxs as T, jsx as i } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo as F, useState as l, useCallback as A, useEffect as N, useRef as G } from "react";
|
|
4
|
-
import { A as C } from "./toggle-DEerYRil.js";
|
|
5
|
-
import { D as Y, a as q, b as J, c as K, d as Q } from "./dialog-CJvpoeMm.js";
|
|
6
|
-
import { c as ee, u as te, d as re, a as ne, j as ie } from "./useButtonProps-CtZCbMQu.js";
|
|
7
|
-
import { Resizable as ae } from "re-resizable";
|
|
8
|
-
import { a as se } from "./index-DoiuU6VA.js";
|
|
9
|
-
import { n as oe, g as O } from "./dom-dataset-CIEeltF6.js";
|
|
10
|
-
import { B as de } from "./button-Bwn6gUuS.js";
|
|
11
|
-
function ce(e) {
|
|
12
|
-
return e = e || /* @__PURE__ */ new Map(), {
|
|
13
|
-
/**
|
|
14
|
-
* A Map of event names to registered handler functions.
|
|
15
|
-
*/
|
|
16
|
-
all: e,
|
|
17
|
-
/**
|
|
18
|
-
* Register an event handler for the given type.
|
|
19
|
-
* @param {string|symbol} type Type of event to listen for, or `'*'` for all events
|
|
20
|
-
* @param {Function} handler Function to call in response to given event
|
|
21
|
-
* @memberOf mitt
|
|
22
|
-
*/
|
|
23
|
-
//@ts-expect-error
|
|
24
|
-
on(t, n) {
|
|
25
|
-
const r = e.get(t);
|
|
26
|
-
r ? r.push(n) : e.set(t, [n]);
|
|
27
|
-
},
|
|
28
|
-
/**
|
|
29
|
-
* Remove an event handler for the given type.
|
|
30
|
-
* If `handler` is omitted, all handlers of the given type are removed.
|
|
31
|
-
* @param {string|symbol} type Type of event to unregister `handler` from (`'*'` to remove a wildcard handler)
|
|
32
|
-
* @param {Function} [handler] Handler function to remove
|
|
33
|
-
* @memberOf mitt
|
|
34
|
-
*/
|
|
35
|
-
//@ts-expect-error
|
|
36
|
-
off(t, n) {
|
|
37
|
-
const r = e.get(t);
|
|
38
|
-
r && (n ? r.splice(r.indexOf(n) >>> 0, 1) : e.set(t, []));
|
|
39
|
-
},
|
|
40
|
-
/**
|
|
41
|
-
* Invoke all handlers for the given type.
|
|
42
|
-
* If present, `'*'` handlers are invoked after type-matched handlers.
|
|
43
|
-
*
|
|
44
|
-
* Note: Manually firing '*' handlers is not supported.
|
|
45
|
-
*
|
|
46
|
-
* @param {string|symbol} type The event type to invoke
|
|
47
|
-
* @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
|
|
48
|
-
* @memberOf mitt
|
|
49
|
-
*/
|
|
50
|
-
emit(t, n) {
|
|
51
|
-
let r = e.get(t);
|
|
52
|
-
r && [...r].map((s) => {
|
|
53
|
-
s(n);
|
|
54
|
-
}), r = e.get("*"), r && [...r].map((s) => {
|
|
55
|
-
s(t, n);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
let S;
|
|
61
|
-
function H() {
|
|
62
|
-
try {
|
|
63
|
-
return S || (S = ce()), S;
|
|
64
|
-
} catch {
|
|
65
|
-
throw new Error("Error EventEmitter");
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
const R = "OPEN_EXCALIDRAW_SETTING_MODAL";
|
|
69
|
-
function le(e, t) {
|
|
70
|
-
H().on(e, t);
|
|
71
|
-
}
|
|
72
|
-
function ue(e, t) {
|
|
73
|
-
H().off(e, t);
|
|
74
|
-
}
|
|
75
|
-
function Me(e) {
|
|
76
|
-
H().emit(R, e);
|
|
77
|
-
}
|
|
78
|
-
function De() {
|
|
79
|
-
const e = ee(), t = te(W.name), n = re(W.name), {
|
|
80
|
-
tooltipOptions: r = {},
|
|
81
|
-
isActive: s = void 0
|
|
82
|
-
} = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: f } = ne(s), u = F(() => (n == null ? void 0 : n.options) || {}, [n]), [o, _] = l(null), [g, y] = l({}), [b, M] = l({ elements: [], appState: { isLoading: !1 }, files: null }), [d, h] = l(!1), [x, I] = l(!0), [w, D] = l(null), a = A(
|
|
83
|
-
(p) => {
|
|
84
|
-
p && import("@excalidraw/excalidraw").then((m) => {
|
|
85
|
-
_(m.Excalidraw);
|
|
86
|
-
}).catch(D).finally(() => I(!1));
|
|
87
|
-
},
|
|
88
|
-
[I]
|
|
89
|
-
), c = A((p) => {
|
|
90
|
-
setTimeout(() => {
|
|
91
|
-
p.refresh();
|
|
92
|
-
});
|
|
93
|
-
}, []), E = A((p, m, z) => {
|
|
94
|
-
y({
|
|
95
|
-
elements: p,
|
|
96
|
-
appState: { isLoading: !1 },
|
|
97
|
-
files: z
|
|
98
|
-
});
|
|
99
|
-
}, []), L = A(() => {
|
|
100
|
-
if (!o) {
|
|
101
|
-
h(!1);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
e.chain().focus().setExcalidraw({ data: g }).run(), h(!1);
|
|
105
|
-
}, [o, e, g, h]);
|
|
106
|
-
return N(() => {
|
|
107
|
-
const p = (m) => {
|
|
108
|
-
(m == null ? void 0 : m.editor) === e && (h(!0), m && M(m.data));
|
|
109
|
-
};
|
|
110
|
-
return le(R, p), () => {
|
|
111
|
-
ue(R, p);
|
|
112
|
-
};
|
|
113
|
-
}, [e, h]), N(() => {
|
|
114
|
-
!x && o && d && setTimeout(() => {
|
|
115
|
-
window.dispatchEvent(new Event("resize"));
|
|
116
|
-
}, 400);
|
|
117
|
-
}, [x, o, d]), /* @__PURE__ */ T(
|
|
118
|
-
Y,
|
|
119
|
-
{
|
|
120
|
-
onOpenChange: h,
|
|
121
|
-
open: d,
|
|
122
|
-
children: [
|
|
123
|
-
/* @__PURE__ */ i(q, { asChild: !0, children: /* @__PURE__ */ i(
|
|
124
|
-
C,
|
|
125
|
-
{
|
|
126
|
-
disabled: f,
|
|
127
|
-
icon: "Excalidraw",
|
|
128
|
-
tooltip: "Excalidraw",
|
|
129
|
-
tooltipOptions: r,
|
|
130
|
-
action: () => {
|
|
131
|
-
f || h(!0);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
) }),
|
|
135
|
-
/* @__PURE__ */ T(J, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
|
|
136
|
-
/* @__PURE__ */ i(K, { children: "Excalidraw" }),
|
|
137
|
-
/* @__PURE__ */ T("div", { style: { height: "100%", borderWidth: 1 }, children: [
|
|
138
|
-
x && /* @__PURE__ */ i("p", { children: "Loading..." }),
|
|
139
|
-
w && /* @__PURE__ */ i("p", { children: w && w.message || "Error" }),
|
|
140
|
-
/* @__PURE__ */ i(
|
|
141
|
-
"div",
|
|
142
|
-
{
|
|
143
|
-
ref: a,
|
|
144
|
-
style: { width: "100%", height: 600 },
|
|
145
|
-
children: !x && !w && o ? /* @__PURE__ */ i(
|
|
146
|
-
o,
|
|
147
|
-
{
|
|
148
|
-
initialData: b,
|
|
149
|
-
langCode: "en",
|
|
150
|
-
onChange: E,
|
|
151
|
-
ref: c,
|
|
152
|
-
...u.excalidrawProps
|
|
153
|
-
}
|
|
154
|
-
) : null
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
] }),
|
|
158
|
-
/* @__PURE__ */ i(Q, { children: /* @__PURE__ */ i(
|
|
159
|
-
de,
|
|
160
|
-
{
|
|
161
|
-
disabled: !o,
|
|
162
|
-
onClick: L,
|
|
163
|
-
type: "button",
|
|
164
|
-
children: "Save changes"
|
|
165
|
-
}
|
|
166
|
-
) })
|
|
167
|
-
] })
|
|
168
|
-
]
|
|
169
|
-
}
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
const he = "_wrap_dra8y_1", pe = "_renderWrap_dra8y_7", me = "_handlerWrap_dra8y_30", fe = "_disabled_dra8y_40", v = {
|
|
173
|
-
wrap: he,
|
|
174
|
-
renderWrap: pe,
|
|
175
|
-
handlerWrap: me,
|
|
176
|
-
disabled: fe
|
|
177
|
-
}, ge = 10, we = 200, P = 15, j = { width: "100%", height: "100%", maxWidth: "100%" };
|
|
178
|
-
function Ee({ editor: e, node: t, updateAttributes: n }) {
|
|
179
|
-
const r = G(null), s = se(), f = e.isActive(W.name), { data: u, width: o, height: _ } = t.attrs, [g, y] = l(null), [b, M] = l(!0), [d, h] = l(null), [x, I] = l(100), w = A((a) => () => {
|
|
180
|
-
I(
|
|
181
|
-
(c) => ie(a === "minus" ? c - P : c + P, ge, we)
|
|
182
|
-
);
|
|
183
|
-
}, []);
|
|
184
|
-
N(() => {
|
|
185
|
-
let a = !1;
|
|
186
|
-
return import("@excalidraw/excalidraw").then((c) => {
|
|
187
|
-
a || (r.current = c.exportToSvg);
|
|
188
|
-
}).catch((c) => !a && h(c)).finally(() => !a && M(!1)), () => {
|
|
189
|
-
a = !0;
|
|
190
|
-
};
|
|
191
|
-
}, [u]), N(() => {
|
|
192
|
-
let a = !1;
|
|
193
|
-
return (async () => {
|
|
194
|
-
if (!r.current || a || b || d || !u)
|
|
195
|
-
return;
|
|
196
|
-
const E = await r.current(u);
|
|
197
|
-
a || (E.setAttribute("width", "100%"), E.setAttribute("height", "100%"), E.setAttribute("display", "block"), y(E));
|
|
198
|
-
})(), () => {
|
|
199
|
-
a = !0;
|
|
200
|
-
};
|
|
201
|
-
}, [u, b, d]);
|
|
202
|
-
const D = (a) => {
|
|
203
|
-
n({ width: a.width, height: a.height });
|
|
204
|
-
};
|
|
205
|
-
return /* @__PURE__ */ i(
|
|
206
|
-
V,
|
|
207
|
-
{
|
|
208
|
-
className: Z(v.wrap, {
|
|
209
|
-
[v.active]: f,
|
|
210
|
-
[v.disabled]: !s
|
|
211
|
-
}),
|
|
212
|
-
children: /* @__PURE__ */ i(
|
|
213
|
-
ae,
|
|
214
|
-
{
|
|
215
|
-
size: { width: Number.parseInt(o), height: Number.parseInt(_) },
|
|
216
|
-
onResizeStop: (a, c, E, L) => {
|
|
217
|
-
D({
|
|
218
|
-
width: Number.parseInt(o) + L.width,
|
|
219
|
-
height: Number.parseInt(_) + L.height
|
|
220
|
-
});
|
|
221
|
-
},
|
|
222
|
-
children: /* @__PURE__ */ T(
|
|
223
|
-
"div",
|
|
224
|
-
{
|
|
225
|
-
className: Z(v.renderWrap, "render-wrapper"),
|
|
226
|
-
style: { ...j, overflow: "hidden" },
|
|
227
|
-
children: [
|
|
228
|
-
d && /* @__PURE__ */ i("div", { style: j, children: /* @__PURE__ */ i("p", { children: d.message || d }) }),
|
|
229
|
-
b && /* @__PURE__ */ i("p", { children: "Loading..." }),
|
|
230
|
-
!b && !d && g && /* @__PURE__ */ i(
|
|
231
|
-
"div",
|
|
232
|
-
{
|
|
233
|
-
dangerouslySetInnerHTML: { __html: (g == null ? void 0 : g.outerHTML) ?? "" },
|
|
234
|
-
style: {
|
|
235
|
-
height: "100%",
|
|
236
|
-
maxHeight: "100%",
|
|
237
|
-
padding: 24,
|
|
238
|
-
overflow: "hidden",
|
|
239
|
-
display: "flex",
|
|
240
|
-
justifyContent: "center",
|
|
241
|
-
alignItems: "center",
|
|
242
|
-
transform: `scale(${x / 100})`,
|
|
243
|
-
transition: "all ease-in-out .3s"
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
),
|
|
247
|
-
/* @__PURE__ */ T("div", { className: v.handlerWrap, children: [
|
|
248
|
-
/* @__PURE__ */ i(
|
|
249
|
-
C,
|
|
250
|
-
{
|
|
251
|
-
action: w("minus"),
|
|
252
|
-
disabled: !s,
|
|
253
|
-
icon: "ZoomOut",
|
|
254
|
-
tooltip: "Zoom Out"
|
|
255
|
-
}
|
|
256
|
-
),
|
|
257
|
-
/* @__PURE__ */ i(
|
|
258
|
-
C,
|
|
259
|
-
{
|
|
260
|
-
action: w("plus"),
|
|
261
|
-
disabled: !s,
|
|
262
|
-
icon: "ZoomIn",
|
|
263
|
-
tooltip: "Zoom In"
|
|
264
|
-
}
|
|
265
|
-
)
|
|
266
|
-
] })
|
|
267
|
-
]
|
|
268
|
-
}
|
|
269
|
-
)
|
|
270
|
-
}
|
|
271
|
-
)
|
|
272
|
-
}
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
const k = { elements: [] }, W = /* @__PURE__ */ $.create({
|
|
276
|
-
name: "excalidraw",
|
|
277
|
-
group: "block",
|
|
278
|
-
selectable: !0,
|
|
279
|
-
atom: !0,
|
|
280
|
-
draggable: !0,
|
|
281
|
-
inline: !1,
|
|
282
|
-
addAttributes() {
|
|
283
|
-
return {
|
|
284
|
-
defaultShowPicker: {
|
|
285
|
-
default: !1
|
|
286
|
-
},
|
|
287
|
-
createUser: {
|
|
288
|
-
default: null
|
|
289
|
-
},
|
|
290
|
-
width: {
|
|
291
|
-
default: "100%",
|
|
292
|
-
parseHTML: O("width")
|
|
293
|
-
},
|
|
294
|
-
height: {
|
|
295
|
-
default: 240,
|
|
296
|
-
parseHTML: O("height")
|
|
297
|
-
},
|
|
298
|
-
data: {
|
|
299
|
-
default: k,
|
|
300
|
-
parseHTML: O("data", !0)
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
},
|
|
304
|
-
addOptions() {
|
|
305
|
-
var e;
|
|
306
|
-
return {
|
|
307
|
-
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
308
|
-
HTMLAttributes: {
|
|
309
|
-
class: "excalidraw"
|
|
310
|
-
},
|
|
311
|
-
excalidrawProps: {},
|
|
312
|
-
button: () => ({
|
|
313
|
-
componentProps: {}
|
|
314
|
-
})
|
|
315
|
-
};
|
|
316
|
-
},
|
|
317
|
-
parseHTML() {
|
|
318
|
-
return [
|
|
319
|
-
{
|
|
320
|
-
tag: "div[class=excalidraw]"
|
|
321
|
-
}
|
|
322
|
-
];
|
|
323
|
-
},
|
|
324
|
-
renderHTML({ HTMLAttributes: e, node: t }) {
|
|
325
|
-
return ["div", X(this.options.HTMLAttributes, e, oe(t))];
|
|
326
|
-
},
|
|
327
|
-
addCommands() {
|
|
328
|
-
return {
|
|
329
|
-
setExcalidraw: (e) => ({ tr: t, commands: n, chain: r }) => {
|
|
330
|
-
var s, f, u;
|
|
331
|
-
return e = e || {}, e.data = e.data || k, ((u = (f = (s = t.selection) == null ? void 0 : s.node) == null ? void 0 : f.type) == null ? void 0 : u.name) == this.name ? n.updateAttributes(this.name, e) : r().insertContent({
|
|
332
|
-
type: this.name,
|
|
333
|
-
attrs: e
|
|
334
|
-
}).run();
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
},
|
|
338
|
-
addNodeView() {
|
|
339
|
-
return U(Ee);
|
|
340
|
-
},
|
|
341
|
-
addInputRules() {
|
|
342
|
-
return [
|
|
343
|
-
B({
|
|
344
|
-
find: /^\$excalidraw\$$/,
|
|
345
|
-
type: this.type,
|
|
346
|
-
getAttributes: () => ({ width: "100%" })
|
|
347
|
-
})
|
|
348
|
-
];
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
export {
|
|
352
|
-
W as E,
|
|
353
|
-
De as R,
|
|
354
|
-
Me as t
|
|
355
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var B=Object.create;var H=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var F=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of $(t))!X.call(e,a)&&a!==r&&H(e,a,{get:()=>t[a],enumerable:!(n=V(t,a))||n.enumerable});return e};var q=(e,t,r)=>(r=e!=null?B(U(e)):{},F(t||!e||!e.__esModule?H(r,"default",{value:e,enumerable:!0}):r,e));const E=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),i=require("react"),C=require("./toggle-C_SSvDRy.cjs"),A=require("./dialog-CWYTvz5J.cjs"),T=require("./useButtonProps-Cz4W5dC8.cjs"),G=require("re-resizable"),Y=require("./index-Cn-t3Zxw.cjs"),I=require("./dom-dataset-BqoJhJXt.cjs"),J=require("./button-CqJztfH2.cjs");function K(e){return e=e||new Map,{all:e,on(t,r){const n=e.get(t);n?n.push(r):e.set(t,[r])},off(t,r){const n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit(t,r){let n=e.get(t);n&&[...n].map(a=>{a(r)}),n=e.get("*"),n&&[...n].map(a=>{a(t,r)})}}}let O;function W(){try{return O||(O=K()),O}catch{throw new Error("Error EventEmitter")}}const R="OPEN_EXCALIDRAW_SETTING_MODAL";function Q(e,t){W().on(e,t)}function ee(e,t){W().off(e,t)}function te(e){W().emit(R,e)}function re(){const e=T.useEditorInstance(),t=T.useButtonProps(L.name),r=T.useExtension(L.name),{tooltipOptions:n={},isActive:a=void 0}=(t==null?void 0:t.componentProps)??{},{editorDisabled:f}=T.useToggleActive(a),u=i.useMemo(()=>(r==null?void 0:r.options)||{},[r]),[c,_]=i.useState(null),[x,M]=i.useState({}),[b,y]=i.useState({elements:[],appState:{isLoading:!1},files:null}),[l,h]=i.useState(!1),[v,j]=i.useState(!0),[m,N]=i.useState(null),o=i.useCallback(p=>{p&&import("@excalidraw/excalidraw").then(g=>{_(g.Excalidraw)}).catch(N).finally(()=>j(!1))},[j]),d=i.useCallback(p=>{setTimeout(()=>{p.refresh()})},[]),w=i.useCallback((p,g,z)=>{M({elements:p,appState:{isLoading:!1},files:z})},[]),D=i.useCallback(()=>{if(!c){h(!1);return}e.chain().focus().setExcalidraw({data:x}).run(),h(!1)},[c,e,x,h]);return i.useEffect(()=>{const p=g=>{(g==null?void 0:g.editor)===e&&(h(!0),g&&y(g.data))};return Q(R,p),()=>{ee(R,p)}},[e,h]),i.useEffect(()=>{!v&&c&&l&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},400)},[v,c,l]),s.jsxs(A.Dialog,{onOpenChange:h,open:l,children:[s.jsx(A.DialogTrigger,{asChild:!0,children:s.jsx(C.ActionButton,{disabled:f,icon:"Excalidraw",tooltip:"Excalidraw",tooltipOptions:n,action:()=>{f||h(!0)}})}),s.jsxs(A.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[s.jsx(A.DialogTitle,{children:"Excalidraw"}),s.jsxs("div",{style:{height:"100%",borderWidth:1},children:[v&&s.jsx("p",{children:"Loading..."}),m&&s.jsx("p",{children:m&&m.message||"Error"}),s.jsx("div",{ref:o,style:{width:"100%",height:600},children:!v&&!m&&c?s.jsx(c,{initialData:b,langCode:"en",onChange:w,ref:d,...u.excalidrawProps}):null})]}),s.jsx(A.DialogFooter,{children:s.jsx(J.Button,{disabled:!c,onClick:D,type:"button",children:"Save changes"})})]})]})}const ne="_wrap_dra8y_1",se="_renderWrap_dra8y_7",ie="_handlerWrap_dra8y_30",ae="_disabled_dra8y_40",S={wrap:ne,renderWrap:se,handlerWrap:ie,disabled:ae},oe=10,ce=200,k=15,P={width:"100%",height:"100%",maxWidth:"100%"};function le({editor:e,node:t,updateAttributes:r}){const n=i.useRef(null),a=Y.useEditableEditor(),f=e.isActive(L.name),{data:u,width:c,height:_}=t.attrs,[x,M]=i.useState(null),[b,y]=i.useState(!0),[l,h]=i.useState(null),[v,j]=i.useState(100),m=i.useCallback(o=>()=>{j(d=>T.clamp(o==="minus"?d-k:d+k,oe,ce))},[]);i.useEffect(()=>{let o=!1;return import("@excalidraw/excalidraw").then(d=>{o||(n.current=d.exportToSvg)}).catch(d=>!o&&h(d)).finally(()=>!o&&y(!1)),()=>{o=!0}},[u]),i.useEffect(()=>{let o=!1;return(async()=>{if(!n.current||o||b||l||!u)return;const w=await n.current(u);o||(w.setAttribute("width","100%"),w.setAttribute("height","100%"),w.setAttribute("display","block"),M(w))})(),()=>{o=!0}},[u,b,l]);const N=o=>{r({width:o.width,height:o.height})};return s.jsx(E.NodeViewWrapper,{className:E.clsx(S.wrap,{[S.active]:f,[S.disabled]:!a}),children:s.jsx(G.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(_)},onResizeStop:(o,d,w,D)=>{N({width:Number.parseInt(c)+D.width,height:Number.parseInt(_)+D.height})},children:s.jsxs("div",{className:E.clsx(S.renderWrap,"render-wrapper"),style:{...P,overflow:"hidden"},children:[l&&s.jsx("div",{style:P,children:s.jsx("p",{children:l.message||l})}),b&&s.jsx("p",{children:"Loading..."}),!b&&!l&&x&&s.jsx("div",{dangerouslySetInnerHTML:{__html:(x==null?void 0:x.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${v/100})`,transition:"all ease-in-out .3s"}}),s.jsxs("div",{className:S.handlerWrap,children:[s.jsx(C.ActionButton,{action:m("minus"),disabled:!a,icon:"ZoomOut",tooltip:"Zoom Out"}),s.jsx(C.ActionButton,{action:m("plus"),disabled:!a,icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}const Z={elements:[]},L=E.Node3.create({name:"excalidraw",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addAttributes(){return{defaultShowPicker:{default:!1},createUser:{default:null},width:{default:"100%",parseHTML:I.getDatasetAttribute("width")},height:{default:240,parseHTML:I.getDatasetAttribute("height")},data:{default:Z,parseHTML:I.getDatasetAttribute("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},excalidrawProps:{},button:()=>({componentProps:{}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:t}){return["div",E.mergeAttributes(this.options.HTMLAttributes,e,I.nodeAttrsToDataset(t))]},addCommands(){return{setExcalidraw:e=>({tr:t,commands:r,chain:n})=>{var a,f,u;return e=e||{},e.data=e.data||Z,((u=(f=(a=t.selection)==null?void 0:a.node)==null?void 0:f.type)==null?void 0:u.name)==this.name?r.updateAttributes(this.name,e):n().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return E.ReactNodeViewRenderer(le)},addInputRules(){return[E.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=L;exports.RichTextExcalidraw=re;exports.triggerOpenExcalidrawSettingModal=te;
|
package/lib/Icon-C0TJMAOm.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import "./index-DoiuU6VA.js";
|
|
4
|
-
import "./theme.js";
|
|
5
|
-
import { i as c } from "./index-CL7JP-Xz.js";
|
|
6
|
-
function x(t) {
|
|
7
|
-
const n = c[t.name];
|
|
8
|
-
return n ? /* @__PURE__ */ i(n, { onClick: t == null ? void 0 : t.onClick, className: `richtext-w-4 richtext-h-4 ${(t == null ? void 0 : t.className) || ""}` }) : null;
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
x as I
|
|
12
|
-
};
|
package/lib/Icon-DzK0_ztP.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime");require("react");require("./index-Cn-t3Zxw.cjs");require("./theme.cjs");const i=require("./index-VhKd73hZ.cjs");function t(e){const n=i.icons[e.name];return n?c.jsx(n,{onClick:e==null?void 0:e.onClick,className:`richtext-w-4 richtext-h-4 ${(e==null?void 0:e.className)||""}`}):null}exports.IconComponent=t;
|
package/lib/Iframe-BSNCsofW.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),b=require("react"),y=require("re-resizable"),h=require("./dom-dataset-BqoJhJXt.cjs"),S=require("./toggle-C_SSvDRy.cjs"),I=require("./index-Cn-t3Zxw.cjs");require("./theme.cjs");const g=require("./useButtonProps-Cz4W5dC8.cjs"),P=require("./input-ZGRt7lWR.cjs"),R=require("./button-CqJztfH2.cjs"),m={youtube:{example:"https://www.youtube.com/watch?v=I4sMhHbHYXM",src:"https://www.youtube.com/embed/I4sMhHbHYXM",srcPrefix:"https://www.youtube.com/embed",linkRule:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/]},youku:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"https://player.youku.com/embed",linkRule:[String.raw`v.youku.com\/v_show\/id_\w+\=*`],idRule:String.raw`id_\w+\=*`},bilibili:{example:"https://www.bilibili.com/video/BV1EJ411u7DN",src:"https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",srcPrefix:"https://player.bilibili.com/player.html?bvid",linkRule:[String.raw`www.bilibili.com\/video\/\w+`]},qqvideo:{example:"https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",src:"https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",srcPrefix:"https://v.qq.com/txp/iframe/player.html?vid",linkRule:[String.raw`v.qq.com\/x\/cover\/\w+\/\w+`]},amap:{example:"https://ditu.amap.com/",src:"https://www.amap.com/place/B000A45467",srcPrefix:"",linkRule:[String.raw`\.amap\.com`]},baidu_map:{example:"https://j.map.baidu.com/15/fo",src:"https://j.map.baidu.com/15/fo",srcPrefix:"",linkRule:[String.raw`map\.baidu\.com`]},modao:{example:"https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",src:"https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",srcPrefix:"",linkRule:[String.raw`https:\/\/\w+.modao.cc\/app\/\w+\/embed\/v2`],tips:"Modao > More > Share > Embed > COPY"},lanhu:{example:"https://lanhuapp.com/link/#/invite?sid=evP7L",src:"https://lanhuapp.com/url/evP7L",srcPrefix:"",linkRule:[String.raw`https:\/\/lanhuapp.com\/url\/\w+`],tips:"Lanhu > Project > Share > Copy Link"},figma:{example:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",src:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",srcPrefix:"https://www.figma.com/embed?embed_host=share&url",linkRule:[String.raw`https:\/\/www.figma.com\/file\/\w+`]},canva:{example:"https://www.canva.cn/design/DAD61-t29UI/view",src:"https://www.canva.cn/design/DAD61-t29UI/view",srcPrefix:"",linkRule:[String.raw`https:\/\/www.canva.cn\/design\/.+\/view`]},processon:{example:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",src:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",srcPrefix:"",linkRule:[String.raw`https:\/\/www.processon.com\/embed\/\w+`]},codepen:{example:"https://codepen.io/mekery/embed/YzyrKOJ",src:"https://codepen.io/mekery/embed/YzyrKOJ",srcPrefix:"",linkRule:[String.raw`https:\/\/codepen.io\/.+\/embed\/\w+`]},jinshuju:{example:"https://jinshuju.net/f/q9YvVf",src:"https://jinshuju.net/f/q9YvVf",srcPrefix:"",linkRule:[String.raw`https:\/\/jinshuju.net\/f\/\w+`]},iframe:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"",linkRule:[".+"]},googlemaps:{example:"https://goo.gl/maps/8Ys8b4K1ZJY2",src:"https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",srcPrefix:"",linkRule:[String.raw`https:\/\/goo.gl\/maps\/\w+`]}};function j(e){const t=m.youtube,i=e.matchedUrl;e.validLink=!0;const r=i.split("="),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}/${c}`,e.validId=!0}return e}function q(e){const t=m.youku,i=e.matchedUrl,r=t.idRule,n=new RegExp(r),c=i.match(n);if(c&&c.length>0){const o=c[0].slice(3);e.validId=!0,e.src=`${t.srcPrefix}/${o}`}else e.validId=!1;return e}function M(e){const t=m.bilibili,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function N(e){const t=m.qqvideo,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function U(e,t){return t.src=e,t.validId=!0,t}function A(e,t){return t.src=e,t.validId=!0,t}function D(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function L(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function _(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function $(e){const t=m.figma;return e.src=`${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`,e.validId=!0,e.originalLink=e.matchedUrl,e}function T(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function z(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function Y(e){return e.src=`${e.matchedUrl}`,e.validId=!0,e.originalLink=e.src,e}function C(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function E(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function H(e,t,i){if(e==="googlemaps")return i.validLink=!0,i.matchedUrl=t,i;const n=m[e].linkRule;for(const c of n){const o=new RegExp(c),a=t.match(o);if(a&&a.length>0)return i.validLink=!0,i.matchedUrl=e==="youtube"?a[1]:a[0],i}return i}function B(e){var i,r;let t="iframe";return((i=e.includes)!=null&&i.call(e,"youtube")||(r=e.includes)!=null&&r.call(e,"youtu.be"))&&(t="youtube"),e.includes("youku")&&(t="youku"),e.includes("bilibili")&&(t="bilibili"),e.includes("qq")&&(t="qqvideo"),e.includes("amap")&&(t="amap"),e.includes("map.baidu")&&(t="baidu_map"),(e.includes("google.com/maps")||e.includes("maps.app.goo.gl"))&&(t="googlemaps"),e.includes("modao")&&(t="modao"),e.includes("lanhuapp")&&(t="lanhu"),e.includes("figma")&&(t="figma"),e.includes("canva")&&(t="canva"),e.includes("processon")&&(t="processon"),e.includes("codepen")&&(t="codepen"),e.includes("jinshuju")&&(t="jinshuju"),e.includes("iframe")&&(t="iframe"),t}function x(e){let t={validLink:!1,validId:!1,matchedUrl:"",originalLink:e,src:""};const i=B(e);if(t=H(i,e,t),!t.validLink)return t;switch(i){case"youtube":return j(t);case"youku":return q(t);case"bilibili":return M(t);case"qqvideo":return N(t);case"amap":return U(e,t);case"baidu_map":return A(e,t);case"googlemaps":return D(e,t);case"modao":return L(t);case"lanhu":return _(t);case"figma":return $(t);case"canva":return T(e,t);case"processon":return z(e,t);case"codepen":return Y(t);case"jinshuju":return C(e,t);case"iframe":return E(e,t);default:return e}}const V="_wrap_5y04w_1",K="_innerWrap_5y04w_15",v={wrap:V,innerWrap:K};function O({editor:e,node:t,updateAttributes:i}){const r=I.useEditableEditor(),{src:n,width:c,height:o}=t.attrs,[a,p]=b.useState("");function l(){if(!a)return;const d=x(a);e.chain().updateAttributes(f.name,{src:(d==null?void 0:d.src)||a}).setNodeSelection(e.state.selection.from).focus().run()}const k=b.useCallback(d=>{i({width:d.width,height:d.height})},[i]);return s.jsxs(u.NodeViewWrapper,{children:[!n&&s.jsxs("div",{className:"richtext-mx-auto richtext-my-[12px] richtext-flex richtext-max-w-[600px] richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-rounded-[12px] richtext-border richtext-border-solid richtext-border-border richtext-p-[10px]",children:[s.jsx(P.Input,{autoFocus:!0,className:"richtext-flex-1",onInput:d=>p(d.target.value),placeholder:"Enter link",type:"url",value:a}),s.jsx(R.Button,{className:"richtext-w-[60px]",onClick:l,children:"OK"})]}),n&&s.jsx(y.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(o)},onResizeStop:(d,J,W,w)=>{k({width:Number.parseInt(c)+w.width,height:Number.parseInt(o)+w.height})},children:s.jsx("div",{className:u.clsx(v.wrap,"render-wrapper"),children:s.jsx("div",{className:v.innerWrap,style:{pointerEvents:r?"none":"auto"},children:s.jsx("iframe",{className:"richtext-my-[12px] ",src:n})})})})]})}function X(){const e=g.useButtonProps(f.name),{icon:t=void 0,tooltip:i=void 0,shortcutKeys:r=void 0,tooltipOptions:n={},action:c=void 0,isActive:o=void 0}=(e==null?void 0:e.componentProps)??{},{editorDisabled:a,update:p}=g.useToggleActive(o),l=()=>{a||c&&(c(),p())};return e?s.jsx(S.ActionButton,{action:l,disabled:a,icon:t,shortcutKeys:r,tooltip:i,tooltipOptions:n}):s.jsx(s.Fragment,{})}const f=u.Node3.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"iframe"},button:({editor:t,extension:i,t:r})=>({componentProps:{action:n=>t.commands.setIframe(n),upload:i.options.upload,icon:"Iframe",tooltip:r("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:h.getDatasetAttribute("width")},height:{default:300,parseHTML:h.getDatasetAttribute("height")},src:{default:null,parseHTML:h.getDatasetAttribute("src")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["iframe",u.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setIframe:e=>({tr:t,commands:i,chain:r})=>{var c,o,a;if(((a=(o=(c=t.selection)==null?void 0:c.node)==null?void 0:o.type)==null?void 0:a.name)==this.name)return i.updateAttributes(this.name,e);const n=e||{url:""};return r().insertContent({type:this.name,attrs:n}).run()}}},addInputRules(){return[u.nodeInputRule({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return u.ReactNodeViewRenderer(O)}});exports.Iframe=f;exports.RichTextIframe=X;exports.getServiceSrc=x;
|