reactjs-tiptap-editor 1.0.9 → 1.0.11
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-CmDopTWt.cjs → ActionMenuButton-BLlse5KO.cjs} +1 -1
- package/lib/{ActionMenuButton-C4aNFFa8.js → ActionMenuButton-DTXFBdGX.js} +2 -2
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +7 -7
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +3 -3
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +6 -6
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +3 -3
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +3 -3
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +6 -6
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +4 -4
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +3 -3
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +5 -5
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +8 -8
- package/lib/{Drawer-DG0gPU_U.js → Drawer-D0yQ0wR7.js} +6 -6
- package/lib/{Drawer-CTr2snNd.cjs → Drawer-kv6BU_6O.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +8 -7
- package/lib/{Excalidraw-DtezFdjR.cjs → Excalidraw-B82ThkJA.cjs} +1 -1
- package/lib/{Excalidraw-DpgdxOsc.js → Excalidraw-CO4IRHmG.js} +7 -7
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +2 -2
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +3 -3
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +3 -3
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +5 -5
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +5 -5
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +5 -5
- package/lib/History.cjs +1 -1
- package/lib/History.js +4 -4
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +3 -3
- package/lib/{Icon-C_buGjWy.js → Icon-DRuJhcHK.js} +1 -1
- package/lib/{Icon-b6HQAURz.cjs → Icon-DXePECFW.cjs} +1 -1
- package/lib/{Iframe-CUrXCDxj.cjs → Iframe-03dn9wcM.cjs} +1 -1
- package/lib/{Iframe-De88TYvj.js → Iframe-BEO28NPs.js} +8 -8
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +13 -13
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +14 -14
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +3 -3
- package/lib/{Indent-Bensb2nf.js → Indent-CXurBbOr.js} +5 -5
- package/lib/{Indent-D_KtZNHW.cjs → Indent-Cqjdn3Jt.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +3 -3
- package/lib/{Katex-C0dtqznb.js → Katex-Bvj469K1.js} +7 -7
- package/lib/{Katex-NqelWRoi.cjs → Katex-DdWTV5NJ.cjs} +1 -1
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +5 -5
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-BSZ-vgNB.cjs → LinkEditBlock-8ePAZ-G1.cjs} +1 -1
- package/lib/{LinkEditBlock-Bv12sKvW.js → LinkEditBlock-DjXUEubR.js} +32 -32
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +23 -22
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +26 -26
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +5 -5
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +3 -3
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +9 -9
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +39 -266
- package/lib/SlashCommandNodeView-Bl_gwZJB.cjs +1 -0
- package/lib/SlashCommandNodeView-CcqL8ymb.js +254 -0
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +3 -3
- package/lib/{Table-D9ckv6Tb.js → Table-9Y0Cg8Ab.js} +5 -5
- package/lib/{Table-cy1mUM2X.cjs → Table-DBGjezZK.cjs} +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +3 -3
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +5 -5
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +5 -5
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +3 -3
- package/lib/{Twitter-Bvs3sW8F.cjs → Twitter-Cnvt7GBg.cjs} +1 -1
- package/lib/{Twitter-KUvyySA0.js → Twitter-DWwd0vHR.js} +46 -46
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +2 -2
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +7 -7
- package/lib/bubble.cjs +4 -4
- package/lib/bubble.js +1659 -1567
- package/lib/{button-U6XpZt2X.cjs → button-BW5bDPz_.cjs} +1 -1
- package/lib/{button-D8SI-g7p.js → button-RnHbJfd-.js} +1 -1
- package/lib/{checkbox-xrY2c5yo.js → checkbox-CLSoR1Qj.js} +1 -1
- package/lib/{checkbox-DaIBNthL.cjs → checkbox-CTEN0q4y.cjs} +1 -1
- package/lib/{dialog-DgnnVCfv.cjs → dialog-CMC9hsCo.cjs} +1 -1
- package/lib/{dialog-DjnkASYP.js → dialog-D_HCtKvc.js} +1 -1
- package/lib/{dropdown-menu-bI14Gyw4.js → dropdown-menu-66q7Ofc5.js} +3 -2
- package/lib/dropdown-menu-DKSAS-w_.cjs +1 -0
- package/lib/extensions/SlashCommand/types.d.ts +1 -0
- package/lib/index-9A6-kVBM.js +1351 -0
- package/lib/{index-4pRt5Vqu.js → index-C3zg3DPB.js} +442 -403
- package/lib/index-C838s-or.cjs +8 -0
- package/lib/index-Cv9Z6dyV.cjs +1 -0
- package/lib/{index-EKFybgpP.js → index-DKt5wfAc.js} +1 -1
- package/lib/{index-BimeTI7q.js → index-DRHrDScg.js} +1 -1
- package/lib/{index-BQ6ZdLsu.js → index-DmPwbBqm.js} +1 -1
- package/lib/{index-CbIQPoF6.js → index-sVScpCFG.js} +20 -20
- package/lib/index.cjs +1 -1
- package/lib/index.js +5 -5
- package/lib/{input-C5zU49Q1.js → input-CvyMYMZG.js} +1 -1
- package/lib/{input-BtDj0NeF.cjs → input-D555880-.cjs} +1 -1
- package/lib/{isNumber-8HKEgTkA.js → isNumber-DF0fU3ob.js} +1 -1
- package/lib/{label-BEUVs-IA.js → label-DsOYPjAo.js} +1 -1
- package/lib/{label-C8BonzOY.cjs → label-E6jF3Xud.cjs} +1 -1
- package/lib/{popover-CPY5lMCj.js → popover-B7ec5-u2.js} +1 -1
- package/lib/{popover-DjL0De8d.cjs → popover-BSzR_R01.cjs} +1 -1
- package/lib/{separator-BlIlS7LP.js → separator-JaTTqb3J.js} +4 -4
- package/lib/{separator-BzMkiI_c.cjs → separator-PGnA-6Hr.cjs} +1 -1
- package/lib/{store-D_GvIPxo.js → store-Cf7tFiiI.js} +1 -1
- package/lib/{store-BSCjQxMK.cjs → store-oDk-lTPM.cjs} +1 -1
- package/lib/style.css +1 -1
- package/lib/{tabs-CHy82_rs.cjs → tabs-BTwiZkWd.cjs} +1 -1
- package/lib/{tabs-tQpXIzfV.js → tabs-CWr9HYaM.js} +1 -1
- package/lib/{textarea-CMDYVXYo.js → textarea-BdeLXbp8.js} +1 -1
- package/lib/{textarea-B-qfanCT.cjs → textarea-Yetl_PZi.cjs} +1 -1
- package/lib/{throttle-BIkZV3Y_.js → throttle-DsowOft0.js} +1 -1
- package/lib/updatePosition-Bbd8ETMv.js +16 -0
- package/lib/updatePosition-M2IyqkI1.cjs +1 -0
- package/lib/{useButtonProps-BqBGuqoP.cjs → useButtonProps-DfnJiJLV.cjs} +1 -1
- package/lib/{useButtonProps-DTngjZge.js → useButtonProps-cMoicZgd.js} +14 -14
- package/package.json +1 -1
- package/lib/dropdown-menu-BvVMltdB.cjs +0 -1
- package/lib/floating-ui.dom-U1vPFQ5f.js +0 -1151
- package/lib/floating-ui.dom-VCrc58uF.cjs +0 -1
- package/lib/index-DvvMf6Wu.cjs +0 -7
- package/lib/updatePosition-GLTrgcib.js +0 -215
- package/lib/updatePosition-u2mTh3mG.cjs +0 -1
package/lib/Emoji.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { N as x,
|
|
1
|
+
import { N as x, I as z, J as q, K as S, a0 as M, a1 as N, P as T, n as G, m as H, C as P, R } from "./index-sVScpCFG.js";
|
|
2
2
|
import { PluginKey as w, Plugin as L } from "@tiptap/pm/state";
|
|
3
|
-
import { i as O
|
|
3
|
+
import { i as O } from "./index-9A6-kVBM.js";
|
|
4
|
+
import { u as k } from "./updatePosition-Bbd8ETMv.js";
|
|
4
5
|
import { jsx as p, jsxs as h, Fragment as I } from "react/jsx-runtime";
|
|
5
6
|
import { forwardRef as K, useRef as V, useState as E, useMemo as $, useEffect as D, useImperativeHandle as U } from "react";
|
|
6
7
|
import W from "scroll-into-view-if-needed";
|
|
7
8
|
import { u as Z } from "./index-0OnGZkVF.js";
|
|
8
|
-
import { c as b, A as J } from "./index-
|
|
9
|
+
import { c as b, A as J } from "./index-C3zg3DPB.js";
|
|
9
10
|
import { EmojiPicker as d } from "frimousse";
|
|
10
11
|
import { SearchIcon as Y, LoaderIcon as X } from "lucide-react";
|
|
11
|
-
import { u as Q, b as ee } from "./useButtonProps-
|
|
12
|
-
import { P as ae, a as oe, b as se } from "./popover-
|
|
12
|
+
import { u as Q, b as ee } from "./useButtonProps-cMoicZgd.js";
|
|
13
|
+
import { P as ae, a as oe, b as se } from "./popover-B7ec5-u2.js";
|
|
13
14
|
const ne = () => /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
14
15
|
var _ = /* @__PURE__ */ new Map();
|
|
15
16
|
function te(e) {
|
|
@@ -21691,7 +21692,7 @@ function Ie({ onSelectEmoji: e, children: a, disabled: o }) {
|
|
|
21691
21692
|
}
|
|
21692
21693
|
);
|
|
21693
21694
|
}
|
|
21694
|
-
function
|
|
21695
|
+
function Le() {
|
|
21695
21696
|
const e = Q(Ce.name), {
|
|
21696
21697
|
icon: a = void 0,
|
|
21697
21698
|
tooltip: o = void 0,
|
|
@@ -21772,5 +21773,5 @@ const Ee = 200, Ce = /* @__PURE__ */ fe.extend({
|
|
|
21772
21773
|
export {
|
|
21773
21774
|
Ee as EXTENSION_PRIORITY_HIGHEST,
|
|
21774
21775
|
Ce as Emoji,
|
|
21775
|
-
|
|
21776
|
+
Le as RichTextEmoji
|
|
21776
21777
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var B=Object.create;var H=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var F=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of V(t))!X.call(e,a)&&a!==r&&H(e,a,{get:()=>t[a],enumerable:!(n=$(t,a))||n.enumerable});return e};var k=(e,t,r)=>(r=e!=null?B(U(e)):{},F(t||!e||!e.__esModule?H(r,"default",{value:e,enumerable:!0}):r,e));const E=require("./index-BBNITgNi.cjs"),s=require("react/jsx-runtime"),i=require("react"),L=require("./index-
|
|
1
|
+
"use strict";var B=Object.create;var H=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var F=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of V(t))!X.call(e,a)&&a!==r&&H(e,a,{get:()=>t[a],enumerable:!(n=$(t,a))||n.enumerable});return e};var k=(e,t,r)=>(r=e!=null?B(U(e)):{},F(t||!e||!e.__esModule?H(r,"default",{value:e,enumerable:!0}):r,e));const E=require("./index-BBNITgNi.cjs"),s=require("react/jsx-runtime"),i=require("react"),L=require("./index-C838s-or.cjs"),A=require("./dialog-CMC9hsCo.cjs"),T=require("./useButtonProps-DfnJiJLV.cjs"),G=require("re-resizable"),I=require("./dom-dataset-BqoJhJXt.cjs"),Y=require("./button-BW5bDPz_.cjs");function J(e){return e=e||new Map,{all:e,on(t,r){const n=e.get(t);n?n.push(r):e.set(t,[r])},off(t,r){const n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit(t,r){let n=e.get(t);n&&[...n].map(a=>{a(r)}),n=e.get("*"),n&&[...n].map(a=>{a(t,r)})}}}let C;function W(){try{return C||(C=J()),C}catch{throw new Error("Error EventEmitter")}}const R="OPEN_EXCALIDRAW_SETTING_MODAL";function K(e,t){W().on(e,t)}function Q(e,t){W().off(e,t)}function ee(e){W().emit(R,e)}function te(){const e=T.useEditorInstance(),t=T.useButtonProps(M.name),r=T.useExtension(M.name),{tooltipOptions:n={},isActive:a=void 0}=(t==null?void 0:t.componentProps)??{},{editorDisabled:f}=T.useToggleActive(a),u=i.useMemo(()=>(r==null?void 0:r.options)||{},[r]),[c,_]=i.useState(null),[x,y]=i.useState({}),[b,N]=i.useState({elements:[],appState:{isLoading:!1},files:null}),[d,h]=i.useState(!1),[v,j]=i.useState(!0),[m,O]=i.useState(null),o=i.useCallback(p=>{p&&import("@excalidraw/excalidraw").then(g=>{_(g.Excalidraw)}).catch(O).finally(()=>j(!1))},[j]),l=i.useCallback(p=>{setTimeout(()=>{p.refresh()})},[]),w=i.useCallback((p,g,z)=>{y({elements:p,appState:{isLoading:!1},files:z})},[]),D=i.useCallback(()=>{if(!c){h(!1);return}e.chain().focus().setExcalidraw({data:x}).run(),h(!1)},[c,e,x,h]);return i.useEffect(()=>{const p=g=>{(g==null?void 0:g.editor)===e&&(h(!0),g&&N(g.data))};return K(R,p),()=>{Q(R,p)}},[e,h]),i.useEffect(()=>{!v&&c&&d&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},400)},[v,c,d]),s.jsxs(A.Dialog,{onOpenChange:h,open:d,children:[s.jsx(A.DialogTrigger,{asChild:!0,children:s.jsx(L.ActionButton,{disabled:f,icon:"Excalidraw",tooltip:"Excalidraw",tooltipOptions:n,action:()=>{f||h(!0)}})}),s.jsxs(A.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[s.jsx(A.DialogTitle,{children:"Excalidraw"}),s.jsxs("div",{style:{height:"100%",borderWidth:1},children:[v&&s.jsx("p",{children:"Loading..."}),m&&s.jsx("p",{children:m&&m.message||"Error"}),s.jsx("div",{ref:o,style:{width:"100%",height:600},children:!v&&!m&&c?s.jsx(c,{initialData:b,langCode:"en",onChange:w,ref:l,...u.excalidrawProps}):null})]}),s.jsx(A.DialogFooter,{children:s.jsx(Y.Button,{disabled:!c,onClick:D,type:"button",children:"Save changes"})})]})]})}const re="_wrap_dra8y_1",ne="_renderWrap_dra8y_7",se="_handlerWrap_dra8y_30",ie="_disabled_dra8y_40",S={wrap:re,renderWrap:ne,handlerWrap:se,disabled:ie},ae=10,oe=200,q=15,P={width:"100%",height:"100%",maxWidth:"100%"};function ce({editor:e,node:t,updateAttributes:r}){const n=i.useRef(null),a=L.useEditableEditor(),f=e.isActive(M.name),{data:u,width:c,height:_}=t.attrs,[x,y]=i.useState(null),[b,N]=i.useState(!0),[d,h]=i.useState(null),[v,j]=i.useState(100),m=i.useCallback(o=>()=>{j(l=>T.clamp(o==="minus"?l-q:l+q,ae,oe))},[]);i.useEffect(()=>{let o=!1;return import("@excalidraw/excalidraw").then(l=>{o||(n.current=l.exportToSvg)}).catch(l=>!o&&h(l)).finally(()=>!o&&N(!1)),()=>{o=!0}},[u]),i.useEffect(()=>{let o=!1;return(async()=>{if(!n.current||o||b||d||!u)return;const w=await n.current(u);o||(w.setAttribute("width","100%"),w.setAttribute("height","100%"),w.setAttribute("display","block"),y(w))})(),()=>{o=!0}},[u,b,d]);const O=o=>{r({width:o.width,height:o.height})};return s.jsx(E.NodeViewWrapper,{className:E.clsx(S.wrap,{[S.active]:f,[S.disabled]:!a}),children:s.jsx(G.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(_)},onResizeStop:(o,l,w,D)=>{O({width:Number.parseInt(c)+D.width,height:Number.parseInt(_)+D.height})},children:s.jsxs("div",{className:E.clsx(S.renderWrap,"render-wrapper"),style:{...P,overflow:"hidden"},children:[d&&s.jsx("div",{style:P,children:s.jsx("p",{children:d.message||d})}),b&&s.jsx("p",{children:"Loading..."}),!b&&!d&&x&&s.jsx("div",{dangerouslySetInnerHTML:{__html:(x==null?void 0:x.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${v/100})`,transition:"all ease-in-out .3s"}}),s.jsxs("div",{className:S.handlerWrap,children:[s.jsx(L.ActionButton,{action:m("minus"),disabled:!a,icon:"ZoomOut",tooltip:"Zoom Out"}),s.jsx(L.ActionButton,{action:m("plus"),disabled:!a,icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}const Z={elements:[]},M=E.Node3.create({name:"excalidraw",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addAttributes(){return{defaultShowPicker:{default:!1},createUser:{default:null},width:{default:"100%",parseHTML:I.getDatasetAttribute("width")},height:{default:240,parseHTML:I.getDatasetAttribute("height")},data:{default:Z,parseHTML:I.getDatasetAttribute("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},excalidrawProps:{},button:()=>({componentProps:{}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:t}){return["div",E.mergeAttributes(this.options.HTMLAttributes,e,I.nodeAttrsToDataset(t))]},addCommands(){return{setExcalidraw:e=>({tr:t,commands:r,chain:n})=>{var a,f,u;return e=e||{},e.data=e.data||Z,((u=(f=(a=t.selection)==null?void 0:a.node)==null?void 0:f.type)==null?void 0:u.name)==this.name?r.updateAttributes(this.name,e):n().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return E.ReactNodeViewRenderer(ce)},addInputRules(){return[E.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=M;exports.RichTextExcalidraw=te;exports.triggerOpenExcalidrawSettingModal=ee;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { q as V, C as Z, N as $, n as B, u as U, m as X } from "./index-sVScpCFG.js";
|
|
2
2
|
import { jsxs as T, jsx as i } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo as F, useState as l, useCallback as A, useEffect as N, useRef as G } from "react";
|
|
4
|
-
import { A as C, k as
|
|
5
|
-
import { D as
|
|
6
|
-
import { c as te, u as re, d as ne, a as ie, f as ae } from "./useButtonProps-
|
|
4
|
+
import { A as C, k as q } from "./index-C3zg3DPB.js";
|
|
5
|
+
import { D as Y, a as J, b as K, c as Q, d as ee } from "./dialog-D_HCtKvc.js";
|
|
6
|
+
import { c as te, u as re, d as ne, a as ie, f as ae } from "./useButtonProps-cMoicZgd.js";
|
|
7
7
|
import { Resizable as se } from "re-resizable";
|
|
8
8
|
import { n as oe, g as O } from "./dom-dataset-CIEeltF6.js";
|
|
9
|
-
import { B as de } from "./button-
|
|
9
|
+
import { B as de } from "./button-RnHbJfd-.js";
|
|
10
10
|
function ce(e) {
|
|
11
11
|
return e = e || /* @__PURE__ */ new Map(), {
|
|
12
12
|
/**
|
|
@@ -114,7 +114,7 @@ function Me() {
|
|
|
114
114
|
window.dispatchEvent(new Event("resize"));
|
|
115
115
|
}, 400);
|
|
116
116
|
}, [x, o, d]), /* @__PURE__ */ T(
|
|
117
|
-
|
|
117
|
+
Y,
|
|
118
118
|
{
|
|
119
119
|
onOpenChange: h,
|
|
120
120
|
open: d,
|
|
@@ -175,7 +175,7 @@ const he = "_wrap_dra8y_1", pe = "_renderWrap_dra8y_7", me = "_handlerWrap_dra8y
|
|
|
175
175
|
disabled: fe
|
|
176
176
|
}, ge = 10, we = 200, P = 15, k = { width: "100%", height: "100%", maxWidth: "100%" };
|
|
177
177
|
function Ee({ editor: e, node: t, updateAttributes: n }) {
|
|
178
|
-
const r = G(null), s =
|
|
178
|
+
const r = G(null), s = q(), f = e.isActive(W.name), { data: u, width: o, height: _ } = t.attrs, [g, y] = l(null), [b, M] = l(!0), [d, h] = l(null), [x, I] = l(100), w = A((a) => () => {
|
|
179
179
|
I(
|
|
180
180
|
(c) => ae(a === "minus" ? c - P : c + P, ge, we)
|
|
181
181
|
);
|
package/lib/Excalidraw.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-BBNITgNi.cjs");const e=require("./Excalidraw-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-BBNITgNi.cjs");const e=require("./Excalidraw-B82ThkJA.cjs");require("./dom-dataset-BqoJhJXt.cjs");exports.Excalidraw=e.Excalidraw;exports.RichTextExcalidraw=e.RichTextExcalidraw;
|
package/lib/Excalidraw.js
CHANGED
package/lib/ExportPdf.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-BBNITgNi.cjs"),l=require("react/jsx-runtime"),y=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-BBNITgNi.cjs"),l=require("react/jsx-runtime"),y=require("./index-C838s-or.cjs");require("react");const h=require("./useButtonProps-DfnJiJLV.cjs");function P(e,n){var m;const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t);const o=t.contentDocument||((m=t.contentWindow)==null?void 0:m.document);if(!o)return;const{paperSize:s,title:i="React Tiptap Editor",margins:{top:d,right:c,bottom:r,left:a}}=n,p=`
|
|
2
2
|
<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
package/lib/ExportPdf.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { E as b } from "./index-
|
|
1
|
+
import { E as b } from "./index-sVScpCFG.js";
|
|
2
2
|
import { jsx as u, Fragment as v } from "react/jsx-runtime";
|
|
3
|
-
import { A as y } from "./index-
|
|
3
|
+
import { A as y } from "./index-C3zg3DPB.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import { u as x, a as E } from "./useButtonProps-
|
|
5
|
+
import { u as x, a as E } from "./useButtonProps-cMoicZgd.js";
|
|
6
6
|
function P(o, i) {
|
|
7
7
|
var m;
|
|
8
8
|
const t = document.createElement("iframe");
|
package/lib/ExportWord.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-BBNITgNi.cjs"),u=require("docx"),n=require("prosemirror-docx"),i=require("react/jsx-runtime"),y=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-BBNITgNi.cjs"),u=require("docx"),n=require("prosemirror-docx"),i=require("react/jsx-runtime"),y=require("./index-C838s-or.cjs"),B=require("react"),l=require("./useButtonProps-DfnJiJLV.cjs"),v=typeof window<"u";function g(o,e){if(v){const r=window.URL.createObjectURL(o),t=document.createElement("a");return t.href=r,t.download=e,t.click(),window.URL.revokeObjectURL(r),Promise.resolve()}return console.error("Download is not supported in Node.js"),Promise.resolve()}function E(){const o=l.useButtonProps(p.name),[e,r]=B.useState(!1),{icon:t=void 0,tooltip:a=void 0,shortcutKeys:s=void 0,tooltipOptions:f={},action:c=void 0,isActive:x=void 0}=(o==null?void 0:o.componentProps)??{},{dataState:m,disabled:d,update:w}=l.useToggleActive(x),b=async()=>{d||e||c&&(r(!0),await c(),w(),r(!1))};return o?i.jsx(y.ActionButton,{action:b,dataState:m,disabled:d||e,icon:e?"Loader":t,shortcutKeys:s,tooltip:a,tooltipOptions:f}):i.jsx(i.Fragment,{})}const W={...n.defaultNodes,hardBreak:n.defaultNodes.hard_break,codeBlock:n.defaultNodes.code_block,orderedList:n.defaultNodes.ordered_list,listItem:n.defaultNodes.list_item,bulletList:n.defaultNodes.bullet_list,horizontalRule:n.defaultNodes.horizontal_rule,image(o,e){o.renderInline(e),o.closeBlock(e)},table(o,e){o.table(e,{tableOptions:{width:{size:100,type:u.WidthType.PERCENTAGE}}})}},R=new n.DocxSerializer(W,n.defaultMarks),p=h.Extension.create({name:"exportWord",addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),button:({editor:e,t:r})=>({componentProps:{icon:"ExportWord",action:()=>{var t;return e==null?void 0:e.commands.exportToWord((t=e==null?void 0:e.state)==null?void 0:t.doc)},tooltip:r("editor.exportWord.tooltip"),isActive:()=>!1,disabled:!1}})}},addCommands(){return{exportToWord:o=>async()=>{try{const e={getImageBuffer:async t=>{const s=await(await fetch(t)).arrayBuffer();return new Uint8Array(s)}},r=R.serialize(o,e);return u.Packer.toBlob(r).then(t=>g(new Blob([t]),"richtext-export-document.docx")),!0}catch(e){return console.error("Error exporting to Word:",e),!1}}}}});exports.ExportWord=p;exports.RichTextExportWord=E;
|
package/lib/ExportWord.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as w } from "./index-
|
|
1
|
+
import { E as w } from "./index-sVScpCFG.js";
|
|
2
2
|
import { Packer as x, WidthType as b } from "docx";
|
|
3
3
|
import { defaultNodes as n, DocxSerializer as h, defaultMarks as B } from "prosemirror-docx";
|
|
4
4
|
import { jsx as d, Fragment as v } from "react/jsx-runtime";
|
|
5
|
-
import { A as y } from "./index-
|
|
5
|
+
import { A as y } from "./index-C3zg3DPB.js";
|
|
6
6
|
import { useState as E } from "react";
|
|
7
|
-
import { u as g, a as k } from "./useButtonProps-
|
|
7
|
+
import { u as g, a as k } from "./useButtonProps-cMoicZgd.js";
|
|
8
8
|
const W = typeof window < "u";
|
|
9
9
|
function A(e, o) {
|
|
10
10
|
if (W) {
|
package/lib/FontFamily.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-BZ6DfR2r.cjs"),F=require("./index-FSRjMsxW.cjs"),f=require("./useButtonProps-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-BZ6DfR2r.cjs"),F=require("./index-FSRjMsxW.cjs"),f=require("./useButtonProps-DfnJiJLV.cjs"),e=require("react/jsx-runtime"),m=require("react");require("./index-C838s-or.cjs");const x=require("./ActionMenuButton-BLlse5KO.cjs"),d=require("./dropdown-menu-DKSAS-w_.cjs");function M(){const{t:l}=F.useLocale(),n=f.useButtonProps(p.name),{icon:u=void 0,tooltip:a=void 0,items:r=[],isActive:s=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:c,dataState:t}=f.useActive(s),o=m.useMemo(()=>(t==null?void 0:t.font)||l("editor.fontFamily.default.tooltip"),[t]);return n?e.jsxs(d.DropdownMenu,{children:[e.jsx(d.DropdownMenuTrigger,{asChild:!0,disabled:c,children:e.jsx(x.ActionMenuButton,{disabled:c,icon:u,title:(o==null?void 0:o.length)>12?`${o==null?void 0:o.slice(0,12)}...`:o,tooltip:a})}),e.jsx(d.DropdownMenuContent,{className:"richtext-w-full",children:r==null?void 0:r.map((i,y)=>{const h=i.font===l("editor.fontFamily.default.tooltip")?{}:{fontFamily:i.font};return e.jsxs(m.Fragment,{children:[e.jsx(d.DropdownMenuCheckboxItem,{checked:o===i.font,onClick:i.action,children:e.jsx("div",{className:"richtext-ml-1 richtext-h-full",style:h,children:i.font})}),i.font===l("editor.fontFamily.default.tooltip")&&e.jsx(d.DropdownMenuSeparator,{})]},`font-family-${y}`)})})]}):e.jsx(e.Fragment,{})}const p=v.FontFamily.extend({addOptions(){var l;return{...(l=this.parent)==null?void 0:l.call(this),fontFamilyList:F.DEFAULT_FONT_FAMILY_LIST,button({editor:n,extension:u,t:a}){var c;const r=f.ensureNameValueOptions(((c=u==null?void 0:u.options)==null?void 0:c.fontFamilyList)||[]),s=r.map(t=>({action:()=>{if(t.value==="Default"){n.chain().focus().unsetFontFamily().run();return}n.chain().focus().setFontFamily(t.value).run()},isActive:()=>n.isActive("textStyle",{fontFamily:t.value})||!1,title:t.name,font:t.value,default:t.value==="Default"}));return{componentProps:{tooltip:a("editor.fontFamily.tooltip"),disabled:!1,items:s,isActive:()=>{const t=s==null?void 0:s.find(i=>i.isActive());return t&&!t.default?t:{title:a("editor.fontFamily.default.tooltip"),font:a("editor.fontFamily.default.tooltip"),isActive:()=>!1,disabled:!1}},icon:"MenuDown",fontFamilyList:r}}}}}});exports.FontFamily=p;exports.RichTextFontFamily=M;
|
package/lib/FontFamily.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { F as p } from "./index-
|
|
1
|
+
import { F as p } from "./index-DmPwbBqm.js";
|
|
2
2
|
import { u as F, D as y } from "./index-0OnGZkVF.js";
|
|
3
|
-
import { u as h, b as v, e as A } from "./useButtonProps-
|
|
3
|
+
import { u as h, b as v, e as A } from "./useButtonProps-cMoicZgd.js";
|
|
4
4
|
import { jsx as i, Fragment as D, jsxs as f } from "react/jsx-runtime";
|
|
5
5
|
import { useMemo as M, Fragment as w } from "react";
|
|
6
|
-
import "./index-
|
|
7
|
-
import { A as L } from "./ActionMenuButton-
|
|
8
|
-
import { D as b, a as g, b as x, c as T, d as C } from "./dropdown-menu-
|
|
6
|
+
import "./index-C3zg3DPB.js";
|
|
7
|
+
import { A as L } from "./ActionMenuButton-DTXFBdGX.js";
|
|
8
|
+
import { D as b, a as g, b as x, c as T, d as C } from "./dropdown-menu-66q7Ofc5.js";
|
|
9
9
|
function S() {
|
|
10
10
|
const { t: a } = F(), n = h(N.name), {
|
|
11
11
|
icon: s = void 0,
|
package/lib/FontSize.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-BBNITgNi.cjs"),x=require("./index-FSRjMsxW.cjs"),S=require("./useButtonProps-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-BBNITgNi.cjs"),x=require("./index-FSRjMsxW.cjs"),S=require("./useButtonProps-DfnJiJLV.cjs"),o=require("react/jsx-runtime"),p=require("react");require("./index-C838s-or.cjs");const h=require("./ActionMenuButton-BLlse5KO.cjs"),l=require("./dropdown-menu-DKSAS-w_.cjs");function v(){const{t:e}=x.useLocale(),n=S.useButtonProps(z.name),{icon:d=void 0,tooltip:s=void 0,items:c=[],isActive:a=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:u,dataState:t}=S.useActive(a),r=p.useMemo(()=>(t==null?void 0:t.title)||e("editor.fontSize.default.tooltip"),[t]);return n?o.jsxs(l.DropdownMenu,{children:[o.jsx(l.DropdownMenuTrigger,{asChild:!0,disabled:u,children:o.jsx(h.ActionMenuButton,{disabled:u,icon:d,title:r,tooltip:s})}),o.jsx(l.DropdownMenuContent,{className:"richtext-max-h-96 richtext-w-32 richtext-overflow-y-auto",children:c==null?void 0:c.map((i,f)=>o.jsxs(p.Fragment,{children:[o.jsx(l.DropdownMenuCheckboxItem,{checked:r===i.title,onClick:i.action,children:o.jsx("div",{className:"richtext-ml-1 richtext-h-full",children:i.title})}),i.title===e("editor.fontSize.default.tooltip")&&o.jsx(l.DropdownMenuSeparator,{})]},`font-size-${f}`))})]}):o.jsx(o.Fragment,{})}const z=m.Extension.create({name:"fontSize",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["textStyle"],fontSizes:x.DEFAULT_FONT_SIZE_LIST,button({editor:n,extension:d,t:s}){var u;const a=S.ensureNameValueOptions((u=d.options)==null?void 0:u.fontSizes).map(t=>({title:t.value==="Default"?s("editor.fontSize.default.tooltip"):String(t.name),isActive:()=>{const{fontSize:r}=n.getAttributes("textStyle"),i=t.value==="Default",f=r==null||r==="";return i&&f?!0:n.isActive({fontSize:String(t.value)})||!1},action:()=>{if(t.value==="Default"){n.commands.unsetFontSize();return}n.commands.setFontSize(String(t.value))},default:t.value==="Default"||!1}));return{componentProps:{editor:n,tooltip:s("editor.fontSize.tooltip"),disabled:!1,items:a,maxHeight:280,icon:"MenuDown",isActive:()=>{const t=(a||[]).find(i=>i.isActive());return t&&!t.default?t:{title:s("editor.fontSize.default.tooltip"),isActive:()=>!1}}}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize.replaceAll(/["']+/g,""),renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:n})=>n().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});exports.FontSize=z;exports.RichTextFontSize=v;
|
package/lib/FontSize.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { E as m } from "./index-
|
|
1
|
+
import { E as m } from "./index-sVScpCFG.js";
|
|
2
2
|
import { u as p, h as S } from "./index-0OnGZkVF.js";
|
|
3
|
-
import { u as z, b as h, e as v } from "./useButtonProps-
|
|
3
|
+
import { u as z, b as h, e as v } from "./useButtonProps-cMoicZgd.js";
|
|
4
4
|
import { jsx as r, Fragment as x, jsxs as d } from "react/jsx-runtime";
|
|
5
5
|
import { useMemo as A, Fragment as D } from "react";
|
|
6
|
-
import "./index-
|
|
7
|
-
import { A as y } from "./ActionMenuButton-
|
|
8
|
-
import { D as F, a as M, b as g, c as b, d as w } from "./dropdown-menu-
|
|
6
|
+
import "./index-C3zg3DPB.js";
|
|
7
|
+
import { A as y } from "./ActionMenuButton-DTXFBdGX.js";
|
|
8
|
+
import { D as F, a as M, b as g, c as b, d as w } from "./dropdown-menu-66q7Ofc5.js";
|
|
9
9
|
function $() {
|
|
10
10
|
const { t: e } = p(), n = z(T.name), {
|
|
11
11
|
icon: c = void 0,
|
package/lib/Heading.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-BBNITgNi.cjs"),A=require("./index-FSRjMsxW.cjs"),s=require("react/jsx-runtime"),f=require("react"),x=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-BBNITgNi.cjs"),A=require("./index-FSRjMsxW.cjs"),s=require("react/jsx-runtime"),f=require("react"),x=require("./index-C838s-or.cjs"),b=require("./ActionMenuButton-BLlse5KO.cjs"),M=require("./useButtonProps-DfnJiJLV.cjs"),h=require("./dropdown-menu-DKSAS-w_.cjs");var j=v.Node3.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,v.mergeAttributes(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var l;const i=(l=e.attrs)!=null&&l.level?parseInt(e.attrs.level,10):1,a="#".repeat(i);return e.content?`${a} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>v.textblockTypeInputRule({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});function m(){const{t:e}=A.useLocale(),t=M.useButtonProps(H.name),{icon:l=void 0,tooltip:i=void 0,isActive:a=void 0,items:o=[]}=(t==null?void 0:t.componentProps)??{},{disabled:p,dataState:d}=M.useActive(a),r=f.useMemo(()=>(d==null?void 0:d.title)||e("editor.paragraph.tooltip"),[d]);return t?s.jsxs(h.DropdownMenu,{children:[s.jsx(h.DropdownMenuTrigger,{asChild:!0,disabled:p,children:s.jsx(b.ActionMenuButton,{disabled:p,icon:l,title:r,tooltip:i})}),s.jsx(h.DropdownMenuContent,{className:"richtext-w-full",children:o==null?void 0:o.map((n,c)=>{var u,g;return s.jsxs(f.Fragment,{children:[s.jsxs(h.DropdownMenuCheckboxItem,{checked:r===n.title,onClick:n.action,children:[s.jsx("div",{className:x.cn("richtext-ml-1 richtext-h-full",{"":n.level==="Paragraph","heading-1":n.level===1,"heading-2":n.level===2,"heading-3":n.level===3,"heading-4":n.level===4,"heading-5":n.level===5,"heading-6":n.level===6}),children:n.title}),!!((u=n==null?void 0:n.shortcutKeys)!=null&&u.length)&&s.jsx(h.DropdownMenuShortcut,{className:"richtext-pl-4",children:(g=n==null?void 0:n.shortcutKeys)==null?void 0:g.map($=>x.getShortcutKey($)).join(" ")})]}),n.level==="Paragraph"&&s.jsx(h.DropdownMenuSeparator,{})]},`heading-k-${c}`)})})]}):s.jsx(s.Fragment,{})}const H=j.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),levels:A.HEADINGS,button({editor:t,extension:l,t:i}){var d;const a=((d=l.options)==null?void 0:d.levels)||[],o=a.map(r=>{var c;const n=r==="Paragraph";return{action:()=>{if(n){const u=a.find(g=>t.isActive("heading",{level:g}));u&&u!=="Paragraph"&&t.commands.toggleHeading({level:u});return}t.commands.toggleHeading({level:r})},isActive:()=>n?!1:t.isActive("heading",{level:r})||!1,disabled:!t.can().toggleHeading({level:r}),title:i(n?"editor.paragraph.tooltip":`editor.heading.h${r}.tooltip`),level:r,shortcutKeys:((c=l.options.shortcutKeys)==null?void 0:c[r])??["alt","mod",`${r}`],default:n}}),p=o.filter(r=>r.disabled).length===o.length;return{componentProps:{tooltip:i("editor.heading.tooltip"),disabled:p,items:o,icon:"MenuDown",isActive:()=>{const r=o==null?void 0:o.find(c=>c.isActive());return r&&!r.default?r:{title:i("editor.paragraph.tooltip"),level:0,isActive:()=>!1}},levels:a}}}}}});exports.Heading=H;exports.RichTextHeading=m;
|
package/lib/Heading.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { N as f, t as m, m as A } from "./index-
|
|
1
|
+
import { N as f, t as m, m as A } from "./index-sVScpCFG.js";
|
|
2
2
|
import { u as M, H } from "./index-0OnGZkVF.js";
|
|
3
3
|
import { jsx as d, Fragment as b, jsxs as g } from "react/jsx-runtime";
|
|
4
4
|
import { useMemo as $, Fragment as w } from "react";
|
|
5
|
-
import { c as x, h as D } from "./index-
|
|
6
|
-
import { A as y } from "./ActionMenuButton-
|
|
7
|
-
import { u as N, b as k } from "./useButtonProps-
|
|
8
|
-
import { D as L, a as C, b as T, c as I, e as K, d as P } from "./dropdown-menu-
|
|
5
|
+
import { c as x, h as D } from "./index-C3zg3DPB.js";
|
|
6
|
+
import { A as y } from "./ActionMenuButton-DTXFBdGX.js";
|
|
7
|
+
import { u as N, b as k } from "./useButtonProps-cMoicZgd.js";
|
|
8
|
+
import { D as L, a as C, b as T, c as I, e as K, d as P } from "./dropdown-menu-66q7Ofc5.js";
|
|
9
9
|
var R = f.create({
|
|
10
10
|
name: "heading",
|
|
11
11
|
addOptions() {
|
package/lib/Highlight.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-BBNITgNi.cjs"),e=require("react/jsx-runtime"),x=require("react"),C=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-BBNITgNi.cjs"),e=require("react/jsx-runtime"),x=require("react"),C=require("./index-C838s-or.cjs"),m=require("./separator-PGnA-6Hr.cjs"),a=require("./useButtonProps-DfnJiJLV.cjs"),L=require("./Icon-DXePECFW.cjs"),H=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,M=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,v=l.Mark.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",l.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:r})=>r.setMark(this.name,t),toggleHighlight:t=>({commands:r})=>r.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[l.markInputRule({find:H,type:this.type})]},addPasteRules(){return[l.markPasteRule({find:M,type:this.type})]}});function j({fill:t}){return e.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 256 256",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:e.jsxs("g",{id:"icon/背景颜色",children:[e.jsx("g",{fill:"currentColor",children:e.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",children:[e.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),e.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),e.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),e.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",fill:typeof t=="string"?t:"none",id:"矩形"})]})})})}function y(){const t=a.useButtonProps(d.name),{tooltip:r=void 0,isActive:s=void 0,defaultColor:i=void 0,colors:o,action:n,shortcutKeys:g}=(t==null?void 0:t.componentProps)??{},{editorDisabled:h}=a.useActive(s),[u,f]=x.useState(i);function p(c){h||n&&(n==null||n(c),f(c))}return t?e.jsx(m.ColorPicker,{colors:o,disabled:h,highlight:!0,onChange:p,value:u,children:e.jsx(C.ActionButton,{disabled:h,tooltip:r,shortcutKeys:g,children:e.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[e.jsx(j,{fill:u}),e.jsx(L.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):e.jsx(e.Fragment,{})}const d=v.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),multicolor:!0,button:({editor:r,t:s,extension:i})=>({componentProps:{action:o=>{if(typeof o=="string"){r.storage.highlight.currentColor=o,r.chain().focus().setHighlight({color:o}).run();return}r.chain().focus().unsetHighlight().run()},isActive:()=>r.isActive("highlight")||!1,disabled:!1,shortcutKeys:i.options.shortcutKeys??["⇧","mod","H"],tooltip:s("editor.highlight.tooltip"),defaultColor:i.options.defaultColor}})}},addKeyboardShortcuts(){var t;return{...(t=this.parent)==null?void 0:t.call(this),"Mod-Shift-h":()=>{const r=this.storage.currentColor||this.options.defaultColor;if(!r){const{color:i}=this.editor.getAttributes("highlight");return i?this.editor.chain().focus().unsetHighlight().run():!1}return this.editor.isActive("highlight",{color:r})?this.editor.chain().focus().unsetHighlight().run():this.editor.chain().focus().setHighlight({color:r}).run()}}}});exports.Highlight=d;exports.RichTextHighlight=y;
|
package/lib/Highlight.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { M as f,
|
|
1
|
+
import { M as f, f as p, h as m, m as C } from "./index-sVScpCFG.js";
|
|
2
2
|
import { jsx as r, jsxs as h, Fragment as L } from "react/jsx-runtime";
|
|
3
3
|
import { useState as x } from "react";
|
|
4
|
-
import { A as H } from "./index-
|
|
5
|
-
import { C as M } from "./separator-
|
|
6
|
-
import { u as v, b as A } from "./useButtonProps-
|
|
7
|
-
import { I as y } from "./Icon-
|
|
4
|
+
import { A as H } from "./index-C3zg3DPB.js";
|
|
5
|
+
import { C as M } from "./separator-JaTTqb3J.js";
|
|
6
|
+
import { u as v, b as A } from "./useButtonProps-cMoicZgd.js";
|
|
7
|
+
import { I as y } from "./Icon-DRuJhcHK.js";
|
|
8
8
|
const b = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, k = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, R = f.create({
|
|
9
9
|
name: "highlight",
|
|
10
10
|
addOptions() {
|
package/lib/History.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-BBNITgNi.cjs"),C=require("@tiptap/pm/state"),x=require("@tiptap/pm/view"),R=require("./index--nUS7Y66.cjs"),S=require("react/jsx-runtime"),z=require("./index-DvvMf6Wu.cjs");require("react");const A=require("./useButtonProps-BqBGuqoP.cjs");function W(r={}){return new p.Plugin({view(e){return new U(e,r)}})}class U{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(t){let c=e.nodeBefore,h=e.nodeAfter;if(c||h){let m=this.editorView.nodeDOM(this.cursorPos-(c?c.nodeSize:0));if(m){let v=m.getBoundingClientRect(),M=c?v.bottom:v.top;c&&h&&(M=(M+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*l;n={left:v.left,right:v.right,top:M-b,bottom:M+b}}}}if(!n){let c=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;n={left:c.left-h,right:c.left+h,top:c.top,bottom:c.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let c=a.getBoundingClientRect(),h=c.width/a.offsetWidth,m=c.height/a.offsetHeight;d=c.left-a.scrollLeft*h,u=c.top-a.scrollTop*m}this.element.style.left=(n.left-d)/s+"px",this.element.style.top=(n.top-u)/l+"px",this.element.style.width=(n.right-n.left)/s+"px",this.element.style.height=(n.bottom-n.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=p.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class f extends p.Selection{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return f.valid(n)?new f(n):p.Selection.near(n)}content(){return p.Slice.empty}eq(e){return e instanceof f&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new f(e.resolve(t.pos))}getBookmark(){return new N(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!q(e)||!X(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&f.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(f.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!p.NodeSelection.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),n=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(f.valid(l))return l}return null}}}f.prototype.visible=!1;f.findFrom=f.findGapCursorFrom;p.Selection.jsonID("gapcursor",f);class N{constructor(e){this.pos=e}map(e){return new N(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return f.valid(t)?new f(t):p.Selection.near(t)}}function B(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function q(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||B(i.type))return!0;if(i.inlineContent)return!1}}return!0}function X(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||B(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Y(){return new p.Plugin({props:{decorations:$,createSelectionBetween(r,e,t){return e.pos==t.pos&&f.valid(t)?new f(t):null},handleClick:Z,handleKeyDown:J,handleDOMEvents:{beforeinput:Q}}})}const J=R.keydownHandler({ArrowLeft:I("horiz",-1),ArrowRight:I("horiz",1),ArrowUp:I("vert",-1),ArrowDown:I("vert",1)});function I(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,o){let s=n.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof p.TextSelection){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let d=f.findGapCursorFrom(l,e,a);return d?(i&&i(n.tr.setSelection(new f(d))),!0):!1}}function Z(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!f.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&p.NodeSelection.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new f(n))),!0)}function Q(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof f))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=p.Fragment.empty;for(let s=n.length-1;s>=0;s--)i=p.Fragment.from(n[s].createAndFill(null,i));let o=r.state.tr.replace(t.pos,t.pos,new p.Slice(i,0,0));return o.setSelection(p.TextSelection.near(o.doc.resolve(t.pos+1))),r.dispatch(o),!1}function $(r){if(!(r.selection instanceof f))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",R.DecorationSet.create(r.doc,[R.Decoration.widget(r.selection.head,e,{key:"gapcursor"})])}var O=200,g=function(){};g.prototype.append=function(e){return e.length?(e=g.from(e),!this.length&&e||e.length<O&&this.leafAppend(e)||this.length<O&&e.leafPrepend(this)||this.appendInner(e)):this};g.prototype.prepend=function(e){return e.length?g.from(e).append(this):this};g.prototype.appendInner=function(e){return new ee(this,e)};g.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?g.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};g.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};g.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};g.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,n),i};g.from=function(e){return e instanceof g?e:e&&e.length?new j(e):g.empty};var j=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=O)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=O)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(g);g.empty=new j([]);var ee=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(n,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(n,i):n>=o?this.right.slice(n-o,i-o):this.left.slice(n,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(g);const te=500;class w{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,o;t&&(i=this.remapping(n,this.items.length),o=i.maps.length);let s=e.tr,l,a,d=[],u=[];return this.items.forEach((c,h)=>{if(!c.step){i||(i=this.remapping(n,h+1),o=i.maps.length),o--,u.push(c);return}if(i){u.push(new y(c.map));let m=c.step.map(i.slice(o)),v;m&&s.maybeStep(m).doc&&(v=s.mapping.maps[s.mapping.maps.length-1],d.push(new y(v,void 0,void 0,d.length+u.length))),o--,v&&i.appendMap(v,o)}else s.maybeStep(c.step);if(c.selection)return l=i?c.selection.map(i.slice(o)):c.selection,a=new w(this.items.slice(0,n).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,n,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let c=e.steps[u].invert(e.docs[u]),h=new y(e.mapping.maps[u],c,t),m;(m=a&&a.merge(h))&&(h=m,u?o.pop():l=l.slice(0,l.length-1)),o.push(h),t&&(s++,t=void 0),i||(a=h)}let d=s-n.depth;return d>ie&&(l=ne(l,d),s-=d),new w(l.append(o),s)}remapping(e,t){let n=new p.Mapping;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,s)},e,t),n}addMaps(e){return this.eventCount==0?this:new w(this.items.append(e.map(t=>new y(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let m=o.getMirror(--a);if(m==null)return;s=Math.min(s,m);let v=o.maps[m];if(h.step){let M=e.steps[m].invert(e.docs[m]),b=h.selection&&h.selection.map(o.slice(a+1,m));b&&l++,n.push(new y(v,M,b))}else n.push(new y(v))},i);let d=[];for(let h=t;h<s;h++)d.push(new y(o.maps[h]));let u=this.items.slice(0,i).append(d).append(n),c=new w(u,l);return c.emptyItemCount()>te&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(n)),d=a&&a.getMap();if(n--,d&&t.appendMap(d,n),a){let u=s.selection&&s.selection.map(t.slice(n));u&&o++;let c=new y(d.invert(),a,u),h,m=i.length-1;(h=i.length&&i[m].merge(c))?i[m]=h:i.push(c)}}else s.map&&n--},this.items.length,0),new w(g.from(i.reverse()),o)}}w.empty=new w(g.empty,0);function ne(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class y{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new y(t.getMap().invert(),t,this.selection)}}}class P{constructor(e,t,n,i,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=o}}const ie=20;function re(r,e,t,n){let i=t.getMeta(E),o;if(i)return i.historyState;t.getMeta(le)&&(r=new P(r.done,r.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(s&&s.getMeta(E))return s.getMeta(E).redo?new P(r.done.addTransform(t,void 0,n,T(e)),r.undone,V(t.mapping.maps),r.prevTime,r.prevComposition):new P(r.done,r.undone.addTransform(t,void 0,n,T(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!s&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!oe(t,r.prevRanges)),d=s?D(r.prevRanges,t.mapping):V(t.mapping.maps);return new P(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,T(e)),w.empty,d,t.time,l??r.prevComposition)}else return(o=t.getMeta("rebased"))?new P(r.done.rebased(t,o),r.undone.rebased(t,o),D(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new P(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),D(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function oe(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let o=0;o<e.length;o+=2)n<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function V(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,o,s)=>e.push(o,s));return e}function D(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),o=e.map(r[n+1],-1);i<=o&&t.push(i,o)}return t}function se(r,e,t){let n=T(e),i=E.get(e).spec.config,o=(t?r.undone:r.done).popEvent(e,n);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?r.done:r.undone).addTransform(o.transform,e.selection.getBookmark(),i,n),a=new P(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(E,{redo:t,historyState:a})}let k=!1,K=null;function T(r){let e=r.plugins;if(K!=e){k=!1,K=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){k=!0;break}}return k}const E=new p.PluginKey("history"),le=new p.PluginKey("closeHistory");function ae(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new p.Plugin({key:E,state:{init(){return new P(w.empty,w.empty,null,0,-1)},apply(e,t,n){return re(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?G:n=="historyRedo"?_:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function H(r,e){return(t,n)=>{let i=E.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let o=se(i,t,r);o&&n(e?o.scrollIntoView():o)}return!0}}const G=H(!1,!0),_=H(!0,!0);p.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:r=>r.length,wordCounter:r=>r.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc;if(((r==null?void 0:r.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let r=!1;return[new C.Plugin({key:new C.PluginKey("characterCount"),appendTransaction:(e,t,n)=>{if(r)return;const i=this.options.limit;if(i==null||i===0){r=!0;return}const o=this.storage.characters({node:n.doc});if(o>i){const s=o-i,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=n.tr.deleteRange(l,a);return r=!0,d}r=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n||i>n&&o>n&&o<=i)return!0;if(i>n&&o>n&&o>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-n,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>n)}})]}});p.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[W(this.options)]}});p.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("focus"),props:{decorations:({doc:r,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,o=[];if(!t||!n)return x.DecorationSet.create(r,[]);let s=0;this.options.mode==="deepest"&&r.descendants((a,d)=>{if(a.isText)return;if(!(i>=d&&i<=d+a.nodeSize-1))return!1;s+=1});let l=0;return r.descendants((a,d)=>{if(a.isText||!(i>=d&&i<=d+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(x.Decoration.node(d,d+a.nodeSize,{class:this.options.className}))}),x.DecorationSet.create(r,o)}}})]}});p.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[Y()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=p.callOrReturn(p.getExtensionField(r,"allowGapCursor",t)))!=null?e:null}}});p.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("placeholder"),props:{decorations:({doc:r,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,i=[];if(!t)return null;const o=this.editor.isEmpty;return r.descendants((s,l)=>{const a=n>=l&&n<=l+s.nodeSize,d=!s.isLeaf&&p.isNodeEmpty(s);if((a||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const c=x.Decoration.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});i.push(c)}return this.options.includeChildren}),x.DecorationSet.create(r,i)}}})]}});p.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:r,options:e}=this;return[new C.Plugin({key:new C.PluginKey("selection"),props:{decorations(t){return t.selection.empty||r.isFocused||!r.isEditable||p.isNodeSelection(t.selection)||r.view.dragging?null:x.DecorationSet.create(t.doc,[x.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function L({types:r,node:e}){return e&&Array.isArray(r)&&r.includes(e.type)||(e==null?void 0:e.type)===r}p.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var r;const e=new C.PluginKey(this.name),t=this.options.node||((r=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:r.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new C.Plugin({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:a,schema:d}=s,u=e.getState(s),c=l.content.size,h=d.nodes[t];if(u)return a.insert(c,h.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!L({node:s,types:n})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!L({node:s,types:n})}}})]}});var de=p.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>G(r,e),redo:()=>({state:r,dispatch:e})=>_(r,e)}},addProseMirrorPlugins(){return[ae(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});function ce(){var u;const r=A.useButtonProps(F.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((u=r==null?void 0:r.componentProps)==null?void 0:u.undo)??{},{disabled:l}=A.useActive(s),a=z.icons[e],d=()=>{l||o&&o()};return!r||!a?S.jsx(S.Fragment,{}):S.jsx(z.ActionButton,{action:d,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i})}function ue(){var d;const r=A.useButtonProps(F.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((d=r==null?void 0:r.componentProps)==null?void 0:d.redo)??{},{disabled:l}=A.useActive(s),a=()=>{l||o&&o()};return r?S.jsx(z.ActionButton,{action:a,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i}):S.jsx(S.Fragment,{})}const F=de.extend({addOptions(){var r;return{...(r=this.parent)==null?void 0:r.call(this),depth:100,newGroupDelay:500,button:({editor:e,t,extension:n})=>{var i,o;return{componentProps:{undo:{action:()=>{e.chain().focus().undo().run()},shortcutKeys:((i=n.options.shortcutKeys)==null?void 0:i[0])??["mod","Z"],isActive:()=>e.can().undo(),icon:"Undo2",tooltip:t("editor.undo.tooltip")},redo:{action:()=>{e.chain().focus().redo().run()},shortcutKeys:((o=n.options.shortcutKeys)==null?void 0:o[1])??["shift","mod","Z"],isActive:()=>e.can().redo(),icon:"Redo2",tooltip:t("editor.redo.tooltip")}}}}}}});exports.History=F;exports.RichTextRedo=ue;exports.RichTextUndo=ce;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-BBNITgNi.cjs"),C=require("@tiptap/pm/state"),x=require("@tiptap/pm/view"),R=require("./index--nUS7Y66.cjs"),S=require("react/jsx-runtime"),z=require("./index-C838s-or.cjs");require("react");const A=require("./useButtonProps-DfnJiJLV.cjs");function W(r={}){return new p.Plugin({view(e){return new U(e,r)}})}class U{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(t){let c=e.nodeBefore,h=e.nodeAfter;if(c||h){let m=this.editorView.nodeDOM(this.cursorPos-(c?c.nodeSize:0));if(m){let v=m.getBoundingClientRect(),M=c?v.bottom:v.top;c&&h&&(M=(M+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*l;n={left:v.left,right:v.right,top:M-b,bottom:M+b}}}}if(!n){let c=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;n={left:c.left-h,right:c.left+h,top:c.top,bottom:c.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let c=a.getBoundingClientRect(),h=c.width/a.offsetWidth,m=c.height/a.offsetHeight;d=c.left-a.scrollLeft*h,u=c.top-a.scrollTop*m}this.element.style.left=(n.left-d)/s+"px",this.element.style.top=(n.top-u)/l+"px",this.element.style.width=(n.right-n.left)/s+"px",this.element.style.height=(n.bottom-n.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=p.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class f extends p.Selection{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return f.valid(n)?new f(n):p.Selection.near(n)}content(){return p.Slice.empty}eq(e){return e instanceof f&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new f(e.resolve(t.pos))}getBookmark(){return new N(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!q(e)||!X(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&f.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(f.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!p.NodeSelection.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),n=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(f.valid(l))return l}return null}}}f.prototype.visible=!1;f.findFrom=f.findGapCursorFrom;p.Selection.jsonID("gapcursor",f);class N{constructor(e){this.pos=e}map(e){return new N(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return f.valid(t)?new f(t):p.Selection.near(t)}}function B(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function q(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||B(i.type))return!0;if(i.inlineContent)return!1}}return!0}function X(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||B(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Y(){return new p.Plugin({props:{decorations:$,createSelectionBetween(r,e,t){return e.pos==t.pos&&f.valid(t)?new f(t):null},handleClick:Z,handleKeyDown:J,handleDOMEvents:{beforeinput:Q}}})}const J=R.keydownHandler({ArrowLeft:I("horiz",-1),ArrowRight:I("horiz",1),ArrowUp:I("vert",-1),ArrowDown:I("vert",1)});function I(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,o){let s=n.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof p.TextSelection){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let d=f.findGapCursorFrom(l,e,a);return d?(i&&i(n.tr.setSelection(new f(d))),!0):!1}}function Z(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!f.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&p.NodeSelection.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new f(n))),!0)}function Q(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof f))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=p.Fragment.empty;for(let s=n.length-1;s>=0;s--)i=p.Fragment.from(n[s].createAndFill(null,i));let o=r.state.tr.replace(t.pos,t.pos,new p.Slice(i,0,0));return o.setSelection(p.TextSelection.near(o.doc.resolve(t.pos+1))),r.dispatch(o),!1}function $(r){if(!(r.selection instanceof f))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",R.DecorationSet.create(r.doc,[R.Decoration.widget(r.selection.head,e,{key:"gapcursor"})])}var O=200,g=function(){};g.prototype.append=function(e){return e.length?(e=g.from(e),!this.length&&e||e.length<O&&this.leafAppend(e)||this.length<O&&e.leafPrepend(this)||this.appendInner(e)):this};g.prototype.prepend=function(e){return e.length?g.from(e).append(this):this};g.prototype.appendInner=function(e){return new ee(this,e)};g.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?g.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};g.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};g.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};g.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,n),i};g.from=function(e){return e instanceof g?e:e&&e.length?new j(e):g.empty};var j=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=O)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=O)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(g);g.empty=new j([]);var ee=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(n,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(n,i):n>=o?this.right.slice(n-o,i-o):this.left.slice(n,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(g);const te=500;class w{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,o;t&&(i=this.remapping(n,this.items.length),o=i.maps.length);let s=e.tr,l,a,d=[],u=[];return this.items.forEach((c,h)=>{if(!c.step){i||(i=this.remapping(n,h+1),o=i.maps.length),o--,u.push(c);return}if(i){u.push(new y(c.map));let m=c.step.map(i.slice(o)),v;m&&s.maybeStep(m).doc&&(v=s.mapping.maps[s.mapping.maps.length-1],d.push(new y(v,void 0,void 0,d.length+u.length))),o--,v&&i.appendMap(v,o)}else s.maybeStep(c.step);if(c.selection)return l=i?c.selection.map(i.slice(o)):c.selection,a=new w(this.items.slice(0,n).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,n,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let c=e.steps[u].invert(e.docs[u]),h=new y(e.mapping.maps[u],c,t),m;(m=a&&a.merge(h))&&(h=m,u?o.pop():l=l.slice(0,l.length-1)),o.push(h),t&&(s++,t=void 0),i||(a=h)}let d=s-n.depth;return d>ie&&(l=ne(l,d),s-=d),new w(l.append(o),s)}remapping(e,t){let n=new p.Mapping;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,s)},e,t),n}addMaps(e){return this.eventCount==0?this:new w(this.items.append(e.map(t=>new y(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let m=o.getMirror(--a);if(m==null)return;s=Math.min(s,m);let v=o.maps[m];if(h.step){let M=e.steps[m].invert(e.docs[m]),b=h.selection&&h.selection.map(o.slice(a+1,m));b&&l++,n.push(new y(v,M,b))}else n.push(new y(v))},i);let d=[];for(let h=t;h<s;h++)d.push(new y(o.maps[h]));let u=this.items.slice(0,i).append(d).append(n),c=new w(u,l);return c.emptyItemCount()>te&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(n)),d=a&&a.getMap();if(n--,d&&t.appendMap(d,n),a){let u=s.selection&&s.selection.map(t.slice(n));u&&o++;let c=new y(d.invert(),a,u),h,m=i.length-1;(h=i.length&&i[m].merge(c))?i[m]=h:i.push(c)}}else s.map&&n--},this.items.length,0),new w(g.from(i.reverse()),o)}}w.empty=new w(g.empty,0);function ne(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class y{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new y(t.getMap().invert(),t,this.selection)}}}class P{constructor(e,t,n,i,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=o}}const ie=20;function re(r,e,t,n){let i=t.getMeta(E),o;if(i)return i.historyState;t.getMeta(le)&&(r=new P(r.done,r.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(s&&s.getMeta(E))return s.getMeta(E).redo?new P(r.done.addTransform(t,void 0,n,T(e)),r.undone,V(t.mapping.maps),r.prevTime,r.prevComposition):new P(r.done,r.undone.addTransform(t,void 0,n,T(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!s&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!oe(t,r.prevRanges)),d=s?D(r.prevRanges,t.mapping):V(t.mapping.maps);return new P(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,T(e)),w.empty,d,t.time,l??r.prevComposition)}else return(o=t.getMeta("rebased"))?new P(r.done.rebased(t,o),r.undone.rebased(t,o),D(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new P(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),D(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function oe(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let o=0;o<e.length;o+=2)n<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function V(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,o,s)=>e.push(o,s));return e}function D(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),o=e.map(r[n+1],-1);i<=o&&t.push(i,o)}return t}function se(r,e,t){let n=T(e),i=E.get(e).spec.config,o=(t?r.undone:r.done).popEvent(e,n);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?r.done:r.undone).addTransform(o.transform,e.selection.getBookmark(),i,n),a=new P(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(E,{redo:t,historyState:a})}let k=!1,K=null;function T(r){let e=r.plugins;if(K!=e){k=!1,K=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){k=!0;break}}return k}const E=new p.PluginKey("history"),le=new p.PluginKey("closeHistory");function ae(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new p.Plugin({key:E,state:{init(){return new P(w.empty,w.empty,null,0,-1)},apply(e,t,n){return re(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?G:n=="historyRedo"?_:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function H(r,e){return(t,n)=>{let i=E.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let o=se(i,t,r);o&&n(e?o.scrollIntoView():o)}return!0}}const G=H(!1,!0),_=H(!0,!0);p.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:r=>r.length,wordCounter:r=>r.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc;if(((r==null?void 0:r.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let r=!1;return[new C.Plugin({key:new C.PluginKey("characterCount"),appendTransaction:(e,t,n)=>{if(r)return;const i=this.options.limit;if(i==null||i===0){r=!0;return}const o=this.storage.characters({node:n.doc});if(o>i){const s=o-i,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=n.tr.deleteRange(l,a);return r=!0,d}r=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n||i>n&&o>n&&o<=i)return!0;if(i>n&&o>n&&o>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-n,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>n)}})]}});p.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[W(this.options)]}});p.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("focus"),props:{decorations:({doc:r,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,o=[];if(!t||!n)return x.DecorationSet.create(r,[]);let s=0;this.options.mode==="deepest"&&r.descendants((a,d)=>{if(a.isText)return;if(!(i>=d&&i<=d+a.nodeSize-1))return!1;s+=1});let l=0;return r.descendants((a,d)=>{if(a.isText||!(i>=d&&i<=d+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(x.Decoration.node(d,d+a.nodeSize,{class:this.options.className}))}),x.DecorationSet.create(r,o)}}})]}});p.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[Y()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=p.callOrReturn(p.getExtensionField(r,"allowGapCursor",t)))!=null?e:null}}});p.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("placeholder"),props:{decorations:({doc:r,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,i=[];if(!t)return null;const o=this.editor.isEmpty;return r.descendants((s,l)=>{const a=n>=l&&n<=l+s.nodeSize,d=!s.isLeaf&&p.isNodeEmpty(s);if((a||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const c=x.Decoration.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});i.push(c)}return this.options.includeChildren}),x.DecorationSet.create(r,i)}}})]}});p.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:r,options:e}=this;return[new C.Plugin({key:new C.PluginKey("selection"),props:{decorations(t){return t.selection.empty||r.isFocused||!r.isEditable||p.isNodeSelection(t.selection)||r.view.dragging?null:x.DecorationSet.create(t.doc,[x.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function L({types:r,node:e}){return e&&Array.isArray(r)&&r.includes(e.type)||(e==null?void 0:e.type)===r}p.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var r;const e=new C.PluginKey(this.name),t=this.options.node||((r=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:r.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new C.Plugin({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:a,schema:d}=s,u=e.getState(s),c=l.content.size,h=d.nodes[t];if(u)return a.insert(c,h.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!L({node:s,types:n})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!L({node:s,types:n})}}})]}});var de=p.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>G(r,e),redo:()=>({state:r,dispatch:e})=>_(r,e)}},addProseMirrorPlugins(){return[ae(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});function ce(){var u;const r=A.useButtonProps(F.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((u=r==null?void 0:r.componentProps)==null?void 0:u.undo)??{},{disabled:l}=A.useActive(s),a=z.icons[e],d=()=>{l||o&&o()};return!r||!a?S.jsx(S.Fragment,{}):S.jsx(z.ActionButton,{action:d,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i})}function ue(){var d;const r=A.useButtonProps(F.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((d=r==null?void 0:r.componentProps)==null?void 0:d.redo)??{},{disabled:l}=A.useActive(s),a=()=>{l||o&&o()};return r?S.jsx(z.ActionButton,{action:a,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i}):S.jsx(S.Fragment,{})}const F=de.extend({addOptions(){var r;return{...(r=this.parent)==null?void 0:r.call(this),depth:100,newGroupDelay:500,button:({editor:e,t,extension:n})=>{var i,o;return{componentProps:{undo:{action:()=>{e.chain().focus().undo().run()},shortcutKeys:((i=n.options.shortcutKeys)==null?void 0:i[0])??["mod","Z"],isActive:()=>e.can().undo(),icon:"Undo2",tooltip:t("editor.undo.tooltip")},redo:{action:()=>{e.chain().focus().redo().run()},shortcutKeys:((o=n.options.shortcutKeys)==null?void 0:o[1])??["shift","mod","Z"],isActive:()=>e.can().redo(),icon:"Redo2",tooltip:t("editor.redo.tooltip")}}}}}}});exports.History=F;exports.RichTextRedo=ue;exports.RichTextUndo=ce;
|
package/lib/History.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Q as N, y as te, F as V, x as G, T as H, v as _, S as A, U as W, V as ne, E as C, W as re, X as ie, Y as oe,
|
|
1
|
+
import { Q as N, y as te, F as V, x as G, T as H, v as _, S as A, U as W, V as ne, E as C, W as re, X as ie, Y as oe, l as se } from "./index-sVScpCFG.js";
|
|
2
2
|
import { Plugin as I, PluginKey as b } from "@tiptap/pm/state";
|
|
3
3
|
import { DecorationSet as O, Decoration as R } from "@tiptap/pm/view";
|
|
4
|
-
import { k as le, D as ae, a as de } from "./index-
|
|
4
|
+
import { k as le, D as ae, a as de } from "./index-DKt5wfAc.js";
|
|
5
5
|
import { jsx as T, Fragment as j } from "react/jsx-runtime";
|
|
6
|
-
import { A as U, i as ce } from "./index-
|
|
6
|
+
import { A as U, i as ce } from "./index-C3zg3DPB.js";
|
|
7
7
|
import "react";
|
|
8
|
-
import { u as X, b as Y } from "./useButtonProps-
|
|
8
|
+
import { u as X, b as Y } from "./useButtonProps-cMoicZgd.js";
|
|
9
9
|
function ue(i = {}) {
|
|
10
10
|
return new N({
|
|
11
11
|
view(e) {
|
package/lib/HorizontalRule.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-BBNITgNi.cjs"),l=require("@tiptap/pm/state"),f=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-BBNITgNi.cjs"),l=require("@tiptap/pm/state"),f=require("./index-C838s-or.cjs"),h=require("react/jsx-runtime");require("react");const T=require("./useButtonProps-DfnJiJLV.cjs");var A=i.Node3.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",i.mergeAttributes(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,n)=>n.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:n})=>{if(!i.canInsertNode(n,n.schema.nodes[this.name]))return!1;const{selection:r}=n,{$to:s}=r,c=t();return i.isNodeSelection(r)?c.insertContentAt(s.pos,{type:this.name}):c.insertContent({type:this.name}),c.command(({state:a,tr:e,dispatch:p})=>{if(p){const{$to:o}=e.selection,u=o.end();if(o.nodeAfter)o.nodeAfter.isTextblock?e.setSelection(l.TextSelection.create(e.doc,o.pos+1)):o.nodeAfter.isBlock?e.setSelection(l.NodeSelection.create(e.doc,o.pos)):e.setSelection(l.TextSelection.create(e.doc,o.pos));else{const d=a.schema.nodes[this.options.nextNodeType]||o.parent.type.contentMatch.defaultType,m=d==null?void 0:d.create();m&&(e.insert(u,m),e.setSelection(l.TextSelection.create(e.doc,u+1)))}e.scrollIntoView()}return!0}).run()}}},addInputRules(){return[i.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});function R(){const t=T.useButtonProps(y.name),{icon:n=void 0,tooltip:r=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:a=void 0,isActive:e=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:o,update:u}=T.useToggleActive(e),d=()=>{o||a&&(a(),u())};return t?h.jsx(f.ActionButton,{action:d,dataState:p,disabled:o,icon:n,shortcutKeys:s,tooltip:r,tooltipOptions:c}):h.jsx(h.Fragment,{})}const y=A.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:n,t:r,extension:s})=>({component:f.ActionButton,componentProps:{action:()=>n.commands.setHorizontalRule(),disabled:!n.can().setHorizontalRule(),icon:"Minus",shortcutKeys:s.options.shortcutKeys??["mod","alt","S"],tooltip:r("editor.horizontalrule.tooltip")}})}},addKeyboardShortcuts(){return{"Mod-Alt-s":()=>this.editor.commands.setHorizontalRule()}},renderHTML(){return["div",i.mergeAttributes(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}});exports.HorizontalRule=y;exports.RichTextHorizontalRule=R;
|
package/lib/HorizontalRule.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { N as T, n as A,
|
|
1
|
+
import { N as T, n as A, k as y, l as H, m as h } from "./index-sVScpCFG.js";
|
|
2
2
|
import { TextSelection as u, NodeSelection as R } from "@tiptap/pm/state";
|
|
3
|
-
import { A as f } from "./index-
|
|
3
|
+
import { A as f } from "./index-C3zg3DPB.js";
|
|
4
4
|
import { jsx as m, Fragment as M } from "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
|
-
import { u as v, a as z } from "./useButtonProps-
|
|
6
|
+
import { u as v, a as z } from "./useButtonProps-cMoicZgd.js";
|
|
7
7
|
var S = T.create({
|
|
8
8
|
name: "horizontalRule",
|
|
9
9
|
addOptions() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime"),t=require("./index-
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),t=require("./index-C838s-or.cjs");require("react");function i(n){const e=t.icons[n.name];return e?c.jsx(e,{onClick:n==null?void 0:n.onClick,className:`richtext-w-4 richtext-h-4 ${(n==null?void 0:n.className)||""}`}):null}exports.IconComponent=i;
|