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/bubble.js
ADDED
|
@@ -0,0 +1,1925 @@
|
|
|
1
|
+
import { jsx as i, Fragment as x, jsxs as v } from "react/jsx-runtime";
|
|
2
|
+
import yt, { useRef as L, useEffect as k, useCallback as w, useState as P, useMemo as z, Fragment as ht } from "react";
|
|
3
|
+
import { _ as Kt, d as Ct, E as Tt, $ as qt, a0 as jt, a1 as q, a2 as Gt } from "./index-DnWWK9F_.js";
|
|
4
|
+
import { f as It, s as St, o as Ot, a as Mt, b as At, d as Ut, h as Et, i as Pt, c as kt } from "./floating-ui.dom-U1vPFQ5f.js";
|
|
5
|
+
import { Plugin as Rt, PluginKey as Bt, NodeSelection as Xt, TextSelection as Yt } from "@tiptap/pm/state";
|
|
6
|
+
import { C as Zt, T as Jt } from "./Table-Db8TcQX8.js";
|
|
7
|
+
import { u as Dt } from "./index-DzcKxutn.js";
|
|
8
|
+
import { createPortal as Nt } from "react-dom";
|
|
9
|
+
import { A as p } from "./toggle-Cdp4IT2U.js";
|
|
10
|
+
import { MultipleColumnNode as mt } from "./Column.js";
|
|
11
|
+
import { u as A, r as Q, V as gt } from "./index-DYkucCoF.js";
|
|
12
|
+
import { d as j } from "./delete-node-IyVmiRbI.js";
|
|
13
|
+
import { e as U, a as M } from "./index-BPfVXs5_.js";
|
|
14
|
+
import { C as Qt, D as lt } from "./Drawer-DZ5jvmrX.js";
|
|
15
|
+
import { Editor as te, makeDropdownToolbar as ee } from "easydrawer";
|
|
16
|
+
import { s as Ht, i as zt } from "./shortId-WJVkrvml.js";
|
|
17
|
+
import { D as et, a as it, b as nt, c as ot, d as rt, e as ie } from "./dialog-PtQivpHS.js";
|
|
18
|
+
import { d as Lt } from "./file-BLas99n7.js";
|
|
19
|
+
import { B as $ } from "./button-DXMsXUEn.js";
|
|
20
|
+
import { u as V, K as tt } from "./Katex-DsYXsjSS.js";
|
|
21
|
+
import { d as $t } from "./useButtonProps-BsEd4zYM.js";
|
|
22
|
+
import { S as H } from "./separator-CuBW_w98.js";
|
|
23
|
+
import { L as at } from "./label-CGdLYWv7.js";
|
|
24
|
+
import { P as ne, a as oe, b as re } from "./popover-CAuEW0Mr.js";
|
|
25
|
+
import { I as J } from "./input-wJ9PDEzZ.js";
|
|
26
|
+
import { E as F, t as se } from "./Excalidraw-DwBRXEtC.js";
|
|
27
|
+
import { I as _, g as le } from "./Iframe-CmXkEqOd.js";
|
|
28
|
+
import ae from "katex";
|
|
29
|
+
import { Pencil as ce, Trash2 as he } from "lucide-react";
|
|
30
|
+
import { T as Vt } from "./textarea-DUUM1jZd.js";
|
|
31
|
+
import { L as xt, a as de, R as ue } from "./LinkEditBlock-CB8yIffE.js";
|
|
32
|
+
import { Image as pe } from "./Image.js";
|
|
33
|
+
import { ImageGif as fe } from "./ImageGif.js";
|
|
34
|
+
import { Video as me } from "./Video.js";
|
|
35
|
+
import { Mermaid as ct } from "./Mermaid.js";
|
|
36
|
+
import { RichTextBold as ge } from "./Bold.js";
|
|
37
|
+
import { RichTextCode as xe } from "./Code.js";
|
|
38
|
+
import "./index-D2TUfKkC.js";
|
|
39
|
+
import { RichTextColor as be } from "./Color.js";
|
|
40
|
+
import { RichTextHighlight as we } from "./Highlight.js";
|
|
41
|
+
import { RichTextItalic as ve } from "./Italic.js";
|
|
42
|
+
import { RichTextStrike as ye } from "./Strike.js";
|
|
43
|
+
import { RichTextAlign as Ce } from "./TextAlign.js";
|
|
44
|
+
import { RichTextUnderline as bt } from "./TextUnderline.js";
|
|
45
|
+
import { T as wt, F as Te } from "./Twitter-CXmmjz9R.js";
|
|
46
|
+
function Ie(t, e) {
|
|
47
|
+
const r = Math.min(t.top, e.top), n = Math.max(t.bottom, e.bottom), s = Math.min(t.left, e.left), l = Math.max(t.right, e.right) - s, a = n - r, h = s, c = r;
|
|
48
|
+
return new DOMRect(h, c, l, a);
|
|
49
|
+
}
|
|
50
|
+
var Se = class {
|
|
51
|
+
constructor({
|
|
52
|
+
editor: t,
|
|
53
|
+
element: e,
|
|
54
|
+
view: r,
|
|
55
|
+
updateDelay: n = 250,
|
|
56
|
+
resizeDelay: s = 60,
|
|
57
|
+
shouldShow: o,
|
|
58
|
+
appendTo: l,
|
|
59
|
+
getReferencedVirtualElement: a,
|
|
60
|
+
options: h
|
|
61
|
+
}) {
|
|
62
|
+
this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.floatingUIOptions = {
|
|
63
|
+
strategy: "absolute",
|
|
64
|
+
placement: "top",
|
|
65
|
+
offset: 8,
|
|
66
|
+
flip: {},
|
|
67
|
+
shift: {},
|
|
68
|
+
arrow: !1,
|
|
69
|
+
size: !1,
|
|
70
|
+
autoPlacement: !1,
|
|
71
|
+
hide: !1,
|
|
72
|
+
inline: !1,
|
|
73
|
+
onShow: void 0,
|
|
74
|
+
onHide: void 0,
|
|
75
|
+
onUpdate: void 0,
|
|
76
|
+
onDestroy: void 0
|
|
77
|
+
}, this.shouldShow = ({ view: d, state: u, from: f, to: g }) => {
|
|
78
|
+
const { doc: S, selection: T } = u, { empty: I } = T, C = !S.textBetween(f, g).length && Kt(u.selection), R = this.element.contains(document.activeElement);
|
|
79
|
+
return !(!(d.hasFocus() || R) || I || C || !this.editor.isEditable);
|
|
80
|
+
}, this.mousedownHandler = () => {
|
|
81
|
+
this.preventHide = !0;
|
|
82
|
+
}, this.dragstartHandler = () => {
|
|
83
|
+
this.hide();
|
|
84
|
+
}, this.resizeHandler = () => {
|
|
85
|
+
this.resizeDebounceTimer && clearTimeout(this.resizeDebounceTimer), this.resizeDebounceTimer = window.setTimeout(() => {
|
|
86
|
+
this.updatePosition();
|
|
87
|
+
}, this.resizeDelay);
|
|
88
|
+
}, this.focusHandler = () => {
|
|
89
|
+
setTimeout(() => this.update(this.editor.view));
|
|
90
|
+
}, this.blurHandler = ({ event: d }) => {
|
|
91
|
+
var u;
|
|
92
|
+
if (this.editor.isDestroyed) {
|
|
93
|
+
this.destroy();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (this.preventHide) {
|
|
97
|
+
this.preventHide = !1;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
d != null && d.relatedTarget && ((u = this.element.parentNode) != null && u.contains(d.relatedTarget)) || (d == null ? void 0 : d.relatedTarget) !== this.editor.view.dom && this.hide();
|
|
101
|
+
}, this.handleDebouncedUpdate = (d, u) => {
|
|
102
|
+
const f = !(u != null && u.selection.eq(d.state.selection)), g = !(u != null && u.doc.eq(d.state.doc));
|
|
103
|
+
!f && !g || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
|
|
104
|
+
this.updateHandler(d, f, g, u);
|
|
105
|
+
}, this.updateDelay));
|
|
106
|
+
}, this.updateHandler = (d, u, f, g) => {
|
|
107
|
+
const { composing: S } = d;
|
|
108
|
+
if (S || !u && !f)
|
|
109
|
+
return;
|
|
110
|
+
if (!this.getShouldShow(g)) {
|
|
111
|
+
this.hide();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
this.updatePosition(), this.show();
|
|
115
|
+
}, this.transactionHandler = ({ transaction: d }) => {
|
|
116
|
+
d.getMeta("bubbleMenu") === "updatePosition" && this.updatePosition();
|
|
117
|
+
};
|
|
118
|
+
var c;
|
|
119
|
+
this.editor = t, this.element = e, this.view = r, this.updateDelay = n, this.resizeDelay = s, this.appendTo = l, this.scrollTarget = (c = h == null ? void 0 : h.scrollTarget) != null ? c : window, this.getReferencedVirtualElement = a, this.floatingUIOptions = {
|
|
120
|
+
...this.floatingUIOptions,
|
|
121
|
+
...h
|
|
122
|
+
}, 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(r, r.state), this.getShouldShow() && (this.show(), this.updatePosition());
|
|
123
|
+
}
|
|
124
|
+
get middlewares() {
|
|
125
|
+
const t = [];
|
|
126
|
+
return this.floatingUIOptions.flip && t.push(It(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && t.push(
|
|
127
|
+
St(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
|
|
128
|
+
), this.floatingUIOptions.offset && t.push(
|
|
129
|
+
Ot(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
|
|
130
|
+
), this.floatingUIOptions.arrow && t.push(Mt(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && t.push(At(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && t.push(
|
|
131
|
+
Ut(
|
|
132
|
+
typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0
|
|
133
|
+
)
|
|
134
|
+
), this.floatingUIOptions.hide && t.push(Et(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && t.push(
|
|
135
|
+
Pt(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
|
|
136
|
+
), t;
|
|
137
|
+
}
|
|
138
|
+
get virtualElement() {
|
|
139
|
+
var t;
|
|
140
|
+
const { selection: e } = this.editor.state, r = (t = this.getReferencedVirtualElement) == null ? void 0 : t.call(this);
|
|
141
|
+
if (r)
|
|
142
|
+
return r;
|
|
143
|
+
const n = Ct(this.view, e.from, e.to);
|
|
144
|
+
let s = {
|
|
145
|
+
getBoundingClientRect: () => n,
|
|
146
|
+
getClientRects: () => [n]
|
|
147
|
+
};
|
|
148
|
+
if (e instanceof Xt) {
|
|
149
|
+
let o = this.view.nodeDOM(e.from);
|
|
150
|
+
const l = o.dataset.nodeViewWrapper ? o : o.querySelector("[data-node-view-wrapper]");
|
|
151
|
+
l && (o = l), o && (s = {
|
|
152
|
+
getBoundingClientRect: () => o.getBoundingClientRect(),
|
|
153
|
+
getClientRects: () => [o.getBoundingClientRect()]
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (e instanceof Zt) {
|
|
157
|
+
const { $anchorCell: o, $headCell: l } = e, a = o ? o.pos : l.pos, h = l ? l.pos : o.pos, c = this.view.nodeDOM(a), d = this.view.nodeDOM(h);
|
|
158
|
+
if (!c || !d)
|
|
159
|
+
return;
|
|
160
|
+
const u = c === d ? c.getBoundingClientRect() : Ie(
|
|
161
|
+
c.getBoundingClientRect(),
|
|
162
|
+
d.getBoundingClientRect()
|
|
163
|
+
);
|
|
164
|
+
s = {
|
|
165
|
+
getBoundingClientRect: () => u,
|
|
166
|
+
getClientRects: () => [u]
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
return s;
|
|
170
|
+
}
|
|
171
|
+
updatePosition() {
|
|
172
|
+
const t = this.virtualElement;
|
|
173
|
+
t && kt(t, this.element, {
|
|
174
|
+
placement: this.floatingUIOptions.placement,
|
|
175
|
+
strategy: this.floatingUIOptions.strategy,
|
|
176
|
+
middleware: this.middlewares
|
|
177
|
+
}).then(({ x: e, y: r, strategy: n }) => {
|
|
178
|
+
this.element.style.width = "max-content", this.element.style.position = n, this.element.style.left = `${e}px`, this.element.style.top = `${r}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
update(t, e) {
|
|
182
|
+
const { state: r } = t, n = r.selection.from !== r.selection.to;
|
|
183
|
+
if (this.updateDelay > 0 && n) {
|
|
184
|
+
this.handleDebouncedUpdate(t, e);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const s = !(e != null && e.selection.eq(t.state.selection)), o = !(e != null && e.doc.eq(t.state.doc));
|
|
188
|
+
this.updateHandler(t, s, o, e);
|
|
189
|
+
}
|
|
190
|
+
getShouldShow(t) {
|
|
191
|
+
var e;
|
|
192
|
+
const { state: r } = this.view, { selection: n } = r, { ranges: s } = n, o = Math.min(...s.map((h) => h.$from.pos)), l = Math.max(...s.map((h) => h.$to.pos));
|
|
193
|
+
return ((e = this.shouldShow) == null ? void 0 : e.call(this, {
|
|
194
|
+
editor: this.editor,
|
|
195
|
+
element: this.element,
|
|
196
|
+
view: this.view,
|
|
197
|
+
state: r,
|
|
198
|
+
oldState: t,
|
|
199
|
+
from: o,
|
|
200
|
+
to: l
|
|
201
|
+
})) || !1;
|
|
202
|
+
}
|
|
203
|
+
show() {
|
|
204
|
+
var t;
|
|
205
|
+
if (this.isVisible)
|
|
206
|
+
return;
|
|
207
|
+
this.element.style.visibility = "visible", this.element.style.opacity = "1";
|
|
208
|
+
const e = typeof this.appendTo == "function" ? this.appendTo() : this.appendTo;
|
|
209
|
+
(t = e ?? this.view.dom.parentElement) == null || t.appendChild(this.element), this.floatingUIOptions.onShow && this.floatingUIOptions.onShow(), this.isVisible = !0;
|
|
210
|
+
}
|
|
211
|
+
hide() {
|
|
212
|
+
this.isVisible && (this.element.style.visibility = "hidden", this.element.style.opacity = "0", this.element.remove(), this.floatingUIOptions.onHide && this.floatingUIOptions.onHide(), this.isVisible = !1);
|
|
213
|
+
}
|
|
214
|
+
destroy() {
|
|
215
|
+
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();
|
|
216
|
+
}
|
|
217
|
+
}, Wt = (t) => new Rt({
|
|
218
|
+
key: typeof t.pluginKey == "string" ? new Bt(t.pluginKey) : t.pluginKey,
|
|
219
|
+
view: (e) => new Se({ view: e, ...t })
|
|
220
|
+
});
|
|
221
|
+
Tt.create({
|
|
222
|
+
name: "bubbleMenu",
|
|
223
|
+
addOptions() {
|
|
224
|
+
return {
|
|
225
|
+
element: null,
|
|
226
|
+
pluginKey: "bubbleMenu",
|
|
227
|
+
updateDelay: void 0,
|
|
228
|
+
appendTo: void 0,
|
|
229
|
+
shouldShow: null
|
|
230
|
+
};
|
|
231
|
+
},
|
|
232
|
+
addProseMirrorPlugins() {
|
|
233
|
+
return this.options.element ? [
|
|
234
|
+
Wt({
|
|
235
|
+
pluginKey: this.options.pluginKey,
|
|
236
|
+
editor: this.editor,
|
|
237
|
+
element: this.options.element,
|
|
238
|
+
updateDelay: this.options.updateDelay,
|
|
239
|
+
options: this.options.options,
|
|
240
|
+
appendTo: this.options.appendTo,
|
|
241
|
+
getReferencedVirtualElement: this.options.getReferencedVirtualElement,
|
|
242
|
+
shouldShow: this.options.shouldShow
|
|
243
|
+
})
|
|
244
|
+
] : [];
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
var Oe = class {
|
|
248
|
+
constructor({ editor: t, element: e, view: r, options: n, appendTo: s, shouldShow: o }) {
|
|
249
|
+
this.preventHide = !1, this.isVisible = !1, this.shouldShow = ({ view: l, state: a }) => {
|
|
250
|
+
const { selection: h } = a, { $anchor: c, empty: d } = h, u = c.depth === 1, f = c.parent.isTextblock && !c.parent.type.spec.code && !c.parent.textContent && c.parent.childCount === 0 && !this.getTextContent(c.parent);
|
|
251
|
+
return !(!l.hasFocus() || !d || !u || !f || !this.editor.isEditable);
|
|
252
|
+
}, this.floatingUIOptions = {
|
|
253
|
+
strategy: "absolute",
|
|
254
|
+
placement: "right",
|
|
255
|
+
offset: 8,
|
|
256
|
+
flip: {},
|
|
257
|
+
shift: {},
|
|
258
|
+
arrow: !1,
|
|
259
|
+
size: !1,
|
|
260
|
+
autoPlacement: !1,
|
|
261
|
+
hide: !1,
|
|
262
|
+
inline: !1
|
|
263
|
+
}, this.updateHandler = (l, a, h, c) => {
|
|
264
|
+
const { composing: d } = l;
|
|
265
|
+
if (d || !a && !h)
|
|
266
|
+
return;
|
|
267
|
+
if (!this.getShouldShow(c)) {
|
|
268
|
+
this.hide();
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
this.updatePosition(), this.show();
|
|
272
|
+
}, this.mousedownHandler = () => {
|
|
273
|
+
this.preventHide = !0;
|
|
274
|
+
}, this.focusHandler = () => {
|
|
275
|
+
setTimeout(() => this.update(this.editor.view));
|
|
276
|
+
}, this.blurHandler = ({ event: l }) => {
|
|
277
|
+
var a;
|
|
278
|
+
if (this.preventHide) {
|
|
279
|
+
this.preventHide = !1;
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
l != null && l.relatedTarget && ((a = this.element.parentNode) != null && a.contains(l.relatedTarget)) || (l == null ? void 0 : l.relatedTarget) !== this.editor.view.dom && this.hide();
|
|
283
|
+
}, this.editor = t, this.element = e, this.view = r, this.appendTo = s, this.floatingUIOptions = {
|
|
284
|
+
...this.floatingUIOptions,
|
|
285
|
+
...n
|
|
286
|
+
}, 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(r, r.state), this.getShouldShow() && (this.show(), this.updatePosition());
|
|
287
|
+
}
|
|
288
|
+
getTextContent(t) {
|
|
289
|
+
return qt(t, { textSerializers: jt(this.editor.schema) });
|
|
290
|
+
}
|
|
291
|
+
get middlewares() {
|
|
292
|
+
const t = [];
|
|
293
|
+
return this.floatingUIOptions.flip && t.push(It(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && t.push(
|
|
294
|
+
St(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
|
|
295
|
+
), this.floatingUIOptions.offset && t.push(
|
|
296
|
+
Ot(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
|
|
297
|
+
), this.floatingUIOptions.arrow && t.push(Mt(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && t.push(At(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && t.push(
|
|
298
|
+
Ut(
|
|
299
|
+
typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0
|
|
300
|
+
)
|
|
301
|
+
), this.floatingUIOptions.hide && t.push(Et(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && t.push(
|
|
302
|
+
Pt(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
|
|
303
|
+
), t;
|
|
304
|
+
}
|
|
305
|
+
getShouldShow(t) {
|
|
306
|
+
var e;
|
|
307
|
+
const { state: r } = this.view, { selection: n } = r, { ranges: s } = n, o = Math.min(...s.map((h) => h.$from.pos)), l = Math.max(...s.map((h) => h.$to.pos));
|
|
308
|
+
return (e = this.shouldShow) == null ? void 0 : e.call(this, {
|
|
309
|
+
editor: this.editor,
|
|
310
|
+
view: this.view,
|
|
311
|
+
state: r,
|
|
312
|
+
oldState: t,
|
|
313
|
+
from: o,
|
|
314
|
+
to: l
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
updatePosition() {
|
|
318
|
+
const { selection: t } = this.editor.state, e = Ct(this.view, t.from, t.to);
|
|
319
|
+
kt({
|
|
320
|
+
getBoundingClientRect: () => e,
|
|
321
|
+
getClientRects: () => [e]
|
|
322
|
+
}, this.element, {
|
|
323
|
+
placement: this.floatingUIOptions.placement,
|
|
324
|
+
strategy: this.floatingUIOptions.strategy,
|
|
325
|
+
middleware: this.middlewares
|
|
326
|
+
}).then(({ x: n, y: s, strategy: o }) => {
|
|
327
|
+
this.element.style.width = "max-content", this.element.style.position = o, this.element.style.left = `${n}px`, this.element.style.top = `${s}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
update(t, e) {
|
|
331
|
+
const r = !(e != null && e.selection.eq(t.state.selection)), n = !(e != null && e.doc.eq(t.state.doc));
|
|
332
|
+
this.updateHandler(t, r, n, e);
|
|
333
|
+
}
|
|
334
|
+
show() {
|
|
335
|
+
var t;
|
|
336
|
+
if (this.isVisible)
|
|
337
|
+
return;
|
|
338
|
+
this.element.style.visibility = "visible", this.element.style.opacity = "1";
|
|
339
|
+
const e = typeof this.appendTo == "function" ? this.appendTo() : this.appendTo;
|
|
340
|
+
(t = e ?? this.view.dom.parentElement) == null || t.appendChild(this.element), this.floatingUIOptions.onShow && this.floatingUIOptions.onShow(), this.isVisible = !0;
|
|
341
|
+
}
|
|
342
|
+
hide() {
|
|
343
|
+
this.isVisible && (this.element.style.visibility = "hidden", this.element.style.opacity = "0", this.element.remove(), this.floatingUIOptions.onHide && this.floatingUIOptions.onHide(), this.isVisible = !1);
|
|
344
|
+
}
|
|
345
|
+
destroy() {
|
|
346
|
+
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();
|
|
347
|
+
}
|
|
348
|
+
}, Ft = (t) => new Rt({
|
|
349
|
+
key: typeof t.pluginKey == "string" ? new Bt(t.pluginKey) : t.pluginKey,
|
|
350
|
+
view: (e) => new Oe({ view: e, ...t })
|
|
351
|
+
});
|
|
352
|
+
Tt.create({
|
|
353
|
+
name: "floatingMenu",
|
|
354
|
+
addOptions() {
|
|
355
|
+
return {
|
|
356
|
+
element: null,
|
|
357
|
+
options: {},
|
|
358
|
+
pluginKey: "floatingMenu",
|
|
359
|
+
appendTo: void 0,
|
|
360
|
+
shouldShow: null
|
|
361
|
+
};
|
|
362
|
+
},
|
|
363
|
+
addProseMirrorPlugins() {
|
|
364
|
+
return this.options.element ? [
|
|
365
|
+
Ft({
|
|
366
|
+
pluginKey: this.options.pluginKey,
|
|
367
|
+
editor: this.editor,
|
|
368
|
+
element: this.options.element,
|
|
369
|
+
options: this.options.options,
|
|
370
|
+
appendTo: this.options.appendTo,
|
|
371
|
+
shouldShow: this.options.shouldShow
|
|
372
|
+
})
|
|
373
|
+
] : [];
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
var E = yt.forwardRef(
|
|
377
|
+
({
|
|
378
|
+
pluginKey: t = "bubbleMenu",
|
|
379
|
+
editor: e,
|
|
380
|
+
updateDelay: r,
|
|
381
|
+
resizeDelay: n,
|
|
382
|
+
appendTo: s,
|
|
383
|
+
shouldShow: o = null,
|
|
384
|
+
getReferencedVirtualElement: l,
|
|
385
|
+
options: a,
|
|
386
|
+
children: h,
|
|
387
|
+
...c
|
|
388
|
+
}, d) => {
|
|
389
|
+
const u = L(document.createElement("div"));
|
|
390
|
+
typeof d == "function" ? d(u.current) : d && (d.current = u.current);
|
|
391
|
+
const { editor: f } = Dt(), g = e || f, S = {
|
|
392
|
+
updateDelay: r,
|
|
393
|
+
resizeDelay: n,
|
|
394
|
+
appendTo: s,
|
|
395
|
+
pluginKey: t,
|
|
396
|
+
shouldShow: o,
|
|
397
|
+
getReferencedVirtualElement: l,
|
|
398
|
+
options: a
|
|
399
|
+
}, T = L(S);
|
|
400
|
+
return T.current = S, k(() => {
|
|
401
|
+
if (g != null && g.isDestroyed)
|
|
402
|
+
return;
|
|
403
|
+
if (!g) {
|
|
404
|
+
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
const I = u.current;
|
|
408
|
+
I.style.visibility = "hidden", I.style.position = "absolute";
|
|
409
|
+
const C = Wt({
|
|
410
|
+
...T.current,
|
|
411
|
+
editor: g,
|
|
412
|
+
element: I
|
|
413
|
+
});
|
|
414
|
+
g.registerPlugin(C);
|
|
415
|
+
const R = T.current.pluginKey;
|
|
416
|
+
return () => {
|
|
417
|
+
g.unregisterPlugin(R), window.requestAnimationFrame(() => {
|
|
418
|
+
I.parentNode && I.parentNode.removeChild(I);
|
|
419
|
+
});
|
|
420
|
+
};
|
|
421
|
+
}, [g]), Nt(/* @__PURE__ */ i("div", { ...c, children: h }), u.current);
|
|
422
|
+
}
|
|
423
|
+
);
|
|
424
|
+
yt.forwardRef(
|
|
425
|
+
({ pluginKey: t = "floatingMenu", editor: e, appendTo: r, shouldShow: n = null, options: s, children: o, ...l }, a) => {
|
|
426
|
+
const h = L(document.createElement("div"));
|
|
427
|
+
typeof a == "function" ? a(h.current) : a && (a.current = h.current);
|
|
428
|
+
const { editor: c } = Dt();
|
|
429
|
+
return k(() => {
|
|
430
|
+
const d = h.current;
|
|
431
|
+
if (d.style.visibility = "hidden", d.style.position = "absolute", e != null && e.isDestroyed || c != null && c.isDestroyed)
|
|
432
|
+
return;
|
|
433
|
+
const u = e || c;
|
|
434
|
+
if (!u) {
|
|
435
|
+
console.warn(
|
|
436
|
+
"FloatingMenu component is not rendered inside of an editor component or does not have editor prop."
|
|
437
|
+
);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
const f = Ft({
|
|
441
|
+
editor: u,
|
|
442
|
+
element: d,
|
|
443
|
+
pluginKey: t,
|
|
444
|
+
appendTo: r,
|
|
445
|
+
shouldShow: n,
|
|
446
|
+
options: s
|
|
447
|
+
});
|
|
448
|
+
return u.registerPlugin(f), () => {
|
|
449
|
+
u.unregisterPlugin(t), window.requestAnimationFrame(() => {
|
|
450
|
+
d.parentNode && d.parentNode.removeChild(d);
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
}, [e, c, r, t, n, s]), Nt(/* @__PURE__ */ i("div", { ...l, children: o }), h.current);
|
|
454
|
+
}
|
|
455
|
+
);
|
|
456
|
+
function _i() {
|
|
457
|
+
const t = U(), e = M(), { t: r } = A(), n = w(() => e.isActive(mt.name), [e]), s = w(() => j(mt.name, e), [e]), o = w(() => e.chain().focus().addColBefore().run(), [e]), l = w(() => e.chain().focus().addColAfter().run(), [e]), a = w(() => e.chain().focus().deleteCol().run(), [e]);
|
|
458
|
+
return t ? /* @__PURE__ */ i(
|
|
459
|
+
E,
|
|
460
|
+
{
|
|
461
|
+
editor: e,
|
|
462
|
+
shouldShow: n,
|
|
463
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
464
|
+
children: /* @__PURE__ */ v("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: [
|
|
465
|
+
/* @__PURE__ */ i(
|
|
466
|
+
p,
|
|
467
|
+
{
|
|
468
|
+
action: o,
|
|
469
|
+
icon: "ColumnAddLeft",
|
|
470
|
+
tooltip: r("editor.table.menu.insertColumnBefore")
|
|
471
|
+
}
|
|
472
|
+
),
|
|
473
|
+
/* @__PURE__ */ i(
|
|
474
|
+
p,
|
|
475
|
+
{
|
|
476
|
+
action: l,
|
|
477
|
+
icon: "ColumnAddRight",
|
|
478
|
+
tooltip: r("editor.table.menu.insertColumnAfter")
|
|
479
|
+
}
|
|
480
|
+
),
|
|
481
|
+
/* @__PURE__ */ i(
|
|
482
|
+
p,
|
|
483
|
+
{
|
|
484
|
+
action: a,
|
|
485
|
+
icon: "DeleteColumn",
|
|
486
|
+
tooltip: r("editor.table.menu.deleteColumn")
|
|
487
|
+
}
|
|
488
|
+
),
|
|
489
|
+
/* @__PURE__ */ i(
|
|
490
|
+
p,
|
|
491
|
+
{
|
|
492
|
+
action: s,
|
|
493
|
+
icon: "Trash2",
|
|
494
|
+
tooltip: r("editor.table.menu.delete_column")
|
|
495
|
+
}
|
|
496
|
+
)
|
|
497
|
+
] })
|
|
498
|
+
}
|
|
499
|
+
) : /* @__PURE__ */ i(x, {});
|
|
500
|
+
}
|
|
501
|
+
let K = !1;
|
|
502
|
+
function Me({ editor: t, attrs: e, extension: r }) {
|
|
503
|
+
const [n, s] = P(!1), o = L(null), l = L(null), { alt: a, align: h } = e, c = r == null ? void 0 : r.options.upload, d = () => {
|
|
504
|
+
(async () => {
|
|
505
|
+
const m = document.querySelector("#easydrawer");
|
|
506
|
+
m && (o.current = new te(m, {
|
|
507
|
+
wheelEventsEnabled: !1,
|
|
508
|
+
disableZoom: !0
|
|
509
|
+
}), l.current = ee(o.current), l.current.addDefaultToolWidgets(), o.current.loadFromSVG(decodeURIComponent(a)));
|
|
510
|
+
})();
|
|
511
|
+
};
|
|
512
|
+
k(() => {
|
|
513
|
+
n && setTimeout(() => {
|
|
514
|
+
d();
|
|
515
|
+
}, 200);
|
|
516
|
+
}, [n]);
|
|
517
|
+
const u = async () => {
|
|
518
|
+
if (o.current) {
|
|
519
|
+
const y = o.current.toSVG(), m = y.outerHTML, b = `drawer-${Ht()}.svg`;
|
|
520
|
+
let D = zt(y.outerHTML);
|
|
521
|
+
if (c) {
|
|
522
|
+
const G = Lt(D, b);
|
|
523
|
+
D = await c(G);
|
|
524
|
+
}
|
|
525
|
+
t == null || t.chain().focus().setDrawer(
|
|
526
|
+
{
|
|
527
|
+
type: "drawer",
|
|
528
|
+
src: D,
|
|
529
|
+
alt: encodeURIComponent(m),
|
|
530
|
+
width: 426,
|
|
531
|
+
height: 212
|
|
532
|
+
},
|
|
533
|
+
!!m
|
|
534
|
+
).run(), t == null || t.commands.setAlignImageDrawer(h);
|
|
535
|
+
}
|
|
536
|
+
s(!1);
|
|
537
|
+
}, f = (y) => {
|
|
538
|
+
const m = o.current.toolController.getPrimaryTools()[2], b = l.current.getWidgetById("pen-1");
|
|
539
|
+
m && b && (m.setColor(y), b.serializeState());
|
|
540
|
+
}, g = (y) => {
|
|
541
|
+
const m = o.current.toolController.getPrimaryTools()[2], b = l.current.getWidgetById("pen-1");
|
|
542
|
+
m && b && (m.setThickness(y), b.serializeState());
|
|
543
|
+
}, S = (y) => {
|
|
544
|
+
const m = o.current.toolController.getPrimaryTools()[3], b = l.current.getWidgetById("pen-2");
|
|
545
|
+
m && b && (m.setColor(y), b.serializeState());
|
|
546
|
+
}, T = (y) => {
|
|
547
|
+
const m = l.current.getWidgetById("shape");
|
|
548
|
+
m && m.setShapeType(y);
|
|
549
|
+
}, I = (y) => {
|
|
550
|
+
const m = o.current.toolController.getPrimaryTools()[5], b = l.current.getWidgetById("shape");
|
|
551
|
+
m && b && (m.setColor(y), b.serializeState());
|
|
552
|
+
}, C = (y) => {
|
|
553
|
+
const m = o.current.toolController.getPrimaryTools()[5], b = l.current.getWidgetById("shape");
|
|
554
|
+
m && b && (m.setThickness(y), b.serializeState());
|
|
555
|
+
}, R = (y) => {
|
|
556
|
+
const m = o.current.toolController.getPrimaryTools()[5], b = l.current.getWidgetById("shape");
|
|
557
|
+
m && b && (m.setBorderColor(y), b.serializeState());
|
|
558
|
+
}, O = () => {
|
|
559
|
+
if (K) {
|
|
560
|
+
for (; o.current.history.redoStackSize > 0; )
|
|
561
|
+
o.current.history.redo();
|
|
562
|
+
K = !1;
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
o.current.history.undo();
|
|
566
|
+
};
|
|
567
|
+
return /* @__PURE__ */ v(
|
|
568
|
+
et,
|
|
569
|
+
{
|
|
570
|
+
onOpenChange: s,
|
|
571
|
+
open: n,
|
|
572
|
+
children: [
|
|
573
|
+
/* @__PURE__ */ i(it, { asChild: !0, children: /* @__PURE__ */ i(
|
|
574
|
+
p,
|
|
575
|
+
{
|
|
576
|
+
action: () => s(!0),
|
|
577
|
+
icon: "Pencil",
|
|
578
|
+
tooltip: "Edit Drawer"
|
|
579
|
+
}
|
|
580
|
+
) }),
|
|
581
|
+
/* @__PURE__ */ v(nt, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
|
|
582
|
+
/* @__PURE__ */ i(ot, { children: "Edit Drawer" }),
|
|
583
|
+
/* @__PURE__ */ v("div", { style: { height: "100%", borderWidth: 1, background: "white", position: "relative" }, children: [
|
|
584
|
+
/* @__PURE__ */ i(
|
|
585
|
+
"div",
|
|
586
|
+
{
|
|
587
|
+
className: "richtext-size-full",
|
|
588
|
+
id: "easydrawer"
|
|
589
|
+
}
|
|
590
|
+
),
|
|
591
|
+
/* @__PURE__ */ i(
|
|
592
|
+
Qt,
|
|
593
|
+
{
|
|
594
|
+
changeBorderColorShape: R,
|
|
595
|
+
changeColorShape: I,
|
|
596
|
+
changeShape: T,
|
|
597
|
+
onClear: () => {
|
|
598
|
+
if (!K) {
|
|
599
|
+
for (; o.current.history.undoStackSize > 0; )
|
|
600
|
+
O();
|
|
601
|
+
K = !0;
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
onRedo: () => {
|
|
605
|
+
K || o.current.history.redo();
|
|
606
|
+
},
|
|
607
|
+
onThicknessChange: C,
|
|
608
|
+
onUndo: O,
|
|
609
|
+
refEditor: o,
|
|
610
|
+
setColorHighlight: S,
|
|
611
|
+
setColorPen: f,
|
|
612
|
+
setThicknessPen: g
|
|
613
|
+
}
|
|
614
|
+
)
|
|
615
|
+
] }),
|
|
616
|
+
/* @__PURE__ */ i(rt, { children: /* @__PURE__ */ i(
|
|
617
|
+
$,
|
|
618
|
+
{
|
|
619
|
+
onClick: u,
|
|
620
|
+
type: "button",
|
|
621
|
+
children: "Save changes"
|
|
622
|
+
}
|
|
623
|
+
) })
|
|
624
|
+
] })
|
|
625
|
+
]
|
|
626
|
+
}
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
function Ae(t, e) {
|
|
630
|
+
const r = ["size-small", "size-medium", "size-large"], n = [
|
|
631
|
+
"SizeS",
|
|
632
|
+
"SizeM",
|
|
633
|
+
"SizeL"
|
|
634
|
+
];
|
|
635
|
+
return r.map((s, o) => ({
|
|
636
|
+
type: `image-${s}`,
|
|
637
|
+
component: p,
|
|
638
|
+
componentProps: {
|
|
639
|
+
tooltip: e(`editor.${s.replace("-", ".")}.tooltip`),
|
|
640
|
+
icon: n[o],
|
|
641
|
+
action: () => t.commands.updateImage({ width: Q[s] }),
|
|
642
|
+
isActive: () => t.isActive("image", { width: Q[s] })
|
|
643
|
+
}
|
|
644
|
+
}));
|
|
645
|
+
}
|
|
646
|
+
function Ue(t, e) {
|
|
647
|
+
const r = ["size-small", "size-medium", "size-large"], n = [
|
|
648
|
+
"SizeS",
|
|
649
|
+
"SizeM",
|
|
650
|
+
"SizeL"
|
|
651
|
+
];
|
|
652
|
+
return r.map((s, o) => ({
|
|
653
|
+
type: `image-${s}`,
|
|
654
|
+
component: p,
|
|
655
|
+
componentProps: {
|
|
656
|
+
tooltip: e(`editor.${s.replace("-", ".")}.tooltip`),
|
|
657
|
+
icon: n[o],
|
|
658
|
+
action: () => t.commands.updateImageGif({ width: Q[s] }),
|
|
659
|
+
isActive: () => t.isActive("image", { width: Q[s] })
|
|
660
|
+
}
|
|
661
|
+
}));
|
|
662
|
+
}
|
|
663
|
+
function Ee(t, e) {
|
|
664
|
+
const r = ["left", "center", "right"], n = {
|
|
665
|
+
left: "AlignLeft",
|
|
666
|
+
center: "AlignCenter",
|
|
667
|
+
right: "AlignRight"
|
|
668
|
+
};
|
|
669
|
+
return r.map((s) => ({
|
|
670
|
+
type: `image-${s}`,
|
|
671
|
+
component: p,
|
|
672
|
+
componentProps: {
|
|
673
|
+
tooltip: e(`editor.textalign.${s}.tooltip`),
|
|
674
|
+
icon: n[s],
|
|
675
|
+
action: () => {
|
|
676
|
+
var o, l;
|
|
677
|
+
return (l = (o = t.commands) == null ? void 0 : o.setAlignImage) == null ? void 0 : l.call(o, s);
|
|
678
|
+
},
|
|
679
|
+
isActive: () => t.isActive({ align: s }) || !1,
|
|
680
|
+
disabled: !1
|
|
681
|
+
}
|
|
682
|
+
}));
|
|
683
|
+
}
|
|
684
|
+
function Pe(t, e) {
|
|
685
|
+
const r = ["left", "center", "right"], n = {
|
|
686
|
+
left: "AlignLeft",
|
|
687
|
+
center: "AlignCenter",
|
|
688
|
+
right: "AlignRight"
|
|
689
|
+
};
|
|
690
|
+
return r.map((s) => ({
|
|
691
|
+
type: `image-${s}`,
|
|
692
|
+
component: p,
|
|
693
|
+
componentProps: {
|
|
694
|
+
tooltip: e(`editor.textalign.${s}.tooltip`),
|
|
695
|
+
icon: n[s],
|
|
696
|
+
action: () => {
|
|
697
|
+
var o, l;
|
|
698
|
+
return (l = (o = t.commands) == null ? void 0 : o.setAlignImageGif) == null ? void 0 : l.call(o, s);
|
|
699
|
+
},
|
|
700
|
+
isActive: () => t.isActive({ align: s }) || !1,
|
|
701
|
+
disabled: !1
|
|
702
|
+
}
|
|
703
|
+
}));
|
|
704
|
+
}
|
|
705
|
+
function ke(t, e) {
|
|
706
|
+
const r = ["left", "center", "right"], n = {
|
|
707
|
+
left: "AlignLeft",
|
|
708
|
+
center: "AlignCenter",
|
|
709
|
+
right: "AlignRight"
|
|
710
|
+
};
|
|
711
|
+
return r.map((s) => ({
|
|
712
|
+
type: `image-${s}`,
|
|
713
|
+
component: p,
|
|
714
|
+
componentProps: {
|
|
715
|
+
tooltip: e(`editor.textalign.${s}.tooltip`),
|
|
716
|
+
icon: n[s],
|
|
717
|
+
action: () => {
|
|
718
|
+
var o, l;
|
|
719
|
+
return (l = (o = t.commands) == null ? void 0 : o.setAlignImageMermaid) == null ? void 0 : l.call(o, s);
|
|
720
|
+
},
|
|
721
|
+
isActive: () => t.isActive({ align: s }) || !1,
|
|
722
|
+
disabled: !1
|
|
723
|
+
}
|
|
724
|
+
}));
|
|
725
|
+
}
|
|
726
|
+
function Re(t, e) {
|
|
727
|
+
const r = ["left", "center", "right"], n = {
|
|
728
|
+
left: "AlignLeft",
|
|
729
|
+
center: "AlignCenter",
|
|
730
|
+
right: "AlignRight"
|
|
731
|
+
};
|
|
732
|
+
return r.map((s) => ({
|
|
733
|
+
type: `image-${s}`,
|
|
734
|
+
component: p,
|
|
735
|
+
componentProps: {
|
|
736
|
+
tooltip: e(`editor.textalign.${s}.tooltip`),
|
|
737
|
+
icon: n[s],
|
|
738
|
+
action: () => {
|
|
739
|
+
var o, l;
|
|
740
|
+
return (l = (o = t.commands) == null ? void 0 : o.setAlignImageDrawer) == null ? void 0 : l.call(o, s);
|
|
741
|
+
},
|
|
742
|
+
isActive: () => t.isActive({ align: s }) || !1,
|
|
743
|
+
disabled: !1
|
|
744
|
+
}
|
|
745
|
+
}));
|
|
746
|
+
}
|
|
747
|
+
function Be(t) {
|
|
748
|
+
return [
|
|
749
|
+
{ type: "flex-start", icon: "AlignLeft", tooltip: "Align left" },
|
|
750
|
+
{ type: "center", icon: "AlignCenter", tooltip: "Align center" },
|
|
751
|
+
{ type: "flex-end", icon: "AlignRight", tooltip: "Align right" }
|
|
752
|
+
].map((r) => ({
|
|
753
|
+
type: `video-align-${r.type}`,
|
|
754
|
+
component: p,
|
|
755
|
+
componentProps: {
|
|
756
|
+
tooltip: r.tooltip,
|
|
757
|
+
icon: r.icon,
|
|
758
|
+
action: () => t.commands.updateVideo({ align: r.type }),
|
|
759
|
+
isActive: () => t.getAttributes("video").align === r.type
|
|
760
|
+
}
|
|
761
|
+
}));
|
|
762
|
+
}
|
|
763
|
+
function De(t, e) {
|
|
764
|
+
const r = ["size-small", "size-medium", "size-large"], n = [
|
|
765
|
+
"SizeS",
|
|
766
|
+
"SizeM",
|
|
767
|
+
"SizeL"
|
|
768
|
+
];
|
|
769
|
+
return r.map((s, o) => ({
|
|
770
|
+
type: `video-${s}`,
|
|
771
|
+
component: p,
|
|
772
|
+
componentProps: {
|
|
773
|
+
tooltip: e(`editor.${s.replace("-", ".")}.tooltip`),
|
|
774
|
+
icon: n[o],
|
|
775
|
+
action: () => t.commands.updateVideo({ width: gt[s] }),
|
|
776
|
+
isActive: () => t.isActive("video", { width: gt[s] })
|
|
777
|
+
}
|
|
778
|
+
}));
|
|
779
|
+
}
|
|
780
|
+
function Ne(t, e) {
|
|
781
|
+
return [
|
|
782
|
+
{
|
|
783
|
+
type: "flipX",
|
|
784
|
+
component: p,
|
|
785
|
+
componentProps: {
|
|
786
|
+
editor: t,
|
|
787
|
+
tooltip: e("editor.tooltip.flipX"),
|
|
788
|
+
icon: "FlipX",
|
|
789
|
+
action: () => {
|
|
790
|
+
const r = t.getAttributes("image"), { flipX: n } = r;
|
|
791
|
+
t.chain().focus(void 0, { scrollIntoView: !1 }).updateImage({
|
|
792
|
+
flipX: !n
|
|
793
|
+
}).run();
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
type: "flipY",
|
|
799
|
+
component: p,
|
|
800
|
+
componentProps: {
|
|
801
|
+
editor: t,
|
|
802
|
+
tooltip: e("editor.tooltip.flipY"),
|
|
803
|
+
icon: "FlipY",
|
|
804
|
+
action: () => {
|
|
805
|
+
const r = t.getAttributes("image"), { flipY: n } = r;
|
|
806
|
+
t.chain().focus(void 0, { scrollIntoView: !1 }).updateImage({
|
|
807
|
+
flipY: !n
|
|
808
|
+
}).run();
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
...Ae(t, e),
|
|
813
|
+
...Ee(t, e),
|
|
814
|
+
{
|
|
815
|
+
type: "remove",
|
|
816
|
+
component: p,
|
|
817
|
+
componentProps: {
|
|
818
|
+
editor: t,
|
|
819
|
+
tooltip: e("editor.remove"),
|
|
820
|
+
icon: "Trash2",
|
|
821
|
+
action: () => {
|
|
822
|
+
const { state: r, dispatch: n } = t.view;
|
|
823
|
+
q(r, n);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
];
|
|
828
|
+
}
|
|
829
|
+
function He(t, e) {
|
|
830
|
+
return [
|
|
831
|
+
...Ue(t, e),
|
|
832
|
+
...Pe(t, e),
|
|
833
|
+
{
|
|
834
|
+
type: "remove",
|
|
835
|
+
component: p,
|
|
836
|
+
componentProps: {
|
|
837
|
+
editor: t,
|
|
838
|
+
tooltip: e("editor.remove"),
|
|
839
|
+
icon: "Trash2",
|
|
840
|
+
action: () => {
|
|
841
|
+
const { state: r, dispatch: n } = t.view;
|
|
842
|
+
q(r, n);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
];
|
|
847
|
+
}
|
|
848
|
+
function ze(t, e) {
|
|
849
|
+
return [
|
|
850
|
+
...ke(t, e),
|
|
851
|
+
{
|
|
852
|
+
type: "edit",
|
|
853
|
+
component: p,
|
|
854
|
+
componentProps: {
|
|
855
|
+
editor: t,
|
|
856
|
+
tooltip: e("editor.edit"),
|
|
857
|
+
icon: "Pencil",
|
|
858
|
+
action: () => !0
|
|
859
|
+
}
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
type: "remove",
|
|
863
|
+
component: p,
|
|
864
|
+
componentProps: {
|
|
865
|
+
editor: t,
|
|
866
|
+
tooltip: e("editor.remove"),
|
|
867
|
+
icon: "Trash2",
|
|
868
|
+
action: () => {
|
|
869
|
+
const { state: r, dispatch: n } = t.view;
|
|
870
|
+
q(r, n);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
];
|
|
875
|
+
}
|
|
876
|
+
function Le(t, e) {
|
|
877
|
+
return [
|
|
878
|
+
...Re(t, e),
|
|
879
|
+
{
|
|
880
|
+
type: "edit",
|
|
881
|
+
component: p,
|
|
882
|
+
componentProps: {
|
|
883
|
+
editor: t,
|
|
884
|
+
tooltip: e("editor.edit"),
|
|
885
|
+
icon: "Pencil",
|
|
886
|
+
action: () => !0
|
|
887
|
+
}
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
type: "remove",
|
|
891
|
+
component: p,
|
|
892
|
+
componentProps: {
|
|
893
|
+
editor: t,
|
|
894
|
+
tooltip: e("editor.remove"),
|
|
895
|
+
icon: "Trash2",
|
|
896
|
+
action: () => {
|
|
897
|
+
const { state: r, dispatch: n } = t.view;
|
|
898
|
+
q(r, n);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
];
|
|
903
|
+
}
|
|
904
|
+
function $e(t, e) {
|
|
905
|
+
return [
|
|
906
|
+
...De(t, e),
|
|
907
|
+
...Be(t),
|
|
908
|
+
{
|
|
909
|
+
type: "remove",
|
|
910
|
+
component: p,
|
|
911
|
+
componentProps: {
|
|
912
|
+
editor: t,
|
|
913
|
+
tooltip: e("editor.remove"),
|
|
914
|
+
icon: "Trash2",
|
|
915
|
+
action: () => {
|
|
916
|
+
const { state: r, dispatch: n } = t.view;
|
|
917
|
+
q(r, n);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
];
|
|
922
|
+
}
|
|
923
|
+
function Ve({ item: t, disabled: e, editor: r }) {
|
|
924
|
+
var s;
|
|
925
|
+
const n = t.component;
|
|
926
|
+
return n ? /* @__PURE__ */ i(ht, { children: t.type === "divider" ? /* @__PURE__ */ i(
|
|
927
|
+
H,
|
|
928
|
+
{
|
|
929
|
+
className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",
|
|
930
|
+
orientation: "vertical"
|
|
931
|
+
}
|
|
932
|
+
) : /* @__PURE__ */ i(
|
|
933
|
+
n,
|
|
934
|
+
{
|
|
935
|
+
...t.componentProps,
|
|
936
|
+
disabled: e || ((s = t == null ? void 0 : t.componentProps) == null ? void 0 : s.disabled),
|
|
937
|
+
editor: r
|
|
938
|
+
}
|
|
939
|
+
) }) : /* @__PURE__ */ i(x, {});
|
|
940
|
+
}
|
|
941
|
+
function Ki() {
|
|
942
|
+
const { lang: t, t: e } = A(), r = U(), n = M(), s = V(n, lt.name), o = $t(lt.name), l = ({ editor: h }) => {
|
|
943
|
+
const { selection: c } = h.view.state, { $from: d, to: u } = c;
|
|
944
|
+
let f = !1;
|
|
945
|
+
return h.view.state.doc.nodesBetween(d.pos, u, (g) => {
|
|
946
|
+
if (g.type.name === lt.name)
|
|
947
|
+
return f = !0, !1;
|
|
948
|
+
}), f;
|
|
949
|
+
}, a = z(() => Le(n, e), [n, t, e]);
|
|
950
|
+
return r ? /* @__PURE__ */ i(
|
|
951
|
+
E,
|
|
952
|
+
{
|
|
953
|
+
editor: n,
|
|
954
|
+
shouldShow: l,
|
|
955
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
956
|
+
children: a != null && a.length ? /* @__PURE__ */ i("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: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap", children: a == null ? void 0 : a.map((h, c) => h.type === "edit" && (s != null && s.src) ? /* @__PURE__ */ i(
|
|
957
|
+
Me,
|
|
958
|
+
{
|
|
959
|
+
attrs: s,
|
|
960
|
+
editor: n,
|
|
961
|
+
extension: o
|
|
962
|
+
},
|
|
963
|
+
`bubbleMenu-drawer-${c}`
|
|
964
|
+
) : /* @__PURE__ */ i(
|
|
965
|
+
Ve,
|
|
966
|
+
{
|
|
967
|
+
editor: n,
|
|
968
|
+
item: h
|
|
969
|
+
},
|
|
970
|
+
`bubbleMenu-drawer-${c}`
|
|
971
|
+
)) }) }) : /* @__PURE__ */ i(x, {})
|
|
972
|
+
}
|
|
973
|
+
) : /* @__PURE__ */ i(x, {});
|
|
974
|
+
}
|
|
975
|
+
const We = { padding: "0 12px 12px" }, _t = ({ width: t, maxWidth: e, height: r, onOk: n, children: s }) => {
|
|
976
|
+
const { t: o } = A(), [l, a] = P({
|
|
977
|
+
width: "",
|
|
978
|
+
height: "",
|
|
979
|
+
maxWidth: ""
|
|
980
|
+
});
|
|
981
|
+
k(() => {
|
|
982
|
+
a({
|
|
983
|
+
width: t,
|
|
984
|
+
height: r,
|
|
985
|
+
maxWidth: e
|
|
986
|
+
});
|
|
987
|
+
}, [r, e, t]);
|
|
988
|
+
function h(c) {
|
|
989
|
+
c.preventDefault(), c.stopPropagation(), n(l);
|
|
990
|
+
}
|
|
991
|
+
return /* @__PURE__ */ v(ne, { modal: !0, children: [
|
|
992
|
+
/* @__PURE__ */ i(oe, { asChild: !0, children: s }),
|
|
993
|
+
/* @__PURE__ */ i(re, { children: /* @__PURE__ */ i("div", { style: We, children: /* @__PURE__ */ v("form", { className: "richtext-flex richtext-flex-col richtext-gap-2", onSubmit: h, children: [
|
|
994
|
+
/* @__PURE__ */ i(at, { className: "mb-[6px]", children: "Width" }),
|
|
995
|
+
/* @__PURE__ */ i("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm", children: /* @__PURE__ */ i(
|
|
996
|
+
J,
|
|
997
|
+
{
|
|
998
|
+
type: "number",
|
|
999
|
+
value: l.width,
|
|
1000
|
+
required: !0,
|
|
1001
|
+
onChange: (c) => a({ ...l, width: c.target.value })
|
|
1002
|
+
}
|
|
1003
|
+
) }) }),
|
|
1004
|
+
/* @__PURE__ */ i(at, { className: "mb-[6px]", children: "Max Width" }),
|
|
1005
|
+
/* @__PURE__ */ i("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm", children: /* @__PURE__ */ i(
|
|
1006
|
+
J,
|
|
1007
|
+
{
|
|
1008
|
+
type: "number",
|
|
1009
|
+
value: l.maxWidth,
|
|
1010
|
+
required: !0,
|
|
1011
|
+
onChange: (c) => a({ ...l, maxWidth: c.target.value })
|
|
1012
|
+
}
|
|
1013
|
+
) }) }),
|
|
1014
|
+
/* @__PURE__ */ i(at, { className: "mb-[6px]", children: "Height" }),
|
|
1015
|
+
/* @__PURE__ */ i("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm", children: /* @__PURE__ */ i(
|
|
1016
|
+
J,
|
|
1017
|
+
{
|
|
1018
|
+
type: "number",
|
|
1019
|
+
value: l.height,
|
|
1020
|
+
required: !0,
|
|
1021
|
+
onChange: (c) => a({ ...l, height: c.target.value })
|
|
1022
|
+
}
|
|
1023
|
+
) }) }),
|
|
1024
|
+
/* @__PURE__ */ i($, { type: "submit", className: "richtext-self-end richtext-mt-2", children: o("editor.link.dialog.button.apply") })
|
|
1025
|
+
] }) }) })
|
|
1026
|
+
] });
|
|
1027
|
+
}, N = /* @__PURE__ */ new Map();
|
|
1028
|
+
function Fe(t) {
|
|
1029
|
+
const e = t.options.element;
|
|
1030
|
+
N.has("width") || N.set("width", e.clientWidth), N.has("width") && N.get("width") <= 0 && N.set("width", e.clientWidth);
|
|
1031
|
+
const r = { attributes: !0, childList: !0, subtree: !0 }, n = function() {
|
|
1032
|
+
N.set("width", e.clientWidth);
|
|
1033
|
+
}, s = new MutationObserver(n);
|
|
1034
|
+
return s.observe(e, r), t.on("destroy", () => {
|
|
1035
|
+
s.disconnect();
|
|
1036
|
+
}), { width: N.get("width") };
|
|
1037
|
+
}
|
|
1038
|
+
function qi() {
|
|
1039
|
+
const t = U(), e = M(), { t: r } = A(), { width: n } = Fe(e), s = V(e, F.name, {
|
|
1040
|
+
defaultShowPicker: !1,
|
|
1041
|
+
createUser: "",
|
|
1042
|
+
width: 0,
|
|
1043
|
+
height: 0
|
|
1044
|
+
}), { defaultShowPicker: o, createUser: l, width: a, height: h } = s, c = w(
|
|
1045
|
+
(g) => {
|
|
1046
|
+
e.chain().updateAttributes(F.name, g).setNodeSelection(e.state.selection.from).focus().run();
|
|
1047
|
+
},
|
|
1048
|
+
[e]
|
|
1049
|
+
), d = w(() => {
|
|
1050
|
+
se({ ...s, editor: e });
|
|
1051
|
+
}, [e, s]), u = w(() => e.isActive(F.name), [e]), f = w(() => j(F.name, e), [e]);
|
|
1052
|
+
return k(() => {
|
|
1053
|
+
o && (d(), e.chain().updateAttributes(F.name, { defaultShowPicker: !1 }).focus().run());
|
|
1054
|
+
}, [l, o, e, d]), t ? /* @__PURE__ */ i(
|
|
1055
|
+
E,
|
|
1056
|
+
{
|
|
1057
|
+
editor: e,
|
|
1058
|
+
shouldShow: u,
|
|
1059
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1060
|
+
children: /* @__PURE__ */ v("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: [
|
|
1061
|
+
/* @__PURE__ */ i(
|
|
1062
|
+
p,
|
|
1063
|
+
{
|
|
1064
|
+
action: d,
|
|
1065
|
+
icon: "Pencil",
|
|
1066
|
+
tooltip: r("editor.edit")
|
|
1067
|
+
}
|
|
1068
|
+
),
|
|
1069
|
+
/* @__PURE__ */ i(
|
|
1070
|
+
_t,
|
|
1071
|
+
{
|
|
1072
|
+
height: h,
|
|
1073
|
+
maxWidth: n,
|
|
1074
|
+
onOk: c,
|
|
1075
|
+
width: a,
|
|
1076
|
+
children: /* @__PURE__ */ i(
|
|
1077
|
+
p,
|
|
1078
|
+
{
|
|
1079
|
+
icon: "Settings",
|
|
1080
|
+
tooltip: r("editor.settings")
|
|
1081
|
+
}
|
|
1082
|
+
)
|
|
1083
|
+
}
|
|
1084
|
+
),
|
|
1085
|
+
/* @__PURE__ */ i(
|
|
1086
|
+
p,
|
|
1087
|
+
{
|
|
1088
|
+
action: f,
|
|
1089
|
+
icon: "Trash2",
|
|
1090
|
+
tooltip: r("editor.delete")
|
|
1091
|
+
}
|
|
1092
|
+
)
|
|
1093
|
+
] })
|
|
1094
|
+
}
|
|
1095
|
+
) : /* @__PURE__ */ i(x, {});
|
|
1096
|
+
}
|
|
1097
|
+
function ji() {
|
|
1098
|
+
const t = U(), e = M(), { t: r } = A(), { width: n, height: s, src: o } = V(e, _.name, {
|
|
1099
|
+
width: 0,
|
|
1100
|
+
height: 0,
|
|
1101
|
+
src: "",
|
|
1102
|
+
defaultShowPicker: !1
|
|
1103
|
+
}), [l, a] = P(!1), [h, c] = P(""), d = w(() => {
|
|
1104
|
+
a(!1);
|
|
1105
|
+
}, [a]);
|
|
1106
|
+
k(() => {
|
|
1107
|
+
l && c(o);
|
|
1108
|
+
}, [l, o]);
|
|
1109
|
+
const u = w(() => {
|
|
1110
|
+
const C = le(h);
|
|
1111
|
+
e.chain().updateAttributes(_.name, {
|
|
1112
|
+
src: (C == null ? void 0 : C.src) || h
|
|
1113
|
+
}).setNodeSelection(e.state.selection.from).focus().run(), a(!1);
|
|
1114
|
+
}, [e, h, a]), f = w(() => {
|
|
1115
|
+
window.open(o, "_blank");
|
|
1116
|
+
}, [o]), g = w(() => {
|
|
1117
|
+
a(!0);
|
|
1118
|
+
}, [a]), S = w(
|
|
1119
|
+
(C) => {
|
|
1120
|
+
e.chain().updateAttributes(_.name, C).setNodeSelection(e.state.selection.from).focus().run();
|
|
1121
|
+
},
|
|
1122
|
+
[e]
|
|
1123
|
+
), T = w(() => e.isActive(_.name) && !o, [e, o]), I = w(() => j(_.name, e), [e]);
|
|
1124
|
+
return t ? /* @__PURE__ */ v(x, { children: [
|
|
1125
|
+
/* @__PURE__ */ i(
|
|
1126
|
+
E,
|
|
1127
|
+
{
|
|
1128
|
+
editor: e,
|
|
1129
|
+
shouldShow: T,
|
|
1130
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1131
|
+
children: /* @__PURE__ */ v("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: [
|
|
1132
|
+
/* @__PURE__ */ i(
|
|
1133
|
+
p,
|
|
1134
|
+
{
|
|
1135
|
+
action: f,
|
|
1136
|
+
icon: "Eye",
|
|
1137
|
+
tooltip: "Visit Link"
|
|
1138
|
+
}
|
|
1139
|
+
),
|
|
1140
|
+
/* @__PURE__ */ i(
|
|
1141
|
+
p,
|
|
1142
|
+
{
|
|
1143
|
+
action: g,
|
|
1144
|
+
icon: "Pencil",
|
|
1145
|
+
tooltip: "Open Edit Link"
|
|
1146
|
+
}
|
|
1147
|
+
),
|
|
1148
|
+
/* @__PURE__ */ i(
|
|
1149
|
+
_t,
|
|
1150
|
+
{
|
|
1151
|
+
height: s,
|
|
1152
|
+
onOk: S,
|
|
1153
|
+
width: n,
|
|
1154
|
+
children: /* @__PURE__ */ i(
|
|
1155
|
+
p,
|
|
1156
|
+
{
|
|
1157
|
+
icon: "Settings",
|
|
1158
|
+
tooltip: r("editor.settings")
|
|
1159
|
+
}
|
|
1160
|
+
)
|
|
1161
|
+
}
|
|
1162
|
+
),
|
|
1163
|
+
/* @__PURE__ */ i(
|
|
1164
|
+
p,
|
|
1165
|
+
{
|
|
1166
|
+
action: I,
|
|
1167
|
+
icon: "Trash2",
|
|
1168
|
+
tooltip: r("editor.delete")
|
|
1169
|
+
}
|
|
1170
|
+
)
|
|
1171
|
+
] })
|
|
1172
|
+
}
|
|
1173
|
+
),
|
|
1174
|
+
/* @__PURE__ */ v(
|
|
1175
|
+
et,
|
|
1176
|
+
{
|
|
1177
|
+
onOpenChange: a,
|
|
1178
|
+
open: l,
|
|
1179
|
+
children: [
|
|
1180
|
+
/* @__PURE__ */ i(it, {}),
|
|
1181
|
+
/* @__PURE__ */ v(nt, { children: [
|
|
1182
|
+
/* @__PURE__ */ i(ie, { children: /* @__PURE__ */ i(ot, { children: "Edit Link Iframe" }) }),
|
|
1183
|
+
/* @__PURE__ */ i(
|
|
1184
|
+
J,
|
|
1185
|
+
{
|
|
1186
|
+
autoFocus: !0,
|
|
1187
|
+
onInput: (C) => c(C.target.value),
|
|
1188
|
+
placeholder: "Enter link",
|
|
1189
|
+
type: "url",
|
|
1190
|
+
value: h
|
|
1191
|
+
}
|
|
1192
|
+
),
|
|
1193
|
+
/* @__PURE__ */ v(rt, { children: [
|
|
1194
|
+
/* @__PURE__ */ i($, { onClick: d, children: "Cancel" }),
|
|
1195
|
+
/* @__PURE__ */ i($, { onClick: u, children: "OK" })
|
|
1196
|
+
] })
|
|
1197
|
+
] })
|
|
1198
|
+
]
|
|
1199
|
+
}
|
|
1200
|
+
)
|
|
1201
|
+
] }) : /* @__PURE__ */ i(x, {});
|
|
1202
|
+
}
|
|
1203
|
+
function _e({
|
|
1204
|
+
children: t,
|
|
1205
|
+
visible: e,
|
|
1206
|
+
toggleVisible: r
|
|
1207
|
+
}) {
|
|
1208
|
+
const { t: n } = A(), s = M(), o = V(s, tt.name, {
|
|
1209
|
+
text: "",
|
|
1210
|
+
defaultShowPicker: !1
|
|
1211
|
+
}), { text: l, defaultShowPicker: a } = o, [h, c] = P(l || "");
|
|
1212
|
+
k(() => {
|
|
1213
|
+
e && c(l || "");
|
|
1214
|
+
}, [e]), k(() => {
|
|
1215
|
+
a && (r(!0), s.chain().updateAttributes(tt.name, { defaultShowPicker: !1 }).focus().run());
|
|
1216
|
+
}, [s, a, r]);
|
|
1217
|
+
const d = w(() => {
|
|
1218
|
+
s.chain().focus().setKatex({ text: h }).run(), c(""), r(!1);
|
|
1219
|
+
}, [s, h, r]), u = z(() => {
|
|
1220
|
+
try {
|
|
1221
|
+
return ae.renderToString(`${h}`);
|
|
1222
|
+
} catch {
|
|
1223
|
+
return h;
|
|
1224
|
+
}
|
|
1225
|
+
}, [h]), f = z(
|
|
1226
|
+
() => `${h}`.trim() ? u : null,
|
|
1227
|
+
[h, u]
|
|
1228
|
+
);
|
|
1229
|
+
return /* @__PURE__ */ v(
|
|
1230
|
+
et,
|
|
1231
|
+
{
|
|
1232
|
+
onOpenChange: r,
|
|
1233
|
+
open: e,
|
|
1234
|
+
children: [
|
|
1235
|
+
/* @__PURE__ */ i(
|
|
1236
|
+
it,
|
|
1237
|
+
{
|
|
1238
|
+
asChild: !0,
|
|
1239
|
+
children: t
|
|
1240
|
+
}
|
|
1241
|
+
),
|
|
1242
|
+
/* @__PURE__ */ v(nt, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
|
|
1243
|
+
/* @__PURE__ */ i(ot, { children: n("editor.formula.dialog.text") }),
|
|
1244
|
+
/* @__PURE__ */ i(
|
|
1245
|
+
"div",
|
|
1246
|
+
{
|
|
1247
|
+
style: { height: "100%", border: "1px solid hsl(var(--border))" },
|
|
1248
|
+
children: /* @__PURE__ */ v("div", { className: "richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]", children: [
|
|
1249
|
+
/* @__PURE__ */ i(
|
|
1250
|
+
Vt,
|
|
1251
|
+
{
|
|
1252
|
+
autoFocus: !0,
|
|
1253
|
+
onChange: (g) => c(g.target.value),
|
|
1254
|
+
required: !0,
|
|
1255
|
+
value: h,
|
|
1256
|
+
className: "richtext-flex-1",
|
|
1257
|
+
placeholder: "Text",
|
|
1258
|
+
rows: 10,
|
|
1259
|
+
style: {
|
|
1260
|
+
color: "hsl(var(--richtext-foreground))"
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
),
|
|
1264
|
+
/* @__PURE__ */ i(
|
|
1265
|
+
"div",
|
|
1266
|
+
{
|
|
1267
|
+
className: "richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",
|
|
1268
|
+
dangerouslySetInnerHTML: { __html: f || "" },
|
|
1269
|
+
style: { height: "100%", borderWidth: 1, minHeight: 500, background: "#fff" }
|
|
1270
|
+
}
|
|
1271
|
+
)
|
|
1272
|
+
] })
|
|
1273
|
+
}
|
|
1274
|
+
),
|
|
1275
|
+
/* @__PURE__ */ i(rt, { children: /* @__PURE__ */ i(
|
|
1276
|
+
$,
|
|
1277
|
+
{
|
|
1278
|
+
onClick: d,
|
|
1279
|
+
type: "button",
|
|
1280
|
+
children: "Save changes"
|
|
1281
|
+
}
|
|
1282
|
+
) })
|
|
1283
|
+
] })
|
|
1284
|
+
]
|
|
1285
|
+
}
|
|
1286
|
+
);
|
|
1287
|
+
}
|
|
1288
|
+
function Gi() {
|
|
1289
|
+
const t = U(), e = M(), [r, n] = P(!1), s = w(() => e.isActive(tt.name), [e]), o = w(() => j(tt.name, e), [e]);
|
|
1290
|
+
return t ? /* @__PURE__ */ i(
|
|
1291
|
+
E,
|
|
1292
|
+
{
|
|
1293
|
+
editor: e,
|
|
1294
|
+
shouldShow: s,
|
|
1295
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1296
|
+
children: /* @__PURE__ */ i("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: /* @__PURE__ */ v("div", { className: "richtext-flex richtext-items-center richtext-justify-center richtext-gap-[6px]", children: [
|
|
1297
|
+
/* @__PURE__ */ i(
|
|
1298
|
+
_e,
|
|
1299
|
+
{
|
|
1300
|
+
visible: r,
|
|
1301
|
+
toggleVisible: n,
|
|
1302
|
+
children: /* @__PURE__ */ i(
|
|
1303
|
+
p,
|
|
1304
|
+
{
|
|
1305
|
+
action: () => n(!r),
|
|
1306
|
+
tooltip: "Edit",
|
|
1307
|
+
children: /* @__PURE__ */ i(ce, { size: 16 })
|
|
1308
|
+
}
|
|
1309
|
+
)
|
|
1310
|
+
}
|
|
1311
|
+
),
|
|
1312
|
+
/* @__PURE__ */ i(
|
|
1313
|
+
p,
|
|
1314
|
+
{
|
|
1315
|
+
action: o,
|
|
1316
|
+
tooltip: "Delete",
|
|
1317
|
+
children: /* @__PURE__ */ i(he, { size: 16 })
|
|
1318
|
+
}
|
|
1319
|
+
)
|
|
1320
|
+
] }) })
|
|
1321
|
+
}
|
|
1322
|
+
) : /* @__PURE__ */ i(x, {});
|
|
1323
|
+
}
|
|
1324
|
+
function Ke(t) {
|
|
1325
|
+
const { t: e } = A();
|
|
1326
|
+
return /* @__PURE__ */ i("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: /* @__PURE__ */ v("div", { className: "richtext-flex richtext-flex-nowrap", children: [
|
|
1327
|
+
/* @__PURE__ */ i(
|
|
1328
|
+
p,
|
|
1329
|
+
{
|
|
1330
|
+
disabled: !(t != null && t.link),
|
|
1331
|
+
icon: "ExternalLink",
|
|
1332
|
+
tooltip: e("editor.link.open.tooltip"),
|
|
1333
|
+
tooltipOptions: { sideOffset: 15 },
|
|
1334
|
+
action: () => {
|
|
1335
|
+
window.open(t == null ? void 0 : t.link, "_blank");
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
),
|
|
1339
|
+
/* @__PURE__ */ i(
|
|
1340
|
+
p,
|
|
1341
|
+
{
|
|
1342
|
+
icon: "Pencil",
|
|
1343
|
+
tooltip: e("editor.link.edit.tooltip"),
|
|
1344
|
+
tooltipOptions: { sideOffset: 15 },
|
|
1345
|
+
action: () => {
|
|
1346
|
+
t == null || t.onEdit();
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
),
|
|
1350
|
+
/* @__PURE__ */ i(
|
|
1351
|
+
p,
|
|
1352
|
+
{
|
|
1353
|
+
icon: "Unlink",
|
|
1354
|
+
tooltip: e("editor.link.unlink.tooltip"),
|
|
1355
|
+
tooltipOptions: { sideOffset: 15 },
|
|
1356
|
+
action: () => {
|
|
1357
|
+
t == null || t.onClear();
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
)
|
|
1361
|
+
] }) });
|
|
1362
|
+
}
|
|
1363
|
+
function Xi() {
|
|
1364
|
+
const t = U(), e = M(), [r, n] = P(!1), s = V(e, xt.name), o = s == null ? void 0 : s.href, l = w(({ editor: c }) => c.isActive(xt.name), []), a = (c, d, u) => {
|
|
1365
|
+
const f = e.state.selection, { from: g } = f, S = (d == null ? void 0 : d.length) ?? 0, T = g + S;
|
|
1366
|
+
e.chain().extendMarkRange("link").insertContent({
|
|
1367
|
+
type: "text",
|
|
1368
|
+
text: d,
|
|
1369
|
+
marks: [
|
|
1370
|
+
{
|
|
1371
|
+
type: "link",
|
|
1372
|
+
attrs: {
|
|
1373
|
+
href: c,
|
|
1374
|
+
target: u ? "_blank" : ""
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
]
|
|
1378
|
+
}).setLink({ href: c }).setTextSelection({ from: g, to: T }).focus().run(), n(!1);
|
|
1379
|
+
}, h = w(() => {
|
|
1380
|
+
e.chain().extendMarkRange("link").unsetLink().focus().run(), n(!1);
|
|
1381
|
+
}, [e]);
|
|
1382
|
+
return t ? /* @__PURE__ */ i(
|
|
1383
|
+
E,
|
|
1384
|
+
{
|
|
1385
|
+
editor: e,
|
|
1386
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1387
|
+
shouldShow: l,
|
|
1388
|
+
children: /* @__PURE__ */ i(x, { children: r ? /* @__PURE__ */ i(
|
|
1389
|
+
de,
|
|
1390
|
+
{
|
|
1391
|
+
editor: e,
|
|
1392
|
+
onSetLink: a
|
|
1393
|
+
}
|
|
1394
|
+
) : /* @__PURE__ */ i(
|
|
1395
|
+
Ke,
|
|
1396
|
+
{
|
|
1397
|
+
editor: e,
|
|
1398
|
+
link: o,
|
|
1399
|
+
onClear: h,
|
|
1400
|
+
onEdit: () => {
|
|
1401
|
+
n(!0);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
) })
|
|
1405
|
+
}
|
|
1406
|
+
) : /* @__PURE__ */ i(x, {});
|
|
1407
|
+
}
|
|
1408
|
+
function dt({ item: t, disabled: e, editor: r }) {
|
|
1409
|
+
const n = t.component;
|
|
1410
|
+
return n ? /* @__PURE__ */ i(ht, { children: t.type === "divider" ? /* @__PURE__ */ i(
|
|
1411
|
+
H,
|
|
1412
|
+
{
|
|
1413
|
+
className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",
|
|
1414
|
+
orientation: "vertical"
|
|
1415
|
+
}
|
|
1416
|
+
) : /* @__PURE__ */ i(
|
|
1417
|
+
n,
|
|
1418
|
+
{
|
|
1419
|
+
...t.componentProps,
|
|
1420
|
+
disabled: e || (t == null ? void 0 : t.componentdisabled),
|
|
1421
|
+
editor: r
|
|
1422
|
+
}
|
|
1423
|
+
) }) : /* @__PURE__ */ i(x, {});
|
|
1424
|
+
}
|
|
1425
|
+
function qe(t) {
|
|
1426
|
+
return t.type.name === pe.name;
|
|
1427
|
+
}
|
|
1428
|
+
function je(t) {
|
|
1429
|
+
return t.type.name === fe.name;
|
|
1430
|
+
}
|
|
1431
|
+
function Ge(t) {
|
|
1432
|
+
return t.type.name === me.name;
|
|
1433
|
+
}
|
|
1434
|
+
function Yi() {
|
|
1435
|
+
const { lang: t, t: e } = A(), r = U(), n = M(), s = ({ editor: l }) => {
|
|
1436
|
+
const { selection: a } = l.view.state, { $from: h, to: c } = a;
|
|
1437
|
+
let d = !1;
|
|
1438
|
+
return l.view.state.doc.nodesBetween(h.pos, c, (u) => {
|
|
1439
|
+
if (qe(u))
|
|
1440
|
+
return d = !0, !1;
|
|
1441
|
+
}), d;
|
|
1442
|
+
}, o = z(() => Ne(n, e), [n, t, e]);
|
|
1443
|
+
return r ? /* @__PURE__ */ i(
|
|
1444
|
+
E,
|
|
1445
|
+
{
|
|
1446
|
+
editor: n,
|
|
1447
|
+
shouldShow: s,
|
|
1448
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1449
|
+
children: o != null && o.length ? /* @__PURE__ */ i("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: /* @__PURE__ */ i("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, a) => /* @__PURE__ */ i(
|
|
1450
|
+
dt,
|
|
1451
|
+
{
|
|
1452
|
+
editor: n,
|
|
1453
|
+
item: l
|
|
1454
|
+
},
|
|
1455
|
+
`bubbleMenu-image-${a}`
|
|
1456
|
+
)) }) }) : /* @__PURE__ */ i(x, {})
|
|
1457
|
+
}
|
|
1458
|
+
) : /* @__PURE__ */ i(x, {});
|
|
1459
|
+
}
|
|
1460
|
+
function Zi() {
|
|
1461
|
+
const { lang: t, t: e } = A(), r = U(), n = M(), s = ({ editor: l }) => {
|
|
1462
|
+
const { selection: a } = l.view.state, { $from: h, to: c } = a;
|
|
1463
|
+
let d = !1;
|
|
1464
|
+
return l.view.state.doc.nodesBetween(h.pos, c, (u) => {
|
|
1465
|
+
if (je(u))
|
|
1466
|
+
return d = !0, !1;
|
|
1467
|
+
}), d;
|
|
1468
|
+
}, o = z(() => He(n, e), [n, e, t]);
|
|
1469
|
+
return r ? /* @__PURE__ */ i(
|
|
1470
|
+
E,
|
|
1471
|
+
{
|
|
1472
|
+
editor: n,
|
|
1473
|
+
shouldShow: s,
|
|
1474
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1475
|
+
children: o != null && o.length ? /* @__PURE__ */ i("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: /* @__PURE__ */ i("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, a) => /* @__PURE__ */ i(
|
|
1476
|
+
dt,
|
|
1477
|
+
{
|
|
1478
|
+
editor: n,
|
|
1479
|
+
item: l
|
|
1480
|
+
},
|
|
1481
|
+
`bubbleMenu-image-gif-${a}`
|
|
1482
|
+
)) }) }) : /* @__PURE__ */ i(x, {})
|
|
1483
|
+
}
|
|
1484
|
+
) : /* @__PURE__ */ i(x, {});
|
|
1485
|
+
}
|
|
1486
|
+
function Ji() {
|
|
1487
|
+
const { t } = A(), e = U(), r = M(), n = ({ editor: o }) => {
|
|
1488
|
+
const { selection: l } = o.view.state, { $from: a, to: h } = l;
|
|
1489
|
+
let c = !1;
|
|
1490
|
+
return o.view.state.doc.nodesBetween(a.pos, h, (d) => {
|
|
1491
|
+
if (Ge(d))
|
|
1492
|
+
return c = !0, !1;
|
|
1493
|
+
}), c;
|
|
1494
|
+
}, s = z(() => $e(r, t), [r, t]);
|
|
1495
|
+
return e ? /* @__PURE__ */ i(
|
|
1496
|
+
E,
|
|
1497
|
+
{
|
|
1498
|
+
editor: r,
|
|
1499
|
+
shouldShow: n,
|
|
1500
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1501
|
+
children: s != null && s.length ? /* @__PURE__ */ i("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: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap", children: s == null ? void 0 : s.map((o, l) => /* @__PURE__ */ i(
|
|
1502
|
+
dt,
|
|
1503
|
+
{
|
|
1504
|
+
editor: r,
|
|
1505
|
+
item: o
|
|
1506
|
+
},
|
|
1507
|
+
`bubbleMenu-video-${l}`
|
|
1508
|
+
)) }) }) : /* @__PURE__ */ i(x, {})
|
|
1509
|
+
}
|
|
1510
|
+
) : /* @__PURE__ */ i(x, {});
|
|
1511
|
+
}
|
|
1512
|
+
const vt = `graph TB
|
|
1513
|
+
a-->b`, Xe = ({ editor: t, attrs: e, extension: r }) => {
|
|
1514
|
+
const { alt: n, align: s } = e, [o, l] = P(decodeURIComponent(n ?? vt)), [a, h] = P(""), [c, d] = P(!1), u = L(null), [f, g] = P(null), S = r == null ? void 0 : r.options.upload, T = w(
|
|
1515
|
+
(O) => {
|
|
1516
|
+
O && import("mermaid").then((B) => {
|
|
1517
|
+
g(B.default);
|
|
1518
|
+
});
|
|
1519
|
+
},
|
|
1520
|
+
[]
|
|
1521
|
+
), I = async (O) => {
|
|
1522
|
+
try {
|
|
1523
|
+
const { svg: B } = await f.render("mermaid-svg", O);
|
|
1524
|
+
h(B);
|
|
1525
|
+
} catch {
|
|
1526
|
+
h("");
|
|
1527
|
+
}
|
|
1528
|
+
}, C = () => {
|
|
1529
|
+
f.initialize({
|
|
1530
|
+
darkMode: !1,
|
|
1531
|
+
startOnLoad: !1,
|
|
1532
|
+
// fontFamily:'',
|
|
1533
|
+
fontSize: 12,
|
|
1534
|
+
theme: "base"
|
|
1535
|
+
}), I(o);
|
|
1536
|
+
};
|
|
1537
|
+
return k(() => {
|
|
1538
|
+
f && c && C();
|
|
1539
|
+
}, [f, c]), k(() => {
|
|
1540
|
+
f && c && I(o);
|
|
1541
|
+
}, [f, o]), /* @__PURE__ */ v(
|
|
1542
|
+
et,
|
|
1543
|
+
{
|
|
1544
|
+
onOpenChange: d,
|
|
1545
|
+
open: c,
|
|
1546
|
+
children: [
|
|
1547
|
+
/* @__PURE__ */ i(it, { asChild: !0, children: /* @__PURE__ */ i(
|
|
1548
|
+
p,
|
|
1549
|
+
{
|
|
1550
|
+
action: () => d(!0),
|
|
1551
|
+
icon: "Pencil",
|
|
1552
|
+
tooltip: "Edit Mermaid"
|
|
1553
|
+
}
|
|
1554
|
+
) }),
|
|
1555
|
+
/* @__PURE__ */ v(nt, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
|
|
1556
|
+
/* @__PURE__ */ i(ot, { children: "Edit Mermaid" }),
|
|
1557
|
+
/* @__PURE__ */ i(
|
|
1558
|
+
"div",
|
|
1559
|
+
{
|
|
1560
|
+
ref: T,
|
|
1561
|
+
style: { height: "100%", border: "1px solid hsl(var(--border))" },
|
|
1562
|
+
children: /* @__PURE__ */ v("div", { className: "richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]", children: [
|
|
1563
|
+
/* @__PURE__ */ i(
|
|
1564
|
+
Vt,
|
|
1565
|
+
{
|
|
1566
|
+
autoFocus: !0,
|
|
1567
|
+
className: "richtext-flex-1",
|
|
1568
|
+
defaultValue: vt,
|
|
1569
|
+
onChange: (O) => l(O.target.value),
|
|
1570
|
+
placeholder: "Text",
|
|
1571
|
+
required: !0,
|
|
1572
|
+
rows: 10,
|
|
1573
|
+
value: o,
|
|
1574
|
+
style: {
|
|
1575
|
+
color: "hsl(var(--richtext-foreground))"
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
),
|
|
1579
|
+
/* @__PURE__ */ i(
|
|
1580
|
+
"div",
|
|
1581
|
+
{
|
|
1582
|
+
className: "richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",
|
|
1583
|
+
dangerouslySetInnerHTML: { __html: a },
|
|
1584
|
+
ref: u,
|
|
1585
|
+
style: { height: "100%", border: "1px solid hsl(var(--border))", minHeight: 500, background: "#fff" }
|
|
1586
|
+
}
|
|
1587
|
+
)
|
|
1588
|
+
] })
|
|
1589
|
+
}
|
|
1590
|
+
),
|
|
1591
|
+
/* @__PURE__ */ i(rt, { children: /* @__PURE__ */ i(
|
|
1592
|
+
$,
|
|
1593
|
+
{
|
|
1594
|
+
onClick: async () => {
|
|
1595
|
+
if (o !== "") {
|
|
1596
|
+
if (o) {
|
|
1597
|
+
const O = u.current.querySelector("svg"), { width: B, height: W } = O.getBoundingClientRect(), y = `mermaid-${Ht()}.svg`;
|
|
1598
|
+
let m = zt(O.outerHTML);
|
|
1599
|
+
if (S) {
|
|
1600
|
+
const b = Lt(m, y);
|
|
1601
|
+
m = await S(b);
|
|
1602
|
+
}
|
|
1603
|
+
t == null || t.chain().focus().setMermaid(
|
|
1604
|
+
{
|
|
1605
|
+
type: "mermaid",
|
|
1606
|
+
src: m,
|
|
1607
|
+
alt: encodeURIComponent(o),
|
|
1608
|
+
width: B,
|
|
1609
|
+
height: W
|
|
1610
|
+
},
|
|
1611
|
+
!!o
|
|
1612
|
+
).run(), t == null || t.commands.setAlignImageMermaid(s);
|
|
1613
|
+
}
|
|
1614
|
+
d(!1);
|
|
1615
|
+
}
|
|
1616
|
+
},
|
|
1617
|
+
type: "button",
|
|
1618
|
+
children: "Save changes"
|
|
1619
|
+
}
|
|
1620
|
+
) })
|
|
1621
|
+
] })
|
|
1622
|
+
]
|
|
1623
|
+
}
|
|
1624
|
+
);
|
|
1625
|
+
};
|
|
1626
|
+
function Ye({ item: t, disabled: e, editor: r }) {
|
|
1627
|
+
var s;
|
|
1628
|
+
const n = t.component;
|
|
1629
|
+
return n ? /* @__PURE__ */ i(ht, { children: t.type === "divider" ? /* @__PURE__ */ i(
|
|
1630
|
+
H,
|
|
1631
|
+
{
|
|
1632
|
+
className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",
|
|
1633
|
+
orientation: "vertical"
|
|
1634
|
+
}
|
|
1635
|
+
) : /* @__PURE__ */ i(
|
|
1636
|
+
n,
|
|
1637
|
+
{
|
|
1638
|
+
...t.componentProps,
|
|
1639
|
+
disabled: e || ((s = t == null ? void 0 : t.componentProps) == null ? void 0 : s.disabled),
|
|
1640
|
+
editor: r
|
|
1641
|
+
}
|
|
1642
|
+
) }) : /* @__PURE__ */ i(x, {});
|
|
1643
|
+
}
|
|
1644
|
+
function Ze(t) {
|
|
1645
|
+
return t.type.name === ct.name;
|
|
1646
|
+
}
|
|
1647
|
+
function Qi() {
|
|
1648
|
+
const { lang: t, t: e } = A(), r = U(), n = M(), s = V(n, ct.name), o = $t(ct.name), l = ({ editor: h }) => {
|
|
1649
|
+
const { selection: c } = h.view.state, { $from: d, to: u } = c;
|
|
1650
|
+
let f = !1;
|
|
1651
|
+
return h.view.state.doc.nodesBetween(d.pos, u, (g) => {
|
|
1652
|
+
if (Ze(g))
|
|
1653
|
+
return f = !0, !1;
|
|
1654
|
+
}), f;
|
|
1655
|
+
}, a = z(() => ze(n, e), [n, t, e]);
|
|
1656
|
+
return r ? /* @__PURE__ */ i(
|
|
1657
|
+
E,
|
|
1658
|
+
{
|
|
1659
|
+
editor: n,
|
|
1660
|
+
shouldShow: l,
|
|
1661
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1662
|
+
children: a != null && a.length ? /* @__PURE__ */ i("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: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap", children: a == null ? void 0 : a.map((h, c) => h.type === "edit" && (s != null && s.src) ? /* @__PURE__ */ i(
|
|
1663
|
+
Xe,
|
|
1664
|
+
{
|
|
1665
|
+
attrs: s,
|
|
1666
|
+
editor: n,
|
|
1667
|
+
extension: o
|
|
1668
|
+
},
|
|
1669
|
+
`bubbleMenu-mermaid-${c}`
|
|
1670
|
+
) : /* @__PURE__ */ i(
|
|
1671
|
+
Ye,
|
|
1672
|
+
{
|
|
1673
|
+
editor: n,
|
|
1674
|
+
item: h
|
|
1675
|
+
},
|
|
1676
|
+
`bubbleMenu-mermaid-${c}`
|
|
1677
|
+
)) }) }) : /* @__PURE__ */ i(x, {})
|
|
1678
|
+
}
|
|
1679
|
+
) : /* @__PURE__ */ i(x, {});
|
|
1680
|
+
}
|
|
1681
|
+
function tn({ hiddenActions: t = [] }) {
|
|
1682
|
+
var T, I, C, R, O, B, W, y, m, b, D, G, X, ut, Y, pt, Z, ft;
|
|
1683
|
+
const { t: e } = A(), r = U(), n = M(), s = ({ editor: st }) => Gt(st.view.state, Jt.name), o = (st) => t.includes(st);
|
|
1684
|
+
function l() {
|
|
1685
|
+
n.chain().focus().addColumnBefore().run();
|
|
1686
|
+
}
|
|
1687
|
+
function a() {
|
|
1688
|
+
n.chain().focus().addColumnAfter().run();
|
|
1689
|
+
}
|
|
1690
|
+
function h() {
|
|
1691
|
+
n.chain().focus().deleteColumn().run();
|
|
1692
|
+
}
|
|
1693
|
+
function c() {
|
|
1694
|
+
n.chain().focus().addRowBefore().run();
|
|
1695
|
+
}
|
|
1696
|
+
function d() {
|
|
1697
|
+
n.chain().focus().addRowAfter().run();
|
|
1698
|
+
}
|
|
1699
|
+
function u() {
|
|
1700
|
+
n.chain().focus().deleteRow().run();
|
|
1701
|
+
}
|
|
1702
|
+
function f() {
|
|
1703
|
+
n.chain().focus().mergeCells().run();
|
|
1704
|
+
}
|
|
1705
|
+
function g() {
|
|
1706
|
+
n == null || n.chain().focus().splitCell().run();
|
|
1707
|
+
}
|
|
1708
|
+
function S() {
|
|
1709
|
+
n.chain().focus().deleteTable().run();
|
|
1710
|
+
}
|
|
1711
|
+
return r ? /* @__PURE__ */ i(
|
|
1712
|
+
E,
|
|
1713
|
+
{
|
|
1714
|
+
editor: n,
|
|
1715
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1716
|
+
shouldShow: s,
|
|
1717
|
+
updateDelay: 0,
|
|
1718
|
+
children: /* @__PURE__ */ v("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: [
|
|
1719
|
+
!o("addColumnBefore") && /* @__PURE__ */ i(
|
|
1720
|
+
p,
|
|
1721
|
+
{
|
|
1722
|
+
action: l,
|
|
1723
|
+
disabled: !((I = (T = n == null ? void 0 : n.can()) == null ? void 0 : T.addColumnBefore) != null && I.call(T)),
|
|
1724
|
+
icon: "BetweenHorizonalEnd",
|
|
1725
|
+
tooltip: e("editor.table.menu.insertColumnBefore"),
|
|
1726
|
+
tooltipOptions: { sideOffset: 15 }
|
|
1727
|
+
}
|
|
1728
|
+
),
|
|
1729
|
+
!o("addColumnAfter") && /* @__PURE__ */ i(
|
|
1730
|
+
p,
|
|
1731
|
+
{
|
|
1732
|
+
action: a,
|
|
1733
|
+
disabled: !((R = (C = n == null ? void 0 : n.can()) == null ? void 0 : C.addColumnAfter) != null && R.call(C)),
|
|
1734
|
+
icon: "BetweenHorizonalStart",
|
|
1735
|
+
tooltip: e("editor.table.menu.insertColumnAfter"),
|
|
1736
|
+
tooltipOptions: { sideOffset: 15 }
|
|
1737
|
+
}
|
|
1738
|
+
),
|
|
1739
|
+
!o("deleteColumn") && /* @__PURE__ */ i(
|
|
1740
|
+
p,
|
|
1741
|
+
{
|
|
1742
|
+
action: h,
|
|
1743
|
+
disabled: !((B = n == null ? void 0 : (O = n.can()).deleteColumn) != null && B.call(O)),
|
|
1744
|
+
icon: "DeleteColumn",
|
|
1745
|
+
tooltip: e("editor.table.menu.deleteColumn"),
|
|
1746
|
+
tooltipOptions: { sideOffset: 15 }
|
|
1747
|
+
}
|
|
1748
|
+
),
|
|
1749
|
+
/* @__PURE__ */ i(
|
|
1750
|
+
H,
|
|
1751
|
+
{
|
|
1752
|
+
className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",
|
|
1753
|
+
orientation: "vertical"
|
|
1754
|
+
}
|
|
1755
|
+
),
|
|
1756
|
+
!o("addRowAbove") && /* @__PURE__ */ i(
|
|
1757
|
+
p,
|
|
1758
|
+
{
|
|
1759
|
+
action: c,
|
|
1760
|
+
disabled: !((y = n == null ? void 0 : (W = n.can()).addRowBefore) != null && y.call(W)),
|
|
1761
|
+
icon: "BetweenVerticalEnd",
|
|
1762
|
+
tooltip: e("editor.table.menu.insertRowAbove"),
|
|
1763
|
+
tooltipOptions: { sideOffset: 15 }
|
|
1764
|
+
}
|
|
1765
|
+
),
|
|
1766
|
+
!o("addRowBelow") && /* @__PURE__ */ i(
|
|
1767
|
+
p,
|
|
1768
|
+
{
|
|
1769
|
+
action: d,
|
|
1770
|
+
disabled: !((b = (m = n == null ? void 0 : n.can()) == null ? void 0 : m.addRowAfter) != null && b.call(m)),
|
|
1771
|
+
icon: "BetweenVerticalStart",
|
|
1772
|
+
tooltip: e("editor.table.menu.insertRowBelow"),
|
|
1773
|
+
tooltipOptions: { sideOffset: 15 }
|
|
1774
|
+
}
|
|
1775
|
+
),
|
|
1776
|
+
!o("deleteRow") && /* @__PURE__ */ i(
|
|
1777
|
+
p,
|
|
1778
|
+
{
|
|
1779
|
+
action: u,
|
|
1780
|
+
disabled: !((G = (D = n == null ? void 0 : n.can()) == null ? void 0 : D.deleteRow) != null && G.call(D)),
|
|
1781
|
+
icon: "DeleteRow",
|
|
1782
|
+
tooltip: e("editor.table.menu.deleteRow"),
|
|
1783
|
+
tooltipOptions: { sideOffset: 15 }
|
|
1784
|
+
}
|
|
1785
|
+
),
|
|
1786
|
+
/* @__PURE__ */ i(
|
|
1787
|
+
H,
|
|
1788
|
+
{
|
|
1789
|
+
className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",
|
|
1790
|
+
orientation: "vertical"
|
|
1791
|
+
}
|
|
1792
|
+
),
|
|
1793
|
+
!o("mergeCells") && /* @__PURE__ */ i(
|
|
1794
|
+
p,
|
|
1795
|
+
{
|
|
1796
|
+
action: f,
|
|
1797
|
+
disabled: !((ut = (X = n == null ? void 0 : n.can()) == null ? void 0 : X.mergeCells) != null && ut.call(X)),
|
|
1798
|
+
icon: "TableCellsMerge",
|
|
1799
|
+
tooltip: e("editor.table.menu.mergeCells"),
|
|
1800
|
+
tooltipOptions: { sideOffset: 15 }
|
|
1801
|
+
}
|
|
1802
|
+
),
|
|
1803
|
+
!o("splitCells") && /* @__PURE__ */ i(
|
|
1804
|
+
p,
|
|
1805
|
+
{
|
|
1806
|
+
action: g,
|
|
1807
|
+
disabled: !((pt = (Y = n == null ? void 0 : n.can()) == null ? void 0 : Y.splitCell) != null && pt.call(Y)),
|
|
1808
|
+
icon: "TableCellsSplit",
|
|
1809
|
+
tooltip: e("editor.table.menu.splitCells"),
|
|
1810
|
+
tooltipOptions: { sideOffset: 15 }
|
|
1811
|
+
}
|
|
1812
|
+
),
|
|
1813
|
+
/* @__PURE__ */ i(
|
|
1814
|
+
H,
|
|
1815
|
+
{
|
|
1816
|
+
className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",
|
|
1817
|
+
orientation: "vertical"
|
|
1818
|
+
}
|
|
1819
|
+
),
|
|
1820
|
+
!o("deleteTable") && /* @__PURE__ */ i(
|
|
1821
|
+
p,
|
|
1822
|
+
{
|
|
1823
|
+
action: S,
|
|
1824
|
+
disabled: !((ft = (Z = n == null ? void 0 : n.can()) == null ? void 0 : Z.deleteTable) != null && ft.call(Z)),
|
|
1825
|
+
icon: "Trash2",
|
|
1826
|
+
tooltip: e("editor.table.menu.deleteTable"),
|
|
1827
|
+
tooltipOptions: { sideOffset: 15 }
|
|
1828
|
+
}
|
|
1829
|
+
)
|
|
1830
|
+
] })
|
|
1831
|
+
}
|
|
1832
|
+
) : /* @__PURE__ */ i(x, {});
|
|
1833
|
+
}
|
|
1834
|
+
function Je() {
|
|
1835
|
+
return /* @__PURE__ */ v(x, { children: [
|
|
1836
|
+
/* @__PURE__ */ i(ge, {}),
|
|
1837
|
+
/* @__PURE__ */ i(ve, {}),
|
|
1838
|
+
/* @__PURE__ */ i(bt, {}),
|
|
1839
|
+
/* @__PURE__ */ i(bt, {}),
|
|
1840
|
+
/* @__PURE__ */ i(ye, {}),
|
|
1841
|
+
/* @__PURE__ */ i(xe, {}),
|
|
1842
|
+
/* @__PURE__ */ i(ue, {}),
|
|
1843
|
+
/* @__PURE__ */ i(
|
|
1844
|
+
H,
|
|
1845
|
+
{
|
|
1846
|
+
className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",
|
|
1847
|
+
orientation: "vertical"
|
|
1848
|
+
}
|
|
1849
|
+
),
|
|
1850
|
+
/* @__PURE__ */ i(be, {}),
|
|
1851
|
+
/* @__PURE__ */ i(we, {}),
|
|
1852
|
+
/* @__PURE__ */ i(Ce, {})
|
|
1853
|
+
] });
|
|
1854
|
+
}
|
|
1855
|
+
function en({ buttonBubble: t }) {
|
|
1856
|
+
const e = M(), r = U(), n = ({ editor: s }) => {
|
|
1857
|
+
const { selection: o } = s.view.state, { $from: l, to: a } = o;
|
|
1858
|
+
return l.pos === a ? !1 : o instanceof Yt;
|
|
1859
|
+
};
|
|
1860
|
+
return r ? /* @__PURE__ */ i(
|
|
1861
|
+
E,
|
|
1862
|
+
{
|
|
1863
|
+
editor: e,
|
|
1864
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1865
|
+
shouldShow: n,
|
|
1866
|
+
children: t ? /* @__PURE__ */ i(x, { children: t }) : /* @__PURE__ */ i("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: /* @__PURE__ */ i("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: /* @__PURE__ */ i(Je, {}) }) })
|
|
1867
|
+
}
|
|
1868
|
+
) : /* @__PURE__ */ i(x, {});
|
|
1869
|
+
}
|
|
1870
|
+
function nn() {
|
|
1871
|
+
const { t } = A(), e = U(), r = M(), [n, s] = P(!1), o = w(({ editor: h }) => h.isActive(wt.name), []), l = (h) => {
|
|
1872
|
+
r.commands.updateTweet({ src: h }), s(!1);
|
|
1873
|
+
}, a = w(() => j(wt.name, r), [r]);
|
|
1874
|
+
return e ? /* @__PURE__ */ i(
|
|
1875
|
+
E,
|
|
1876
|
+
{
|
|
1877
|
+
editor: r,
|
|
1878
|
+
shouldShow: o,
|
|
1879
|
+
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1880
|
+
children: /* @__PURE__ */ i(x, { children: n ? /* @__PURE__ */ i(
|
|
1881
|
+
Te,
|
|
1882
|
+
{
|
|
1883
|
+
editor: r,
|
|
1884
|
+
onSetLink: l
|
|
1885
|
+
}
|
|
1886
|
+
) : /* @__PURE__ */ i("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: /* @__PURE__ */ v("div", { className: "richtext-flex richtext-flex-nowrap", children: [
|
|
1887
|
+
/* @__PURE__ */ i(
|
|
1888
|
+
p,
|
|
1889
|
+
{
|
|
1890
|
+
icon: "Pencil",
|
|
1891
|
+
tooltip: t("editor.link.edit.tooltip"),
|
|
1892
|
+
tooltipOptions: { sideOffset: 15 },
|
|
1893
|
+
action: () => {
|
|
1894
|
+
s(!0);
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
),
|
|
1898
|
+
/* @__PURE__ */ i(
|
|
1899
|
+
p,
|
|
1900
|
+
{
|
|
1901
|
+
action: a,
|
|
1902
|
+
icon: "Trash",
|
|
1903
|
+
tooltip: t("editor.delete"),
|
|
1904
|
+
tooltipOptions: { sideOffset: 15 }
|
|
1905
|
+
}
|
|
1906
|
+
)
|
|
1907
|
+
] }) }) })
|
|
1908
|
+
}
|
|
1909
|
+
) : /* @__PURE__ */ i(x, {});
|
|
1910
|
+
}
|
|
1911
|
+
export {
|
|
1912
|
+
_i as RichTextBubbleColumns,
|
|
1913
|
+
Ki as RichTextBubbleDrawer,
|
|
1914
|
+
qi as RichTextBubbleExcalidraw,
|
|
1915
|
+
ji as RichTextBubbleIframe,
|
|
1916
|
+
Yi as RichTextBubbleImage,
|
|
1917
|
+
Zi as RichTextBubbleImageGif,
|
|
1918
|
+
Gi as RichTextBubbleKatex,
|
|
1919
|
+
Xi as RichTextBubbleLink,
|
|
1920
|
+
Qi as RichTextBubbleMermaid,
|
|
1921
|
+
tn as RichTextBubbleTable,
|
|
1922
|
+
en as RichTextBubbleText,
|
|
1923
|
+
nn as RichTextBubbleTwitter,
|
|
1924
|
+
Ji as RichTextBubbleVideo
|
|
1925
|
+
};
|