reactjs-tiptap-editor 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{ActionMenuButton-lsIBc9sU.js → ActionMenuButton-BOjCHFTA.js} +6 -6
- package/lib/ActionMenuButton-Df077oOH.cjs +1 -0
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.js +40 -78
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +2 -3
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +2 -3
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -3
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +105 -99
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -3
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +2 -3
- package/lib/CodeBlock.cjs +38 -38
- package/lib/CodeBlock.js +1561 -1605
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +46 -63
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +24 -10
- package/lib/Drawer-DwrlY_lY.cjs +1 -0
- package/lib/Drawer-DxOoRiGQ.js +1099 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +6 -5
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +69 -93
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +99 -110
- package/lib/ExportPdf.cjs +4 -4
- package/lib/ExportPdf.js +4 -13
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +9 -7
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +12 -34
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +12 -27
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +34 -47
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +39 -52
- package/lib/History.cjs +1 -1
- package/lib/History.js +318 -313
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -3
- package/lib/{Iframe-CTajPyzs.js → Iframe-AhNV5WH5.js} +25 -34
- package/lib/Iframe-C6pBw-AF.cjs +1 -0
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +5 -4
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +5 -4
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +63 -91
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +7 -11
- package/lib/{Indent-BGEHlRx_.js → Indent-DZ5PcJA4.js} +3 -7
- package/lib/Indent-Do-X0AsY.cjs +1 -0
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +2 -3
- package/lib/Katex-CIC9ygbL.cjs +4 -0
- package/lib/{Katex-tMh4bfBb.js → Katex-bIgoenn_.js} +241 -255
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +5 -4
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +13 -21
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/LinkEditBlock-B0ZaACZO.cjs +5 -0
- package/lib/{LinkEditBlock-CA5NhP-m.js → LinkEditBlock-D_cF9fnc.js} +320 -370
- package/lib/MarkdownPaste.cjs +58 -0
- package/lib/MarkdownPaste.js +1656 -0
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +22 -17
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +118 -142
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +10 -18
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -3
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +68 -133
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +15 -14
- package/lib/{SlashCommandNodeView-CZoM3ZlS.cjs → SlashCommandNodeView-Ba03hlVZ.cjs} +1 -1
- package/lib/{SlashCommandNodeView-DLuqbX2o.js → SlashCommandNodeView-cg0x3NRF.js} +15 -17
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -3
- package/lib/{Table-BC4Lbqzn.js → Table-KqLiT5wG.js} +95 -133
- package/lib/Table-ddU2LSc6.cjs +9 -0
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +2 -3
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +51 -60
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +47 -69
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +2 -3
- package/lib/Twitter-BIiR78Jh.cjs +1 -0
- package/lib/{Twitter-D8Cbgl7g.js → Twitter-C1Lzqc7u.js} +567 -593
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +4 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +3 -3
- package/lib/bubble.cjs +6 -4
- package/lib/bubble.js +3712 -3023
- package/lib/clsx-BWE7vnna.cjs +33 -0
- package/lib/clsx-eGVyq7ot.js +1062 -0
- package/lib/components/ActionButton.d.ts +2 -2
- package/lib/components/ActionMenuButton.d.ts +1 -1
- package/lib/components/Bubble/formatBubble.d.ts +5 -5
- package/lib/components/ui/checkbox.d.ts +1 -1
- package/lib/components/ui/dialog.d.ts +1 -1
- package/lib/components/ui/dropdown-menu.d.ts +1 -1
- package/lib/components/ui/emoji-picker.d.ts +1 -1
- package/lib/components/ui/label.d.ts +1 -1
- package/lib/components/ui/popover.d.ts +1 -1
- package/lib/components/ui/select.d.ts +1 -1
- package/lib/components/ui/separator.d.ts +1 -1
- package/lib/components/ui/switch.d.ts +1 -1
- package/lib/components/ui/tabs.d.ts +1 -1
- package/lib/components/ui/toast.d.ts +1 -1
- package/lib/components/ui/toggle.d.ts +1 -1
- package/lib/components/ui/tooltip.d.ts +1 -1
- package/lib/{delete-node-IyVmiRbI.js → delete-node-eQHsyyhR.js} +3 -1
- package/lib/{dropdown-menu-q6RL_fkA.js → dropdown-menu-CexIkt_V.js} +8 -8
- package/lib/{dropdown-menu-C_F7LEy5.cjs → dropdown-menu-oSKIntXM.cjs} +1 -1
- package/lib/extensions/Blockquote/Blockquote.d.ts +1 -1
- package/lib/extensions/Bold/Bold.d.ts +1 -1
- package/lib/extensions/Code/Code.d.ts +1 -1
- package/lib/extensions/CodeView/CodeView.d.ts +2 -2
- package/lib/extensions/Heading/Heading.d.ts +1 -1
- package/lib/extensions/Highlight/Highlight.d.ts +1 -1
- package/lib/extensions/HorizontalRule/HorizontalRule.d.ts +1 -1
- package/lib/extensions/ImportWord/ImportWord.d.ts +2 -2
- package/lib/extensions/Italic/Italic.d.ts +1 -1
- package/lib/extensions/Link/Link.d.ts +1 -1
- package/lib/extensions/MarkdownPaste/MarkdownPaste.d.ts +5 -0
- package/lib/extensions/MarkdownPaste/index.d.ts +1 -0
- package/lib/extensions/Mermaid/Mermaid.d.ts +1 -1
- package/lib/extensions/MoreMark/MoreMark.d.ts +1 -1
- package/lib/extensions/Strike/Strike.d.ts +1 -1
- package/lib/extensions/Table/Table.d.ts +1 -1
- package/lib/extensions/TextAlign/TextAlign.d.ts +1 -1
- package/lib/extensions/TextUnderline/TextUnderline.d.ts +1 -1
- package/lib/index-BUTn2LY6.cjs +1 -0
- package/lib/{index-C07N8gA1.js → index-BlXGgvT-.js} +21 -18
- package/lib/{index-DqruLhsu.js → index-BnW6t8z6.js} +23 -23
- package/lib/{index-BsFvo9PG.cjs → index-BqL4vAWE.cjs} +1 -1
- package/lib/index-BtxvYLJ1.cjs +12 -0
- package/lib/{index-Do_dsOGB.js → index-C6xmkxrQ.js} +232 -217
- package/lib/index-CJ9pyCM4.cjs +1 -0
- package/lib/{index-neeeY2o7.cjs → index-D0lc95kr.cjs} +3 -3
- package/lib/{index-RcSPeQHn.js → index-DHUN85fV.js} +571 -657
- package/lib/index-DUpSE1Gb.cjs +1 -0
- package/lib/index-D_8P0LE5.js +1362 -0
- package/lib/{index-BDYJ8Ph2.js → index-RIXs7STX.js} +1 -1
- package/lib/index-mfGK4pFo.js +6469 -0
- package/lib/index-zig3Dj7A.cjs +22 -0
- package/lib/index.cjs +1 -1
- package/lib/index.js +26 -34
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/plugins/image-upload.d.ts +1 -1
- package/lib/popover-BYSZ3zBi.js +24 -0
- package/lib/popover-BcHDZqBt.cjs +1 -0
- package/lib/{renderNodeView-BEkECnnY.js → renderNodeView-BrM5kUj_.js} +2 -2
- package/lib/{renderNodeView-DfLmGrgA.cjs → renderNodeView-D1zydtli.cjs} +1 -1
- package/lib/{select-CmV5uTXr.js → select-C5SHDLFj.js} +8 -5
- package/lib/{select-CYyIeImH.cjs → select-DHjzKkcu.cjs} +1 -1
- package/lib/{separator-BLp6xpSY.cjs → separator-BmixLrnJ.cjs} +1 -1
- package/lib/separator-CFKVxAea.js +293 -0
- package/lib/store/editor.d.ts +1 -1
- package/lib/store/store.d.ts +1 -1
- package/lib/style.css +1 -1
- package/lib/{textarea-Cn75Cm2n.cjs → textarea-CasDcv3u.cjs} +1 -1
- package/lib/{textarea-CkVKMPqK.js → textarea-DNLrJoRl.js} +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +3 -3
- package/lib/updatePosition-CBRjbQMH.js +16 -0
- package/lib/updatePosition-CfmY5Trk.cjs +1 -0
- package/lib/utils/columns.d.ts +1 -1
- package/lib/utils/pdf.d.ts +1 -1
- package/lib/utils/utils.d.ts +1 -1
- package/package.json +262 -247
- package/lib/ActionMenuButton-B_E2mbAW.cjs +0 -1
- package/lib/Drawer-DQ4CxBwG.js +0 -1373
- package/lib/Drawer-FUeUKshi.cjs +0 -1
- package/lib/Iframe-EVWXCqe4.cjs +0 -1
- package/lib/Indent-q9cEWAa_.cjs +0 -1
- package/lib/Katex-ClqcEnN_.cjs +0 -4
- package/lib/LinkEditBlock-DZXk4ln_.cjs +0 -5
- package/lib/Table-BmDopO43.cjs +0 -9
- package/lib/Twitter-BbMD3Ybp.cjs +0 -1
- package/lib/clsx-CXbNJWDD.cjs +0 -54
- package/lib/clsx-DaPvp9ji.js +0 -7391
- package/lib/index-BCzvbrf5.cjs +0 -12
- package/lib/index-BnVcq33n.cjs +0 -1
- package/lib/index-CjhjjJsN.cjs +0 -1
- package/lib/index-Cs6cp0Y6.cjs +0 -1
- package/lib/index-Qcl3BG94.js +0 -1351
- package/lib/popover-CtinPbiy.js +0 -24
- package/lib/popover-DIMT3pae.cjs +0 -1
- package/lib/separator-C7luvaG8.js +0 -327
- package/lib/updatePosition-Cjuj2E26.cjs +0 -1
- package/lib/updatePosition-DRmKQBGm.js +0 -16
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import n from "react";
|
|
3
|
-
import
|
|
4
|
-
import { i as d, T as m, a as f, B as s, b as u, g } from "./index-
|
|
2
|
+
import { Slot as n } from "@radix-ui/react-slot";
|
|
3
|
+
import r from "react";
|
|
4
|
+
import { i as d, T as m, a as f, B as s, b as u, g } from "./index-DHUN85fV.js";
|
|
5
5
|
import "./theme.js";
|
|
6
|
-
const C =
|
|
6
|
+
const C = r.forwardRef(
|
|
7
7
|
({ asChild: x = !1, tooltip: i, ...t }, l) => {
|
|
8
8
|
var a;
|
|
9
9
|
const h = d[t.icon];
|
|
10
10
|
return /* @__PURE__ */ c(m, { children: [
|
|
11
11
|
/* @__PURE__ */ e(f, { asChild: !0, children: /* @__PURE__ */ e(
|
|
12
|
-
x ?
|
|
12
|
+
x ? n : s,
|
|
13
13
|
{
|
|
14
|
-
className: "richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px]
|
|
14
|
+
className: "richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",
|
|
15
15
|
"data-state": t != null && t.dataState ? "on" : "off",
|
|
16
16
|
disabled: t == null ? void 0 : t.disabled,
|
|
17
17
|
ref: l,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),a=require("@radix-ui/react-slot"),d=require("react"),i=require("./index-BUTn2LY6.cjs");require("./theme.cjs");const s=d.forwardRef(({asChild:h=!1,tooltip:c,...t},l)=>{var n;const x=i.icons[t.icon],r=h?a.Slot:i.Button;return e.jsxs(i.Tooltip,{children:[e.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsx(r,{className:"richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0","data-state":t!=null&&t.dataState?"on":"off",disabled:t==null?void 0:t.disabled,ref:l,variant:"ghost",...t,children:e.jsxs("div",{className:"richtext-flex richtext-h-full richtext-items-center richtext-font-normal",children:[(t==null?void 0:t.title)&&e.jsx("div",{className:"richtext-grow richtext-truncate richtext-text-left richtext-text-sm",children:t==null?void 0:t.title}),x&&e.jsx(x,{className:"richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500"})]})})}),c&&e.jsx(i.TooltipContent,{children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[c&&e.jsx("div",{children:c}),e.jsx("div",{className:"richtext-flex",children:!!((n=t==null?void 0:t.shortcutKeys)!=null&&n.length)&&e.jsx("span",{children:i.getShortcutKeys(t==null?void 0:t.shortcutKeys)})})]})})]})});exports.ActionMenuButton=s;
|
package/lib/Attachment.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-zig3Dj7A.cjs"),u=require("./clsx-BWE7vnna.cjs"),s=require("./index-BUTn2LY6.cjs"),e=require("react/jsx-runtime"),v=require("react");require("./theme.cjs");const x=require("lucide-react"),S=require("./index-BqL4vAWE.cjs"),d=require("./dom-dataset-BqoJhJXt.cjs"),B={audio:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>',file:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',pdf:`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">
|
|
2
2
|
<path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"></path>
|
|
3
3
|
<path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"></path>
|
|
4
4
|
</svg>`,word:`<svg
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
fill="currentColor"
|
|
17
17
|
d="m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"
|
|
18
18
|
/>
|
|
19
|
-
</svg>`,excel:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sheet"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="9" y2="21"/><line x1="15" x2="15" y1="9" y2="21"/></svg>',ppt:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table-properties"><path d="M15 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M21 9H3"/><path d="M21 15H3"/></svg>'};function
|
|
19
|
+
</svg>`,excel:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sheet"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="9" y2="21"/><line x1="15" x2="15" y1="9" y2="21"/></svg>',ppt:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table-properties"><path d="M15 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M21 9H3"/><path d="M21 15H3"/></svg>'};function _(t){const n=B[t],l=new DOMParser().parseFromString(n,"image/svg+xml").documentElement,o=["svg",{...Array.from(l.attributes).reduce((i,a)=>(i[a.name]=a.value,i),{})}];return Array.from(l.childNodes).forEach(i=>{if(i.nodeType===1){const a=[i.tagName.toLowerCase(),Array.from(i.attributes).reduce((h,p)=>(h[p.name]=p.value,h),{})];i.textContent&&a.push(i.textContent),o.push(a)}}),o}const q={audio:e.jsx(x.LucideAudioLines,{}),video:e.jsx(x.LucideVideo,{}),file:e.jsx(x.LucideFile,{}),image:e.jsx(x.LucideImage,{}),pdf:e.jsx(s.ExportPdf,{}),word:e.jsx(s.ExportWord,{}),excel:e.jsx(x.LucideSheet,{}),ppt:e.jsx(x.LucideTableProperties,{})};function L(t,n=!1){const r=s.normalizeFileType(t),c=q[r]||e.jsx(e.Fragment,{});return n?_(r):c}const R="_wrap_15oj2_2",k={wrap:R};function P({editor:t,node:n,updateAttributes:r,deleteNode:c,extension:l}){var M;const o=v.useRef(null),i=s.useEditableEditor(),{hasTrigger:a,fileName:h,fileSize:p,fileExt:H,fileType:N,url:g,error:A}=n.attrs,[z,w]=v.useState(!1),{t:y}=S.useLocale(),E=(M=l==null?void 0:l.options)==null?void 0:M.upload,f=v.useCallback(()=>{!i||g||o.current.click()},[g,i]),F=v.useCallback(async T=>{const m=T.target.files&&T.target.files[0];if(!m)return;const D={fileName:s.extractFilename(m.name),fileSize:m.size,fileType:m.type,fileExt:s.extractFileExtension(m.name)};w(!0);try{const j=await E(m);r({...D,url:j}),w(!1)}catch(j){r({error:`File upload fail: ${j&&j.message}`}),w(!1),o.current.value=""}},[w,r]);v.useEffect(()=>{!g&&!a&&(f(),r({hasTrigger:!0}))},[g,a,f,r]);const V=v.useCallback(()=>c(),[t]);return i&&!g?e.jsx(u.NodeViewWrapper,{children:e.jsxs("div",{className:u.clsx(k.wrap,"render-wrapper"),children:[e.jsx("p",{onClick:f,style:{cursor:"pointer"},children:z?e.jsx("span",{children:y("editor.attachment.uploading")}):e.jsx("span",{children:y("editor.attachment.please_upload")})}),e.jsx("input",{hidden:!0,onChange:F,ref:o,type:"file"})]})}):g?e.jsx(u.NodeViewWrapper,{children:e.jsxs("div",{className:u.clsx(k.wrap,"render-wrapper"),onClick:f,children:[e.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px]",children:[e.jsx("span",{children:L(N)}),e.jsxs("span",{children:[h,".",H]}),e.jsxs("span",{children:["(",s.normalizeFileSize(p),")"]})]}),e.jsx(s.ActionButton,{action:V,icon:"Trash2",tooltip:y("editor.delete")})]})}):A!=="null"?e.jsx(u.NodeViewWrapper,{children:e.jsx("div",{className:u.clsx(k.wrap,"render-wrapper"),onClick:f,children:e.jsx("p",{children:A})})}):e.jsx(e.Fragment,{})}function $(){const t=s.useButtonProps(C.name),{icon:n=void 0,tooltip:r=void 0,shortcutKeys:c=void 0,tooltipOptions:l={},action:o=void 0,isActive:i=void 0}=(t==null?void 0:t.componentProps)??{},{editorDisabled:a,update:h}=s.useToggleActive(i),p=()=>{a||o&&(o(),h())};return t?e.jsx(s.ActionButton,{action:p,disabled:a,icon:n,shortcutKeys:c,tooltip:r,tooltipOptions:l}):e.jsx(e.Fragment,{})}const C=b.Node3.create({name:"attachment",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"attachment"},button:({editor:n,t:r})=>({component:s.ActionButton,componentProps:{action:()=>n.chain().focus().setAttachment().run(),isActive:()=>!1,disabled:!1,icon:"Attachment",tooltip:r("editor.attachment.tooltip")}})}},parseHTML(){return[{tag:"div[class=attachment]"}]},renderHTML({HTMLAttributes:t}){const{url:n="",fileName:r="",fileSize:c="",fileType:l="",fileExt:o=""}=t||{};return["div",b.mergeAttributes(this.options.HTMLAttributes||{},t||{}),n?["a",{href:n||"#"},["span",{class:"attachment__icon"},L(l,!0)],["span",{class:"attachment__text"},`${r}.${o} (${s.normalizeFileSize(c)})`]]:["div",{class:"attachment__placeholder"}]]},addAttributes(){return{fileName:{default:null,parseHTML:d.getDatasetAttribute("filename")},fileSize:{default:null,parseHTML:d.getDatasetAttribute("filesize")},fileType:{default:null,parseHTML:d.getDatasetAttribute("filetype")},fileExt:{default:null,parseHTML:d.getDatasetAttribute("fileext")},url:{default:null,parseHTML:d.getDatasetAttribute("url")},hasTrigger:{default:!1,parseHTML:t=>d.getDatasetAttribute("hastrigger")(t)==="true"},error:{default:null,parseHTML:d.getDatasetAttribute("error")}}},addCommands(){return{setAttachment:(t={})=>({chain:n})=>n().insertContent({type:this.name,attrs:t}).run()}},addNodeView(){return u.ReactNodeViewRenderer(P)}});exports.Attachment=C;exports.RichTextAttachment=$;
|
package/lib/Attachment.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { N as j, m as P } from "./index-mfGK4pFo.js";
|
|
2
|
+
import { N as x, c as y, a as D } from "./clsx-eGVyq7ot.js";
|
|
3
|
+
import { P as R, Q as $, U as I, F as O, V as W, W as Z, X as N, A as T, u as K, d as Q } from "./index-DHUN85fV.js";
|
|
3
4
|
import { jsx as e, Fragment as L, jsxs as f } from "react/jsx-runtime";
|
|
4
|
-
import { useRef as
|
|
5
|
+
import { useRef as U, useState as X, useCallback as k, useEffect as q } from "react";
|
|
5
6
|
import "./theme.js";
|
|
6
|
-
import { LucideTableProperties as
|
|
7
|
-
import { u as ie } from "./index-
|
|
7
|
+
import { LucideTableProperties as G, LucideSheet as J, LucideImage as Y, LucideFile as ee, LucideVideo as te, LucideAudioLines as re } from "lucide-react";
|
|
8
|
+
import { u as ie } from "./index-BlXGgvT-.js";
|
|
8
9
|
import { g as c } from "./dom-dataset-CIEeltF6.js";
|
|
9
10
|
const oe = {
|
|
10
11
|
audio: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',
|
|
@@ -59,24 +60,23 @@ const ae = {
|
|
|
59
60
|
pdf: /* @__PURE__ */ e(I, {}),
|
|
60
61
|
word: /* @__PURE__ */ e($, {}),
|
|
61
62
|
excel: /* @__PURE__ */ e(J, {}),
|
|
62
|
-
ppt: /* @__PURE__ */ e(
|
|
63
|
+
ppt: /* @__PURE__ */ e(G, {})
|
|
63
64
|
};
|
|
64
65
|
function b(t, o = !1) {
|
|
65
66
|
const r = R(t), l = ae[r] || /* @__PURE__ */ e(L, {});
|
|
66
67
|
return o ? ne(r) : l;
|
|
67
68
|
}
|
|
68
|
-
const se = "
|
|
69
|
+
const se = "_wrap_15oj2_2", M = {
|
|
69
70
|
wrap: se
|
|
70
71
|
};
|
|
71
72
|
function le({ editor: t, node: o, updateAttributes: r, deleteNode: l, extension: s }) {
|
|
72
73
|
var A;
|
|
73
|
-
const n =
|
|
74
|
+
const n = U(null), i = O(), { hasTrigger: a, fileName: d, fileSize: h, fileExt: z, fileType: E, url: u, error: H } = o.attrs, [F, v] = X(!1), { t: w } = ie(), V = (A = s == null ? void 0 : s.options) == null ? void 0 : A.upload, m = k(() => {
|
|
74
75
|
!i || u || n.current.click();
|
|
75
76
|
}, [u, i]), B = k(
|
|
76
77
|
async (C) => {
|
|
77
78
|
const p = C.target.files && C.target.files[0];
|
|
78
|
-
if (!p)
|
|
79
|
-
return;
|
|
79
|
+
if (!p) return;
|
|
80
80
|
const _ = {
|
|
81
81
|
fileName: Z(p.name),
|
|
82
82
|
fileSize: p.size,
|
|
@@ -85,83 +85,49 @@ function le({ editor: t, node: o, updateAttributes: r, deleteNode: l, extension:
|
|
|
85
85
|
};
|
|
86
86
|
v(!0);
|
|
87
87
|
try {
|
|
88
|
-
const g = await
|
|
88
|
+
const g = await V(p);
|
|
89
89
|
r({ ..._, url: g }), v(!1);
|
|
90
90
|
} catch (g) {
|
|
91
|
-
r({
|
|
91
|
+
r({
|
|
92
|
+
error: `File upload fail: ${g && g.message}`
|
|
93
|
+
}), v(!1), n.current.value = "";
|
|
92
94
|
}
|
|
93
95
|
},
|
|
94
96
|
[v, r]
|
|
95
97
|
);
|
|
96
|
-
|
|
98
|
+
q(() => {
|
|
97
99
|
!u && !a && (m(), r({ hasTrigger: !0 }));
|
|
98
100
|
}, [u, a, m, r]);
|
|
99
101
|
const S = k(() => l(), [t]);
|
|
100
102
|
return i && !u ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ f("div", { className: y(M.wrap, "render-wrapper"), children: [
|
|
101
|
-
/* @__PURE__ */ e(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
)
|
|
118
|
-
] }) }) :
|
|
119
|
-
"div",
|
|
120
|
-
{
|
|
121
|
-
className: y(M.wrap, "render-wrapper"),
|
|
122
|
-
onClick: m,
|
|
123
|
-
children: [
|
|
124
|
-
/* @__PURE__ */ f("div", { className: "richtext-flex richtext-items-center richtext-gap-[4px]", children: [
|
|
125
|
-
/* @__PURE__ */ e("span", { children: b(E) }),
|
|
126
|
-
/* @__PURE__ */ f("span", { children: [
|
|
127
|
-
d,
|
|
128
|
-
".",
|
|
129
|
-
z
|
|
130
|
-
] }),
|
|
131
|
-
/* @__PURE__ */ f("span", { children: [
|
|
132
|
-
"(",
|
|
133
|
-
N(h),
|
|
134
|
-
")"
|
|
135
|
-
] })
|
|
136
|
-
] }),
|
|
137
|
-
/* @__PURE__ */ e(
|
|
138
|
-
T,
|
|
139
|
-
{
|
|
140
|
-
action: S,
|
|
141
|
-
icon: "Trash2",
|
|
142
|
-
tooltip: w("editor.delete")
|
|
143
|
-
}
|
|
144
|
-
)
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
) }) : H !== "null" ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(
|
|
148
|
-
"div",
|
|
149
|
-
{
|
|
150
|
-
className: y(M.wrap, "render-wrapper"),
|
|
151
|
-
onClick: m,
|
|
152
|
-
children: /* @__PURE__ */ e("p", { children: H })
|
|
153
|
-
}
|
|
154
|
-
) }) : /* @__PURE__ */ e(L, {});
|
|
103
|
+
/* @__PURE__ */ e("p", { onClick: m, style: { cursor: "pointer" }, children: F ? /* @__PURE__ */ e("span", { children: w("editor.attachment.uploading") }) : /* @__PURE__ */ e("span", { children: w("editor.attachment.please_upload") }) }),
|
|
104
|
+
/* @__PURE__ */ e("input", { hidden: !0, onChange: B, ref: n, type: "file" })
|
|
105
|
+
] }) }) : u ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ f("div", { className: y(M.wrap, "render-wrapper"), onClick: m, children: [
|
|
106
|
+
/* @__PURE__ */ f("div", { className: "richtext-flex richtext-items-center richtext-gap-[4px]", children: [
|
|
107
|
+
/* @__PURE__ */ e("span", { children: b(E) }),
|
|
108
|
+
/* @__PURE__ */ f("span", { children: [
|
|
109
|
+
d,
|
|
110
|
+
".",
|
|
111
|
+
z
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ f("span", { children: [
|
|
114
|
+
"(",
|
|
115
|
+
N(h),
|
|
116
|
+
")"
|
|
117
|
+
] })
|
|
118
|
+
] }),
|
|
119
|
+
/* @__PURE__ */ e(T, { action: S, icon: "Trash2", tooltip: w("editor.delete") })
|
|
120
|
+
] }) }) : H !== "null" ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e("div", { className: y(M.wrap, "render-wrapper"), onClick: m, children: /* @__PURE__ */ e("p", { children: H }) }) }) : /* @__PURE__ */ e(L, {});
|
|
155
121
|
}
|
|
156
|
-
function
|
|
157
|
-
const t =
|
|
122
|
+
function xe() {
|
|
123
|
+
const t = K(ce.name), {
|
|
158
124
|
icon: o = void 0,
|
|
159
125
|
tooltip: r = void 0,
|
|
160
126
|
shortcutKeys: l = void 0,
|
|
161
127
|
tooltipOptions: s = {},
|
|
162
128
|
action: n = void 0,
|
|
163
129
|
isActive: i = void 0
|
|
164
|
-
} = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: a, update: d } =
|
|
130
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: a, update: d } = Q(i), h = () => {
|
|
165
131
|
a || n && (n(), d());
|
|
166
132
|
};
|
|
167
133
|
return t ? /* @__PURE__ */ e(
|
|
@@ -217,7 +183,7 @@ const ce = /* @__PURE__ */ j.create({
|
|
|
217
183
|
} = t || {};
|
|
218
184
|
return [
|
|
219
185
|
"div",
|
|
220
|
-
|
|
186
|
+
P(
|
|
221
187
|
// @ts-expect-error
|
|
222
188
|
this.options.HTMLAttributes || {},
|
|
223
189
|
t || {}
|
|
@@ -225,11 +191,7 @@ const ce = /* @__PURE__ */ j.create({
|
|
|
225
191
|
o ? [
|
|
226
192
|
"a",
|
|
227
193
|
{ href: o || "#" },
|
|
228
|
-
[
|
|
229
|
-
"span",
|
|
230
|
-
{ class: "attachment__icon" },
|
|
231
|
-
b(s, !0)
|
|
232
|
-
],
|
|
194
|
+
["span", { class: "attachment__icon" }, b(s, !0)],
|
|
233
195
|
[
|
|
234
196
|
"span",
|
|
235
197
|
{ class: "attachment__text" },
|
|
@@ -276,10 +238,10 @@ const ce = /* @__PURE__ */ j.create({
|
|
|
276
238
|
};
|
|
277
239
|
},
|
|
278
240
|
addNodeView() {
|
|
279
|
-
return
|
|
241
|
+
return D(le);
|
|
280
242
|
}
|
|
281
243
|
});
|
|
282
244
|
export {
|
|
283
245
|
ce as Attachment,
|
|
284
|
-
|
|
246
|
+
xe as RichTextAttachment
|
|
285
247
|
};
|
package/lib/Blockquote.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-zig3Dj7A.cjs"),p=require("./jsx-runtime-C_NLcKys.cjs"),l=require("react/jsx-runtime"),a=require("./index-BUTn2LY6.cjs");require("react");require("./theme.cjs");var g=/^\s*>\s$/,m=c.Node3.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return p.h("blockquote",{...c.mergeAttributes(this.options.HTMLAttributes,t),children:p.h("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const o=">",n=[];return t.content.forEach(i=>{const u=e.renderChildren([i]).split(`
|
|
2
2
|
`).map(r=>r.trim()===""?o:`${o} ${r}`);n.push(u.join(`
|
|
3
3
|
`))}),n.join(`
|
|
4
4
|
${o}
|
package/lib/Blockquote.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { N as m, w as h, m as k } from "./
|
|
1
|
+
import { N as m, w as h, m as k } from "./index-mfGK4pFo.js";
|
|
2
2
|
import { h as a } from "./jsx-runtime-CT7Pcg-t.js";
|
|
3
3
|
import { jsx as d, Fragment as g } from "react/jsx-runtime";
|
|
4
|
-
import { u as f, d as b, A as q } from "./index-
|
|
4
|
+
import { u as f, d as b, A as q } from "./index-DHUN85fV.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "./theme.js";
|
|
7
7
|
var v = /^\s*>\s$/, B = m.create({
|
|
@@ -80,7 +80,6 @@ function H() {
|
|
|
80
80
|
) : /* @__PURE__ */ d(g, {});
|
|
81
81
|
}
|
|
82
82
|
const A = /* @__PURE__ */ B.extend({
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
84
83
|
//@ts-expect-error
|
|
85
84
|
addOptions() {
|
|
86
85
|
var t;
|
package/lib/Bold.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-zig3Dj7A.cjs"),u=require("./jsx-runtime-C_NLcKys.cjs"),r=require("./index-BUTn2LY6.cjs"),i=require("react/jsx-runtime");require("react");require("./theme.cjs");var y=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,B=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,k=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,v=o.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return u.h("strong",{...o.mergeAttributes(this.options.HTMLAttributes,t),children:u.h("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[o.markInputRule({find:y,type:this.type}),o.markInputRule({find:B,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:_,type:this.type}),o.markPasteRule({find:k,type:this.type})]}});function M(){const t=r.useButtonProps(l.name),{icon:e=void 0,tooltip:n=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:d=void 0,isActive:p=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:g,disabled:a,update:m}=r.useToggleActive(p),h=()=>{a||d&&(d(),m())};return t?i.jsx(r.ActionButton,{action:h,dataState:g,disabled:a,icon:e,shortcutKeys:s,tooltip:n,tooltipOptions:c}):i.jsx(i.Fragment,{})}const l=v.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n,extension:s})=>({component:r.ActionButton,componentProps:{action:()=>e.commands.toggleBold(),isActive:()=>e.isActive("bold"),icon:"Bold",shortcutKeys:s.options.shortcutKeys??["mod","B"],tooltip:n("editor.bold.tooltip")}})}}});exports.Bold=l;exports.RichTextBold=M;
|
package/lib/Bold.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { M as _,
|
|
1
|
+
import { M as _, f as a, h as i, m as y } from "./index-mfGK4pFo.js";
|
|
2
2
|
import { h as d } from "./jsx-runtime-CT7Pcg-t.js";
|
|
3
|
-
import { u as f, d as M, A as l } from "./index-
|
|
3
|
+
import { u as f, d as M, A as l } from "./index-DHUN85fV.js";
|
|
4
4
|
import { jsx as u, Fragment as v } from "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import "./theme.js";
|
|
@@ -99,7 +99,6 @@ function K() {
|
|
|
99
99
|
) : /* @__PURE__ */ u(v, {});
|
|
100
100
|
}
|
|
101
101
|
const x = /* @__PURE__ */ R.extend({
|
|
102
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
103
102
|
//@ts-expect-error
|
|
104
103
|
addOptions() {
|
|
105
104
|
var t;
|
package/lib/BulletList.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-BtxvYLJ1.cjs"),s=require("react/jsx-runtime"),n=require("./index-BUTn2LY6.cjs");require("react");require("./theme.cjs");function g(){const t=n.useButtonProps(l.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:c=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:a,disabled:u,update:p}=n.useToggleActive(d),m=()=>{u||c&&(c(),p())};return t?s.jsx(n.ActionButton,{action:m,dataState:a,disabled:u,icon:e,shortcutKeys:o,tooltip:i,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=v.BulletList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:i,extension:o})=>({componentProps:{action:()=>e.commands.toggleBulletList(),isActive:()=>e.isActive("bulletList"),disabled:!1,shortcutKeys:o.options.shortcutKeys??["shift","mod","8"],icon:"List",tooltip:i("editor.bulletlist.tooltip")}})}}});exports.BulletList=l;exports.RichTextBulletList=g;
|
package/lib/BulletList.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as d } from "./index-
|
|
1
|
+
import { B as d } from "./index-C6xmkxrQ.js";
|
|
2
2
|
import { jsx as c, Fragment as m } from "react/jsx-runtime";
|
|
3
|
-
import { u as f, d as v, A } from "./index-
|
|
3
|
+
import { u as f, d as v, A } from "./index-DHUN85fV.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
function y() {
|
|
@@ -28,7 +28,6 @@ function y() {
|
|
|
28
28
|
) : /* @__PURE__ */ c(m, {});
|
|
29
29
|
}
|
|
30
30
|
const B = /* @__PURE__ */ d.extend({
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
32
31
|
//@ts-expect-error
|
|
33
32
|
addOptions() {
|
|
34
33
|
var t;
|
package/lib/Callout.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index-zig3Dj7A.cjs"),x=require("./clsx-BWE7vnna.cjs"),o=require("./index-BUTn2LY6.cjs"),t=require("react/jsx-runtime"),h=require("react");require("./theme.cjs");const n=require("lucide-react"),c=require("./select-DHjzKkcu.cjs"),k=require("./index-BqL4vAWE.cjs"),C=[{value:"note",label:"Note",icon:n.Info,color:"#1f6feb",background:"#1f6feb1f"},{value:"tip",label:"Tip",icon:n.Lightbulb,color:"#238636",background:"#2386361f"},{value:"important",label:"Important",icon:n.AlertCircle,color:"#ab7df8",background:"#ab7df81f"},{value:"warning",label:"Warning",icon:n.TriangleAlert,color:"#d29922",background:"#d299221f"},{value:"caution",label:"Caution",icon:n.OctagonAlert,color:"#f85149",background:"#f851491f"}];function w({node:e}){const{type:l="note",title:r="",body:s=""}=e.attrs,u=(C.find(d=>d.value===l)||C[0]).icon;return t.jsx(x.NodeViewWrapper,{children:t.jsxs("div",{className:x.clsx("richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",{"richtext-bg-[#1f6feb1f] richtext-border-[#1f6feb]":l==="note","richtext-bg-[#2386361f] richtext-border-[#238636]":l==="tip","richtext-bg-[#ab7df81f] richtext-border-[#ab7df8]":l==="important","richtext-bg-[#d299221f] richtext-border-[#d29922]":l==="warning","richtext-bg-[#f851491f] richtext-border-[#f85149]":l==="caution"}),children:[t.jsxs("div",{className:x.clsx("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2",{"richtext-text-[#1f6feb]":l==="note","richtext-text-[#238636]":l==="tip","richtext-text-[#ab7df8]":l==="important","richtext-text-[#d29922]":l==="warning","richtext-text-[#f85149]":l==="caution"}),children:[t.jsx(u,{className:"richtext-size-5"}),t.jsx("span",{className:"richtext-font-semibold",children:r})]}),s&&t.jsx("p",{className:"richtext-pl-[28px]",children:s})]})})}const M=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function B(){const{t:e}=k.useLocale(),l=o.useEditorInstance(),r=o.useButtonProps(y.name),[s,a]=h.useState(!1),[u,d]=h.useState("note"),[b,g]=h.useState(""),[f,v]=h.useState(""),{icon:T=void 0,tooltip:A=void 0,shortcutKeys:L=void 0,tooltipOptions:N={},isActive:S=void 0}=(r==null?void 0:r.componentProps)??{},{dataState:I,disabled:m}=o.useToggleActive(S),q=()=>{l&&(l.chain().focus().setCallout({type:u,title:b,body:f}).run(),a(!1),d("note"),g(""),v(""))},O=()=>{m||a(!0)};return r?t.jsxs(o.Dialog,{onOpenChange:a,open:s,children:[t.jsx(o.DialogTrigger,{asChild:!0,children:t.jsx(o.ActionButton,{action:O,dataState:I,disabled:m,icon:T,shortcutKeys:L,tooltip:A,tooltipOptions:N})}),t.jsxs(o.DialogContent,{children:[t.jsx(o.DialogTitle,{children:e("editor.callout.dialog.title")}),t.jsxs("div",{className:"richtext-space-y-4 richtext-py-4",children:[t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(o.Label,{children:e("editor.callout.dialog.type")}),t.jsxs(c.Select,{onValueChange:d,value:u,children:[t.jsx(c.SelectTrigger,{children:t.jsx(c.SelectValue,{placeholder:e("editor.callout.dialog.type.placeholder")})}),t.jsx(c.SelectContent,{children:M.map(i=>t.jsx(c.SelectItem,{value:i.value,children:e(`editor.callout.type.${i.value}`)},i.value))})]})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(o.Label,{children:e("editor.callout.dialog.title.label")}),t.jsx(o.Input,{onChange:i=>g(i.target.value),placeholder:e("editor.callout.dialog.title.placeholder"),value:b})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(o.Label,{children:e("editor.callout.dialog.body.label")}),t.jsx(o.Input,{onChange:i=>v(i.target.value),placeholder:e("editor.callout.dialog.body.placeholder"),value:f})]})]}),t.jsxs(o.DialogFooter,{children:[t.jsx(o.Button,{onClick:()=>a(!1),variant:"outline",children:e("editor.callout.dialog.button.cancel")}),t.jsx(o.Button,{onClick:q,children:e("editor.callout.dialog.button.apply")})]})]})]}):t.jsx(t.Fragment,{})}function p(e){return l=>l.getAttribute(e)}const y=j.Node3.create({name:"callout",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"callout"},button:({editor:l,t:r})=>({component:o.ActionButton,componentProps:{action:()=>!0,isActive:()=>l.isActive("callout"),disabled:!1,icon:"Callout",tooltip:r("editor.callout.tooltip")}})}},parseHTML(){return[{tag:"div.callout"}]},renderHTML({HTMLAttributes:e}){return["div",j.mergeAttributes(this.options&&this.options.HTMLAttributes||{},e)]},addAttributes(){return{type:{default:"",parseHTML:p("type")},title:{default:"",parseHTML:p("title")},body:{default:"",parseHTML:p("body")}}},addCommands(){return{setCallout:e=>({chain:l})=>l().insertContent({type:this.name,attrs:e}).run()}},addNodeView(){return x.ReactNodeViewRenderer(w)}});exports.Callout=y;exports.RichTextCallout=B;
|