reactjs-tiptap-editor 0.4.1 → 1.0.0
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-BKOg7hkq.js +38 -0
- package/lib/ActionMenuButton-DLQyd_gx.cjs +1 -0
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.d.cts +43 -55
- package/lib/Attachment.d.ts +43 -55
- package/lib/Attachment.js +129 -99
- package/lib/Blockquote.cjs +3 -3
- package/lib/Blockquote.d.cts +43 -55
- package/lib/Blockquote.d.ts +43 -55
- package/lib/Blockquote.js +50 -22
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +43 -55
- package/lib/Bold.d.ts +43 -55
- package/lib/Bold.js +48 -20
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +43 -55
- package/lib/BulletList.d.ts +43 -55
- package/lib/BulletList.js +38 -9
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +43 -55
- package/lib/Clear.d.ts +43 -55
- package/lib/Clear.js +32 -6
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +43 -55
- package/lib/Code.d.ts +43 -55
- package/lib/Code.js +53 -25
- package/lib/CodeBlock.cjs +35 -35
- package/lib/CodeBlock.d.cts +43 -55
- package/lib/CodeBlock.d.ts +43 -55
- package/lib/CodeBlock.js +605 -590
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +44 -56
- package/lib/CodeView.d.ts +44 -56
- package/lib/CodeView.js +49 -21
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +47 -55
- package/lib/Color.d.ts +47 -55
- package/lib/Color.js +123 -79
- package/lib/Column.cjs +1 -0
- package/lib/{Document.d.cts → Column.d.cts} +49 -58
- package/lib/{Document.d.ts → Column.d.ts} +49 -58
- package/lib/Column.js +217 -0
- package/lib/{Drawer-CaAfmqNo.js → Drawer-DZ5jvmrX.js} +404 -394
- package/lib/Drawer-SRhwOc6T.cjs +1 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +43 -55
- package/lib/Drawer.d.ts +43 -55
- package/lib/Drawer.js +6 -5
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +43 -60
- package/lib/Emoji.d.ts +43 -60
- package/lib/Emoji.js +377 -392
- package/lib/Excalidraw-DwBRXEtC.js +345 -0
- package/lib/Excalidraw-ZN3DQvDC.cjs +1 -0
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +43 -55
- package/lib/Excalidraw.d.ts +43 -55
- package/lib/Excalidraw.js +6 -4
- package/lib/ExportPdf.cjs +5 -5
- package/lib/ExportPdf.d.cts +43 -55
- package/lib/ExportPdf.d.ts +43 -55
- package/lib/ExportPdf.js +60 -32
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +44 -56
- package/lib/ExportWord.d.ts +44 -56
- package/lib/ExportWord.js +84 -21
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +57 -58
- package/lib/FontFamily.d.ts +57 -58
- package/lib/FontFamily.js +72 -74
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +54 -58
- package/lib/FontSize.d.ts +54 -58
- package/lib/FontSize.js +72 -64
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +57 -55
- package/lib/Heading.d.ts +57 -55
- package/lib/Heading.js +91 -73
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +47 -55
- package/lib/Highlight.d.ts +47 -55
- package/lib/Highlight.js +152 -21
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +45 -55
- package/lib/History.d.ts +45 -55
- package/lib/History.js +976 -53
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +43 -55
- package/lib/HorizontalRule.d.ts +43 -55
- package/lib/HorizontalRule.js +97 -17
- package/lib/Icon-DUpv2cI6.cjs +1 -0
- package/lib/Icon-jKs8Hr6p.js +11 -0
- package/lib/Iframe-CmXkEqOd.js +431 -0
- package/lib/Iframe-Cvca2G7X.cjs +1 -0
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +42 -61
- package/lib/Iframe.d.ts +42 -61
- package/lib/Iframe.js +6 -4
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +43 -56
- package/lib/Image.d.ts +43 -56
- package/lib/Image.js +848 -5
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +44 -58
- package/lib/ImageGif.d.ts +44 -58
- package/lib/ImageGif.js +424 -5
- package/lib/ImportWord.cjs +48 -48
- package/lib/ImportWord.d.cts +44 -56
- package/lib/ImportWord.d.ts +44 -56
- package/lib/ImportWord.js +2596 -2588
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +43 -55
- package/lib/Indent.d.ts +43 -55
- package/lib/Indent.js +97 -27
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +43 -55
- package/lib/Italic.d.ts +43 -55
- package/lib/Italic.js +47 -19
- package/lib/Katex-DsYXsjSS.js +2740 -0
- package/lib/Katex-XfrNne6U.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +43 -55
- package/lib/Katex.d.ts +43 -55
- package/lib/Katex.js +5 -196
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +45 -61
- package/lib/LineHeight.d.ts +45 -61
- package/lib/LineHeight.js +71 -112
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +44 -58
- package/lib/Link.d.ts +44 -58
- package/lib/Link.js +3 -3
- package/lib/LinkEditBlock-BZenZq-Z.cjs +5 -0
- package/lib/LinkEditBlock-CB8yIffE.js +1241 -0
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.d.cts +40 -55
- package/lib/Mention.d.ts +40 -55
- package/lib/Mention.js +114 -130
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.d.cts +43 -55
- package/lib/Mermaid.d.ts +43 -55
- package/lib/Mermaid.js +177 -165
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +58 -57
- package/lib/MoreMark.d.ts +58 -57
- package/lib/MoreMark.js +125 -55
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +43 -55
- package/lib/OrderedList.d.ts +43 -55
- package/lib/OrderedList.js +37 -9
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +43 -58
- package/lib/SearchAndReplace.d.ts +43 -58
- package/lib/SearchAndReplace.js +221 -197
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +55 -62
- package/lib/SlashCommand.d.ts +55 -62
- package/lib/SlashCommand.js +235 -249
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +43 -55
- package/lib/Strike.d.ts +43 -55
- package/lib/Strike.js +39 -11
- package/lib/Table-B1j1Ebmh.cjs +9 -0
- package/lib/Table-Db8TcQX8.js +1984 -0
- package/lib/Table.cjs +1 -9
- package/lib/Table.d.cts +44 -58
- package/lib/Table.d.ts +44 -58
- package/lib/Table.js +3 -558
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +43 -55
- package/lib/TaskList.d.ts +43 -55
- package/lib/TaskList.js +38 -10
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +56 -55
- package/lib/TextAlign.d.ts +56 -55
- package/lib/TextAlign.js +108 -101
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +72 -55
- package/lib/TextDirection.d.ts +72 -55
- package/lib/TextDirection.js +105 -112
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +43 -55
- package/lib/TextUnderline.d.ts +43 -55
- package/lib/TextUnderline.js +46 -18
- package/lib/{Twitter-BFULyqdR.js → Twitter-CXmmjz9R.js} +536 -498
- package/lib/Twitter-CtVTIWJW.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +43 -55
- package/lib/Twitter.d.ts +43 -55
- package/lib/Twitter.js +5 -4
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +43 -55
- package/lib/Video.d.ts +43 -55
- package/lib/Video.js +261 -4
- package/lib/_commonjsHelpers-BItOPCY9.js +28 -0
- package/lib/_commonjsHelpers-BTDuMlIz.cjs +1 -0
- package/lib/bubble.cjs +2 -0
- package/lib/{bubble-extra.d.cts → bubble.d.cts} +69 -70
- package/lib/{bubble-extra.d.ts → bubble.d.ts} +69 -70
- package/lib/bubble.js +1925 -0
- package/lib/button-B12K7BJ4.cjs +1 -0
- package/lib/button-DXMsXUEn.js +43 -0
- package/lib/clsx-C11secjj.cjs +1 -0
- package/lib/clsx-OuTLNxxd.js +16 -0
- package/lib/delete-node-CosiBes5.cjs +1 -0
- package/lib/delete-node-IyVmiRbI.js +22 -0
- package/lib/dialog-CaCS-W5S.cjs +1 -0
- package/lib/dialog-PtQivpHS.js +100 -0
- package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
- package/lib/dom-dataset-CIEeltF6.js +47 -0
- package/lib/dropdown-menu-BPp2Z_U-.js +136 -0
- package/lib/dropdown-menu-CdSm4emp.cjs +1 -0
- package/lib/file-BLas99n7.js +43 -0
- package/lib/file-i7e4nQY2.cjs +1 -0
- package/lib/floating-ui.dom-U1vPFQ5f.js +1151 -0
- package/lib/floating-ui.dom-VCrc58uF.cjs +1 -0
- package/lib/icons-Cllpys39.js +362 -0
- package/lib/icons-CqHjeW5T.cjs +1 -0
- package/lib/index-BH4bc3jN.cjs +33 -0
- package/lib/index-BPfVXs5_.js +2380 -0
- package/lib/index-Bnmd0WvY.js +1631 -0
- package/lib/{index-Ch6dBBad.js → index-CBce_TWY.js} +40 -42
- package/lib/{index-5iBZLua9.cjs → index-D-5U8dY8.cjs} +8 -8
- package/lib/{index-ByurDDMv.js → index-D2TUfKkC.js} +2 -2
- package/lib/index-DV5kbgRU.cjs +1 -0
- package/lib/{index-LmrOdnen.js → index-DYkucCoF.js} +396 -495
- package/lib/index-Dfmm6FTT.cjs +1 -0
- package/lib/index-DnWWK9F_.js +6374 -0
- package/lib/index-DzcKxutn.js +632 -0
- package/lib/index-DzvuNTxo.cjs +4 -0
- package/lib/{index-BeCTd5v2.cjs → index-N--9MohJ.cjs} +1 -1
- package/lib/index-RfTlOzIr.cjs +22 -0
- package/lib/index.cjs +132 -1
- package/lib/index.d.cts +45 -296
- package/lib/index.d.ts +45 -296
- package/lib/index.js +243 -2
- package/lib/input-_ECRfn3Y.cjs +1 -0
- package/lib/input-wJ9PDEzZ.js +21 -0
- package/lib/isNumber-ClPupm7P.cjs +1 -0
- package/lib/isNumber-fpLGS0AZ.js +15 -0
- package/lib/label-BkgAe7IY.cjs +1 -0
- package/lib/label-CGdLYWv7.js +19 -0
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +5421 -73
- package/lib/locale-bundle.d.ts +5421 -73
- package/lib/locale-bundle.js +9 -7
- package/lib/popover-BgmUNMHj.cjs +1 -0
- package/lib/popover-CAuEW0Mr.js +23 -0
- package/lib/separator-CuBW_w98.js +328 -0
- package/lib/separator-DRIrVZ2N.cjs +1 -0
- package/lib/store-DX599H5W.js +10 -0
- package/lib/store-WStcMOiW.cjs +1 -0
- package/lib/style.css +1 -1
- package/lib/switch-CnLJ7Y-b.cjs +1 -0
- package/lib/switch-Coix_FA1.js +27 -0
- package/lib/tabs-B5mVSN1I.js +46 -0
- package/lib/tabs-BoLCMcCI.cjs +1 -0
- package/lib/textarea-B-6zTKQz.cjs +1 -0
- package/lib/{textarea-aPtytkDx.js → textarea-DUUM1jZd.js} +1 -1
- package/lib/theme-B7aAsK_T.js +15 -0
- package/lib/theme-D8_cxGqB.cjs +1 -0
- package/lib/throttle-CdwDrFpn.js +249 -0
- package/lib/throttle-qX7Yjtsg.cjs +1 -0
- package/lib/toggle-Cdp4IT2U.js +85 -0
- package/lib/toggle-D41PzQLJ.cjs +1 -0
- package/lib/tooltip-BuEiE96N.cjs +1 -0
- package/lib/tooltip-CopwsU8q.js +23 -0
- package/lib/updatePosition-8Sdem5jb.cjs +1 -0
- package/lib/updatePosition-BPmcE0YD.js +215 -0
- package/lib/use-toast-Bz3QCOtE.cjs +1 -0
- package/lib/use-toast-Crf7-q5H.js +98 -0
- package/lib/useButtonProps-BsEd4zYM.js +141 -0
- package/lib/useButtonProps-C6Vpn190.cjs +1 -0
- package/package.json +22 -105
- package/lib/ActionMenuButton-CYdM1xx5.cjs +0 -1
- package/lib/ActionMenuButton-DKRF6oa0.js +0 -33
- package/lib/BaseKit.cjs +0 -3
- package/lib/BaseKit.d.cts +0 -481
- package/lib/BaseKit.d.ts +0 -481
- package/lib/BaseKit.js +0 -132
- package/lib/Document.cjs +0 -1
- package/lib/Document.js +0 -9
- package/lib/Drawer-CdvCMSzN.cjs +0 -1
- package/lib/Excalidraw-BbMQhNvs.cjs +0 -1
- package/lib/Excalidraw-CVWz2Vyn.js +0 -290
- package/lib/FormatPainter.cjs +0 -1
- package/lib/FormatPainter.d.cts +0 -372
- package/lib/FormatPainter.d.ts +0 -372
- package/lib/FormatPainter.js +0 -76
- package/lib/ListItem.cjs +0 -1
- package/lib/ListItem.d.cts +0 -290
- package/lib/ListItem.d.ts +0 -290
- package/lib/ListItem.js +0 -7
- package/lib/MultiColumn.cjs +0 -1
- package/lib/MultiColumn.d.cts +0 -294
- package/lib/MultiColumn.d.ts +0 -294
- package/lib/MultiColumn.js +0 -8
- package/lib/RichTextEditor-CxvwGvQG.cjs +0 -142
- package/lib/RichTextEditor-DGcKEUGr.js +0 -22166
- package/lib/Selection.cjs +0 -1
- package/lib/Selection.d.cts +0 -289
- package/lib/Selection.d.ts +0 -289
- package/lib/Selection.js +0 -25
- package/lib/SubAndSuperScript.cjs +0 -1
- package/lib/SubAndSuperScript.d.cts +0 -377
- package/lib/SubAndSuperScript.d.ts +0 -377
- package/lib/SubAndSuperScript.js +0 -43
- package/lib/TableOfContent.cjs +0 -1
- package/lib/TableOfContent.d.cts +0 -291
- package/lib/TableOfContent.d.ts +0 -291
- package/lib/TableOfContent.js +0 -185
- package/lib/TextBubble.cjs +0 -1
- package/lib/TextBubble.d.cts +0 -362
- package/lib/TextBubble.d.ts +0 -362
- package/lib/TextBubble.js +0 -133
- package/lib/TrailingNode.cjs +0 -1
- package/lib/TrailingNode.d.cts +0 -297
- package/lib/TrailingNode.d.ts +0 -297
- package/lib/TrailingNode.js +0 -41
- package/lib/Twitter-Cutpkh3h.cjs +0 -1
- package/lib/bubble-extra.cjs +0 -2
- package/lib/bubble-extra.js +0 -631
- package/lib/dom-dataset-_6-diIRQ.cjs +0 -33
- package/lib/dom-dataset-lYeH6gfI.js +0 -2361
- package/lib/index-6D1J-A-o.cjs +0 -1
- package/lib/index-B96Cclrj.cjs +0 -3
- package/lib/index-BBz7Nmv9.js +0 -55
- package/lib/index-CUogRI7j.cjs +0 -1
- package/lib/index-DF2Lp4HZ.cjs +0 -100
- package/lib/index-D_L6n8O8.js +0 -76
- package/lib/index-Dbvi-Bvh.cjs +0 -1
- package/lib/index-DpCrt7xs.cjs +0 -1
- package/lib/index-DsAX1Vq8.cjs +0 -1
- package/lib/index-Dy4DlW9o.js +0 -12
- package/lib/index-J3jHHZ4d.js +0 -200
- package/lib/index-VvXaaKe3.js +0 -898
- package/lib/index-kbO3iWqL.js +0 -13432
- package/lib/textarea-DFo_aXnj.cjs +0 -1
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { N as C, n as L, Z as W, m as z } from "./index-DnWWK9F_.js";
|
|
2
|
+
var B = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, H = C.create({
|
|
3
|
+
name: "image",
|
|
4
|
+
addOptions() {
|
|
5
|
+
return {
|
|
6
|
+
inline: !1,
|
|
7
|
+
allowBase64: !1,
|
|
8
|
+
HTMLAttributes: {},
|
|
9
|
+
resize: !1
|
|
10
|
+
};
|
|
11
|
+
},
|
|
12
|
+
inline() {
|
|
13
|
+
return this.options.inline;
|
|
14
|
+
},
|
|
15
|
+
group() {
|
|
16
|
+
return this.options.inline ? "inline" : "block";
|
|
17
|
+
},
|
|
18
|
+
draggable: !0,
|
|
19
|
+
addAttributes() {
|
|
20
|
+
return {
|
|
21
|
+
src: {
|
|
22
|
+
default: null
|
|
23
|
+
},
|
|
24
|
+
alt: {
|
|
25
|
+
default: null
|
|
26
|
+
},
|
|
27
|
+
title: {
|
|
28
|
+
default: null
|
|
29
|
+
},
|
|
30
|
+
width: {
|
|
31
|
+
default: null
|
|
32
|
+
},
|
|
33
|
+
height: {
|
|
34
|
+
default: null
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
parseHTML() {
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
tag: this.options.allowBase64 ? "img[src]" : 'img[src]:not([src^="data:"])'
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
},
|
|
45
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
46
|
+
return ["img", z(this.options.HTMLAttributes, e)];
|
|
47
|
+
},
|
|
48
|
+
parseMarkdown: (e, t) => t.createNode("image", {
|
|
49
|
+
src: e.href,
|
|
50
|
+
title: e.title,
|
|
51
|
+
alt: e.text
|
|
52
|
+
}),
|
|
53
|
+
renderMarkdown: (e) => {
|
|
54
|
+
var t, n, r, a, c, u;
|
|
55
|
+
const o = (n = (t = e.attrs) == null ? void 0 : t.src) != null ? n : "", s = (a = (r = e.attrs) == null ? void 0 : r.alt) != null ? a : "", d = (u = (c = e.attrs) == null ? void 0 : c.title) != null ? u : "";
|
|
56
|
+
return d ? `` : ``;
|
|
57
|
+
},
|
|
58
|
+
addNodeView() {
|
|
59
|
+
if (!this.options.resize || !this.options.resize.enabled || typeof document > "u")
|
|
60
|
+
return null;
|
|
61
|
+
const { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize;
|
|
62
|
+
return ({ node: a, getPos: c, HTMLAttributes: u, editor: o }) => {
|
|
63
|
+
const s = document.createElement("img");
|
|
64
|
+
Object.entries(u).forEach(([l, f]) => {
|
|
65
|
+
if (f != null)
|
|
66
|
+
switch (l) {
|
|
67
|
+
case "width":
|
|
68
|
+
case "height":
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
s.setAttribute(l, f);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}), s.src = u.src;
|
|
75
|
+
const d = new W({
|
|
76
|
+
element: s,
|
|
77
|
+
editor: o,
|
|
78
|
+
node: a,
|
|
79
|
+
getPos: c,
|
|
80
|
+
onResize: (l, f) => {
|
|
81
|
+
s.style.width = `${l}px`, s.style.height = `${f}px`;
|
|
82
|
+
},
|
|
83
|
+
onCommit: (l, f) => {
|
|
84
|
+
const b = c();
|
|
85
|
+
b !== void 0 && this.editor.chain().setNodeSelection(b).updateAttributes(this.name, {
|
|
86
|
+
width: l,
|
|
87
|
+
height: f
|
|
88
|
+
}).run();
|
|
89
|
+
},
|
|
90
|
+
onUpdate: (l, f, b) => l.type === a.type,
|
|
91
|
+
options: {
|
|
92
|
+
directions: e,
|
|
93
|
+
min: {
|
|
94
|
+
width: t,
|
|
95
|
+
height: n
|
|
96
|
+
},
|
|
97
|
+
preserveAspectRatio: r === !0
|
|
98
|
+
}
|
|
99
|
+
}), m = d.dom;
|
|
100
|
+
return m.style.visibility = "hidden", m.style.pointerEvents = "none", s.onload = () => {
|
|
101
|
+
m.style.visibility = "", m.style.pointerEvents = "";
|
|
102
|
+
}, d;
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
addCommands() {
|
|
106
|
+
return {
|
|
107
|
+
setImage: (e) => ({ commands: t }) => t.insertContent({
|
|
108
|
+
type: this.name,
|
|
109
|
+
attrs: e
|
|
110
|
+
})
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
addInputRules() {
|
|
114
|
+
return [
|
|
115
|
+
L({
|
|
116
|
+
find: B,
|
|
117
|
+
type: this.type,
|
|
118
|
+
getAttributes: (e) => {
|
|
119
|
+
const [, , t, n, r] = e;
|
|
120
|
+
return { src: n, alt: t, title: r };
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
}), be = H, P = typeof global == "object" && global && global.Object === Object && global, F = typeof self == "object" && self && self.Object === Object && self, R = P || F || Function("return this")(), T = R.Symbol, _ = Object.prototype, U = _.hasOwnProperty, V = _.toString, h = T ? T.toStringTag : void 0;
|
|
126
|
+
function D(e) {
|
|
127
|
+
var t = U.call(e, h), n = e[h];
|
|
128
|
+
try {
|
|
129
|
+
e[h] = void 0;
|
|
130
|
+
var r = !0;
|
|
131
|
+
} catch {
|
|
132
|
+
}
|
|
133
|
+
var a = V.call(e);
|
|
134
|
+
return r && (t ? e[h] = n : delete e[h]), a;
|
|
135
|
+
}
|
|
136
|
+
var G = Object.prototype, X = G.toString;
|
|
137
|
+
function Z(e) {
|
|
138
|
+
return X.call(e);
|
|
139
|
+
}
|
|
140
|
+
var q = "[object Null]", J = "[object Undefined]", E = T ? T.toStringTag : void 0;
|
|
141
|
+
function K(e) {
|
|
142
|
+
return e == null ? e === void 0 ? J : q : E && E in Object(e) ? D(e) : Z(e);
|
|
143
|
+
}
|
|
144
|
+
function Q(e) {
|
|
145
|
+
return e != null && typeof e == "object";
|
|
146
|
+
}
|
|
147
|
+
var Y = "[object Symbol]";
|
|
148
|
+
function ee(e) {
|
|
149
|
+
return typeof e == "symbol" || Q(e) && K(e) == Y;
|
|
150
|
+
}
|
|
151
|
+
var te = /\s/;
|
|
152
|
+
function ne(e) {
|
|
153
|
+
for (var t = e.length; t-- && te.test(e.charAt(t)); )
|
|
154
|
+
;
|
|
155
|
+
return t;
|
|
156
|
+
}
|
|
157
|
+
var re = /^\s+/;
|
|
158
|
+
function ie(e) {
|
|
159
|
+
return e && e.slice(0, ne(e) + 1).replace(re, "");
|
|
160
|
+
}
|
|
161
|
+
function v(e) {
|
|
162
|
+
var t = typeof e;
|
|
163
|
+
return e != null && (t == "object" || t == "function");
|
|
164
|
+
}
|
|
165
|
+
var I = NaN, ae = /^[-+]0x[0-9a-f]+$/i, oe = /^0b[01]+$/i, se = /^0o[0-7]+$/i, le = parseInt;
|
|
166
|
+
function $(e) {
|
|
167
|
+
if (typeof e == "number")
|
|
168
|
+
return e;
|
|
169
|
+
if (ee(e))
|
|
170
|
+
return I;
|
|
171
|
+
if (v(e)) {
|
|
172
|
+
var t = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
173
|
+
e = v(t) ? t + "" : t;
|
|
174
|
+
}
|
|
175
|
+
if (typeof e != "string")
|
|
176
|
+
return e === 0 ? e : +e;
|
|
177
|
+
e = ie(e);
|
|
178
|
+
var n = oe.test(e);
|
|
179
|
+
return n || se.test(e) ? le(e.slice(2), n ? 2 : 8) : ae.test(e) ? I : +e;
|
|
180
|
+
}
|
|
181
|
+
var S = function() {
|
|
182
|
+
return R.Date.now();
|
|
183
|
+
}, ue = "Expected a function", ce = Math.max, de = Math.min;
|
|
184
|
+
function fe(e, t, n) {
|
|
185
|
+
var r, a, c, u, o, s, d = 0, m = !1, l = !1, f = !0;
|
|
186
|
+
if (typeof e != "function")
|
|
187
|
+
throw new TypeError(ue);
|
|
188
|
+
t = $(t) || 0, v(n) && (m = !!n.leading, l = "maxWait" in n, c = l ? ce($(n.maxWait) || 0, t) : c, f = "trailing" in n ? !!n.trailing : f);
|
|
189
|
+
function b(i) {
|
|
190
|
+
var g = r, p = a;
|
|
191
|
+
return r = a = void 0, d = i, u = e.apply(p, g), u;
|
|
192
|
+
}
|
|
193
|
+
function A(i) {
|
|
194
|
+
return d = i, o = setTimeout(y, t), m ? b(i) : u;
|
|
195
|
+
}
|
|
196
|
+
function N(i) {
|
|
197
|
+
var g = i - s, p = i - d, w = t - g;
|
|
198
|
+
return l ? de(w, c - p) : w;
|
|
199
|
+
}
|
|
200
|
+
function O(i) {
|
|
201
|
+
var g = i - s, p = i - d;
|
|
202
|
+
return s === void 0 || g >= t || g < 0 || l && p >= c;
|
|
203
|
+
}
|
|
204
|
+
function y() {
|
|
205
|
+
var i = S();
|
|
206
|
+
if (O(i))
|
|
207
|
+
return x(i);
|
|
208
|
+
o = setTimeout(y, N(i));
|
|
209
|
+
}
|
|
210
|
+
function x(i) {
|
|
211
|
+
return o = void 0, f && r ? b(i) : (r = a = void 0, u);
|
|
212
|
+
}
|
|
213
|
+
function k() {
|
|
214
|
+
o !== void 0 && clearTimeout(o), d = 0, r = s = a = o = void 0;
|
|
215
|
+
}
|
|
216
|
+
function M() {
|
|
217
|
+
return o === void 0 ? u : x(S());
|
|
218
|
+
}
|
|
219
|
+
function j() {
|
|
220
|
+
var i = S(), g = O(i);
|
|
221
|
+
if (r = arguments, a = this, s = i, g) {
|
|
222
|
+
if (o === void 0)
|
|
223
|
+
return A(s);
|
|
224
|
+
if (l)
|
|
225
|
+
return clearTimeout(o), o = setTimeout(y, t), b(s);
|
|
226
|
+
}
|
|
227
|
+
return o === void 0 && (o = setTimeout(y, t)), u;
|
|
228
|
+
}
|
|
229
|
+
return j.cancel = k, j.flush = M, j;
|
|
230
|
+
}
|
|
231
|
+
var ge = "Expected a function";
|
|
232
|
+
function pe(e, t, n) {
|
|
233
|
+
var r = !0, a = !0;
|
|
234
|
+
if (typeof e != "function")
|
|
235
|
+
throw new TypeError(ge);
|
|
236
|
+
return v(n) && (r = "leading" in n ? !!n.leading : r, a = "trailing" in n ? !!n.trailing : a), fe(e, t, {
|
|
237
|
+
leading: r,
|
|
238
|
+
maxWait: t,
|
|
239
|
+
trailing: a
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
export {
|
|
243
|
+
pe as a,
|
|
244
|
+
K as b,
|
|
245
|
+
be as c,
|
|
246
|
+
fe as d,
|
|
247
|
+
Q as i,
|
|
248
|
+
$ as t
|
|
249
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const T=require("./index-RfTlOzIr.cjs");var B=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,H=T.Node3.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",T.mergeAttributes(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,r,a,c,u;const o=(n=(t=e.attrs)==null?void 0:t.src)!=null?n:"",s=(a=(r=e.attrs)==null?void 0:r.alt)!=null?a:"",d=(u=(c=e.attrs)==null?void 0:c.title)!=null?u:"";return d?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:a,getPos:c,HTMLAttributes:u,editor:o})=>{const s=document.createElement("img");Object.entries(u).forEach(([l,f])=>{if(f!=null)switch(l){case"width":case"height":break;default:s.setAttribute(l,f);break}}),s.src=u.src;const d=new T.ResizableNodeView({element:s,editor:o,node:a,getPos:c,onResize:(l,f)=>{s.style.width=`${l}px`,s.style.height=`${f}px`},onCommit:(l,f)=>{const b=c();b!==void 0&&this.editor.chain().setNodeSelection(b).updateAttributes(this.name,{width:l,height:f}).run()},onUpdate:(l,f,b)=>l.type===a.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),m=d.dom;return m.style.visibility="hidden",m.style.pointerEvents="none",s.onload=()=>{m.style.visibility="",m.style.pointerEvents=""},d}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[T.nodeInputRule({find:B,type:this.type,getAttributes:e=>{const[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),P=H,F=typeof global=="object"&&global&&global.Object===Object&&global,U=typeof self=="object"&&self&&self.Object===Object&&self,_=F||U||Function("return this")(),v=_.Symbol,A=Object.prototype,G=A.hasOwnProperty,V=A.toString,h=v?v.toStringTag:void 0;function D(e){var t=G.call(e,h),n=e[h];try{e[h]=void 0;var r=!0}catch{}var a=V.call(e);return r&&(t?e[h]=n:delete e[h]),a}var X=Object.prototype,q=X.toString;function J(e){return q.call(e)}var K="[object Null]",Q="[object Undefined]",$=v?v.toStringTag:void 0;function N(e){return e==null?e===void 0?Q:K:$&&$ in Object(e)?D(e):J(e)}function k(e){return e!=null&&typeof e=="object"}var Y="[object Symbol]";function Z(e){return typeof e=="symbol"||k(e)&&N(e)==Y}var ee=/\s/;function te(e){for(var t=e.length;t--&&ee.test(e.charAt(t)););return t}var ne=/^\s+/;function re(e){return e&&e.slice(0,te(e)+1).replace(ne,"")}function j(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var R=NaN,ie=/^[-+]0x[0-9a-f]+$/i,ae=/^0b[01]+$/i,oe=/^0o[0-7]+$/i,se=parseInt;function x(e){if(typeof e=="number")return e;if(Z(e))return R;if(j(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=j(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=re(e);var n=ae.test(e);return n||oe.test(e)?se(e.slice(2),n?2:8):ie.test(e)?R:+e}var S=function(){return _.Date.now()},le="Expected a function",ue=Math.max,ce=Math.min;function L(e,t,n){var r,a,c,u,o,s,d=0,m=!1,l=!1,f=!0;if(typeof e!="function")throw new TypeError(le);t=x(t)||0,j(n)&&(m=!!n.leading,l="maxWait"in n,c=l?ue(x(n.maxWait)||0,t):c,f="trailing"in n?!!n.trailing:f);function b(i){var g=r,p=a;return r=a=void 0,d=i,u=e.apply(p,g),u}function M(i){return d=i,o=setTimeout(y,t),m?b(i):u}function C(i){var g=i-s,p=i-d,I=t-g;return l?ce(I,c-p):I}function w(i){var g=i-s,p=i-d;return s===void 0||g>=t||g<0||l&&p>=c}function y(){var i=S();if(w(i))return E(i);o=setTimeout(y,C(i))}function E(i){return o=void 0,f&&r?b(i):(r=a=void 0,u)}function W(){o!==void 0&&clearTimeout(o),d=0,r=s=a=o=void 0}function z(){return o===void 0?u:E(S())}function O(){var i=S(),g=w(i);if(r=arguments,a=this,s=i,g){if(o===void 0)return M(s);if(l)return clearTimeout(o),o=setTimeout(y,t),b(s)}return o===void 0&&(o=setTimeout(y,t)),u}return O.cancel=W,O.flush=z,O}var de="Expected a function";function fe(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(de);return j(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),L(e,t,{leading:r,maxWait:t,trailing:a})}exports.baseGetTag=N;exports.debounce=L;exports.index_default=P;exports.isObjectLike=k;exports.throttle=fe;exports.toNumber=x;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as b from "react";
|
|
3
|
+
import C from "react";
|
|
4
|
+
import { Slot as T } from "@radix-ui/react-slot";
|
|
5
|
+
import { c as l } from "./index-BPfVXs5_.js";
|
|
6
|
+
import { i as N } from "./icons-Cllpys39.js";
|
|
7
|
+
import { g as R, c as y } from "./useButtonProps-BsEd4zYM.js";
|
|
8
|
+
import { T as w, a as z, b as j } from "./tooltip-CopwsU8q.js";
|
|
9
|
+
import * as h from "@radix-ui/react-toggle";
|
|
10
|
+
const G = C.forwardRef(
|
|
11
|
+
(r, o) => {
|
|
12
|
+
const {
|
|
13
|
+
icon: c = void 0,
|
|
14
|
+
// title = undefined,
|
|
15
|
+
tooltip: e = void 0,
|
|
16
|
+
disabled: a = !1,
|
|
17
|
+
customClass: d = "",
|
|
18
|
+
// color = undefined,
|
|
19
|
+
loading: S = void 0,
|
|
20
|
+
shortcutKeys: i = void 0,
|
|
21
|
+
tooltipOptions: f = {},
|
|
22
|
+
action: m = void 0,
|
|
23
|
+
isActive: k = void 0,
|
|
24
|
+
children: p,
|
|
25
|
+
asChild: g = !1,
|
|
26
|
+
upload: V = !1,
|
|
27
|
+
initialDisplayedColor: _ = void 0,
|
|
28
|
+
dataState: u = !1,
|
|
29
|
+
...v
|
|
30
|
+
} = r, n = N[c];
|
|
31
|
+
return /* @__PURE__ */ s(w, { children: [
|
|
32
|
+
/* @__PURE__ */ t(z, { asChild: !0, children: /* @__PURE__ */ s(
|
|
33
|
+
g ? T : x,
|
|
34
|
+
{
|
|
35
|
+
className: l("richtext-w-[32px] richtext-h-[32px]", d),
|
|
36
|
+
"data-state": u ? "on" : "off",
|
|
37
|
+
disabled: a,
|
|
38
|
+
onClick: m,
|
|
39
|
+
ref: o,
|
|
40
|
+
size: "sm",
|
|
41
|
+
...v,
|
|
42
|
+
children: [
|
|
43
|
+
n && /* @__PURE__ */ t(n, { className: "richtext-size-4" }),
|
|
44
|
+
p
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
) }),
|
|
48
|
+
e && /* @__PURE__ */ t(j, { ...f, children: /* @__PURE__ */ s("div", { className: "richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center", children: [
|
|
49
|
+
/* @__PURE__ */ t("div", { children: e }),
|
|
50
|
+
!!(i != null && i.length) && /* @__PURE__ */ t("span", { children: R(i) })
|
|
51
|
+
] }) })
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
), A = y(
|
|
55
|
+
"richtext-inline-flex richtext-items-center richtext-justify-center richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-muted hover:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=on]:richtext-bg-accent data-[state=on]:richtext-text-accent-foreground",
|
|
56
|
+
{
|
|
57
|
+
variants: {
|
|
58
|
+
variant: {
|
|
59
|
+
default: "richtext-bg-transparent",
|
|
60
|
+
outline: "richtext-border richtext-border-input richtext-bg-transparent hover:richtext-bg-accent hover:richtext-text-accent-foreground"
|
|
61
|
+
},
|
|
62
|
+
size: {
|
|
63
|
+
default: "richtext-h-10 richtext-px-3",
|
|
64
|
+
sm: "richtext-h-9 richtext-px-2",
|
|
65
|
+
lg: "richtext-h-11 richtext-px-5"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
defaultVariants: {
|
|
69
|
+
variant: "default",
|
|
70
|
+
size: "default"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
), x = b.forwardRef(({ className: r, variant: o, size: c, ...e }, a) => /* @__PURE__ */ t(
|
|
74
|
+
h.Root,
|
|
75
|
+
{
|
|
76
|
+
ref: a,
|
|
77
|
+
className: l(A({ variant: o, size: c, className: r })),
|
|
78
|
+
...e
|
|
79
|
+
}
|
|
80
|
+
));
|
|
81
|
+
x.displayName = h.Root.displayName;
|
|
82
|
+
export {
|
|
83
|
+
G as A,
|
|
84
|
+
x as T
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),x=require("react"),y=require("@radix-ui/react-slot"),d=require("./index-DV5kbgRU.cjs"),C=require("./icons-CqHjeW5T.cjs"),h=require("./useButtonProps-C6Vpn190.cjs"),s=require("./tooltip-BuEiE96N.cjs"),N=require("@radix-ui/react-toggle");function u(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,o.get?o:{enumerable:!0,get:()=>t[i]})}}return r.default=t,Object.freeze(r)}const R=u(x),f=u(N),O=x.forwardRef((t,r)=>{const{icon:i=void 0,tooltip:o=void 0,disabled:n=!1,customClass:g="",loading:w=void 0,shortcutKeys:c=void 0,tooltipOptions:p={},action:m=void 0,isActive:z=void 0,children:v,asChild:b=!1,upload:P=!1,initialDisplayedColor:_=void 0,dataState:j=!1,...T}=t,l=C.icons[i],q=b?y.Slot:a;return e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(q,{className:d.cn("richtext-w-[32px] richtext-h-[32px]",g),"data-state":j?"on":"off",disabled:n,onClick:m,ref:r,size:"sm",...T,children:[l&&e.jsx(l,{className:"richtext-size-4"}),v]})}),o&&e.jsx(s.TooltipContent,{...p,children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[e.jsx("div",{children:o}),!!(c!=null&&c.length)&&e.jsx("span",{children:h.getShortcutKeys(c)})]})})]})}),S=h.cva("richtext-inline-flex richtext-items-center richtext-justify-center richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-muted hover:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=on]:richtext-bg-accent data-[state=on]:richtext-text-accent-foreground",{variants:{variant:{default:"richtext-bg-transparent",outline:"richtext-border richtext-border-input richtext-bg-transparent hover:richtext-bg-accent hover:richtext-text-accent-foreground"},size:{default:"richtext-h-10 richtext-px-3",sm:"richtext-h-9 richtext-px-2",lg:"richtext-h-11 richtext-px-5"}},defaultVariants:{variant:"default",size:"default"}}),a=R.forwardRef(({className:t,variant:r,size:i,...o},n)=>e.jsx(f.Root,{ref:n,className:d.cn(S({variant:r,size:i,className:t})),...o}));a.displayName=f.Root.displayName;exports.ActionButton=O;exports.Toggle=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),a=require("react"),d=require("@radix-ui/react-tooltip"),l=require("./index-DV5kbgRU.cjs");function n(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return i.default=t,Object.freeze(i)}const p=n(a),o=n(d),x=o.Provider,m=o.Root,h=o.Trigger,c=p.forwardRef(({className:t,sideOffset:i=4,...e},r)=>s.jsx(o.Content,{ref:r,sideOffset:i,className:l.cn("richtext-z-50 richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-text-popover-foreground richtext-shadow-md richtext-animate-in richtext-fade-in-0 richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",t),...e}));c.displayName=o.Content.displayName;exports.Tooltip=m;exports.TooltipContent=c;exports.TooltipProvider=x;exports.TooltipTrigger=h;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import * as t from "@radix-ui/react-tooltip";
|
|
4
|
+
import { c } from "./index-BPfVXs5_.js";
|
|
5
|
+
const x = t.Provider, h = t.Root, p = t.Trigger, s = d.forwardRef(({ className: i, sideOffset: o = 4, ...e }, r) => /* @__PURE__ */ a(
|
|
6
|
+
t.Content,
|
|
7
|
+
{
|
|
8
|
+
ref: r,
|
|
9
|
+
sideOffset: o,
|
|
10
|
+
className: c(
|
|
11
|
+
"richtext-z-50 richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-text-popover-foreground richtext-shadow-md richtext-animate-in richtext-fade-in-0 richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",
|
|
12
|
+
i
|
|
13
|
+
),
|
|
14
|
+
...e
|
|
15
|
+
}
|
|
16
|
+
));
|
|
17
|
+
s.displayName = t.Content.displayName;
|
|
18
|
+
export {
|
|
19
|
+
h as T,
|
|
20
|
+
p as a,
|
|
21
|
+
s as b,
|
|
22
|
+
x as c
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const z=require("@tiptap/pm/state"),L=require("@tiptap/pm/view"),G=require("./index-RfTlOzIr.cjs"),U=require("./floating-ui.dom-VCrc58uF.cjs");function Q(f){var l;const{char:y,allowSpaces:I,allowToIncludeChar:h,allowedPrefixes:m,startOfLine:k,$position:v}=f,B=I&&!h,q=G.escapeForRegEx(y),O=new RegExp(`\\s${q}$`),S=k?"^":"",M=h?"":q,C=B?new RegExp(`${S}${q}.*?(?=\\s${M}|$)`,"gm"):new RegExp(`${S}(?:^)?${q}[^\\s${M}]*`,"gm"),$=((l=v.nodeBefore)==null?void 0:l.isText)&&v.nodeBefore.text;if(!$)return null;const F=v.pos-$.length,a=Array.from($.matchAll(C)).pop();if(!a||a.input===void 0||a.index===void 0)return null;const e=a.input.slice(Math.max(0,a.index-1),a.index),K=new RegExp(`^[${m==null?void 0:m.join("")}\0]?$`).test(e);if(m!==null&&!K)return null;const _=F+a.index;let x=_+a[0].length;return B&&O.test($.slice(x-1,x+1))&&(a[0]+=" ",x+=1),_<v.pos&&x>=v.pos?{range:{from:_,to:x},query:a[0].slice(y.length),text:a[0]}:null}var V=new z.PluginKey("suggestion");function H({pluginKey:f=V,editor:l,char:y="@",allowSpaces:I=!1,allowToIncludeChar:h=!1,allowedPrefixes:m=[" "],startOfLine:k=!1,decorationTag:v="span",decorationClass:B="suggestion",decorationContent:q="",decorationEmptyClass:O="is-empty",command:S=()=>null,items:M=()=>[],render:C=()=>({}),allow:$=()=>!0,findSuggestionMatch:F=Q}){let a;const e=C==null?void 0:C(),K=()=>{const n=l.state.selection.$anchor.pos,i=l.view.coordsAtPos(n),{top:r,right:s,bottom:o,left:c}=i;try{return new DOMRect(c,r,s-c,o-r)}catch{return null}},_=(n,i)=>i?()=>{const r=f.getState(l.state),s=r==null?void 0:r.decorationId,o=n.dom.querySelector(`[data-decoration-id="${s}"]`);return(o==null?void 0:o.getBoundingClientRect())||null}:K;function x(n,i){var r;try{const o=f.getState(n.state),c=o!=null&&o.decorationId?n.dom.querySelector(`[data-decoration-id="${o.decorationId}"]`):null,d={editor:l,range:(o==null?void 0:o.range)||{from:0,to:0},query:(o==null?void 0:o.query)||null,text:(o==null?void 0:o.text)||null,items:[],command:p=>S({editor:l,range:(o==null?void 0:o.range)||{from:0,to:0},props:p}),decorationNode:c,clientRect:_(n,c)};(r=e==null?void 0:e.onExit)==null||r.call(e,d)}catch{}const s=n.state.tr.setMeta(i,{exit:!0});n.dispatch(s)}const N=new z.Plugin({key:f,view(){return{update:async(n,i)=>{var r,s,o,c,d,p,E;const t=(r=this.key)==null?void 0:r.getState(i),g=(s=this.key)==null?void 0:s.getState(n.state),u=t.active&&g.active&&t.range.from!==g.range.from,R=!t.active&&g.active,b=t.active&&!g.active,P=!R&&!b&&t.query!==g.query,D=R||u&&P,A=P||u,T=b||u&&P;if(!D&&!A&&!T)return;const w=T&&!D?t:g,j=n.dom.querySelector(`[data-decoration-id="${w.decorationId}"]`);a={editor:l,range:w.range,query:w.query,text:w.text,items:[],command:J=>S({editor:l,range:w.range,props:J}),decorationNode:j,clientRect:_(n,j)},D&&((o=e==null?void 0:e.onBeforeStart)==null||o.call(e,a)),A&&((c=e==null?void 0:e.onBeforeUpdate)==null||c.call(e,a)),(A||D)&&(a.items=await M({editor:l,query:w.query})),T&&((d=e==null?void 0:e.onExit)==null||d.call(e,a)),A&&((p=e==null?void 0:e.onUpdate)==null||p.call(e,a)),D&&((E=e==null?void 0:e.onStart)==null||E.call(e,a))},destroy:()=>{var n;a&&((n=e==null?void 0:e.onExit)==null||n.call(e,a))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(n,i,r,s){const{isEditable:o}=l,{composing:c}=l.view,{selection:d}=n,{empty:p,from:E}=d,t={...i},g=n.getMeta(f);if(g&&g.exit)return t.active=!1,t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null,t;if(t.composing=c,o&&(p||l.view.composing)){(E<i.range.from||E>i.range.to)&&!c&&!i.composing&&(t.active=!1);const u=F({char:y,allowSpaces:I,allowToIncludeChar:h,allowedPrefixes:m,startOfLine:k,$position:d.$from}),R=`id_${Math.floor(Math.random()*4294967295)}`;u&&$({editor:l,state:s,range:u.range,isActive:i.active})?(t.active=!0,t.decorationId=i.decorationId?i.decorationId:R,t.range=u.range,t.query=u.query,t.text=u.text):t.active=!1}else t.active=!1;return t.active||(t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null),t}},props:{handleKeyDown(n,i){var r,s,o,c;const{active:d,range:p}=N.getState(n.state);if(!d)return!1;if(i.key==="Escape"||i.key==="Esc"){const t=N.getState(n.state),g=(r=a==null?void 0:a.decorationNode)!=null?r:null,u=g??(t!=null&&t.decorationId?n.dom.querySelector(`[data-decoration-id="${t.decorationId}"]`):null);if(((s=e==null?void 0:e.onKeyDown)==null?void 0:s.call(e,{view:n,event:i,range:t.range}))||!1)return!0;const b={editor:l,range:t.range,query:t.query,text:t.text,items:[],command:P=>S({editor:l,range:t.range,props:P}),decorationNode:u,clientRect:u?()=>u.getBoundingClientRect()||null:null};return(o=e==null?void 0:e.onExit)==null||o.call(e,b),x(n,f),!0}return((c=e==null?void 0:e.onKeyDown)==null?void 0:c.call(e,{view:n,event:i,range:p}))||!1},decorations(n){const{active:i,range:r,decorationId:s,query:o}=N.getState(n);if(!i)return null;const c=!(o!=null&&o.length),d=[B];return c&&d.push(O),L.DecorationSet.create(n.doc,[L.Decoration.inline(r.from,r.to,{nodeName:v,class:d.join(" "),"data-decoration-id":s,"data-decoration-content":q})])}}});return N}var W=H;function X(f,l){const y={getBoundingClientRect:()=>G.posToDOMRect(f.view,f.state.selection.from,f.state.selection.to)};U.computePosition(y,l,{placement:"bottom-start",strategy:"absolute",middleware:[U.shift(),U.flip()]}).then(({x:I,y:h,strategy:m})=>{l.style.width="max-content",l.style.position=m,l.style.left=`${I}px`,l.style.top=`${h}px`})}exports.Suggestion=H;exports.index_default=W;exports.updatePosition=X;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { PluginKey as L, Plugin as z } from "@tiptap/pm/state";
|
|
2
|
+
import { DecorationSet as G, Decoration as H } from "@tiptap/pm/view";
|
|
3
|
+
import { e as J, d as Q } from "./index-DnWWK9F_.js";
|
|
4
|
+
import { c as V, s as W, f as X } from "./floating-ui.dom-U1vPFQ5f.js";
|
|
5
|
+
function Y(g) {
|
|
6
|
+
var a;
|
|
7
|
+
const { char: I, allowSpaces: w, allowToIncludeChar: y, allowedPrefixes: m, startOfLine: k, $position: v } = g, B = w && !y, h = J(I), O = new RegExp(`\\s${h}$`), S = k ? "^" : "", M = y ? "" : h, C = B ? new RegExp(`${S}${h}.*?(?=\\s${M}|$)`, "gm") : new RegExp(`${S}(?:^)?${h}[^\\s${M}]*`, "gm"), $ = ((a = v.nodeBefore) == null ? void 0 : a.isText) && v.nodeBefore.text;
|
|
8
|
+
if (!$)
|
|
9
|
+
return null;
|
|
10
|
+
const F = v.pos - $.length, l = Array.from($.matchAll(C)).pop();
|
|
11
|
+
if (!l || l.input === void 0 || l.index === void 0)
|
|
12
|
+
return null;
|
|
13
|
+
const e = l.input.slice(Math.max(0, l.index - 1), l.index), K = new RegExp(`^[${m == null ? void 0 : m.join("")}\0]?$`).test(e);
|
|
14
|
+
if (m !== null && !K)
|
|
15
|
+
return null;
|
|
16
|
+
const q = F + l.index;
|
|
17
|
+
let x = q + l[0].length;
|
|
18
|
+
return B && O.test($.slice(x - 1, x + 1)) && (l[0] += " ", x += 1), q < v.pos && x >= v.pos ? {
|
|
19
|
+
range: {
|
|
20
|
+
from: q,
|
|
21
|
+
to: x
|
|
22
|
+
},
|
|
23
|
+
query: l[0].slice(I.length),
|
|
24
|
+
text: l[0]
|
|
25
|
+
} : null;
|
|
26
|
+
}
|
|
27
|
+
var Z = new L("suggestion");
|
|
28
|
+
function tt({
|
|
29
|
+
pluginKey: g = Z,
|
|
30
|
+
editor: a,
|
|
31
|
+
char: I = "@",
|
|
32
|
+
allowSpaces: w = !1,
|
|
33
|
+
allowToIncludeChar: y = !1,
|
|
34
|
+
allowedPrefixes: m = [" "],
|
|
35
|
+
startOfLine: k = !1,
|
|
36
|
+
decorationTag: v = "span",
|
|
37
|
+
decorationClass: B = "suggestion",
|
|
38
|
+
decorationContent: h = "",
|
|
39
|
+
decorationEmptyClass: O = "is-empty",
|
|
40
|
+
command: S = () => null,
|
|
41
|
+
items: M = () => [],
|
|
42
|
+
render: C = () => ({}),
|
|
43
|
+
allow: $ = () => !0,
|
|
44
|
+
findSuggestionMatch: F = Y
|
|
45
|
+
}) {
|
|
46
|
+
let l;
|
|
47
|
+
const e = C == null ? void 0 : C(), K = () => {
|
|
48
|
+
const n = a.state.selection.$anchor.pos, r = a.view.coordsAtPos(n), { top: i, right: s, bottom: o, left: c } = r;
|
|
49
|
+
try {
|
|
50
|
+
return new DOMRect(c, i, s - c, o - i);
|
|
51
|
+
} catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}, q = (n, r) => r ? () => {
|
|
55
|
+
const i = g.getState(a.state), s = i == null ? void 0 : i.decorationId, o = n.dom.querySelector(`[data-decoration-id="${s}"]`);
|
|
56
|
+
return (o == null ? void 0 : o.getBoundingClientRect()) || null;
|
|
57
|
+
} : K;
|
|
58
|
+
function x(n, r) {
|
|
59
|
+
var i;
|
|
60
|
+
try {
|
|
61
|
+
const o = g.getState(n.state), c = o != null && o.decorationId ? n.dom.querySelector(`[data-decoration-id="${o.decorationId}"]`) : null, d = {
|
|
62
|
+
// @ts-ignore editor is available in closure
|
|
63
|
+
editor: a,
|
|
64
|
+
range: (o == null ? void 0 : o.range) || { from: 0, to: 0 },
|
|
65
|
+
query: (o == null ? void 0 : o.query) || null,
|
|
66
|
+
text: (o == null ? void 0 : o.text) || null,
|
|
67
|
+
items: [],
|
|
68
|
+
command: (p) => S({ editor: a, range: (o == null ? void 0 : o.range) || { from: 0, to: 0 }, props: p }),
|
|
69
|
+
decorationNode: c,
|
|
70
|
+
clientRect: q(n, c)
|
|
71
|
+
};
|
|
72
|
+
(i = e == null ? void 0 : e.onExit) == null || i.call(e, d);
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
75
|
+
const s = n.state.tr.setMeta(r, { exit: !0 });
|
|
76
|
+
n.dispatch(s);
|
|
77
|
+
}
|
|
78
|
+
const N = new z({
|
|
79
|
+
key: g,
|
|
80
|
+
view() {
|
|
81
|
+
return {
|
|
82
|
+
update: async (n, r) => {
|
|
83
|
+
var i, s, o, c, d, p, E;
|
|
84
|
+
const t = (i = this.key) == null ? void 0 : i.getState(r), f = (s = this.key) == null ? void 0 : s.getState(n.state), u = t.active && f.active && t.range.from !== f.range.from, R = !t.active && f.active, b = t.active && !f.active, P = !R && !b && t.query !== f.query, D = R || u && P, A = P || u, T = b || u && P;
|
|
85
|
+
if (!D && !A && !T)
|
|
86
|
+
return;
|
|
87
|
+
const _ = T && !D ? t : f, j = n.dom.querySelector(`[data-decoration-id="${_.decorationId}"]`);
|
|
88
|
+
l = {
|
|
89
|
+
editor: a,
|
|
90
|
+
range: _.range,
|
|
91
|
+
query: _.query,
|
|
92
|
+
text: _.text,
|
|
93
|
+
items: [],
|
|
94
|
+
command: (U) => S({
|
|
95
|
+
editor: a,
|
|
96
|
+
range: _.range,
|
|
97
|
+
props: U
|
|
98
|
+
}),
|
|
99
|
+
decorationNode: j,
|
|
100
|
+
clientRect: q(n, j)
|
|
101
|
+
}, D && ((o = e == null ? void 0 : e.onBeforeStart) == null || o.call(e, l)), A && ((c = e == null ? void 0 : e.onBeforeUpdate) == null || c.call(e, l)), (A || D) && (l.items = await M({
|
|
102
|
+
editor: a,
|
|
103
|
+
query: _.query
|
|
104
|
+
})), T && ((d = e == null ? void 0 : e.onExit) == null || d.call(e, l)), A && ((p = e == null ? void 0 : e.onUpdate) == null || p.call(e, l)), D && ((E = e == null ? void 0 : e.onStart) == null || E.call(e, l));
|
|
105
|
+
},
|
|
106
|
+
destroy: () => {
|
|
107
|
+
var n;
|
|
108
|
+
l && ((n = e == null ? void 0 : e.onExit) == null || n.call(e, l));
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
state: {
|
|
113
|
+
// Initialize the plugin's internal state.
|
|
114
|
+
init() {
|
|
115
|
+
return {
|
|
116
|
+
active: !1,
|
|
117
|
+
range: {
|
|
118
|
+
from: 0,
|
|
119
|
+
to: 0
|
|
120
|
+
},
|
|
121
|
+
query: null,
|
|
122
|
+
text: null,
|
|
123
|
+
composing: !1
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
// Apply changes to the plugin state from a view transaction.
|
|
127
|
+
apply(n, r, i, s) {
|
|
128
|
+
const { isEditable: o } = a, { composing: c } = a.view, { selection: d } = n, { empty: p, from: E } = d, t = { ...r }, f = n.getMeta(g);
|
|
129
|
+
if (f && f.exit)
|
|
130
|
+
return t.active = !1, t.decorationId = null, t.range = { from: 0, to: 0 }, t.query = null, t.text = null, t;
|
|
131
|
+
if (t.composing = c, o && (p || a.view.composing)) {
|
|
132
|
+
(E < r.range.from || E > r.range.to) && !c && !r.composing && (t.active = !1);
|
|
133
|
+
const u = F({
|
|
134
|
+
char: I,
|
|
135
|
+
allowSpaces: w,
|
|
136
|
+
allowToIncludeChar: y,
|
|
137
|
+
allowedPrefixes: m,
|
|
138
|
+
startOfLine: k,
|
|
139
|
+
$position: d.$from
|
|
140
|
+
}), R = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
141
|
+
u && $({
|
|
142
|
+
editor: a,
|
|
143
|
+
state: s,
|
|
144
|
+
range: u.range,
|
|
145
|
+
isActive: r.active
|
|
146
|
+
}) ? (t.active = !0, t.decorationId = r.decorationId ? r.decorationId : R, t.range = u.range, t.query = u.query, t.text = u.text) : t.active = !1;
|
|
147
|
+
} else
|
|
148
|
+
t.active = !1;
|
|
149
|
+
return t.active || (t.decorationId = null, t.range = { from: 0, to: 0 }, t.query = null, t.text = null), t;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
props: {
|
|
153
|
+
// Call the keydown hook if suggestion is active.
|
|
154
|
+
handleKeyDown(n, r) {
|
|
155
|
+
var i, s, o, c;
|
|
156
|
+
const { active: d, range: p } = N.getState(n.state);
|
|
157
|
+
if (!d)
|
|
158
|
+
return !1;
|
|
159
|
+
if (r.key === "Escape" || r.key === "Esc") {
|
|
160
|
+
const t = N.getState(n.state), f = (i = l == null ? void 0 : l.decorationNode) != null ? i : null, u = f ?? (t != null && t.decorationId ? n.dom.querySelector(`[data-decoration-id="${t.decorationId}"]`) : null);
|
|
161
|
+
if (((s = e == null ? void 0 : e.onKeyDown) == null ? void 0 : s.call(e, { view: n, event: r, range: t.range })) || !1)
|
|
162
|
+
return !0;
|
|
163
|
+
const b = {
|
|
164
|
+
editor: a,
|
|
165
|
+
range: t.range,
|
|
166
|
+
query: t.query,
|
|
167
|
+
text: t.text,
|
|
168
|
+
items: [],
|
|
169
|
+
command: (P) => S({ editor: a, range: t.range, props: P }),
|
|
170
|
+
decorationNode: u,
|
|
171
|
+
// If we have a cached decoration node, use it for the clientRect
|
|
172
|
+
// to avoid another DOM lookup. If not, leave clientRect null and
|
|
173
|
+
// let consumer decide if they want to query.
|
|
174
|
+
clientRect: u ? () => u.getBoundingClientRect() || null : null
|
|
175
|
+
};
|
|
176
|
+
return (o = e == null ? void 0 : e.onExit) == null || o.call(e, b), x(n, g), !0;
|
|
177
|
+
}
|
|
178
|
+
return ((c = e == null ? void 0 : e.onKeyDown) == null ? void 0 : c.call(e, { view: n, event: r, range: p })) || !1;
|
|
179
|
+
},
|
|
180
|
+
// Setup decorator on the currently active suggestion.
|
|
181
|
+
decorations(n) {
|
|
182
|
+
const { active: r, range: i, decorationId: s, query: o } = N.getState(n);
|
|
183
|
+
if (!r)
|
|
184
|
+
return null;
|
|
185
|
+
const c = !(o != null && o.length), d = [B];
|
|
186
|
+
return c && d.push(O), G.create(n.doc, [
|
|
187
|
+
H.inline(i.from, i.to, {
|
|
188
|
+
nodeName: v,
|
|
189
|
+
class: d.join(" "),
|
|
190
|
+
"data-decoration-id": s,
|
|
191
|
+
"data-decoration-content": h
|
|
192
|
+
})
|
|
193
|
+
]);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
return N;
|
|
198
|
+
}
|
|
199
|
+
var lt = tt;
|
|
200
|
+
function rt(g, a) {
|
|
201
|
+
V({
|
|
202
|
+
getBoundingClientRect: () => Q(g.view, g.state.selection.from, g.state.selection.to)
|
|
203
|
+
}, a, {
|
|
204
|
+
placement: "bottom-start",
|
|
205
|
+
strategy: "absolute",
|
|
206
|
+
middleware: [W(), X()]
|
|
207
|
+
}).then(({ x: w, y, strategy: m }) => {
|
|
208
|
+
a.style.width = "max-content", a.style.position = m, a.style.left = `${w}px`, a.style.top = `${y}px`;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
export {
|
|
212
|
+
tt as S,
|
|
213
|
+
lt as i,
|
|
214
|
+
rt as u
|
|
215
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const S=require("react");function d(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const T=d(S),p=1,O=1e6;let i=0;function l(){return i=(i+1)%Number.MAX_SAFE_INTEGER,i.toString()}const a=new Map;function f(t){if(a.has(t))return;const e=setTimeout(()=>{a.delete(t),n({type:"REMOVE_TOAST",toastId:t})},O);a.set(t,e)}function A(t,e){switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,p)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(s=>s.id===e.toast.id?{...s,...e.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=e;return s?f(s):t.toasts.forEach(o=>{f(o.id)}),{...t,toasts:t.toasts.map(o=>o.id===s||s===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(s=>s.id!==e.toastId)}}}const r=[];let u={toasts:[]};function n(t){u=A(u,t),r.forEach(e=>{e(u)})}function _({...t}){const e=l(),s=c=>n({type:"UPDATE_TOAST",toast:{...c,id:e}}),o=()=>n({type:"DISMISS_TOAST",toastId:e});return n({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:c=>{c||o()}}}),{id:e,dismiss:o,update:s}}function m(){const[t,e]=T.useState(u);return T.useEffect(()=>(r.push(e),()=>{const s=r.indexOf(e);s>-1&&r.splice(s,1)}),[t]),{...t,toast:_,dismiss:s=>n({type:"DISMISS_TOAST",toastId:s})}}exports.useToast=m;
|