reactjs-tiptap-editor 1.0.16 → 1.0.18
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-a8LhmHXe.js → ActionMenuButton-BOjCHFTA.js} +12 -16
- package/lib/ActionMenuButton-Df077oOH.cjs +1 -0
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.js +47 -89
- package/lib/Blockquote.cjs +2 -2
- package/lib/Blockquote.js +11 -14
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +13 -16
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +15 -18
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +113 -113
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +12 -14
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +8 -11
- package/lib/CodeBlock.cjs +37 -37
- package/lib/CodeBlock.js +1566 -1613
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +9 -11
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +62 -82
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +27 -15
- package/lib/Drawer-DwrlY_lY.cjs +1 -0
- package/lib/Drawer-DxOoRiGQ.js +1099 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +6 -5
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +71 -97
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +265 -5
- package/lib/ExportPdf.cjs +4 -4
- package/lib/ExportPdf.js +20 -31
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +11 -11
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +16 -39
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +25 -41
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +51 -65
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +60 -76
- package/lib/History.cjs +1 -1
- package/lib/History.js +322 -320
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +8 -11
- package/lib/{Iframe-CmjbQQcz.js → Iframe-AhNV5WH5.js} +52 -65
- package/lib/Iframe-C6pBw-AF.cjs +1 -0
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +5 -4
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +5 -5
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +148 -181
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +19 -26
- package/lib/{Indent-BoG-vpIE.js → Indent-DZ5PcJA4.js} +24 -30
- package/lib/Indent-Do-X0AsY.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 -14
- package/lib/Katex-CIC9ygbL.cjs +4 -0
- package/lib/{Katex-ByL9snce.js → Katex-bIgoenn_.js} +243 -262
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +5 -4
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +23 -34
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/LinkEditBlock-B0ZaACZO.cjs +5 -0
- package/lib/{LinkEditBlock-Ckih17pU.js → LinkEditBlock-D_cF9fnc.js} +324 -381
- package/lib/MarkdownPaste.cjs +58 -0
- package/lib/MarkdownPaste.js +1656 -0
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +22 -17
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +125 -154
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +28 -40
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +13 -16
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +114 -186
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +15 -14
- package/lib/SlashCommandNodeView-Ba03hlVZ.cjs +1 -0
- package/lib/{SlashCommandNodeView-B2g1MbgN.js → SlashCommandNodeView-cg0x3NRF.js} +72 -79
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +12 -15
- package/lib/{Table-BEwrZVup.js → Table-KqLiT5wG.js} +85 -125
- package/lib/Table-ddU2LSc6.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 -21
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +65 -78
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +51 -77
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +7 -10
- package/lib/Twitter-BIiR78Jh.cjs +1 -0
- package/lib/{Twitter-4U_ZBhpv.js → Twitter-C1Lzqc7u.js} +567 -599
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +4 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -270
- package/lib/bubble.cjs +6 -4
- package/lib/bubble.js +3719 -3039
- package/lib/clsx-BWE7vnna.cjs +33 -0
- package/lib/clsx-eGVyq7ot.js +1062 -0
- package/lib/components/ActionButton.d.ts +2 -2
- package/lib/components/ActionMenuButton.d.ts +1 -1
- package/lib/components/Bubble/formatBubble.d.ts +5 -5
- 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/components/ui/checkbox.d.ts +1 -1
- package/lib/components/ui/dialog.d.ts +1 -1
- package/lib/components/ui/dropdown-menu.d.ts +1 -1
- package/lib/components/ui/emoji-picker.d.ts +1 -1
- package/lib/components/ui/label.d.ts +1 -1
- package/lib/components/ui/popover.d.ts +1 -1
- package/lib/components/ui/select.d.ts +1 -1
- package/lib/components/ui/separator.d.ts +1 -1
- package/lib/components/ui/switch.d.ts +1 -1
- package/lib/components/ui/tabs.d.ts +1 -1
- package/lib/components/ui/toast.d.ts +1 -1
- package/lib/components/ui/toggle.d.ts +1 -1
- package/lib/components/ui/tooltip.d.ts +1 -1
- package/lib/{delete-node-IyVmiRbI.js → delete-node-eQHsyyhR.js} +3 -1
- package/lib/{dropdown-menu-CW3Kthwy.js → dropdown-menu-CexIkt_V.js} +8 -8
- package/lib/{dropdown-menu-eUeBXQeA.cjs → dropdown-menu-oSKIntXM.cjs} +1 -1
- package/lib/extensions/Blockquote/Blockquote.d.ts +1 -1
- package/lib/extensions/Bold/Bold.d.ts +1 -1
- package/lib/extensions/Code/Code.d.ts +1 -1
- package/lib/extensions/CodeView/CodeView.d.ts +2 -2
- package/lib/extensions/Heading/Heading.d.ts +1 -1
- package/lib/extensions/Highlight/Highlight.d.ts +1 -1
- package/lib/extensions/HorizontalRule/HorizontalRule.d.ts +1 -1
- package/lib/extensions/ImportWord/ImportWord.d.ts +2 -2
- package/lib/extensions/Italic/Italic.d.ts +1 -1
- package/lib/extensions/Link/Link.d.ts +1 -1
- package/lib/extensions/MarkdownPaste/MarkdownPaste.d.ts +5 -0
- package/lib/extensions/MarkdownPaste/index.d.ts +1 -0
- package/lib/extensions/Mermaid/Mermaid.d.ts +1 -1
- package/lib/extensions/MoreMark/MoreMark.d.ts +1 -1
- package/lib/extensions/Strike/Strike.d.ts +1 -1
- package/lib/extensions/Table/Table.d.ts +1 -1
- package/lib/extensions/TextAlign/TextAlign.d.ts +1 -1
- package/lib/extensions/TextUnderline/TextUnderline.d.ts +1 -1
- package/lib/index-BUTn2LY6.cjs +1 -0
- package/lib/{index-C07N8gA1.js → index-BlXGgvT-.js} +21 -18
- package/lib/{index-CpTykZBR.js → index-BnW6t8z6.js} +23 -23
- package/lib/{index-BsFvo9PG.cjs → index-BqL4vAWE.cjs} +1 -1
- package/lib/index-BtxvYLJ1.cjs +12 -0
- package/lib/{index-DR5tIdL7.js → index-C6xmkxrQ.js} +232 -217
- package/lib/index-CJ9pyCM4.cjs +1 -0
- package/lib/{index-neeeY2o7.cjs → index-D0lc95kr.cjs} +3 -3
- package/lib/index-DHUN85fV.js +4855 -0
- package/lib/index-DUpSE1Gb.cjs +1 -0
- package/lib/index-D_8P0LE5.js +1362 -0
- package/lib/{index-4bHF5ovf.js → index-RIXs7STX.js} +1 -1
- package/lib/index-mfGK4pFo.js +6469 -0
- package/lib/index-zig3Dj7A.cjs +22 -0
- package/lib/index.cjs +3 -3
- package/lib/index.js +60 -72
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/plugins/image-upload.d.ts +1 -1
- package/lib/popover-BYSZ3zBi.js +24 -0
- package/lib/popover-BcHDZqBt.cjs +1 -0
- package/lib/{renderNodeView-CSazLrKF.js → renderNodeView-BrM5kUj_.js} +2 -2
- package/lib/{renderNodeView-DfLmGrgA.cjs → renderNodeView-D1zydtli.cjs} +1 -1
- package/lib/{select-F0ZZ3VZB.js → select-C5SHDLFj.js} +8 -5
- package/lib/{select-Doa_-jkZ.cjs → select-DHjzKkcu.cjs} +1 -1
- package/lib/separator-BmixLrnJ.cjs +1 -0
- package/lib/separator-CFKVxAea.js +293 -0
- package/lib/store/editor.d.ts +1 -1
- package/lib/store/store.d.ts +2 -22
- package/lib/style.css +1 -1
- package/lib/{textarea-BAolHF_W.cjs → textarea-CasDcv3u.cjs} +1 -1
- package/lib/{textarea-tOsPnxHf.js → textarea-DNLrJoRl.js} +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +3 -3
- package/lib/updatePosition-CBRjbQMH.js +16 -0
- package/lib/updatePosition-CfmY5Trk.cjs +1 -0
- package/lib/utils/checkIsVideoUrl.d.ts +1 -0
- package/lib/utils/columns.d.ts +1 -1
- package/lib/utils/customEvents/events.constant.d.ts +1 -0
- package/lib/utils/mitt.d.ts +6 -3
- package/lib/utils/pdf.d.ts +1 -1
- package/lib/utils/utils.d.ts +1 -1
- package/package.json +262 -247
- package/lib/ActionMenuButton-BYu0NyVo.cjs +0 -1
- package/lib/Drawer-CbOJ1Igo.js +0 -1379
- 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/clsx-CXbNJWDD.cjs +0 -54
- package/lib/clsx-DSzxBzvL.js +0 -7391
- 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-BCzvbrf5.cjs +0 -12
- package/lib/index-CL7JP-Xz.js +0 -426
- package/lib/index-CjhjjJsN.cjs +0 -1
- package/lib/index-Cn-t3Zxw.cjs +0 -1
- package/lib/index-Cs6cp0Y6.cjs +0 -1
- package/lib/index-D8li6EQ4.js +0 -1351
- 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/popover-C6Cya3Cz.cjs +0 -1
- package/lib/popover-CeY3RbI5.js +0 -24
- package/lib/separator-CUh5Y7Rh.cjs +0 -1
- package/lib/separator-Cjn4YH8a.js +0 -329
- 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/updatePosition-CDK7OR0i.js +0 -16
- package/lib/updatePosition-Cjuj2E26.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
package/lib/Image-BZEFuS0P.js
DELETED
|
@@ -1,925 +0,0 @@
|
|
|
1
|
-
import { h as Ie, m as xe, k as we } from "./clsx-DSzxBzvL.js";
|
|
2
|
-
import { a as ee, c as Ae } from "./throttle-D040PfWL.js";
|
|
3
|
-
import { jsx as o, jsxs as b, Fragment as P } from "react/jsx-runtime";
|
|
4
|
-
import * as te from "react";
|
|
5
|
-
import X, { useState as _, useMemo as H, useCallback as F, useEffect as Q, useRef as de } from "react";
|
|
6
|
-
import { I as ie, i as ae, j as Se, u as ue } from "./index-C07N8gA1.js";
|
|
7
|
-
import { i as ne, c as ve } from "./isNumber-ClwLypY2.js";
|
|
8
|
-
import { A as Ee } from "./toggle-DEerYRil.js";
|
|
9
|
-
import "./index-DoiuU6VA.js";
|
|
10
|
-
import "./theme.js";
|
|
11
|
-
import { D as me, a as fe, b as he, c as ge, d as Me } from "./dialog-CJvpoeMm.js";
|
|
12
|
-
import _e from "react-image-crop";
|
|
13
|
-
import { B } from "./button-Bwn6gUuS.js";
|
|
14
|
-
import { d as pe, c as Ce, u as Le, a as Ne } from "./useButtonProps-CtZCbMQu.js";
|
|
15
|
-
import { d as Oe, r as Re } from "./file-BLas99n7.js";
|
|
16
|
-
import { I as Y } from "./Icon-C0TJMAOm.js";
|
|
17
|
-
import { a as De } from "./store-BsJz5QRC.js";
|
|
18
|
-
import { l as ze, E as ke } from "./events.constant-do95b767.js";
|
|
19
|
-
import { T as Ue, a as Fe, b as re, c as se } from "./tabs-CBDjOLl_.js";
|
|
20
|
-
import { C as Pe } from "./checkbox-B_rpz5Xq.js";
|
|
21
|
-
import { L as le } from "./label-Cjrzc5H2.js";
|
|
22
|
-
import { I as oe } from "./input-B1egKb-t.js";
|
|
23
|
-
const He = 1, Be = 1e6;
|
|
24
|
-
let q = 0;
|
|
25
|
-
function je() {
|
|
26
|
-
return q = (q + 1) % Number.MAX_SAFE_INTEGER, q.toString();
|
|
27
|
-
}
|
|
28
|
-
const Z = /* @__PURE__ */ new Map();
|
|
29
|
-
function ce(e) {
|
|
30
|
-
if (Z.has(e))
|
|
31
|
-
return;
|
|
32
|
-
const t = setTimeout(() => {
|
|
33
|
-
Z.delete(e), j({
|
|
34
|
-
type: "REMOVE_TOAST",
|
|
35
|
-
toastId: e
|
|
36
|
-
});
|
|
37
|
-
}, Be);
|
|
38
|
-
Z.set(e, t);
|
|
39
|
-
}
|
|
40
|
-
function Xe(e, t) {
|
|
41
|
-
switch (t.type) {
|
|
42
|
-
case "ADD_TOAST":
|
|
43
|
-
return {
|
|
44
|
-
...e,
|
|
45
|
-
toasts: [t.toast, ...e.toasts].slice(0, He)
|
|
46
|
-
};
|
|
47
|
-
case "UPDATE_TOAST":
|
|
48
|
-
return {
|
|
49
|
-
...e,
|
|
50
|
-
toasts: e.toasts.map(
|
|
51
|
-
(i) => i.id === t.toast.id ? { ...i, ...t.toast } : i
|
|
52
|
-
)
|
|
53
|
-
};
|
|
54
|
-
case "DISMISS_TOAST": {
|
|
55
|
-
const { toastId: i } = t;
|
|
56
|
-
return i ? ce(i) : e.toasts.forEach((n) => {
|
|
57
|
-
ce(n.id);
|
|
58
|
-
}), {
|
|
59
|
-
...e,
|
|
60
|
-
toasts: e.toasts.map(
|
|
61
|
-
(n) => n.id === i || i === void 0 ? {
|
|
62
|
-
...n,
|
|
63
|
-
open: !1
|
|
64
|
-
} : n
|
|
65
|
-
)
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
case "REMOVE_TOAST":
|
|
69
|
-
return t.toastId === void 0 ? {
|
|
70
|
-
...e,
|
|
71
|
-
toasts: []
|
|
72
|
-
} : {
|
|
73
|
-
...e,
|
|
74
|
-
toasts: e.toasts.filter((i) => i.id !== t.toastId)
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const G = [];
|
|
79
|
-
let V = { toasts: [] };
|
|
80
|
-
function j(e) {
|
|
81
|
-
V = Xe(V, e), G.forEach((t) => {
|
|
82
|
-
t(V);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function $e({ ...e }) {
|
|
86
|
-
const t = je(), i = (c) => j({
|
|
87
|
-
type: "UPDATE_TOAST",
|
|
88
|
-
toast: { ...c, id: t }
|
|
89
|
-
}), n = () => j({ type: "DISMISS_TOAST", toastId: t });
|
|
90
|
-
return j({
|
|
91
|
-
type: "ADD_TOAST",
|
|
92
|
-
toast: {
|
|
93
|
-
...e,
|
|
94
|
-
id: t,
|
|
95
|
-
open: !0,
|
|
96
|
-
onOpenChange: (c) => {
|
|
97
|
-
c || n();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}), {
|
|
101
|
-
id: t,
|
|
102
|
-
dismiss: n,
|
|
103
|
-
update: i
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function be() {
|
|
107
|
-
const [e, t] = te.useState(V);
|
|
108
|
-
return te.useEffect(() => (G.push(t), () => {
|
|
109
|
-
const i = G.indexOf(t);
|
|
110
|
-
i > -1 && G.splice(i, 1);
|
|
111
|
-
}), [e]), {
|
|
112
|
-
...e,
|
|
113
|
-
toast: $e,
|
|
114
|
-
dismiss: (i) => j({ type: "DISMISS_TOAST", toastId: i })
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
const $ = {
|
|
118
|
-
TOP_LEFT: "tl",
|
|
119
|
-
TOP_RIGHT: "tr",
|
|
120
|
-
BOTTOM_LEFT: "bl",
|
|
121
|
-
BOTTOM_RIGHT: "br"
|
|
122
|
-
};
|
|
123
|
-
function Ye(e) {
|
|
124
|
-
var U, u, C;
|
|
125
|
-
const [t, i] = _({
|
|
126
|
-
width: ie,
|
|
127
|
-
height: ie
|
|
128
|
-
}), [n, c] = _({
|
|
129
|
-
width: 0,
|
|
130
|
-
height: 0
|
|
131
|
-
}), [m] = _([
|
|
132
|
-
$.TOP_LEFT,
|
|
133
|
-
$.TOP_RIGHT,
|
|
134
|
-
$.BOTTOM_LEFT,
|
|
135
|
-
$.BOTTOM_RIGHT
|
|
136
|
-
]), [g, w] = _(!1), [f, T] = _({
|
|
137
|
-
x: 0,
|
|
138
|
-
y: 0,
|
|
139
|
-
w: 0,
|
|
140
|
-
h: 0,
|
|
141
|
-
dir: ""
|
|
142
|
-
}), { align: v, inline: A } = (U = e == null ? void 0 : e.node) == null ? void 0 : U.attrs, N = A && (v === "left" || v === "right"), L = H(() => {
|
|
143
|
-
var K;
|
|
144
|
-
const { src: r, alt: y, width: a, height: s, flipX: h, flipY: l } = (K = e == null ? void 0 : e.node) == null ? void 0 : K.attrs, I = ne(a) ? `${a}px` : a, x = ne(s) ? `${s}px` : s, W = [];
|
|
145
|
-
h && W.push("rotateX(180deg)"), l && W.push("rotateY(180deg)");
|
|
146
|
-
const ye = W.join(" ");
|
|
147
|
-
return {
|
|
148
|
-
src: r || void 0,
|
|
149
|
-
alt: y || void 0,
|
|
150
|
-
style: {
|
|
151
|
-
width: I || void 0,
|
|
152
|
-
height: x || void 0,
|
|
153
|
-
transform: ye || "none",
|
|
154
|
-
...N ? { float: v } : {}
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
}, [(u = e == null ? void 0 : e.node) == null ? void 0 : u.attrs]), D = H(() => {
|
|
158
|
-
const {
|
|
159
|
-
style: { width: r }
|
|
160
|
-
} = L;
|
|
161
|
-
return { width: r === "100%" ? r : void 0 };
|
|
162
|
-
}, [L]);
|
|
163
|
-
function R(r) {
|
|
164
|
-
c({
|
|
165
|
-
width: r.target.width,
|
|
166
|
-
height: r.target.height
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
function M() {
|
|
170
|
-
const { editor: r, getPos: y } = e;
|
|
171
|
-
r.commands.setNodeSelection(y());
|
|
172
|
-
}
|
|
173
|
-
const E = F(
|
|
174
|
-
ee(() => {
|
|
175
|
-
const { editor: r } = e, { width: y } = getComputedStyle(r.view.dom);
|
|
176
|
-
i((a) => ({
|
|
177
|
-
...a,
|
|
178
|
-
width: Number.parseInt(y, 10)
|
|
179
|
-
}));
|
|
180
|
-
}, ae),
|
|
181
|
-
[e == null ? void 0 : e.editor]
|
|
182
|
-
);
|
|
183
|
-
function O(r, y) {
|
|
184
|
-
r.preventDefault(), r.stopPropagation();
|
|
185
|
-
const a = n.width, s = n.height, h = a / s;
|
|
186
|
-
let l = Number(e.node.attrs.width), I = Number(e.node.attrs.height);
|
|
187
|
-
const x = t.width;
|
|
188
|
-
l && !I ? (l = l > x ? x : l, I = Math.round(l / h)) : I && !l ? (l = Math.round(I * h), l = l > x ? x : l) : !l && !I ? (l = a > x ? x : a, I = Math.round(l / h)) : l = l > x ? x : l, w(!0), T({
|
|
189
|
-
x: r.clientX,
|
|
190
|
-
y: r.clientY,
|
|
191
|
-
w: l,
|
|
192
|
-
h: I,
|
|
193
|
-
dir: y
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
const S = F(
|
|
197
|
-
ee((r) => {
|
|
198
|
-
if (r.preventDefault(), r.stopPropagation(), !g)
|
|
199
|
-
return;
|
|
200
|
-
const { x: y, w: a, dir: s } = f, h = (r.clientX - y) * (/l/.test(s) ? -1 : 1), l = ve(a + h, Se, t.width);
|
|
201
|
-
e.updateAttributes({
|
|
202
|
-
width: l,
|
|
203
|
-
height: null
|
|
204
|
-
});
|
|
205
|
-
}, ae),
|
|
206
|
-
[g, f, t, e.updateAttributes]
|
|
207
|
-
), p = F(
|
|
208
|
-
(r) => {
|
|
209
|
-
r.preventDefault(), r.stopPropagation(), g && (T({
|
|
210
|
-
x: 0,
|
|
211
|
-
y: 0,
|
|
212
|
-
w: 0,
|
|
213
|
-
h: 0,
|
|
214
|
-
dir: ""
|
|
215
|
-
}), w(!1), M());
|
|
216
|
-
},
|
|
217
|
-
[g, M]
|
|
218
|
-
), d = F(() => {
|
|
219
|
-
document == null || document.addEventListener("mousemove", S, !0), document == null || document.addEventListener("mouseup", p, !0);
|
|
220
|
-
}, [S, p]), z = F(() => {
|
|
221
|
-
document == null || document.removeEventListener("mousemove", S, !0), document == null || document.removeEventListener("mouseup", p, !0);
|
|
222
|
-
}, [S, p]);
|
|
223
|
-
Q(() => (g ? d() : z(), () => {
|
|
224
|
-
z();
|
|
225
|
-
}), [g, d, z]);
|
|
226
|
-
const k = H(() => new ResizeObserver(() => E()), [E]);
|
|
227
|
-
return Q(() => (k.observe(e.editor.view.dom), () => {
|
|
228
|
-
k.disconnect();
|
|
229
|
-
}), [e.editor.view.dom, k]), /* @__PURE__ */ o(
|
|
230
|
-
Ie,
|
|
231
|
-
{
|
|
232
|
-
as: A ? "span" : "div",
|
|
233
|
-
className: "image-view",
|
|
234
|
-
style: {
|
|
235
|
-
float: N ? v : void 0,
|
|
236
|
-
margin: N ? v === "left" ? "1em 1em 1em 0" : "1em 0 1em 1em" : void 0,
|
|
237
|
-
display: A ? "inline" : "block",
|
|
238
|
-
textAlign: N ? void 0 : v,
|
|
239
|
-
width: ((C = L.style) == null ? void 0 : C.width) ?? "auto",
|
|
240
|
-
...N ? {} : D
|
|
241
|
-
},
|
|
242
|
-
children: /* @__PURE__ */ b(
|
|
243
|
-
"div",
|
|
244
|
-
{
|
|
245
|
-
"data-drag-handle": !0,
|
|
246
|
-
draggable: "true",
|
|
247
|
-
style: D,
|
|
248
|
-
className: `image-view__body ${e != null && e.selected ? "image-view__body--focused" : ""} ${g ? "image-view__body--resizing" : ""}`,
|
|
249
|
-
children: [
|
|
250
|
-
/* @__PURE__ */ o(
|
|
251
|
-
"img",
|
|
252
|
-
{
|
|
253
|
-
alt: L.alt,
|
|
254
|
-
className: "image-view__body__image block",
|
|
255
|
-
height: "auto",
|
|
256
|
-
onClick: M,
|
|
257
|
-
onLoad: R,
|
|
258
|
-
src: L.src,
|
|
259
|
-
style: L.style
|
|
260
|
-
}
|
|
261
|
-
),
|
|
262
|
-
(e == null ? void 0 : e.editor.view.editable) && ((e == null ? void 0 : e.selected) || g) && /* @__PURE__ */ o("div", { className: "image-resizer", children: m == null ? void 0 : m.map((r) => /* @__PURE__ */ o(
|
|
263
|
-
"span",
|
|
264
|
-
{
|
|
265
|
-
className: `image-resizer__handler image-resizer__handler--${r}`,
|
|
266
|
-
onMouseDown: (y) => O(y, r)
|
|
267
|
-
},
|
|
268
|
-
`image-dir-${r}`
|
|
269
|
-
)) })
|
|
270
|
-
]
|
|
271
|
-
}
|
|
272
|
-
)
|
|
273
|
-
}
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
function Ge(e, t) {
|
|
277
|
-
const i = e.type, n = e.name.toLowerCase(), c = n.split(".").pop();
|
|
278
|
-
if (!c) return !1;
|
|
279
|
-
const g = i || {
|
|
280
|
-
heif: "image/heif",
|
|
281
|
-
heic: "image/heic",
|
|
282
|
-
dng: "image/x-adobe-dng",
|
|
283
|
-
cr2: "image/x-canon-cr2",
|
|
284
|
-
nef: "image/x-nikon-nef",
|
|
285
|
-
arw: "image/x-sony-arw",
|
|
286
|
-
raf: "image/x-fuji-raf",
|
|
287
|
-
orf: "image/x-olympus-orf"
|
|
288
|
-
}[c];
|
|
289
|
-
return t.some((w) => {
|
|
290
|
-
if (w.startsWith("."))
|
|
291
|
-
return n.endsWith(w);
|
|
292
|
-
if (w.endsWith("/*")) {
|
|
293
|
-
const f = w.split("/")[0];
|
|
294
|
-
return g == null ? void 0 : g.startsWith(f + "/");
|
|
295
|
-
}
|
|
296
|
-
return g === w;
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
function Te(e, t) {
|
|
300
|
-
const { acceptMimes: i, maxSize: n, t: c, toast: m } = t, g = [];
|
|
301
|
-
return (Array.isArray(e) ? e : Object.values(e)).forEach((f) => {
|
|
302
|
-
if (!Ge(f, i)) {
|
|
303
|
-
t.onError ? t.onError({
|
|
304
|
-
type: "type",
|
|
305
|
-
message: c("editor.upload.fileTypeNotSupported", { fileName: f.name }),
|
|
306
|
-
file: f
|
|
307
|
-
}) : m({
|
|
308
|
-
variant: "default",
|
|
309
|
-
title: c("editor.upload.fileTypeNotSupported", { fileName: f.name })
|
|
310
|
-
});
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
if (f.size > n) {
|
|
314
|
-
const T = (n / 1024 / 1024).toFixed(2);
|
|
315
|
-
t.onError ? t.onError({
|
|
316
|
-
type: "size",
|
|
317
|
-
message: c("editor.upload.fileSizeTooBig", { fileName: f.name, size: T }),
|
|
318
|
-
file: f
|
|
319
|
-
}) : m({
|
|
320
|
-
variant: "default",
|
|
321
|
-
title: c("editor.upload.fileSizeTooBig", { fileName: f.name, size: T })
|
|
322
|
-
});
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
g.push(f);
|
|
326
|
-
}), g;
|
|
327
|
-
}
|
|
328
|
-
function Ve({ editor: e, imageInline: t, onClose: i, disabled: n, alt: c }) {
|
|
329
|
-
var r, y;
|
|
330
|
-
const { t: m } = ue(), { toast: g } = be(), [w, f] = _(!1), [T, v] = _(!1), A = X.useRef(null), [N, L] = X.useState(), [D, R] = X.useState(""), M = de(null), [E, O] = _({
|
|
331
|
-
src: "",
|
|
332
|
-
file: null
|
|
333
|
-
}), S = pe(J.name), p = H(() => (S == null ? void 0 : S.options) ?? {}, [S]);
|
|
334
|
-
function d(a) {
|
|
335
|
-
if (A.current && a.width && a.height) {
|
|
336
|
-
const s = z(A.current, a);
|
|
337
|
-
R(s);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
function z(a, s) {
|
|
341
|
-
const h = document.createElement("canvas"), l = a.naturalWidth / a.width, I = a.naturalHeight / a.height;
|
|
342
|
-
h.width = s.width * l, h.height = s.height * I;
|
|
343
|
-
const x = h.getContext("2d");
|
|
344
|
-
return x && (x.imageSmoothingEnabled = !1, x.drawImage(
|
|
345
|
-
a,
|
|
346
|
-
s.x * l,
|
|
347
|
-
s.y * I,
|
|
348
|
-
s.width * l,
|
|
349
|
-
s.height * I,
|
|
350
|
-
0,
|
|
351
|
-
0,
|
|
352
|
-
s.width * l,
|
|
353
|
-
s.height * I
|
|
354
|
-
)), h.toDataURL("image/png", 1);
|
|
355
|
-
}
|
|
356
|
-
const k = X.useCallback(async () => {
|
|
357
|
-
var a;
|
|
358
|
-
if (!T) {
|
|
359
|
-
v(!0);
|
|
360
|
-
try {
|
|
361
|
-
const s = Oe(D, ((a = E == null ? void 0 : E.file) == null ? void 0 : a.name) || "image.png");
|
|
362
|
-
let h = "";
|
|
363
|
-
p.upload ? h = await p.upload(s) : h = URL.createObjectURL(s), e.chain().focus().setImageInline({ src: h, inline: t, alt: c }).run(), f(!1), O({
|
|
364
|
-
src: "",
|
|
365
|
-
file: null
|
|
366
|
-
}), C(), i();
|
|
367
|
-
} catch (s) {
|
|
368
|
-
console.error("Error cropping image", s);
|
|
369
|
-
} finally {
|
|
370
|
-
v(!1);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}, [D, e, t, T, i, (r = E == null ? void 0 : E.file) == null ? void 0 : r.name, p]);
|
|
374
|
-
function U(a) {
|
|
375
|
-
var s;
|
|
376
|
-
a.preventDefault(), (s = M.current) == null || s.click();
|
|
377
|
-
}
|
|
378
|
-
const u = async (a) => {
|
|
379
|
-
var x;
|
|
380
|
-
const s = (x = a == null ? void 0 : a.target) == null ? void 0 : x.files;
|
|
381
|
-
if (!e || e.isDestroyed || s.length === 0) {
|
|
382
|
-
a.target.value = "";
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
const h = Te(s, {
|
|
386
|
-
acceptMimes: p == null ? void 0 : p.acceptMimes,
|
|
387
|
-
maxSize: p == null ? void 0 : p.maxSize,
|
|
388
|
-
t: m,
|
|
389
|
-
toast: g,
|
|
390
|
-
onError: p.onError
|
|
391
|
-
});
|
|
392
|
-
if (h.length <= 0) {
|
|
393
|
-
a.target.value = "";
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
396
|
-
const l = h[0], I = await Re(l);
|
|
397
|
-
f(!0), O({
|
|
398
|
-
src: I.src,
|
|
399
|
-
file: l
|
|
400
|
-
});
|
|
401
|
-
}, C = () => {
|
|
402
|
-
M.current && (M.current.value = "");
|
|
403
|
-
};
|
|
404
|
-
return /* @__PURE__ */ b(P, { children: [
|
|
405
|
-
/* @__PURE__ */ o(
|
|
406
|
-
B,
|
|
407
|
-
{
|
|
408
|
-
className: "richtext-mt-1 richtext-w-full",
|
|
409
|
-
disabled: n,
|
|
410
|
-
onClick: U,
|
|
411
|
-
size: "sm",
|
|
412
|
-
children: m("editor.image.dialog.tab.uploadCrop")
|
|
413
|
-
}
|
|
414
|
-
),
|
|
415
|
-
/* @__PURE__ */ b(
|
|
416
|
-
me,
|
|
417
|
-
{
|
|
418
|
-
open: w,
|
|
419
|
-
onOpenChange: (a) => {
|
|
420
|
-
f(a), a || (O({ src: "", file: null }), C());
|
|
421
|
-
},
|
|
422
|
-
children: [
|
|
423
|
-
/* @__PURE__ */ o(fe, {}),
|
|
424
|
-
/* @__PURE__ */ b(he, { children: [
|
|
425
|
-
/* @__PURE__ */ o(ge, { children: m("editor.image.dialog.tab.uploadCrop") }),
|
|
426
|
-
/* @__PURE__ */ o("div", { children: E.src && /* @__PURE__ */ o(
|
|
427
|
-
_e,
|
|
428
|
-
{
|
|
429
|
-
className: "richtext-w-full",
|
|
430
|
-
crop: N,
|
|
431
|
-
onChange: (a) => L(a),
|
|
432
|
-
onComplete: (a) => d(a),
|
|
433
|
-
children: /* @__PURE__ */ o(
|
|
434
|
-
"img",
|
|
435
|
-
{
|
|
436
|
-
alt: "Crop me",
|
|
437
|
-
ref: A,
|
|
438
|
-
src: E.src
|
|
439
|
-
}
|
|
440
|
-
)
|
|
441
|
-
}
|
|
442
|
-
) }),
|
|
443
|
-
/* @__PURE__ */ b(Me, { children: [
|
|
444
|
-
/* @__PURE__ */ b(
|
|
445
|
-
B,
|
|
446
|
-
{
|
|
447
|
-
disabled: T,
|
|
448
|
-
onClick: () => {
|
|
449
|
-
f(!1), O({
|
|
450
|
-
src: "",
|
|
451
|
-
file: null
|
|
452
|
-
}), C();
|
|
453
|
-
},
|
|
454
|
-
children: [
|
|
455
|
-
m("editor.imageUpload.cancel"),
|
|
456
|
-
/* @__PURE__ */ o(
|
|
457
|
-
Y,
|
|
458
|
-
{
|
|
459
|
-
className: "richtext-ml-1",
|
|
460
|
-
name: "Trash2"
|
|
461
|
-
}
|
|
462
|
-
)
|
|
463
|
-
]
|
|
464
|
-
}
|
|
465
|
-
),
|
|
466
|
-
/* @__PURE__ */ o(
|
|
467
|
-
B,
|
|
468
|
-
{
|
|
469
|
-
className: "richtext-w-fit",
|
|
470
|
-
disabled: T || !N,
|
|
471
|
-
onClick: k,
|
|
472
|
-
children: T ? /* @__PURE__ */ b(P, { children: [
|
|
473
|
-
m("editor.imageUpload.uploading"),
|
|
474
|
-
/* @__PURE__ */ o(
|
|
475
|
-
Y,
|
|
476
|
-
{
|
|
477
|
-
className: "richtext-ml-1 richtext-animate-spin",
|
|
478
|
-
name: "Loader"
|
|
479
|
-
}
|
|
480
|
-
)
|
|
481
|
-
] }) : /* @__PURE__ */ b(P, { children: [
|
|
482
|
-
m("editor.imageUpload.crop"),
|
|
483
|
-
/* @__PURE__ */ o(
|
|
484
|
-
Y,
|
|
485
|
-
{
|
|
486
|
-
className: "richtext-ml-1",
|
|
487
|
-
name: "Crop"
|
|
488
|
-
}
|
|
489
|
-
)
|
|
490
|
-
] })
|
|
491
|
-
}
|
|
492
|
-
)
|
|
493
|
-
] })
|
|
494
|
-
] })
|
|
495
|
-
]
|
|
496
|
-
}
|
|
497
|
-
),
|
|
498
|
-
/* @__PURE__ */ o(
|
|
499
|
-
"input",
|
|
500
|
-
{
|
|
501
|
-
accept: ((y = p == null ? void 0 : p.acceptMimes) == null ? void 0 : y.join(",")) || "image/*",
|
|
502
|
-
multiple: !1,
|
|
503
|
-
onChange: u,
|
|
504
|
-
ref: M,
|
|
505
|
-
style: { display: "none" },
|
|
506
|
-
type: "file"
|
|
507
|
-
}
|
|
508
|
-
)
|
|
509
|
-
] });
|
|
510
|
-
}
|
|
511
|
-
function bt() {
|
|
512
|
-
const { t: e } = ue(), { toast: t } = be(), i = Ce(), n = Le(J.name), {
|
|
513
|
-
icon: c,
|
|
514
|
-
tooltip: m
|
|
515
|
-
} = (n == null ? void 0 : n.componentProps) ?? {}, { editorDisabled: g } = Ne(), [w, f] = _(!1), [T, v] = _(!1), A = pe(J.name), N = (u) => {
|
|
516
|
-
f(u.detail);
|
|
517
|
-
}, [L, D] = _(""), [R, M] = _(""), E = de(null), O = (A == null ? void 0 : A.options.defaultInline) || !1, [S, p] = _(O), d = H(() => A == null ? void 0 : A.options, [A]);
|
|
518
|
-
Q(() => {
|
|
519
|
-
const u = ze(ke.UPLOAD_IMAGE(i.id), N);
|
|
520
|
-
return () => {
|
|
521
|
-
u();
|
|
522
|
-
};
|
|
523
|
-
}, []);
|
|
524
|
-
async function z(u) {
|
|
525
|
-
var y;
|
|
526
|
-
const C = (y = u == null ? void 0 : u.target) == null ? void 0 : y.files;
|
|
527
|
-
if (!i || i.isDestroyed || C.length === 0 || T) {
|
|
528
|
-
u.target.value = "";
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
|
-
const r = Te(C, {
|
|
532
|
-
acceptMimes: d == null ? void 0 : d.acceptMimes,
|
|
533
|
-
maxSize: d == null ? void 0 : d.maxSize,
|
|
534
|
-
t: e,
|
|
535
|
-
toast: t,
|
|
536
|
-
onError: d.onError
|
|
537
|
-
});
|
|
538
|
-
if (r.length <= 0) {
|
|
539
|
-
u.target.value = "";
|
|
540
|
-
return;
|
|
541
|
-
}
|
|
542
|
-
v(!0);
|
|
543
|
-
try {
|
|
544
|
-
if (d != null && d.multiple) {
|
|
545
|
-
const a = r.map(async (h) => {
|
|
546
|
-
let l = "";
|
|
547
|
-
return d.upload ? l = await d.upload(h) : l = URL.createObjectURL(h), l;
|
|
548
|
-
});
|
|
549
|
-
(await Promise.all(a)).forEach((h) => {
|
|
550
|
-
i.chain().focus().setImageInline({ src: h, inline: S, alt: R }).run();
|
|
551
|
-
});
|
|
552
|
-
} else {
|
|
553
|
-
const a = r[0];
|
|
554
|
-
let s = "";
|
|
555
|
-
d.upload ? s = await d.upload(a) : s = URL.createObjectURL(a), i.chain().focus().setImageInline({ src: s, inline: S, alt: R }).run();
|
|
556
|
-
}
|
|
557
|
-
f(!1), M(""), p(O);
|
|
558
|
-
} catch (a) {
|
|
559
|
-
console.error("Error uploading image", a), d.onError ? d.onError({
|
|
560
|
-
type: "upload",
|
|
561
|
-
message: e("editor.upload.error")
|
|
562
|
-
}) : t({
|
|
563
|
-
variant: "destructive",
|
|
564
|
-
title: e("editor.upload.error")
|
|
565
|
-
});
|
|
566
|
-
} finally {
|
|
567
|
-
v(!1), u.target.value = "";
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
function k(u) {
|
|
571
|
-
u.preventDefault(), u.stopPropagation(), i.chain().focus().setImageInline({ src: L, inline: S, alt: R }).run(), f(!1), p(O), D(""), M("");
|
|
572
|
-
}
|
|
573
|
-
function U(u) {
|
|
574
|
-
var C;
|
|
575
|
-
u.preventDefault(), (C = E.current) == null || C.click();
|
|
576
|
-
}
|
|
577
|
-
return n ? /* @__PURE__ */ b(
|
|
578
|
-
me,
|
|
579
|
-
{
|
|
580
|
-
onOpenChange: f,
|
|
581
|
-
open: w,
|
|
582
|
-
children: [
|
|
583
|
-
/* @__PURE__ */ o(
|
|
584
|
-
fe,
|
|
585
|
-
{
|
|
586
|
-
asChild: !0,
|
|
587
|
-
children: /* @__PURE__ */ o(
|
|
588
|
-
Ee,
|
|
589
|
-
{
|
|
590
|
-
disabled: g,
|
|
591
|
-
icon: c,
|
|
592
|
-
tooltip: m,
|
|
593
|
-
action: () => {
|
|
594
|
-
g || f(!0);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
)
|
|
598
|
-
}
|
|
599
|
-
),
|
|
600
|
-
/* @__PURE__ */ b(he, { children: [
|
|
601
|
-
/* @__PURE__ */ o(ge, { children: e("editor.image.dialog.title") }),
|
|
602
|
-
/* @__PURE__ */ b(
|
|
603
|
-
Ue,
|
|
604
|
-
{
|
|
605
|
-
activationMode: "manual",
|
|
606
|
-
defaultValue: d.resourceImage === "both" || d.resourceImage === "upload" ? "upload" : "link",
|
|
607
|
-
children: [
|
|
608
|
-
d.resourceImage === "both" && /* @__PURE__ */ b(Fe, { className: "richtext-grid richtext-w-full richtext-grid-cols-2", children: [
|
|
609
|
-
/* @__PURE__ */ o(re, { value: "upload", children: e("editor.image.dialog.tab.upload") }),
|
|
610
|
-
/* @__PURE__ */ o(re, { value: "link", children: e("editor.image.dialog.tab.url") })
|
|
611
|
-
] }),
|
|
612
|
-
/* @__PURE__ */ b("div", { className: "richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-[4px]", children: [
|
|
613
|
-
/* @__PURE__ */ o(
|
|
614
|
-
Pe,
|
|
615
|
-
{
|
|
616
|
-
checked: S,
|
|
617
|
-
onCheckedChange: (u) => {
|
|
618
|
-
p(u);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
),
|
|
622
|
-
/* @__PURE__ */ o(le, { children: e("editor.link.dialog.inline") })
|
|
623
|
-
] }),
|
|
624
|
-
d.enableAlt && /* @__PURE__ */ b("div", { className: "richtext-my-[10px] ", children: [
|
|
625
|
-
/* @__PURE__ */ o(le, { className: "mb-[6px]", children: e("editor.imageUpload.alt") }),
|
|
626
|
-
/* @__PURE__ */ o(
|
|
627
|
-
oe,
|
|
628
|
-
{
|
|
629
|
-
onChange: (u) => M(u.target.value),
|
|
630
|
-
required: !0,
|
|
631
|
-
type: "text",
|
|
632
|
-
value: R
|
|
633
|
-
}
|
|
634
|
-
)
|
|
635
|
-
] }),
|
|
636
|
-
/* @__PURE__ */ b(se, { value: "upload", children: [
|
|
637
|
-
/* @__PURE__ */ b("div", { className: "richtext-flex richtext-items-center richtext-gap-[10px]", children: [
|
|
638
|
-
/* @__PURE__ */ o(
|
|
639
|
-
B,
|
|
640
|
-
{
|
|
641
|
-
className: "richtext-mt-1 richtext-w-full",
|
|
642
|
-
disabled: T,
|
|
643
|
-
onClick: U,
|
|
644
|
-
size: "sm",
|
|
645
|
-
children: T ? /* @__PURE__ */ b(P, { children: [
|
|
646
|
-
e("editor.imageUpload.uploading"),
|
|
647
|
-
/* @__PURE__ */ o(
|
|
648
|
-
Y,
|
|
649
|
-
{
|
|
650
|
-
className: "richtext-ml-1 richtext-animate-spin",
|
|
651
|
-
name: "Loader"
|
|
652
|
-
}
|
|
653
|
-
)
|
|
654
|
-
] }) : e("editor.image.dialog.tab.upload")
|
|
655
|
-
}
|
|
656
|
-
),
|
|
657
|
-
/* @__PURE__ */ o(
|
|
658
|
-
Ve,
|
|
659
|
-
{
|
|
660
|
-
alt: R,
|
|
661
|
-
disabled: T,
|
|
662
|
-
editor: i,
|
|
663
|
-
imageInline: S,
|
|
664
|
-
onClose: () => {
|
|
665
|
-
De.setOpen(i.id, !1), M("");
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
)
|
|
669
|
-
] }),
|
|
670
|
-
/* @__PURE__ */ o(
|
|
671
|
-
"input",
|
|
672
|
-
{
|
|
673
|
-
accept: d.acceptMimes.join(",") || "image/*",
|
|
674
|
-
multiple: d.multiple,
|
|
675
|
-
onChange: z,
|
|
676
|
-
ref: E,
|
|
677
|
-
style: { display: "none" },
|
|
678
|
-
type: "file"
|
|
679
|
-
}
|
|
680
|
-
)
|
|
681
|
-
] }),
|
|
682
|
-
/* @__PURE__ */ o(se, { value: "link", children: /* @__PURE__ */ o("form", { onSubmit: k, children: /* @__PURE__ */ b("div", { className: "richtext-flex richtext-items-center richtext-gap-2", children: [
|
|
683
|
-
/* @__PURE__ */ o(
|
|
684
|
-
oe,
|
|
685
|
-
{
|
|
686
|
-
autoFocus: !0,
|
|
687
|
-
onChange: (u) => D(u.target.value),
|
|
688
|
-
placeholder: e("editor.image.dialog.placeholder"),
|
|
689
|
-
required: !0,
|
|
690
|
-
type: "url",
|
|
691
|
-
value: L
|
|
692
|
-
}
|
|
693
|
-
),
|
|
694
|
-
/* @__PURE__ */ o(B, { type: "submit", children: e("editor.image.dialog.button.apply") })
|
|
695
|
-
] }) }) })
|
|
696
|
-
]
|
|
697
|
-
}
|
|
698
|
-
)
|
|
699
|
-
] })
|
|
700
|
-
]
|
|
701
|
-
}
|
|
702
|
-
) : /* @__PURE__ */ o(P, {});
|
|
703
|
-
}
|
|
704
|
-
const We = {
|
|
705
|
-
acceptMimes: ["image/jpeg", "image/gif", "image/png", "image/jpg"],
|
|
706
|
-
maxSize: 1024 * 1024 * 5,
|
|
707
|
-
// 5MB
|
|
708
|
-
multiple: !0,
|
|
709
|
-
resourceImage: "both",
|
|
710
|
-
defaultInline: !1,
|
|
711
|
-
enableAlt: !0
|
|
712
|
-
}, J = /* @__PURE__ */ Ae.extend({
|
|
713
|
-
group: "inline",
|
|
714
|
-
inline: !0,
|
|
715
|
-
defining: !0,
|
|
716
|
-
draggable: !0,
|
|
717
|
-
selectable: !0,
|
|
718
|
-
addOptions() {
|
|
719
|
-
var e;
|
|
720
|
-
return {
|
|
721
|
-
...We,
|
|
722
|
-
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
723
|
-
upload: () => Promise.reject("Image Upload Function"),
|
|
724
|
-
button: ({
|
|
725
|
-
editor: t,
|
|
726
|
-
extension: i,
|
|
727
|
-
t: n
|
|
728
|
-
}) => {
|
|
729
|
-
var c, m;
|
|
730
|
-
return {
|
|
731
|
-
componentProps: {
|
|
732
|
-
action: () => !0,
|
|
733
|
-
upload: i.options.upload,
|
|
734
|
-
/* If setImage is not available(when Image Component is not imported), the button is disabled */
|
|
735
|
-
disabled: !((m = (c = t.can()).setImage) != null && m.call(c, {})),
|
|
736
|
-
icon: "ImageUp",
|
|
737
|
-
tooltip: n("editor.image.tooltip")
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
};
|
|
742
|
-
},
|
|
743
|
-
addAttributes() {
|
|
744
|
-
var e;
|
|
745
|
-
return {
|
|
746
|
-
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
747
|
-
flipX: {
|
|
748
|
-
default: !1
|
|
749
|
-
},
|
|
750
|
-
flipY: {
|
|
751
|
-
default: !1
|
|
752
|
-
},
|
|
753
|
-
width: {
|
|
754
|
-
default: null,
|
|
755
|
-
parseHTML: (t) => {
|
|
756
|
-
const i = t.style.width || t.getAttribute("width") || null;
|
|
757
|
-
return i ? Number.parseInt(i, 10) : null;
|
|
758
|
-
},
|
|
759
|
-
renderHTML: (t) => ({
|
|
760
|
-
width: t.width
|
|
761
|
-
})
|
|
762
|
-
},
|
|
763
|
-
align: {
|
|
764
|
-
default: "center",
|
|
765
|
-
parseHTML: (t) => t.getAttribute("align"),
|
|
766
|
-
renderHTML: (t) => ({
|
|
767
|
-
align: t.align
|
|
768
|
-
})
|
|
769
|
-
},
|
|
770
|
-
inline: {
|
|
771
|
-
default: !1,
|
|
772
|
-
parseHTML: (t) => !!t.getAttribute("inline"),
|
|
773
|
-
renderHTML: (t) => ({
|
|
774
|
-
inline: t.inline
|
|
775
|
-
})
|
|
776
|
-
},
|
|
777
|
-
alt: {
|
|
778
|
-
default: "",
|
|
779
|
-
parseHTML: (t) => t.getAttribute("alt"),
|
|
780
|
-
renderHTML: (t) => ({
|
|
781
|
-
alt: t.alt
|
|
782
|
-
})
|
|
783
|
-
}
|
|
784
|
-
};
|
|
785
|
-
},
|
|
786
|
-
addNodeView() {
|
|
787
|
-
return we(Ye);
|
|
788
|
-
},
|
|
789
|
-
addCommands() {
|
|
790
|
-
var e;
|
|
791
|
-
return {
|
|
792
|
-
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
793
|
-
setImageInline: (t) => ({ commands: i }) => i.insertContent({
|
|
794
|
-
type: this.name,
|
|
795
|
-
attrs: {
|
|
796
|
-
...t,
|
|
797
|
-
inline: t.inline ?? this.options.defaultInline
|
|
798
|
-
}
|
|
799
|
-
}),
|
|
800
|
-
updateImage: (t) => ({ commands: i }) => i.updateAttributes(this.name, t),
|
|
801
|
-
setAlignImage: (t) => ({ commands: i }) => i.updateAttributes(this.name, { align: t })
|
|
802
|
-
};
|
|
803
|
-
},
|
|
804
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
805
|
-
const { flipX: t, flipY: i, align: n, inline: c } = e, m = c && (n === "left" || n === "right"), g = t || i ? `transform: rotateX(${t ? "180" : "0"}deg) rotateY(${i ? "180" : "0"}deg);` : "", w = m ? "" : `text-align: ${n};`, v = `${m ? `float: ${n};` : ""}${m ? n === "left" ? "margin: 1em 1em 1em 0;" : "margin: 1em 0 1em 1em;" : ""}${g}`;
|
|
806
|
-
return [
|
|
807
|
-
c ? "span" : "div",
|
|
808
|
-
{
|
|
809
|
-
style: w,
|
|
810
|
-
class: "image"
|
|
811
|
-
},
|
|
812
|
-
[
|
|
813
|
-
"img",
|
|
814
|
-
xe(
|
|
815
|
-
{
|
|
816
|
-
height: "auto",
|
|
817
|
-
style: v
|
|
818
|
-
},
|
|
819
|
-
this.options.HTMLAttributes,
|
|
820
|
-
e
|
|
821
|
-
)
|
|
822
|
-
]
|
|
823
|
-
];
|
|
824
|
-
},
|
|
825
|
-
parseHTML() {
|
|
826
|
-
return [
|
|
827
|
-
{
|
|
828
|
-
tag: "span.image img",
|
|
829
|
-
getAttrs: (e) => {
|
|
830
|
-
var m;
|
|
831
|
-
const t = e == null ? void 0 : e.parentElement, i = e == null ? void 0 : e.getAttribute("width"), n = (e == null ? void 0 : e.getAttribute("flipx")) || !1, c = (e == null ? void 0 : e.getAttribute("flipy")) || !1;
|
|
832
|
-
return {
|
|
833
|
-
src: e == null ? void 0 : e.getAttribute("src"),
|
|
834
|
-
alt: e == null ? void 0 : e.getAttribute("alt"),
|
|
835
|
-
caption: e == null ? void 0 : e.getAttribute("caption"),
|
|
836
|
-
width: i ? Number.parseInt(i, 10) : null,
|
|
837
|
-
align: (e == null ? void 0 : e.getAttribute("align")) || ((m = t == null ? void 0 : t.style) == null ? void 0 : m.textAlign) || null,
|
|
838
|
-
inline: (e == null ? void 0 : e.getAttribute("inline")) || !1,
|
|
839
|
-
flipX: n === "true",
|
|
840
|
-
flipY: c === "true"
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
},
|
|
844
|
-
{
|
|
845
|
-
tag: "div[class=image]",
|
|
846
|
-
getAttrs: (e) => {
|
|
847
|
-
const t = e.querySelector("img"), i = t == null ? void 0 : t.getAttribute("width"), n = (t == null ? void 0 : t.getAttribute("flipx")) || !1, c = (t == null ? void 0 : t.getAttribute("flipy")) || !1;
|
|
848
|
-
return {
|
|
849
|
-
src: t == null ? void 0 : t.getAttribute("src"),
|
|
850
|
-
alt: t == null ? void 0 : t.getAttribute("alt"),
|
|
851
|
-
caption: t == null ? void 0 : t.getAttribute("caption"),
|
|
852
|
-
width: i ? Number.parseInt(i, 10) : null,
|
|
853
|
-
align: (t == null ? void 0 : t.getAttribute("align")) || e.style.textAlign || null,
|
|
854
|
-
inline: (t == null ? void 0 : t.getAttribute("inline")) || !1,
|
|
855
|
-
flipX: n === "true",
|
|
856
|
-
flipY: c === "true"
|
|
857
|
-
};
|
|
858
|
-
}
|
|
859
|
-
},
|
|
860
|
-
{
|
|
861
|
-
tag: 'img[src]:not([src^="data:"])'
|
|
862
|
-
}
|
|
863
|
-
];
|
|
864
|
-
}
|
|
865
|
-
// addProseMirrorPlugins() {
|
|
866
|
-
// const validateFile = (file: File): boolean => {
|
|
867
|
-
// // @ts-expect-error
|
|
868
|
-
// if (!this.options.acceptMimes.includes(file.type)) {
|
|
869
|
-
// // toast({ description: t.value('editor.imageUpload.fileTypeNotSupported'), duration: 2000 });
|
|
870
|
-
// return false;
|
|
871
|
-
// }
|
|
872
|
-
// // @ts-expect-error
|
|
873
|
-
// if (file.size > this.options.maxSize) {
|
|
874
|
-
// // toast({
|
|
875
|
-
// // description: `${t.value('editor.imageUpload.fileSizeTooBig')} ${formatFileSize(
|
|
876
|
-
// // this.options.maxSize,
|
|
877
|
-
// // )}.`,
|
|
878
|
-
// // duration: 2000,
|
|
879
|
-
// // });
|
|
880
|
-
// return false;
|
|
881
|
-
// }
|
|
882
|
-
// return true;
|
|
883
|
-
// };
|
|
884
|
-
// const uploadFn = createImageUpload({
|
|
885
|
-
// validateFn: validateFile,
|
|
886
|
-
// onUpload: this.options.upload as any,
|
|
887
|
-
// // postUpload: this.options.postUpload,
|
|
888
|
-
// defaultInline: this.options.defaultInline,
|
|
889
|
-
// });
|
|
890
|
-
// return [
|
|
891
|
-
// UploadImagesPlugin(),
|
|
892
|
-
// new Plugin({
|
|
893
|
-
// key: new PluginKey(`richtextCustomPlugin${this.name}`),
|
|
894
|
-
// props: {
|
|
895
|
-
// handlePaste: (view, event) => {
|
|
896
|
-
// const hasFiles =
|
|
897
|
-
// event.clipboardData &&
|
|
898
|
-
// event.clipboardData.files &&
|
|
899
|
-
// event.clipboardData.files?.length;
|
|
900
|
-
// if (!hasFiles) {
|
|
901
|
-
// return;
|
|
902
|
-
// }
|
|
903
|
-
// const items = [...(event.clipboardData.files || [])];
|
|
904
|
-
// if (items.some(x => x.type === 'text/html')) {
|
|
905
|
-
// return false;
|
|
906
|
-
// }
|
|
907
|
-
// return handleImagePaste(view, event, uploadFn);
|
|
908
|
-
// },
|
|
909
|
-
// handleDrop: (view, event, _, moved) => {
|
|
910
|
-
// if (!(event instanceof DragEvent) || !event.dataTransfer) {
|
|
911
|
-
// return false;
|
|
912
|
-
// }
|
|
913
|
-
// handleImageDrop(view, event, moved, uploadFn);
|
|
914
|
-
// return false;
|
|
915
|
-
// },
|
|
916
|
-
// },
|
|
917
|
-
// }),
|
|
918
|
-
// ];
|
|
919
|
-
// },
|
|
920
|
-
});
|
|
921
|
-
export {
|
|
922
|
-
J as I,
|
|
923
|
-
bt as R,
|
|
924
|
-
be as u
|
|
925
|
-
};
|