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
package/lib/Video.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/react';
|
|
2
2
|
import { Extension } from '@tiptap/core';
|
|
3
|
+
import { JSX } from 'react/jsx-runtime';
|
|
3
4
|
import { Node as Node_2 } from '@tiptap/core';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -71,6 +72,8 @@ declare interface GeneralOptions<T> {
|
|
|
71
72
|
shortcutKeys?: string[] | string[][];
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
export declare function RichTextVideo(): JSX.Element;
|
|
76
|
+
|
|
74
77
|
export declare const Video: Node_2<VideoOptions, any>;
|
|
75
78
|
|
|
76
79
|
/**
|
|
@@ -145,11 +148,22 @@ declare module '@tiptap/core' {
|
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
|
|
151
|
+
declare module '@tiptap/core' {
|
|
152
|
+
interface Storage {
|
|
153
|
+
color: ColorStorage;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
|
|
148
158
|
declare module '@tiptap/core' {
|
|
149
159
|
interface Commands<ReturnType> {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
160
|
+
columns: {
|
|
161
|
+
insertColumns: (attrs?: {
|
|
162
|
+
cols: number;
|
|
163
|
+
}) => ReturnType;
|
|
164
|
+
addColBefore: () => ReturnType;
|
|
165
|
+
addColAfter: () => ReturnType;
|
|
166
|
+
deleteCol: () => ReturnType;
|
|
153
167
|
};
|
|
154
168
|
}
|
|
155
169
|
}
|
|
@@ -157,8 +171,9 @@ declare module '@tiptap/core' {
|
|
|
157
171
|
|
|
158
172
|
declare module '@tiptap/core' {
|
|
159
173
|
interface Commands<ReturnType> {
|
|
160
|
-
|
|
161
|
-
|
|
174
|
+
drawer: {
|
|
175
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
176
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
162
177
|
};
|
|
163
178
|
}
|
|
164
179
|
}
|
|
@@ -176,7 +191,16 @@ declare module '@tiptap/core' {
|
|
|
176
191
|
declare module '@tiptap/core' {
|
|
177
192
|
interface Commands<ReturnType> {
|
|
178
193
|
exportWord: {
|
|
179
|
-
exportToWord: () => ReturnType;
|
|
194
|
+
exportToWord: (docState: any) => ReturnType;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
declare module '@tiptap/core' {
|
|
201
|
+
interface Commands<ReturnType> {
|
|
202
|
+
excalidraw: {
|
|
203
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
180
204
|
};
|
|
181
205
|
}
|
|
182
206
|
}
|
|
@@ -201,10 +225,8 @@ declare module '@tiptap/core' {
|
|
|
201
225
|
|
|
202
226
|
|
|
203
227
|
declare module '@tiptap/core' {
|
|
204
|
-
interface
|
|
205
|
-
|
|
206
|
-
setPainter: (marks: Mark[]) => ReturnType;
|
|
207
|
-
};
|
|
228
|
+
interface Storage {
|
|
229
|
+
highlight: HighlightStorage;
|
|
208
230
|
}
|
|
209
231
|
}
|
|
210
232
|
|
|
@@ -244,22 +266,6 @@ declare module '@tiptap/core' {
|
|
|
244
266
|
}
|
|
245
267
|
|
|
246
268
|
|
|
247
|
-
declare module '@tiptap/core' {
|
|
248
|
-
interface Commands<ReturnType> {
|
|
249
|
-
indent: {
|
|
250
|
-
/**
|
|
251
|
-
* Set the indent attribute
|
|
252
|
-
*/
|
|
253
|
-
indent: () => ReturnType;
|
|
254
|
-
/**
|
|
255
|
-
* Set the outdent attribute
|
|
256
|
-
*/
|
|
257
|
-
outdent: () => ReturnType;
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
|
|
263
269
|
declare module '@tiptap/core' {
|
|
264
270
|
interface Commands<ReturnType> {
|
|
265
271
|
imageGifUpload: {
|
|
@@ -282,8 +288,15 @@ declare module '@tiptap/core' {
|
|
|
282
288
|
|
|
283
289
|
declare module '@tiptap/core' {
|
|
284
290
|
interface Commands<ReturnType> {
|
|
285
|
-
|
|
286
|
-
|
|
291
|
+
indent: {
|
|
292
|
+
/**
|
|
293
|
+
* Set the indent attribute
|
|
294
|
+
*/
|
|
295
|
+
indent: () => ReturnType;
|
|
296
|
+
/**
|
|
297
|
+
* Set the outdent attribute
|
|
298
|
+
*/
|
|
299
|
+
outdent: () => ReturnType;
|
|
287
300
|
};
|
|
288
301
|
}
|
|
289
302
|
}
|
|
@@ -291,9 +304,8 @@ declare module '@tiptap/core' {
|
|
|
291
304
|
|
|
292
305
|
declare module '@tiptap/core' {
|
|
293
306
|
interface Commands<ReturnType> {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
unsetLineHeight: () => ReturnType;
|
|
307
|
+
katex: {
|
|
308
|
+
setKatex: (arg?: IKatexAttrs) => ReturnType;
|
|
297
309
|
};
|
|
298
310
|
}
|
|
299
311
|
}
|
|
@@ -309,20 +321,6 @@ declare module '@tiptap/core' {
|
|
|
309
321
|
}
|
|
310
322
|
|
|
311
323
|
|
|
312
|
-
declare module '@tiptap/core' {
|
|
313
|
-
interface Commands<ReturnType> {
|
|
314
|
-
columns: {
|
|
315
|
-
insertColumns: (attrs?: {
|
|
316
|
-
cols: number;
|
|
317
|
-
}) => ReturnType;
|
|
318
|
-
addColBefore: () => ReturnType;
|
|
319
|
-
addColAfter: () => ReturnType;
|
|
320
|
-
deleteCol: () => ReturnType;
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
|
|
326
324
|
declare module '@tiptap/core' {
|
|
327
325
|
interface Commands<ReturnType> {
|
|
328
326
|
search: {
|
|
@@ -346,16 +344,6 @@ declare module '@tiptap/core' {
|
|
|
346
344
|
}
|
|
347
345
|
|
|
348
346
|
|
|
349
|
-
declare module '@tiptap/core' {
|
|
350
|
-
interface Commands<ReturnType> {
|
|
351
|
-
tableOfContents: {
|
|
352
|
-
setTableOfContents: () => ReturnType;
|
|
353
|
-
removeTableOfContents: () => ReturnType;
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
|
|
359
347
|
declare module '@tiptap/core' {
|
|
360
348
|
interface Commands<ReturnType> {
|
|
361
349
|
twitter: {
|
package/lib/Video.js
CHANGED
|
@@ -1,6 +1,263 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import "./index-
|
|
3
|
-
import {
|
|
1
|
+
import { N as I } from "./index-DnWWK9F_.js";
|
|
2
|
+
import { u as $, k as H, E as S, V as N } from "./index-DYkucCoF.js";
|
|
3
|
+
import { u as U, a as z, d as B, f as R } from "./useButtonProps-BsEd4zYM.js";
|
|
4
|
+
import { jsxs as d, jsx as s } from "react/jsx-runtime";
|
|
5
|
+
import { useState as y, useRef as j, useEffect as F, useMemo as O } from "react";
|
|
6
|
+
import { A as Z } from "./toggle-Cdp4IT2U.js";
|
|
7
|
+
import { a as _ } from "./index-BPfVXs5_.js";
|
|
8
|
+
import { D as q, a as W, b as G, c as J } from "./dialog-PtQivpHS.js";
|
|
9
|
+
import { T as K, a as P, b as D, c as L } from "./tabs-B5mVSN1I.js";
|
|
10
|
+
import { B as T } from "./button-DXMsXUEn.js";
|
|
11
|
+
import { I as Q } from "./input-wJ9PDEzZ.js";
|
|
12
|
+
function X(e, t) {
|
|
13
|
+
let r;
|
|
14
|
+
try {
|
|
15
|
+
r = new URL(e);
|
|
16
|
+
} catch {
|
|
17
|
+
return !1;
|
|
18
|
+
}
|
|
19
|
+
return !(t != null && t.length) || t.length === 1 && t[0] === "." ? !0 : t.some((n) => {
|
|
20
|
+
if (n.includes("*")) {
|
|
21
|
+
const a = n.replace(/\./g, "\\.").replace(/\*/g, ".*");
|
|
22
|
+
return new RegExp(`^${a}$`).test(r.hostname);
|
|
23
|
+
}
|
|
24
|
+
return r.hostname.includes(n);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function ue() {
|
|
28
|
+
const { t: e } = $(), t = _(), r = U(M.name), {
|
|
29
|
+
icon: n,
|
|
30
|
+
tooltip: a
|
|
31
|
+
} = (r == null ? void 0 : r.componentProps) ?? {}, { editorDisabled: c } = z(), [h, v] = y(""), b = j(null), [g, p] = y(""), [x, u] = y(!1), m = B(M.name), k = (o) => {
|
|
32
|
+
u(o.detail);
|
|
33
|
+
};
|
|
34
|
+
F(() => {
|
|
35
|
+
const o = H(S.UPLOAD_VIDEO(t.id), k);
|
|
36
|
+
return () => {
|
|
37
|
+
o();
|
|
38
|
+
};
|
|
39
|
+
}, [t]);
|
|
40
|
+
const i = O(() => (m == null ? void 0 : m.options) ?? {}, [m]);
|
|
41
|
+
async function A(o) {
|
|
42
|
+
var V;
|
|
43
|
+
const l = (V = o == null ? void 0 : o.target) == null ? void 0 : V.files;
|
|
44
|
+
if (!t || t.isDestroyed || l.length === 0)
|
|
45
|
+
return;
|
|
46
|
+
const f = l[0];
|
|
47
|
+
let w = "";
|
|
48
|
+
i.upload ? w = await i.upload(f) : w = URL.createObjectURL(f), t.chain().focus().setVideo({
|
|
49
|
+
src: w,
|
|
50
|
+
width: "100%"
|
|
51
|
+
}).run(), u(!1);
|
|
52
|
+
}
|
|
53
|
+
function C(o) {
|
|
54
|
+
o.preventDefault(), o.stopPropagation(), h && (t.chain().focus().setVideo({
|
|
55
|
+
src: h,
|
|
56
|
+
width: "100%"
|
|
57
|
+
}).run(), u(!1), v(""));
|
|
58
|
+
}
|
|
59
|
+
function E(o) {
|
|
60
|
+
var l;
|
|
61
|
+
o.preventDefault(), (l = b.current) == null || l.click();
|
|
62
|
+
}
|
|
63
|
+
return /* @__PURE__ */ d(
|
|
64
|
+
q,
|
|
65
|
+
{
|
|
66
|
+
onOpenChange: u,
|
|
67
|
+
open: x,
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ s(W, { asChild: !0, children: /* @__PURE__ */ s(
|
|
70
|
+
Z,
|
|
71
|
+
{
|
|
72
|
+
action: () => {
|
|
73
|
+
c || u(!0);
|
|
74
|
+
},
|
|
75
|
+
icon: n,
|
|
76
|
+
tooltip: a,
|
|
77
|
+
disabled: c
|
|
78
|
+
}
|
|
79
|
+
) }),
|
|
80
|
+
/* @__PURE__ */ d(G, { children: [
|
|
81
|
+
/* @__PURE__ */ s(J, { children: e("editor.video.dialog.title") }),
|
|
82
|
+
/* @__PURE__ */ d(
|
|
83
|
+
K,
|
|
84
|
+
{
|
|
85
|
+
activationMode: "manual",
|
|
86
|
+
defaultValue: (i == null ? void 0 : i.resourceVideo) === "both" || (i == null ? void 0 : i.resourceVideo) === "upload" ? "upload" : "link",
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ d(P, { className: "richtext-grid richtext-w-full richtext-grid-cols-2", children: [
|
|
89
|
+
((i == null ? void 0 : i.resourceVideo) === "both" || (i == null ? void 0 : i.resourceVideo) === "upload") && /* @__PURE__ */ s(D, { value: "upload", children: e("editor.video.dialog.tab.upload") }),
|
|
90
|
+
((i == null ? void 0 : i.resourceVideo) === "both" || (i == null ? void 0 : i.resourceVideo) === "link") && /* @__PURE__ */ s(D, { value: "link", children: e("editor.video.dialog.link") })
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ d(L, { value: "upload", children: [
|
|
93
|
+
/* @__PURE__ */ s("div", { className: "richtext-flex richtext-items-center richtext-gap-[10px]", children: /* @__PURE__ */ s(
|
|
94
|
+
T,
|
|
95
|
+
{
|
|
96
|
+
className: "richtext-mt-1 richtext-w-full",
|
|
97
|
+
onClick: E,
|
|
98
|
+
size: "sm",
|
|
99
|
+
children: e("editor.video.dialog.tab.upload")
|
|
100
|
+
}
|
|
101
|
+
) }),
|
|
102
|
+
/* @__PURE__ */ s(
|
|
103
|
+
"input",
|
|
104
|
+
{
|
|
105
|
+
accept: "video/*",
|
|
106
|
+
multiple: !0,
|
|
107
|
+
onChange: A,
|
|
108
|
+
ref: b,
|
|
109
|
+
type: "file",
|
|
110
|
+
style: {
|
|
111
|
+
display: "none"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] }),
|
|
116
|
+
/* @__PURE__ */ d(L, { value: "link", children: [
|
|
117
|
+
/* @__PURE__ */ s("div", { children: /* @__PURE__ */ d("div", { className: "richtext-flex richtext-items-center richtext-gap-2", children: [
|
|
118
|
+
/* @__PURE__ */ s(
|
|
119
|
+
Q,
|
|
120
|
+
{
|
|
121
|
+
autoFocus: !0,
|
|
122
|
+
placeholder: e("editor.video.dialog.placeholder"),
|
|
123
|
+
required: !0,
|
|
124
|
+
type: "url",
|
|
125
|
+
value: h,
|
|
126
|
+
onChange: (o) => {
|
|
127
|
+
v(o.target.value);
|
|
128
|
+
},
|
|
129
|
+
onBlur: (o) => {
|
|
130
|
+
const l = o.target.value, f = i.videoProviders || ["."];
|
|
131
|
+
l && !X(l, f) ? p("Invalid video URL") : p("");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ s(T, { type: "button", onClick: C, children: e("editor.video.dialog.button.apply") })
|
|
136
|
+
] }) }),
|
|
137
|
+
g && /* @__PURE__ */ s("div", { className: "richtext-my-[5px] richtext-text-red-500", children: g })
|
|
138
|
+
] })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
] })
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
function Y(e) {
|
|
148
|
+
e = e.replace("https://youtu.be/", "https://www.youtube.com/watch?v=").replace("watch?v=", "embed/");
|
|
149
|
+
const t = e.match(/^https:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/);
|
|
150
|
+
t && (e = `https://www.youtube.com/embed/${t[1]}`);
|
|
151
|
+
const r = e.match(/^https:\/\/vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?/);
|
|
152
|
+
if (r) {
|
|
153
|
+
const a = r[1], c = r[2];
|
|
154
|
+
c ? e = `https://player.vimeo.com/video/${a}?h=${c}` : e = `https://player.vimeo.com/video/${a}`;
|
|
155
|
+
}
|
|
156
|
+
return /^https?:\/\/www.bilibili.com\/video\/.*/i.test(e) && (e = e.replace(/\?.*$/, "").replace("https://www.bilibili.com/video/", "https://player.bilibili.com/player.html?bvid=")), e.includes("drive.google.com") && (e = e.replace("/view", "/preview")), e;
|
|
157
|
+
}
|
|
158
|
+
const M = /* @__PURE__ */ I.create({
|
|
159
|
+
name: "video",
|
|
160
|
+
group: "block",
|
|
161
|
+
atom: !0,
|
|
162
|
+
draggable: !0,
|
|
163
|
+
//@ts-expect-error
|
|
164
|
+
addOptions() {
|
|
165
|
+
return {
|
|
166
|
+
divider: !1,
|
|
167
|
+
spacer: !1,
|
|
168
|
+
allowFullscreen: !0,
|
|
169
|
+
upload: void 0,
|
|
170
|
+
frameborder: !1,
|
|
171
|
+
resourceVideo: "both",
|
|
172
|
+
width: N["size-medium"],
|
|
173
|
+
HTMLAttributes: {
|
|
174
|
+
class: "iframe-wrapper"
|
|
175
|
+
// style: 'display: flex;justify-content: center;',
|
|
176
|
+
},
|
|
177
|
+
button: ({ editor: e, t }) => {
|
|
178
|
+
var r, n;
|
|
179
|
+
return {
|
|
180
|
+
componentProps: {
|
|
181
|
+
action: () => {
|
|
182
|
+
},
|
|
183
|
+
isActive: () => e.isActive("video") || !1,
|
|
184
|
+
/* If setVideo is not available(when Video Component is not imported), the button is disabled */
|
|
185
|
+
disabled: !((n = (r = e.can()).setVideo) != null && n.call(r, {})),
|
|
186
|
+
icon: "Video",
|
|
187
|
+
tooltip: t("editor.video.tooltip"),
|
|
188
|
+
videoProviders: ["."],
|
|
189
|
+
editor: e
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
},
|
|
195
|
+
addAttributes() {
|
|
196
|
+
return {
|
|
197
|
+
src: {
|
|
198
|
+
default: null,
|
|
199
|
+
renderHTML: ({ src: e }) => ({
|
|
200
|
+
src: e ? Y(e) : null
|
|
201
|
+
})
|
|
202
|
+
},
|
|
203
|
+
width: {
|
|
204
|
+
default: this.options.width,
|
|
205
|
+
renderHTML: ({ width: e }) => ({
|
|
206
|
+
width: R(e)
|
|
207
|
+
})
|
|
208
|
+
},
|
|
209
|
+
frameborder: {
|
|
210
|
+
default: this.options.frameborder ? 1 : 0,
|
|
211
|
+
parseHTML: () => this.options.frameborder ? 1 : 0
|
|
212
|
+
},
|
|
213
|
+
allowfullscreen: {
|
|
214
|
+
default: this.options.allowFullscreen,
|
|
215
|
+
parseHTML: () => this.options.allowFullscreen
|
|
216
|
+
},
|
|
217
|
+
align: {
|
|
218
|
+
default: "center",
|
|
219
|
+
// Default alignment
|
|
220
|
+
renderHTML: ({ align: e }) => ({
|
|
221
|
+
align: e
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
},
|
|
226
|
+
parseHTML() {
|
|
227
|
+
return [
|
|
228
|
+
{
|
|
229
|
+
tag: "div[data-video] iframe"
|
|
230
|
+
}
|
|
231
|
+
];
|
|
232
|
+
},
|
|
233
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
234
|
+
const { width: t = "100%", align: r = "center" } = e ?? {}, n = {
|
|
235
|
+
...e,
|
|
236
|
+
width: "100%",
|
|
237
|
+
height: "100%"
|
|
238
|
+
}, a = `position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${t};`, c = `flex: 1;padding-bottom: ${9 / 16 * 100}%;`, p = ["div", { style: `display: flex; justify-content: ${r};` }, [
|
|
239
|
+
"div",
|
|
240
|
+
{ style: a },
|
|
241
|
+
["div", { style: c }],
|
|
242
|
+
["iframe", n]
|
|
243
|
+
]];
|
|
244
|
+
return ["div", {
|
|
245
|
+
...this.options.HTMLAttributes,
|
|
246
|
+
class: "iframe-wrapper",
|
|
247
|
+
"data-video": ""
|
|
248
|
+
}, p];
|
|
249
|
+
},
|
|
250
|
+
addCommands() {
|
|
251
|
+
return {
|
|
252
|
+
setVideo: (e) => ({ commands: t }) => t.insertContent({
|
|
253
|
+
type: this.name,
|
|
254
|
+
attrs: e
|
|
255
|
+
}),
|
|
256
|
+
updateVideo: (e) => ({ commands: t }) => t.updateAttributes(this.name, e)
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
});
|
|
4
260
|
export {
|
|
5
|
-
|
|
261
|
+
ue as RichTextVideo,
|
|
262
|
+
M as Video
|
|
6
263
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var u = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
+
function f(e) {
|
|
3
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
+
}
|
|
5
|
+
function l(e) {
|
|
6
|
+
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
|
|
7
|
+
var r = e.default;
|
|
8
|
+
if (typeof r == "function") {
|
|
9
|
+
var t = function o() {
|
|
10
|
+
return this instanceof o ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
t.prototype = r.prototype;
|
|
13
|
+
} else t = {};
|
|
14
|
+
return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(o) {
|
|
15
|
+
var n = Object.getOwnPropertyDescriptor(e, o);
|
|
16
|
+
Object.defineProperty(t, o, n.get ? n : {
|
|
17
|
+
enumerable: !0,
|
|
18
|
+
get: function() {
|
|
19
|
+
return e[o];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}), t;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
f as a,
|
|
26
|
+
u as c,
|
|
27
|
+
l as g
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function l(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var t=function o(){return this instanceof o?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}),t}exports.commonjsGlobal=u;exports.getAugmentedNamespace=l;exports.getDefaultExportFromCjs=f;
|
package/lib/bubble.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var jt=Object.create;var lt=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var It=Object.getOwnPropertyNames;var Tt=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty;var Et=(t,i,s,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of It(i))!St.call(t,r)&&r!==s&<(t,r,{get:()=>i[r],enumerable:!(n=Ct(i,r))||n.enumerable});return t};var At=(t,i,s)=>(s=t!=null?jt(Tt(t)):{},Et(i||!t||!t.__esModule?lt(s,"default",{value:t,enumerable:!0}):s,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("react"),B=require("./index-RfTlOzIr.cjs"),S=require("./floating-ui.dom-VCrc58uF.cjs"),q=require("@tiptap/pm/state"),pt=require("./Table-B1j1Ebmh.cjs"),ft=require("./index-BH4bc3jN.cjs"),xt=require("react-dom"),f=require("./toggle-D41PzQLJ.cjs"),ct=require("./Column.cjs"),T=require("./index-Dfmm6FTT.cjs"),$=require("./delete-node-CosiBes5.cjs"),b=require("./index-DV5kbgRU.cjs"),G=require("./Drawer-SRhwOc6T.cjs"),at=require("easydrawer"),Y=require("./shortId-Bfj8TyNr.cjs"),y=require("./dialog-CaCS-W5S.cjs"),mt=require("./file-i7e4nQY2.cjs"),z=require("./button-B12K7BJ4.cjs"),R=require("./Katex-XfrNne6U.cjs"),gt=require("./useButtonProps-C6Vpn190.cjs"),D=require("./separator-DRIrVZ2N.cjs"),Q=require("./label-BkgAe7IY.cjs"),tt=require("./popover-BgmUNMHj.cjs"),Z=require("./input-_ECRfn3Y.cjs"),L=require("./Excalidraw-ZN3DQvDC.cjs"),H=require("./Iframe-Cvca2G7X.cjs"),Bt=require("katex"),dt=require("lucide-react"),bt=require("./textarea-B-6zTKQz.cjs"),X=require("./LinkEditBlock-BZenZq-Z.cjs"),Ot=require("./Image.cjs"),Mt=require("./ImageGif.cjs"),kt=require("./Video.cjs"),it=require("./Mermaid.cjs"),Rt=require("./Bold.cjs"),Ut=require("./Code.cjs");require("./index-N--9MohJ.cjs");const Pt=require("./Color.cjs"),Dt=require("./Highlight.cjs"),Nt=require("./Italic.cjs"),Lt=require("./Strike.cjs"),Ht=require("./TextAlign.cjs"),ut=require("./TextUnderline.cjs"),et=require("./Twitter-CtVTIWJW.cjs");function qt(t,i){const s=Math.min(t.top,i.top),n=Math.max(t.bottom,i.bottom),r=Math.min(t.left,i.left),l=Math.max(t.right,i.right)-r,c=n-s,d=r,a=s;return new DOMRect(d,a,l,c)}var zt=class{constructor({editor:t,element:i,view:s,updateDelay:n=250,resizeDelay:r=60,shouldShow:o,appendTo:l,getReferencedVirtualElement:c,options:d}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:u,state:p,from:x,to:g})=>{const{doc:E,selection:C}=p,{empty:I}=C,j=!E.textBetween(x,g).length&&B.isTextSelection(p.selection),M=this.element.contains(document.activeElement);return!(!(u.hasFocus()||M)||I||j||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var p;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&((p=this.element.parentNode)!=null&&p.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(u,p)=>{const x=!(p!=null&&p.selection.eq(u.state.selection)),g=!(p!=null&&p.doc.eq(u.state.doc));!x&&!g||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(u,x,g,p)},this.updateDelay))},this.updateHandler=(u,p,x,g)=>{const{composing:E}=u;if(E||!p&&!x)return;if(!this.getShouldShow(g)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:u})=>{u.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var a;this.editor=t,this.element=i,this.view=s,this.updateDelay=n,this.resizeDelay=r,this.appendTo=l,this.scrollTarget=(a=d==null?void 0:d.scrollTarget)!=null?a:window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...d},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(s,s.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(S.flip(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(S.shift(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(S.offset(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(S.arrow(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(S.size(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(S.autoPlacement(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(S.hide(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(S.inline(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}get virtualElement(){var t;const{selection:i}=this.editor.state,s=(t=this.getReferencedVirtualElement)==null?void 0:t.call(this);if(s)return s;const n=B.posToDOMRect(this.view,i.from,i.to);let r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(i instanceof q.NodeSelection){let o=this.view.nodeDOM(i.from);const l=o.dataset.nodeViewWrapper?o:o.querySelector("[data-node-view-wrapper]");l&&(o=l),o&&(r={getBoundingClientRect:()=>o.getBoundingClientRect(),getClientRects:()=>[o.getBoundingClientRect()]})}if(i instanceof pt.CellSelection){const{$anchorCell:o,$headCell:l}=i,c=o?o.pos:l.pos,d=l?l.pos:o.pos,a=this.view.nodeDOM(c),u=this.view.nodeDOM(d);if(!a||!u)return;const p=a===u?a.getBoundingClientRect():qt(a.getBoundingClientRect(),u.getBoundingClientRect());r={getBoundingClientRect:()=>p,getClientRects:()=>[p]}}return r}updatePosition(){const t=this.virtualElement;t&&S.computePosition(t,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:i,y:s,strategy:n})=>{this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${i}px`,this.element.style.top=`${s}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,i){const{state:s}=t,n=s.selection.from!==s.selection.to;if(this.updateDelay>0&&n){this.handleDebouncedUpdate(t,i);return}const r=!(i!=null&&i.selection.eq(t.state.selection)),o=!(i!=null&&i.doc.eq(t.state.doc));this.updateHandler(t,r,o,i)}getShouldShow(t){var i;const{state:s}=this.view,{selection:n}=s,{ranges:r}=n,o=Math.min(...r.map(d=>d.$from.pos)),l=Math.max(...r.map(d=>d.$to.pos));return((i=this.shouldShow)==null?void 0:i.call(this,{editor:this.editor,element:this.element,view:this.view,state:s,oldState:t,from:o,to:l}))||!1}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const i=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=i??this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},wt=t=>new q.Plugin({key:typeof t.pluginKey=="string"?new q.PluginKey(t.pluginKey):t.pluginKey,view:i=>new zt({view:i,...t})});B.Extension.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[wt({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Ft=class{constructor({editor:t,element:i,view:s,options:n,appendTo:r,shouldShow:o}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:l,state:c})=>{const{selection:d}=c,{$anchor:a,empty:u}=d,p=a.depth===1,x=a.parent.isTextblock&&!a.parent.type.spec.code&&!a.parent.textContent&&a.parent.childCount===0&&!this.getTextContent(a.parent);return!(!l.hasFocus()||!u||!p||!x||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(l,c,d,a)=>{const{composing:u}=l;if(u||!c&&!d)return;if(!this.getShouldShow(a)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var c;if(this.preventHide){this.preventHide=!1;return}l!=null&&l.relatedTarget&&((c=this.element.parentNode)!=null&&c.contains(l.relatedTarget))||(l==null?void 0:l.relatedTarget)!==this.editor.view.dom&&this.hide()},this.editor=t,this.element=i,this.view=s,this.appendTo=r,this.floatingUIOptions={...this.floatingUIOptions,...n},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(s,s.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(t){return B.getText(t,{textSerializers:B.getTextSerializersFromSchema(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(S.flip(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(S.shift(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(S.offset(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(S.arrow(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(S.size(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(S.autoPlacement(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(S.hide(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(S.inline(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}getShouldShow(t){var i;const{state:s}=this.view,{selection:n}=s,{ranges:r}=n,o=Math.min(...r.map(d=>d.$from.pos)),l=Math.max(...r.map(d=>d.$to.pos));return(i=this.shouldShow)==null?void 0:i.call(this,{editor:this.editor,view:this.view,state:s,oldState:t,from:o,to:l})}updatePosition(){const{selection:t}=this.editor.state,i=B.posToDOMRect(this.view,t.from,t.to),s={getBoundingClientRect:()=>i,getClientRects:()=>[i]};S.computePosition(s,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:n,y:r,strategy:o})=>{this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${n}px`,this.element.style.top=`${r}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,i){const s=!(i!=null&&i.selection.eq(t.state.selection)),n=!(i!=null&&i.doc.eq(t.state.doc));this.updateHandler(t,s,n,i)}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const i=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=i??this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},vt=t=>new q.Plugin({key:typeof t.pluginKey=="string"?new q.PluginKey(t.pluginKey):t.pluginKey,view:i=>new Ft({view:i,...t})});B.Extension.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[vt({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var O=h.forwardRef(({pluginKey:t="bubbleMenu",editor:i,updateDelay:s,resizeDelay:n,appendTo:r,shouldShow:o=null,getReferencedVirtualElement:l,options:c,children:d,...a},u)=>{const p=h.useRef(document.createElement("div"));typeof u=="function"?u(p.current):u&&(u.current=p.current);const{editor:x}=ft.useCurrentEditor(),g=i||x,E={updateDelay:s,resizeDelay:n,appendTo:r,pluginKey:t,shouldShow:o,getReferencedVirtualElement:l,options:c},C=h.useRef(E);return C.current=E,h.useEffect(()=>{if(g!=null&&g.isDestroyed)return;if(!g){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const I=p.current;I.style.visibility="hidden",I.style.position="absolute";const j=wt({...C.current,editor:g,element:I});g.registerPlugin(j);const M=C.current.pluginKey;return()=>{g.unregisterPlugin(M),window.requestAnimationFrame(()=>{I.parentNode&&I.parentNode.removeChild(I)})}},[g]),xt.createPortal(e.jsx("div",{...a,children:d}),p.current)});h.forwardRef(({pluginKey:t="floatingMenu",editor:i,appendTo:s,shouldShow:n=null,options:r,children:o,...l},c)=>{const d=h.useRef(document.createElement("div"));typeof c=="function"?c(d.current):c&&(c.current=d.current);const{editor:a}=ft.useCurrentEditor();return h.useEffect(()=>{const u=d.current;if(u.style.visibility="hidden",u.style.position="absolute",i!=null&&i.isDestroyed||a!=null&&a.isDestroyed)return;const p=i||a;if(!p){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const x=vt({editor:p,element:u,pluginKey:t,appendTo:s,shouldShow:n,options:r});return p.registerPlugin(x),()=>{p.unregisterPlugin(t),window.requestAnimationFrame(()=>{u.parentNode&&u.parentNode.removeChild(u)})}},[i,a,s,t,n,r]),xt.createPortal(e.jsx("div",{...l,children:o}),d.current)});function $t(){const t=b.useEditableEditor(),i=b.useEditorInstance(),{t:s}=T.useLocale(),n=h.useCallback(()=>i.isActive(ct.MultipleColumnNode.name),[i]),r=h.useCallback(()=>$.deleteNode(ct.MultipleColumnNode.name,i),[i]),o=h.useCallback(()=>i.chain().focus().addColBefore().run(),[i]),l=h.useCallback(()=>i.chain().focus().addColAfter().run(),[i]),c=h.useCallback(()=>i.chain().focus().deleteCol().run(),[i]);return t?e.jsx(O,{editor:i,shouldShow:n,options:{placement:"bottom",offset:8,flip:!0},children:e.jsxs("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:[e.jsx(f.ActionButton,{action:o,icon:"ColumnAddLeft",tooltip:s("editor.table.menu.insertColumnBefore")}),e.jsx(f.ActionButton,{action:l,icon:"ColumnAddRight",tooltip:s("editor.table.menu.insertColumnAfter")}),e.jsx(f.ActionButton,{action:c,icon:"DeleteColumn",tooltip:s("editor.table.menu.deleteColumn")}),e.jsx(f.ActionButton,{action:r,icon:"Trash2",tooltip:s("editor.table.menu.delete_column")})]})}):e.jsx(e.Fragment,{})}let F=!1;function Vt({editor:t,attrs:i,extension:s}){const[n,r]=h.useState(!1),o=h.useRef(null),l=h.useRef(null),{alt:c,align:d}=i,a=s==null?void 0:s.options.upload,u=()=>{(async()=>{const m=document.querySelector("#easydrawer");m&&(o.current=new at.Editor(m,{wheelEventsEnabled:!1,disableZoom:!0}),l.current=at.makeDropdownToolbar(o.current),l.current.addDefaultToolWidgets(),o.current.loadFromSVG(decodeURIComponent(c)))})()};h.useEffect(()=>{n&&setTimeout(()=>{u()},200)},[n]);const p=async()=>{if(o.current){const v=o.current.toSVG(),m=v.outerHTML,w=`drawer-${Y.shortId()}.svg`;let U=Y.i(v.outerHTML);if(a){const V=mt.dataURLtoFile(U,w);U=await a(V)}t==null||t.chain().focus().setDrawer({type:"drawer",src:U,alt:encodeURIComponent(m),width:426,height:212},!!m).run(),t==null||t.commands.setAlignImageDrawer(d)}r(!1)},x=v=>{const m=o.current.toolController.getPrimaryTools()[2],w=l.current.getWidgetById("pen-1");m&&w&&(m.setColor(v),w.serializeState())},g=v=>{const m=o.current.toolController.getPrimaryTools()[2],w=l.current.getWidgetById("pen-1");m&&w&&(m.setThickness(v),w.serializeState())},E=v=>{const m=o.current.toolController.getPrimaryTools()[3],w=l.current.getWidgetById("pen-2");m&&w&&(m.setColor(v),w.serializeState())},C=v=>{const m=l.current.getWidgetById("shape");m&&m.setShapeType(v)},I=v=>{const m=o.current.toolController.getPrimaryTools()[5],w=l.current.getWidgetById("shape");m&&w&&(m.setColor(v),w.serializeState())},j=v=>{const m=o.current.toolController.getPrimaryTools()[5],w=l.current.getWidgetById("shape");m&&w&&(m.setThickness(v),w.serializeState())},M=v=>{const m=o.current.toolController.getPrimaryTools()[5],w=l.current.getWidgetById("shape");m&&w&&(m.setBorderColor(v),w.serializeState())},A=()=>{if(F){for(;o.current.history.redoStackSize>0;)o.current.history.redo();F=!1;return}o.current.history.undo()},k=()=>{F||o.current.history.redo()},N=()=>{if(!F){for(;o.current.history.undoStackSize>0;)A();F=!0}};return e.jsxs(y.Dialog,{onOpenChange:r,open:n,children:[e.jsx(y.DialogTrigger,{asChild:!0,children:e.jsx(f.ActionButton,{action:()=>r(!0),icon:"Pencil",tooltip:"Edit Drawer"})}),e.jsxs(y.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[e.jsx(y.DialogTitle,{children:"Edit Drawer"}),e.jsxs("div",{style:{height:"100%",borderWidth:1,background:"white",position:"relative"},children:[e.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),e.jsx(G.ControlDrawer,{changeBorderColorShape:M,changeColorShape:I,changeShape:C,onClear:N,onRedo:k,onThicknessChange:j,onUndo:A,refEditor:o,setColorHighlight:E,setColorPen:x,setThicknessPen:g})]}),e.jsx(y.DialogFooter,{children:e.jsx(z.Button,{onClick:p,type:"button",children:"Save changes"})})]})]})}function Wt(t,i){const s=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return s.map((r,o)=>({type:`image-${r}`,component:f.ActionButton,componentProps:{tooltip:i(`editor.${r.replace("-",".")}.tooltip`),icon:n[o],action:()=>t.commands.updateImage({width:T.IMAGE_SIZE[r]}),isActive:()=>t.isActive("image",{width:T.IMAGE_SIZE[r]})}}))}function Kt(t,i){const s=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return s.map((r,o)=>({type:`image-${r}`,component:f.ActionButton,componentProps:{tooltip:i(`editor.${r.replace("-",".")}.tooltip`),icon:n[o],action:()=>t.commands.updateImageGif({width:T.IMAGE_SIZE[r]}),isActive:()=>t.isActive("image",{width:T.IMAGE_SIZE[r]})}}))}function _t(t,i){const s=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return s.map(r=>({type:`image-${r}`,component:f.ActionButton,componentProps:{tooltip:i(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var o,l;return(l=(o=t.commands)==null?void 0:o.setAlignImage)==null?void 0:l.call(o,r)},isActive:()=>t.isActive({align:r})||!1,disabled:!1}}))}function Gt(t,i){const s=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return s.map(r=>({type:`image-${r}`,component:f.ActionButton,componentProps:{tooltip:i(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var o,l;return(l=(o=t.commands)==null?void 0:o.setAlignImageGif)==null?void 0:l.call(o,r)},isActive:()=>t.isActive({align:r})||!1,disabled:!1}}))}function Zt(t,i){const s=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return s.map(r=>({type:`image-${r}`,component:f.ActionButton,componentProps:{tooltip:i(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var o,l;return(l=(o=t.commands)==null?void 0:o.setAlignImageMermaid)==null?void 0:l.call(o,r)},isActive:()=>t.isActive({align:r})||!1,disabled:!1}}))}function Xt(t,i){const s=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return s.map(r=>({type:`image-${r}`,component:f.ActionButton,componentProps:{tooltip:i(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var o,l;return(l=(o=t.commands)==null?void 0:o.setAlignImageDrawer)==null?void 0:l.call(o,r)},isActive:()=>t.isActive({align:r})||!1,disabled:!1}}))}function Yt(t){return[{type:"flex-start",icon:"AlignLeft",tooltip:"Align left"},{type:"center",icon:"AlignCenter",tooltip:"Align center"},{type:"flex-end",icon:"AlignRight",tooltip:"Align right"}].map(s=>({type:`video-align-${s.type}`,component:f.ActionButton,componentProps:{tooltip:s.tooltip,icon:s.icon,action:()=>t.commands.updateVideo({align:s.type}),isActive:()=>t.getAttributes("video").align===s.type}}))}function Jt(t,i){const s=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return s.map((r,o)=>({type:`video-${r}`,component:f.ActionButton,componentProps:{tooltip:i(`editor.${r.replace("-",".")}.tooltip`),icon:n[o],action:()=>t.commands.updateVideo({width:T.VIDEO_SIZE[r]}),isActive:()=>t.isActive("video",{width:T.VIDEO_SIZE[r]})}}))}function Qt(t,i){return[{type:"flipX",component:f.ActionButton,componentProps:{editor:t,tooltip:i("editor.tooltip.flipX"),icon:"FlipX",action:()=>{const s=t.getAttributes("image"),{flipX:n}=s;t.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!n}).run()}}},{type:"flipY",component:f.ActionButton,componentProps:{editor:t,tooltip:i("editor.tooltip.flipY"),icon:"FlipY",action:()=>{const s=t.getAttributes("image"),{flipY:n}=s;t.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!n}).run()}}},...Wt(t,i),..._t(t,i),{type:"remove",component:f.ActionButton,componentProps:{editor:t,tooltip:i("editor.remove"),icon:"Trash2",action:()=>{const{state:s,dispatch:n}=t.view;B.deleteSelection(s,n)}}}]}function te(t,i){return[...Kt(t,i),...Gt(t,i),{type:"remove",component:f.ActionButton,componentProps:{editor:t,tooltip:i("editor.remove"),icon:"Trash2",action:()=>{const{state:s,dispatch:n}=t.view;B.deleteSelection(s,n)}}}]}function ee(t,i){return[...Zt(t,i),{type:"edit",component:f.ActionButton,componentProps:{editor:t,tooltip:i("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:f.ActionButton,componentProps:{editor:t,tooltip:i("editor.remove"),icon:"Trash2",action:()=>{const{state:s,dispatch:n}=t.view;B.deleteSelection(s,n)}}}]}function ie(t,i){return[...Xt(t,i),{type:"edit",component:f.ActionButton,componentProps:{editor:t,tooltip:i("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:f.ActionButton,componentProps:{editor:t,tooltip:i("editor.remove"),icon:"Trash2",action:()=>{const{state:s,dispatch:n}=t.view;B.deleteSelection(s,n)}}}]}function ne(t,i){return[...Jt(t,i),...Yt(t),{type:"remove",component:f.ActionButton,componentProps:{editor:t,tooltip:i("editor.remove"),icon:"Trash2",action:()=>{const{state:s,dispatch:n}=t.view;B.deleteSelection(s,n)}}}]}function oe({item:t,disabled:i,editor:s}){var r;const n=t.component;return n?e.jsx(h.Fragment,{children:t.type==="divider"?e.jsx(D.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):e.jsx(n,{...t.componentProps,disabled:i||((r=t==null?void 0:t.componentProps)==null?void 0:r.disabled),editor:s})}):e.jsx(e.Fragment,{})}function se(){const{lang:t,t:i}=T.useLocale(),s=b.useEditableEditor(),n=b.useEditorInstance(),r=R.useAttributes(n,G.Drawer.name),o=gt.useExtension(G.Drawer.name),l=({editor:d})=>{const{selection:a}=d.view.state,{$from:u,to:p}=a;let x=!1;return d.view.state.doc.nodesBetween(u.pos,p,g=>{if(g.type.name===G.Drawer.name)return x=!0,!1}),x},c=h.useMemo(()=>ie(n,i),[n,t,i]);return s?e.jsx(O,{editor:n,shouldShow:l,options:{placement:"bottom",offset:8,flip:!0},children:c!=null&&c.length?e.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:e.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:c==null?void 0:c.map((d,a)=>d.type==="edit"&&(r!=null&&r.src)?e.jsx(Vt,{attrs:r,editor:n,extension:o},`bubbleMenu-drawer-${a}`):e.jsx(oe,{editor:n,item:d},`bubbleMenu-drawer-${a}`))})}):e.jsx(e.Fragment,{})}):e.jsx(e.Fragment,{})}const re={padding:"0 12px 12px"},yt=({width:t,maxWidth:i,height:s,onOk:n,children:r})=>{const{t:o}=T.useLocale(),[l,c]=h.useState({width:"",height:"",maxWidth:""});h.useEffect(()=>{c({width:t,height:s,maxWidth:i})},[s,i,t]);function d(a){a.preventDefault(),a.stopPropagation(),n(l)}return e.jsxs(tt.Popover,{modal:!0,children:[e.jsx(tt.PopoverTrigger,{asChild:!0,children:r}),e.jsx(tt.PopoverContent,{children:e.jsx("div",{style:re,children:e.jsxs("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:d,children:[e.jsx(Q.Label,{className:"mb-[6px]",children:"Width"}),e.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:e.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:e.jsx(Z.Input,{type:"number",value:l.width,required:!0,onChange:a=>c({...l,width:a.target.value})})})}),e.jsx(Q.Label,{className:"mb-[6px]",children:"Max Width"}),e.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:e.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:e.jsx(Z.Input,{type:"number",value:l.maxWidth,required:!0,onChange:a=>c({...l,maxWidth:a.target.value})})})}),e.jsx(Q.Label,{className:"mb-[6px]",children:"Height"}),e.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:e.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:e.jsx(Z.Input,{type:"number",value:l.height,required:!0,onChange:a=>c({...l,height:a.target.value})})})}),e.jsx(z.Button,{type:"submit",className:"richtext-self-end richtext-mt-2",children:o("editor.link.dialog.button.apply")})]})})})]})},P=new Map;function le(t){const i=t.options.element;P.has("width")||P.set("width",i.clientWidth),P.has("width")&&P.get("width")<=0&&P.set("width",i.clientWidth);const s={attributes:!0,childList:!0,subtree:!0},n=function(){P.set("width",i.clientWidth)},r=new MutationObserver(n);return r.observe(i,s),t.on("destroy",()=>{r.disconnect()}),{width:P.get("width")}}function ce(){const t=b.useEditableEditor(),i=b.useEditorInstance(),{t:s}=T.useLocale(),{width:n}=le(i),r=R.useAttributes(i,L.Excalidraw.name,{defaultShowPicker:!1,createUser:"",width:0,height:0}),{defaultShowPicker:o,createUser:l,width:c,height:d}=r,a=h.useCallback(g=>{i.chain().updateAttributes(L.Excalidraw.name,g).setNodeSelection(i.state.selection.from).focus().run()},[i]),u=h.useCallback(()=>{L.triggerOpenExcalidrawSettingModal({...r,editor:i})},[i,r]),p=h.useCallback(()=>i.isActive(L.Excalidraw.name),[i]),x=h.useCallback(()=>$.deleteNode(L.Excalidraw.name,i),[i]);return h.useEffect(()=>{o&&(u(),i.chain().updateAttributes(L.Excalidraw.name,{defaultShowPicker:!1}).focus().run())},[l,o,i,u]),t?e.jsx(O,{editor:i,shouldShow:p,options:{placement:"bottom",offset:8,flip:!0},children:e.jsxs("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:[e.jsx(f.ActionButton,{action:u,icon:"Pencil",tooltip:s("editor.edit")}),e.jsx(yt,{height:d,maxWidth:n,onOk:a,width:c,children:e.jsx(f.ActionButton,{icon:"Settings",tooltip:s("editor.settings")})}),e.jsx(f.ActionButton,{action:x,icon:"Trash2",tooltip:s("editor.delete")})]})}):e.jsx(e.Fragment,{})}function ae(){const t=b.useEditableEditor(),i=b.useEditorInstance(),{t:s}=T.useLocale(),{width:n,height:r,src:o}=R.useAttributes(i,H.Iframe.name,{width:0,height:0,src:"",defaultShowPicker:!1}),[l,c]=h.useState(!1),[d,a]=h.useState(""),u=h.useCallback(()=>{c(!1)},[c]);h.useEffect(()=>{l&&a(o)},[l,o]);const p=h.useCallback(()=>{const j=H.getServiceSrc(d);i.chain().updateAttributes(H.Iframe.name,{src:(j==null?void 0:j.src)||d}).setNodeSelection(i.state.selection.from).focus().run(),c(!1)},[i,d,c]),x=h.useCallback(()=>{window.open(o,"_blank")},[o]),g=h.useCallback(()=>{c(!0)},[c]),E=h.useCallback(j=>{i.chain().updateAttributes(H.Iframe.name,j).setNodeSelection(i.state.selection.from).focus().run()},[i]),C=h.useCallback(()=>i.isActive(H.Iframe.name)&&!o,[i,o]),I=h.useCallback(()=>$.deleteNode(H.Iframe.name,i),[i]);return t?e.jsxs(e.Fragment,{children:[e.jsx(O,{editor:i,shouldShow:C,options:{placement:"bottom",offset:8,flip:!0},children:e.jsxs("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:[e.jsx(f.ActionButton,{action:x,icon:"Eye",tooltip:"Visit Link"}),e.jsx(f.ActionButton,{action:g,icon:"Pencil",tooltip:"Open Edit Link"}),e.jsx(yt,{height:r,onOk:E,width:n,children:e.jsx(f.ActionButton,{icon:"Settings",tooltip:s("editor.settings")})}),e.jsx(f.ActionButton,{action:I,icon:"Trash2",tooltip:s("editor.delete")})]})}),e.jsxs(y.Dialog,{onOpenChange:c,open:l,children:[e.jsx(y.DialogTrigger,{}),e.jsxs(y.DialogContent,{children:[e.jsx(y.DialogHeader,{children:e.jsx(y.DialogTitle,{children:"Edit Link Iframe"})}),e.jsx(Z.Input,{autoFocus:!0,onInput:j=>a(j.target.value),placeholder:"Enter link",type:"url",value:d}),e.jsxs(y.DialogFooter,{children:[e.jsx(z.Button,{onClick:u,children:"Cancel"}),e.jsx(z.Button,{onClick:p,children:"OK"})]})]})]})]}):e.jsx(e.Fragment,{})}function de({children:t,visible:i,toggleVisible:s}){const{t:n}=T.useLocale(),r=b.useEditorInstance(),o=R.useAttributes(r,R.Katex.name,{text:"",defaultShowPicker:!1}),{text:l,defaultShowPicker:c}=o,[d,a]=h.useState(l||"");h.useEffect(()=>{i&&a(l||"")},[i]),h.useEffect(()=>{c&&(s(!0),r.chain().updateAttributes(R.Katex.name,{defaultShowPicker:!1}).focus().run())},[r,c,s]);const u=h.useCallback(()=>{r.chain().focus().setKatex({text:d}).run(),a(""),s(!1)},[r,d,s]),p=h.useMemo(()=>{try{return Bt.renderToString(`${d}`)}catch{return d}},[d]),x=h.useMemo(()=>`${d}`.trim()?p:null,[d,p]);return e.jsxs(y.Dialog,{onOpenChange:s,open:i,children:[e.jsx(y.DialogTrigger,{asChild:!0,children:t}),e.jsxs(y.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[e.jsx(y.DialogTitle,{children:n("editor.formula.dialog.text")}),e.jsx("div",{style:{height:"100%",border:"1px solid hsl(var(--border))"},children:e.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[e.jsx(bt.Textarea,{autoFocus:!0,onChange:g=>a(g.target.value),required:!0,value:d,className:"richtext-flex-1",placeholder:"Text",rows:10,style:{color:"hsl(var(--richtext-foreground))"}}),e.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:x||""},style:{height:"100%",borderWidth:1,minHeight:500,background:"#fff"}})]})}),e.jsx(y.DialogFooter,{children:e.jsx(z.Button,{onClick:u,type:"button",children:"Save changes"})})]})]})}function ue(){const t=b.useEditableEditor(),i=b.useEditorInstance(),[s,n]=h.useState(!1),r=h.useCallback(()=>i.isActive(R.Katex.name),[i]),o=h.useCallback(()=>$.deleteNode(R.Katex.name,i),[i]);return t?e.jsx(O,{editor:i,shouldShow:r,options:{placement:"bottom",offset:8,flip:!0},children:e.jsx("div",{className:"richtext-rounded-lg !richtext-border richtext-border-neutral-200 richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black",children:e.jsxs("div",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[6px]",children:[e.jsx(de,{visible:s,toggleVisible:n,children:e.jsx(f.ActionButton,{action:()=>n(!s),tooltip:"Edit",children:e.jsx(dt.Pencil,{size:16})})}),e.jsx(f.ActionButton,{action:o,tooltip:"Delete",children:e.jsx(dt.Trash2,{size:16})})]})})}):e.jsx(e.Fragment,{})}function he(t){const{t:i}=T.useLocale();return e.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-lg !richtext-border richtext-border-neutral-200 richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black",children:e.jsxs("div",{className:"richtext-flex richtext-flex-nowrap",children:[e.jsx(f.ActionButton,{disabled:!(t!=null&&t.link),icon:"ExternalLink",tooltip:i("editor.link.open.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{window.open(t==null?void 0:t.link,"_blank")}}),e.jsx(f.ActionButton,{icon:"Pencil",tooltip:i("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{t==null||t.onEdit()}}),e.jsx(f.ActionButton,{icon:"Unlink",tooltip:i("editor.link.unlink.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{t==null||t.onClear()}})]})})}function pe(){const t=b.useEditableEditor(),i=b.useEditorInstance(),[s,n]=h.useState(!1),r=R.useAttributes(i,X.Link.name),o=r==null?void 0:r.href,l=h.useCallback(({editor:a})=>a.isActive(X.Link.name),[]),c=(a,u,p)=>{const x=i.state.selection,{from:g}=x,E=(u==null?void 0:u.length)??0,C=g+E;i.chain().extendMarkRange("link").insertContent({type:"text",text:u,marks:[{type:"link",attrs:{href:a,target:p?"_blank":""}}]}).setLink({href:a}).setTextSelection({from:g,to:C}).focus().run(),n(!1)},d=h.useCallback(()=>{i.chain().extendMarkRange("link").unsetLink().focus().run(),n(!1)},[i]);return t?e.jsx(O,{editor:i,options:{placement:"bottom",offset:8,flip:!0},shouldShow:l,children:e.jsx(e.Fragment,{children:s?e.jsx(X.LinkEditBlock,{editor:i,onSetLink:c}):e.jsx(he,{editor:i,link:o,onClear:d,onEdit:()=>{n(!0)}})})}):e.jsx(e.Fragment,{})}function nt({item:t,disabled:i,editor:s}){const n=t.component;return n?e.jsx(h.Fragment,{children:t.type==="divider"?e.jsx(D.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):e.jsx(n,{...t.componentProps,disabled:i||(t==null?void 0:t.componentdisabled),editor:s})}):e.jsx(e.Fragment,{})}function fe(t){return t.type.name===Ot.Image.name}function xe(t){return t.type.name===Mt.ImageGif.name}function me(t){return t.type.name===kt.Video.name}function ge(){const{lang:t,t:i}=T.useLocale(),s=b.useEditableEditor(),n=b.useEditorInstance(),r=({editor:l})=>{const{selection:c}=l.view.state,{$from:d,to:a}=c;let u=!1;return l.view.state.doc.nodesBetween(d.pos,a,p=>{if(fe(p))return u=!0,!1}),u},o=h.useMemo(()=>Qt(n,i),[n,t,i]);return s?e.jsx(O,{editor:n,shouldShow:r,options:{placement:"bottom",offset:8,flip:!0},children:o!=null&&o.length?e.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:e.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:o==null?void 0:o.map((l,c)=>e.jsx(nt,{editor:n,item:l},`bubbleMenu-image-${c}`))})}):e.jsx(e.Fragment,{})}):e.jsx(e.Fragment,{})}function be(){const{lang:t,t:i}=T.useLocale(),s=b.useEditableEditor(),n=b.useEditorInstance(),r=({editor:l})=>{const{selection:c}=l.view.state,{$from:d,to:a}=c;let u=!1;return l.view.state.doc.nodesBetween(d.pos,a,p=>{if(xe(p))return u=!0,!1}),u},o=h.useMemo(()=>te(n,i),[n,i,t]);return s?e.jsx(O,{editor:n,shouldShow:r,options:{placement:"bottom",offset:8,flip:!0},children:o!=null&&o.length?e.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:e.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:o==null?void 0:o.map((l,c)=>e.jsx(nt,{editor:n,item:l},`bubbleMenu-image-gif-${c}`))})}):e.jsx(e.Fragment,{})}):e.jsx(e.Fragment,{})}function we(){const{t}=T.useLocale(),i=b.useEditableEditor(),s=b.useEditorInstance(),n=({editor:o})=>{const{selection:l}=o.view.state,{$from:c,to:d}=l;let a=!1;return o.view.state.doc.nodesBetween(c.pos,d,u=>{if(me(u))return a=!0,!1}),a},r=h.useMemo(()=>ne(s,t),[s,t]);return i?e.jsx(O,{editor:s,shouldShow:n,options:{placement:"bottom",offset:8,flip:!0},children:r!=null&&r.length?e.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:e.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:r==null?void 0:r.map((o,l)=>e.jsx(nt,{editor:s,item:o},`bubbleMenu-video-${l}`))})}):e.jsx(e.Fragment,{})}):e.jsx(e.Fragment,{})}const ht=`graph TB
|
|
2
|
+
a-->b`,ve=({editor:t,attrs:i,extension:s})=>{const{alt:n,align:r}=i,[o,l]=h.useState(decodeURIComponent(n??ht)),[c,d]=h.useState(""),[a,u]=h.useState(!1),p=h.useRef(null),[x,g]=h.useState(null),E=s==null?void 0:s.options.upload,C=h.useCallback(A=>{A&&import("mermaid").then(k=>{g(k.default)})},[]),I=async A=>{try{const{svg:k}=await x.render("mermaid-svg",A);d(k)}catch{d("")}},j=()=>{x.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),I(o)};h.useEffect(()=>{x&&a&&j()},[x,a]),h.useEffect(()=>{x&&a&&I(o)},[x,o]);const M=async()=>{if(o!==""){if(o){const A=p.current.querySelector("svg"),{width:k,height:N}=A.getBoundingClientRect(),v=`mermaid-${Y.shortId()}.svg`;let m=Y.i(A.outerHTML);if(E){const w=mt.dataURLtoFile(m,v);m=await E(w)}t==null||t.chain().focus().setMermaid({type:"mermaid",src:m,alt:encodeURIComponent(o),width:k,height:N},!!o).run(),t==null||t.commands.setAlignImageMermaid(r)}u(!1)}};return e.jsxs(y.Dialog,{onOpenChange:u,open:a,children:[e.jsx(y.DialogTrigger,{asChild:!0,children:e.jsx(f.ActionButton,{action:()=>u(!0),icon:"Pencil",tooltip:"Edit Mermaid"})}),e.jsxs(y.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[e.jsx(y.DialogTitle,{children:"Edit Mermaid"}),e.jsx("div",{ref:C,style:{height:"100%",border:"1px solid hsl(var(--border))"},children:e.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[e.jsx(bt.Textarea,{autoFocus:!0,className:"richtext-flex-1",defaultValue:ht,onChange:A=>l(A.target.value),placeholder:"Text",required:!0,rows:10,value:o,style:{color:"hsl(var(--richtext-foreground))"}}),e.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:c},ref:p,style:{height:"100%",border:"1px solid hsl(var(--border))",minHeight:500,background:"#fff"}})]})}),e.jsx(y.DialogFooter,{children:e.jsx(z.Button,{onClick:M,type:"button",children:"Save changes"})})]})]})};function ye({item:t,disabled:i,editor:s}){var r;const n=t.component;return n?e.jsx(h.Fragment,{children:t.type==="divider"?e.jsx(D.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):e.jsx(n,{...t.componentProps,disabled:i||((r=t==null?void 0:t.componentProps)==null?void 0:r.disabled),editor:s})}):e.jsx(e.Fragment,{})}function je(t){return t.type.name===it.Mermaid.name}function Ce(){const{lang:t,t:i}=T.useLocale(),s=b.useEditableEditor(),n=b.useEditorInstance(),r=R.useAttributes(n,it.Mermaid.name),o=gt.useExtension(it.Mermaid.name),l=({editor:d})=>{const{selection:a}=d.view.state,{$from:u,to:p}=a;let x=!1;return d.view.state.doc.nodesBetween(u.pos,p,g=>{if(je(g))return x=!0,!1}),x},c=h.useMemo(()=>ee(n,i),[n,t,i]);return s?e.jsx(O,{editor:n,shouldShow:l,options:{placement:"bottom",offset:8,flip:!0},children:c!=null&&c.length?e.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:e.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:c==null?void 0:c.map((d,a)=>d.type==="edit"&&(r!=null&&r.src)?e.jsx(ve,{attrs:r,editor:n,extension:o},`bubbleMenu-mermaid-${a}`):e.jsx(ye,{editor:n,item:d},`bubbleMenu-mermaid-${a}`))})}):e.jsx(e.Fragment,{})}):e.jsx(e.Fragment,{})}function Ie({hiddenActions:t=[]}){var C,I,j,M,A,k,N,v,m,w,U,V,W,ot,K,st,_,rt;const{t:i}=T.useLocale(),s=b.useEditableEditor(),n=b.useEditorInstance(),r=({editor:J})=>B.isActive(J.view.state,pt.Table.name),o=J=>t.includes(J);function l(){n.chain().focus().addColumnBefore().run()}function c(){n.chain().focus().addColumnAfter().run()}function d(){n.chain().focus().deleteColumn().run()}function a(){n.chain().focus().addRowBefore().run()}function u(){n.chain().focus().addRowAfter().run()}function p(){n.chain().focus().deleteRow().run()}function x(){n.chain().focus().mergeCells().run()}function g(){n==null||n.chain().focus().splitCell().run()}function E(){n.chain().focus().deleteTable().run()}return s?e.jsx(O,{editor:n,options:{placement:"bottom",offset:8,flip:!0},shouldShow:r,updateDelay:0,children:e.jsxs("div",{className:"richtext-flex richtext-size-full richtext-min-w-32 richtext-flex-row richtext-items-center richtext-gap-0.5 richtext-rounded-lg !richtext-border richtext-border-border richtext-bg-background richtext-p-2 richtext-leading-none richtext-shadow-sm",children:[!o("addColumnBefore")&&e.jsx(f.ActionButton,{action:l,disabled:!((I=(C=n==null?void 0:n.can())==null?void 0:C.addColumnBefore)!=null&&I.call(C)),icon:"BetweenHorizonalEnd",tooltip:i("editor.table.menu.insertColumnBefore"),tooltipOptions:{sideOffset:15}}),!o("addColumnAfter")&&e.jsx(f.ActionButton,{action:c,disabled:!((M=(j=n==null?void 0:n.can())==null?void 0:j.addColumnAfter)!=null&&M.call(j)),icon:"BetweenHorizonalStart",tooltip:i("editor.table.menu.insertColumnAfter"),tooltipOptions:{sideOffset:15}}),!o("deleteColumn")&&e.jsx(f.ActionButton,{action:d,disabled:!((k=n==null?void 0:(A=n.can()).deleteColumn)!=null&&k.call(A)),icon:"DeleteColumn",tooltip:i("editor.table.menu.deleteColumn"),tooltipOptions:{sideOffset:15}}),e.jsx(D.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!o("addRowAbove")&&e.jsx(f.ActionButton,{action:a,disabled:!((v=n==null?void 0:(N=n.can()).addRowBefore)!=null&&v.call(N)),icon:"BetweenVerticalEnd",tooltip:i("editor.table.menu.insertRowAbove"),tooltipOptions:{sideOffset:15}}),!o("addRowBelow")&&e.jsx(f.ActionButton,{action:u,disabled:!((w=(m=n==null?void 0:n.can())==null?void 0:m.addRowAfter)!=null&&w.call(m)),icon:"BetweenVerticalStart",tooltip:i("editor.table.menu.insertRowBelow"),tooltipOptions:{sideOffset:15}}),!o("deleteRow")&&e.jsx(f.ActionButton,{action:p,disabled:!((V=(U=n==null?void 0:n.can())==null?void 0:U.deleteRow)!=null&&V.call(U)),icon:"DeleteRow",tooltip:i("editor.table.menu.deleteRow"),tooltipOptions:{sideOffset:15}}),e.jsx(D.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!o("mergeCells")&&e.jsx(f.ActionButton,{action:x,disabled:!((ot=(W=n==null?void 0:n.can())==null?void 0:W.mergeCells)!=null&&ot.call(W)),icon:"TableCellsMerge",tooltip:i("editor.table.menu.mergeCells"),tooltipOptions:{sideOffset:15}}),!o("splitCells")&&e.jsx(f.ActionButton,{action:g,disabled:!((st=(K=n==null?void 0:n.can())==null?void 0:K.splitCell)!=null&&st.call(K)),icon:"TableCellsSplit",tooltip:i("editor.table.menu.splitCells"),tooltipOptions:{sideOffset:15}}),e.jsx(D.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!o("deleteTable")&&e.jsx(f.ActionButton,{action:E,disabled:!((rt=(_=n==null?void 0:n.can())==null?void 0:_.deleteTable)!=null&&rt.call(_)),icon:"Trash2",tooltip:i("editor.table.menu.deleteTable"),tooltipOptions:{sideOffset:15}})]})}):e.jsx(e.Fragment,{})}function Te(){return e.jsxs(e.Fragment,{children:[e.jsx(Rt.RichTextBold,{}),e.jsx(Nt.RichTextItalic,{}),e.jsx(ut.RichTextUnderline,{}),e.jsx(ut.RichTextUnderline,{}),e.jsx(Lt.RichTextStrike,{}),e.jsx(Ut.RichTextCode,{}),e.jsx(X.RichTextLink,{}),e.jsx(D.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),e.jsx(Pt.RichTextColor,{}),e.jsx(Dt.RichTextHighlight,{}),e.jsx(Ht.RichTextAlign,{})]})}function Se({buttonBubble:t}){const i=b.useEditorInstance(),s=b.useEditableEditor(),n=({editor:r})=>{const{selection:o}=r.view.state,{$from:l,to:c}=o;return l.pos===c?!1:o instanceof q.TextSelection};return s?e.jsx(O,{editor:i,options:{placement:"bottom",offset:8,flip:!0},shouldShow:n,children:t?e.jsx(e.Fragment,{children:t}):e.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:e.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-gap-[4px] richtext-whitespace-nowrap",children:e.jsx(Te,{})})})}):e.jsx(e.Fragment,{})}function Ee(){const{t}=T.useLocale(),i=b.useEditableEditor(),s=b.useEditorInstance(),[n,r]=h.useState(!1),o=h.useCallback(({editor:d})=>d.isActive(et.Twitter.name),[]),l=d=>{s.commands.updateTweet({src:d}),r(!1)},c=h.useCallback(()=>$.deleteNode(et.Twitter.name,s),[s]);return i?e.jsx(O,{editor:s,shouldShow:o,options:{placement:"bottom",offset:8,flip:!0},children:e.jsx(e.Fragment,{children:n?e.jsx(et.FormEditLinkTwitter,{editor:s,onSetLink:l}):e.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-lg !richtext-border richtext-border-neutral-200 richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black",children:e.jsxs("div",{className:"richtext-flex richtext-flex-nowrap",children:[e.jsx(f.ActionButton,{icon:"Pencil",tooltip:t("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{r(!0)}}),e.jsx(f.ActionButton,{action:c,icon:"Trash",tooltip:t("editor.delete"),tooltipOptions:{sideOffset:15}})]})})})}):e.jsx(e.Fragment,{})}exports.RichTextBubbleColumns=$t;exports.RichTextBubbleDrawer=se;exports.RichTextBubbleExcalidraw=ce;exports.RichTextBubbleIframe=ae;exports.RichTextBubbleImage=ge;exports.RichTextBubbleImageGif=be;exports.RichTextBubbleKatex=ue;exports.RichTextBubbleLink=pe;exports.RichTextBubbleMermaid=Ce;exports.RichTextBubbleTable=Ie;exports.RichTextBubbleText=Se;exports.RichTextBubbleTwitter=Ee;exports.RichTextBubbleVideo=we;
|