reactjs-tiptap-editor 0.2.29 → 0.3.1
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-BllDdN2-.js +33 -0
- package/lib/ActionMenuButton-tLPdHfCT.cjs +1 -0
- package/lib/Attachment.cjs +19 -0
- package/lib/Attachment.d.cts +344 -0
- package/lib/Attachment.d.ts +344 -0
- package/lib/Attachment.js +259 -0
- package/lib/Blockquote.cjs +1 -0
- package/lib/Blockquote.d.cts +343 -0
- package/lib/Blockquote.d.ts +343 -0
- package/lib/Blockquote.js +65 -0
- package/lib/Bold.cjs +1 -0
- package/lib/Bold.d.cts +343 -0
- package/lib/Bold.d.ts +343 -0
- package/lib/Bold.js +90 -0
- package/lib/BulletList.cjs +1 -0
- package/lib/BulletList.d.cts +343 -0
- package/lib/BulletList.d.ts +343 -0
- package/lib/BulletList.js +72 -0
- package/lib/Clear.cjs +1 -0
- package/lib/Clear.d.cts +342 -0
- package/lib/Clear.d.ts +342 -0
- package/lib/Clear.js +23 -0
- package/lib/Code.cjs +1 -0
- package/lib/Code.d.cts +343 -0
- package/lib/Code.d.ts +343 -0
- package/lib/Code.js +70 -0
- package/lib/CodeBlock.cjs +44 -0
- package/lib/CodeBlock.d.cts +352 -0
- package/lib/CodeBlock.d.ts +352 -0
- package/lib/CodeBlock.js +4189 -0
- package/lib/Color.cjs +1 -0
- package/lib/Color.d.cts +350 -0
- package/lib/Color.d.ts +350 -0
- package/lib/Color.js +141 -0
- package/lib/Document.cjs +1 -0
- package/lib/Document.d.cts +272 -0
- package/lib/Document.d.ts +272 -0
- package/lib/Document.js +13 -0
- package/lib/Drawer-BBmEHEAp.cjs +1 -0
- package/lib/Drawer-hyBIiEP6.js +1367 -0
- package/lib/Drawer.cjs +1 -0
- package/lib/Drawer.d.cts +344 -0
- package/lib/Drawer.d.ts +344 -0
- package/lib/Drawer.js +7 -0
- package/lib/Emoji.cjs +1 -0
- package/lib/Emoji.d.cts +277 -0
- package/lib/Emoji.d.ts +277 -0
- package/lib/Emoji.js +2168 -0
- package/lib/Excalidraw-BQ2PeAoa.js +651 -0
- package/lib/Excalidraw-Cd01zFJl.cjs +1 -0
- package/lib/Excalidraw.cjs +1 -0
- package/lib/Excalidraw.d.cts +278 -0
- package/lib/Excalidraw.d.ts +278 -0
- package/lib/Excalidraw.js +6 -0
- package/lib/ExportPdf.cjs +15 -0
- package/lib/ExportPdf.d.cts +270 -0
- package/lib/ExportPdf.d.ts +270 -0
- package/lib/ExportPdf.js +67 -0
- package/lib/ExportWord.cjs +1 -0
- package/lib/ExportWord.d.cts +341 -0
- package/lib/ExportWord.d.ts +341 -0
- package/lib/ExportWord.js +72 -0
- package/lib/FontFamily.cjs +1 -0
- package/lib/FontFamily.d.cts +354 -0
- package/lib/FontFamily.d.ts +354 -0
- package/lib/FontFamily.js +136 -0
- package/lib/FontSize.cjs +1 -0
- package/lib/FontSize.d.cts +359 -0
- package/lib/FontSize.d.ts +359 -0
- package/lib/FontSize.js +110 -0
- package/lib/FormatPainter.cjs +1 -0
- package/lib/FormatPainter.d.cts +353 -0
- package/lib/FormatPainter.d.ts +353 -0
- package/lib/FormatPainter.js +74 -0
- package/lib/Heading.cjs +1 -0
- package/lib/Heading.d.cts +343 -0
- package/lib/Heading.d.ts +343 -0
- package/lib/Heading.js +147 -0
- package/lib/Highlight.cjs +1 -0
- package/lib/Highlight.d.cts +344 -0
- package/lib/Highlight.d.ts +344 -0
- package/lib/Highlight.js +85 -0
- package/lib/History.cjs +1 -0
- package/lib/History.d.cts +343 -0
- package/lib/History.d.ts +343 -0
- package/lib/History.js +431 -0
- package/lib/HorizontalRule.cjs +1 -0
- package/lib/HorizontalRule.d.cts +343 -0
- package/lib/HorizontalRule.d.ts +343 -0
- package/lib/HorizontalRule.js +87 -0
- package/lib/Iframe.cjs +1 -0
- package/lib/Iframe.d.cts +277 -0
- package/lib/Iframe.d.ts +277 -0
- package/lib/Iframe.js +6 -0
- package/lib/Image.cjs +1 -0
- package/lib/Image.d.cts +370 -0
- package/lib/Image.d.ts +370 -0
- package/lib/Image.js +7 -0
- package/lib/ImageGif.cjs +1 -0
- package/lib/ImageGif.d.cts +292 -0
- package/lib/ImageGif.d.ts +292 -0
- package/lib/ImageGif.js +7 -0
- package/lib/ImportWord.cjs +231 -0
- package/lib/ImportWord.d.cts +353 -0
- package/lib/ImportWord.d.ts +353 -0
- package/lib/ImportWord.js +16620 -0
- package/lib/Indent.cjs +1 -0
- package/lib/Indent.d.cts +344 -0
- package/lib/Indent.d.ts +344 -0
- package/lib/Indent.js +78 -0
- package/lib/Italic.cjs +1 -0
- package/lib/Italic.d.cts +343 -0
- package/lib/Italic.d.ts +343 -0
- package/lib/Italic.js +91 -0
- package/lib/Katex.cjs +1 -0
- package/lib/Katex.d.cts +279 -0
- package/lib/Katex.d.ts +279 -0
- package/lib/Katex.js +197 -0
- package/lib/LineHeight.cjs +1 -0
- package/lib/LineHeight.d.cts +347 -0
- package/lib/LineHeight.d.ts +347 -0
- package/lib/LineHeight.js +137 -0
- package/lib/Link.cjs +5 -0
- package/lib/Link.d.cts +343 -0
- package/lib/Link.d.ts +343 -0
- package/lib/Link.js +1048 -0
- package/lib/ListItem.cjs +1 -0
- package/lib/ListItem.d.cts +269 -0
- package/lib/ListItem.d.ts +269 -0
- package/lib/ListItem.js +33 -0
- package/lib/Mention.cjs +1 -0
- package/lib/Mention.d.cts +272 -0
- package/lib/Mention.d.ts +272 -0
- package/lib/Mention.js +233 -0
- package/lib/Mermaid.cjs +2 -0
- package/lib/Mermaid.d.cts +344 -0
- package/lib/Mermaid.d.ts +344 -0
- package/lib/Mermaid.js +390 -0
- package/lib/MoreMark.cjs +1 -0
- package/lib/MoreMark.d.cts +355 -0
- package/lib/MoreMark.d.ts +355 -0
- package/lib/MoreMark.js +95 -0
- package/lib/MultiColumn.cjs +1 -0
- package/lib/MultiColumn.d.cts +277 -0
- package/lib/MultiColumn.d.ts +277 -0
- package/lib/MultiColumn.js +8 -0
- package/lib/OrderedList.cjs +1 -0
- package/lib/OrderedList.d.cts +343 -0
- package/lib/OrderedList.d.ts +343 -0
- package/lib/OrderedList.js +90 -0
- package/lib/RichTextEditor-CM-Xq9RS.cjs +137 -0
- package/lib/RichTextEditor-DvrUVNK2.js +11417 -0
- package/lib/SearchAndReplace.cjs +1 -0
- package/lib/SearchAndReplace.d.cts +358 -0
- package/lib/SearchAndReplace.d.ts +358 -0
- package/lib/SearchAndReplace.js +339 -0
- package/lib/Selection.cjs +1 -0
- package/lib/Selection.d.cts +272 -0
- package/lib/Selection.d.ts +272 -0
- package/lib/Selection.js +25 -0
- package/lib/SlashCommand.cjs +1 -0
- package/lib/SlashCommand.d.cts +299 -0
- package/lib/SlashCommand.d.ts +299 -0
- package/lib/SlashCommand.js +369 -0
- package/lib/Strike.cjs +1 -0
- package/lib/Strike.d.cts +343 -0
- package/lib/Strike.d.ts +343 -0
- package/lib/Strike.js +80 -0
- package/lib/SubAndSuperScript.cjs +1 -0
- package/lib/SubAndSuperScript.d.cts +358 -0
- package/lib/SubAndSuperScript.d.ts +358 -0
- package/lib/SubAndSuperScript.js +41 -0
- package/lib/Table.cjs +1 -0
- package/lib/Table.d.cts +366 -0
- package/lib/Table.d.ts +366 -0
- package/lib/Table.js +2165 -0
- package/lib/TableOfContent.cjs +1 -0
- package/lib/TableOfContent.d.cts +274 -0
- package/lib/TableOfContent.d.ts +274 -0
- package/lib/TableOfContent.js +184 -0
- package/lib/TaskList.cjs +1 -0
- package/lib/TaskList.d.cts +349 -0
- package/lib/TaskList.d.ts +349 -0
- package/lib/TaskList.js +175 -0
- package/lib/TextAlign.cjs +1 -0
- package/lib/TextAlign.d.cts +353 -0
- package/lib/TextAlign.d.ts +353 -0
- package/lib/TextAlign.js +165 -0
- package/lib/TextBubble.cjs +1 -0
- package/lib/TextBubble.d.cts +343 -0
- package/lib/TextBubble.d.ts +343 -0
- package/lib/TextBubble.js +131 -0
- package/lib/TextDirection.cjs +1 -0
- package/lib/TextDirection.d.cts +270 -0
- package/lib/TextDirection.d.ts +270 -0
- package/lib/TextDirection.js +142 -0
- package/lib/TextUnderline.cjs +1 -0
- package/lib/TextUnderline.d.cts +343 -0
- package/lib/TextUnderline.d.ts +343 -0
- package/lib/TextUnderline.js +61 -0
- package/lib/TrailingNode.cjs +1 -0
- package/lib/TrailingNode.d.cts +280 -0
- package/lib/TrailingNode.d.ts +280 -0
- package/lib/TrailingNode.js +41 -0
- package/lib/Twitter-BuMkJKBq.cjs +17 -0
- package/lib/Twitter-BvdxYuDK.js +1743 -0
- package/lib/Twitter.cjs +1 -0
- package/lib/Twitter.d.cts +295 -0
- package/lib/Twitter.d.ts +295 -0
- package/lib/Twitter.js +6 -0
- package/lib/Video.cjs +1 -0
- package/lib/Video.d.cts +371 -0
- package/lib/Video.d.ts +371 -0
- package/lib/Video.js +6 -0
- package/lib/bubble-extra.cjs +2 -0
- package/lib/bubble-extra.d.cts +294 -0
- package/lib/bubble-extra.d.ts +294 -0
- package/lib/bubble-extra.js +623 -0
- package/lib/dom-dataset-CAXnsjYE.cjs +33 -0
- package/lib/dom-dataset-CJ7GyQ2E.js +999 -0
- package/lib/index-COecBbaE.cjs +89 -0
- package/lib/index-ClFtfQ0J.cjs +1 -0
- package/lib/index-CvYIX2-x.js +129 -0
- package/lib/index-CySbCeQd.cjs +1 -0
- package/lib/{index-CO-iymkb.js → index-D9llIWB5.js} +442 -101
- package/lib/index-DXBa3JBo.js +46 -0
- package/lib/index-DjP7Onch.cjs +1 -0
- package/lib/index-Drmyqk9P.js +12322 -0
- package/lib/index-DuhDIOel.js +76 -0
- package/lib/index-LbrE7K9i.cjs +1 -0
- package/lib/index.cjs +2 -1
- package/lib/index.d.cts +290 -108
- package/lib/index.d.ts +290 -108
- package/lib/index.js +587 -13
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +108 -108
- package/lib/locale-bundle.d.ts +108 -108
- package/lib/locale-bundle.js +1 -1
- package/lib/shortId-Bfj8TyNr.cjs +2 -0
- package/lib/shortId-WJVkrvml.js +30 -0
- package/lib/style.css +1 -1
- package/lib/textarea-B172kMgC.js +20 -0
- package/lib/textarea-CapyElEP.cjs +1 -0
- package/package.json +678 -15
- package/lib/RichTextEditor-Ce2IeNE6.js +0 -8265
- package/lib/RichTextEditor-hDDApaDD.cjs +0 -136
- package/lib/extension-bundle.cjs +0 -33
- package/lib/extension-bundle.d.cts +0 -951
- package/lib/extension-bundle.d.ts +0 -951
- package/lib/extension-bundle.js +0 -5982
- package/lib/index-CJ6Hb9MN.cjs +0 -1
- package/lib/tiptap-DOP8lVCQ.js +0 -5950
- package/lib/tiptap-Dq62HiQ9.cjs +0 -113
- package/lib/vendor-BbgkyoD-.js +0 -40297
- package/lib/vendor-DdwtMmSr.cjs +0 -302
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import n from "react";
|
|
3
|
+
import { Slot as a } from "@radix-ui/react-slot";
|
|
4
|
+
import { i as r, T as d, a as m, B as f, b as u, g } from "./RichTextEditor-DvrUVNK2.js";
|
|
5
|
+
const T = n.forwardRef(
|
|
6
|
+
({ asChild: l, ...t }, x) => {
|
|
7
|
+
var h;
|
|
8
|
+
const c = r[t.icon];
|
|
9
|
+
return /* @__PURE__ */ i(d, { children: [
|
|
10
|
+
/* @__PURE__ */ e(m, { asChild: !0, children: /* @__PURE__ */ e(
|
|
11
|
+
l ? a : f,
|
|
12
|
+
{
|
|
13
|
+
className: "richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",
|
|
14
|
+
disabled: t == null ? void 0 : t.disabled,
|
|
15
|
+
ref: x,
|
|
16
|
+
variant: "ghost",
|
|
17
|
+
...t,
|
|
18
|
+
children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-h-full richtext-items-center richtext-font-normal", children: [
|
|
19
|
+
(t == null ? void 0 : t.title) && /* @__PURE__ */ e("div", { className: "richtext-grow richtext-truncate richtext-text-left richtext-text-sm", children: t == null ? void 0 : t.title }),
|
|
20
|
+
c && /* @__PURE__ */ e(c, { className: "richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500" })
|
|
21
|
+
] })
|
|
22
|
+
}
|
|
23
|
+
) }),
|
|
24
|
+
/* @__PURE__ */ e(u, { children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center", children: [
|
|
25
|
+
(t == null ? void 0 : t.tooltip) && /* @__PURE__ */ e("div", { children: t == null ? void 0 : t.tooltip }),
|
|
26
|
+
/* @__PURE__ */ e("div", { className: "richtext-flex", children: !!((h = t == null ? void 0 : t.shortcutKeys) != null && h.length) && /* @__PURE__ */ e("span", { children: g(t == null ? void 0 : t.shortcutKeys) }) })
|
|
27
|
+
] }) })
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
export {
|
|
32
|
+
T as A
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),r=require("react"),a=require("@radix-ui/react-slot"),i=require("./RichTextEditor-CM-Xq9RS.cjs"),d=r.forwardRef(({asChild:n,...t},h)=>{var x;const c=i.icons[t.icon],l=n?a.Slot:i.Button;return e.jsxs(i.Tooltip,{children:[e.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsx(l,{className:"richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",disabled:t==null?void 0:t.disabled,ref:h,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}),c&&e.jsx(c,{className:"richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500"})]})})}),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:[(t==null?void 0:t.tooltip)&&e.jsx("div",{children:t==null?void 0:t.tooltip}),e.jsx("div",{className:"richtext-flex",children:!!((x=t==null?void 0:t.shortcutKeys)!=null&&x.length)&&e.jsx("span",{children:i.getShortcutKeys(t==null?void 0:t.shortcutKeys)})})]})})]})});exports.ActionMenuButton=d;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-COecBbaE.cjs"),i=require("./dom-dataset-CAXnsjYE.cjs"),a=require("./RichTextEditor-CM-Xq9RS.cjs"),e=require("react/jsx-runtime"),p=require("lucide-react"),g=require("react"),V=require("./index-LbrE7K9i.cjs"),S={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
|
+
<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
|
+
<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
|
+
</svg>`,word:`<svg
|
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
+
width="1em"
|
|
7
|
+
height="1em"
|
|
8
|
+
className="icon"
|
|
9
|
+
viewBox="0 0 1024 1024"
|
|
10
|
+
>
|
|
11
|
+
<path
|
|
12
|
+
fill="currentColor"
|
|
13
|
+
d="M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"
|
|
14
|
+
/>
|
|
15
|
+
<path
|
|
16
|
+
fill="currentColor"
|
|
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
|
+
/>
|
|
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 D(t){const n=S[t],l=new DOMParser().parseFromString(n,"image/svg+xml").documentElement,o=["svg",{...Array.from(l.attributes).reduce((r,c)=>(r[c.name]=c.value,r),{})}];return Array.from(l.childNodes).forEach(r=>{if(r.nodeType===1){const c=[r.tagName.toLowerCase(),Array.from(r.attributes).reduce((v,x)=>(v[x.name]=x.value,v),{})];r.textContent&&c.push(r.textContent),o.push(c)}}),o}const B={audio:e.jsx(p.LucideAudioLines,{}),video:e.jsx(p.LucideVideo,{}),file:e.jsx(p.LucideFile,{}),image:e.jsx(p.LucideImage,{}),pdf:e.jsx(a.ExportPdf,{}),word:e.jsx(a.ExportWord,{}),excel:e.jsx(p.LucideSheet,{}),ppt:e.jsx(p.LucideTableProperties,{})};function A(t,n=!1){const s=a.normalizeFileType(t),d=B[s]||e.jsx(e.Fragment,{});return n?D(s):d}const _="_wrap_1x1ms_2",j={wrap:_};function q({editor:t,node:n,updateAttributes:s,deleteNode:d,extension:l}){var M;const o=g.useRef(null),r=a.useEditableEditor(),{hasTrigger:c,fileName:v,fileSize:x,fileExt:L,fileType:C,url:u,error:k}=n.attrs,[H,f]=g.useState(!1),{t:y}=V.useLocale(),N=(M=l==null?void 0:l.options)==null?void 0:M.upload,m=g.useCallback(()=>{!r||u||r&&o.current.click()},[r,u]),z=g.useCallback(async T=>{const h=T.target.files&&T.target.files[0];if(!h)return;const F={fileName:a.extractFilename(h.name),fileSize:h.size,fileType:h.type,fileExt:a.extractFileExtension(h.name)};f(!0);try{const w=await N(h);s({...F,url:w}),f(!1)}catch(w){s({error:`File upload fail: ${w&&w.message}`||"Unknown error"}),f(!1),o.current.value=""}},[f,s]);g.useEffect(()=>{!u&&!c&&(m(),s({hasTrigger:!0}))},[u,c,m,s]);const E=g.useCallback(()=>d(),[t]);return r&&!u?e.jsx(i.NodeViewWrapper,{children:e.jsxs("div",{className:i.clsx(j.wrap,"render-wrapper"),children:[e.jsx("p",{onClick:m,style:{cursor:"pointer"},children:H?e.jsx("span",{children:y("editor.attachment.uploading")}):e.jsx("span",{children:y("editor.attachment.please_upload")})}),e.jsx("input",{hidden:!0,onChange:z,ref:o,type:"file"})]})}):u?e.jsx(i.NodeViewWrapper,{children:e.jsxs("div",{className:i.clsx(j.wrap,"render-wrapper"),onClick:m,children:[e.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px]",children:[e.jsx("span",{children:A(C)}),e.jsxs("span",{children:[v,".",L]}),e.jsxs("span",{children:["(",a.normalizeFileSize(x),")"]})]}),e.jsx(a.ActionButton,{action:E,icon:"Trash2",tooltip:y("editor.delete")})]})}):k!=="null"?e.jsx(i.NodeViewWrapper,{children:e.jsx("div",{className:i.clsx(j.wrap,"render-wrapper"),onClick:m,children:e.jsx("p",{children:k})})}):e.jsx(e.Fragment,{})}const R=b.Node.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:s})=>({component:a.ActionButton,componentProps:{action:()=>n.chain().focus().setAttachment().run(),isActive:()=>!1,disabled:!1,icon:"Attachment",tooltip:s("editor.attachment.tooltip")}})}},parseHTML(){return[{tag:"div[class=attachment]"}]},renderHTML({HTMLAttributes:t}){const{url:n="",fileName:s="",fileSize:d="",fileType:l="",fileExt:o=""}=t||{};return["div",b.mergeAttributes(this.options.HTMLAttributes||{},t||{}),n?["a",{href:n||"#"},["span",{class:"attachment__icon"},A(l,!0)],["span",{class:"attachment__text"},`${s}.${o} (${a.normalizeFileSize(d)})`]]:["div",{class:"attachment__placeholder"}]]},addAttributes(){return{fileName:{default:null,parseHTML:i.getDatasetAttribute("filename")},fileSize:{default:null,parseHTML:i.getDatasetAttribute("filesize")},fileType:{default:null,parseHTML:i.getDatasetAttribute("filetype")},fileExt:{default:null,parseHTML:i.getDatasetAttribute("fileext")},url:{default:null,parseHTML:i.getDatasetAttribute("url")},hasTrigger:{default:!1,parseHTML:t=>i.getDatasetAttribute("hastrigger")(t)==="true"},error:{default:null,parseHTML:i.getDatasetAttribute("error")}}},addCommands(){return{setAttachment:(t={})=>({chain:n})=>n().insertContent({type:this.name,attrs:t}).run()}},addNodeView(){return i.ReactNodeViewRenderer(q)}});exports.Attachment=R;
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { Extension } from '@tiptap/core';
|
|
3
|
+
import { Node as Node_2 } from '@tiptap/core';
|
|
4
|
+
|
|
5
|
+
export declare const Attachment: Node_2<AttachmentOptions, any>;
|
|
6
|
+
|
|
7
|
+
export declare interface AttachmentOptions extends GeneralOptions<AttachmentOptions> {
|
|
8
|
+
/** Function for uploading files */
|
|
9
|
+
upload?: (file: File) => Promise<string>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Represents the ButtonView function.
|
|
14
|
+
*/
|
|
15
|
+
declare type ButtonView<T = any> = (options: ButtonViewParams<T>) => ButtonViewReturn | ButtonViewReturn[];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Represents the parameters for the ButtonView function.
|
|
19
|
+
*/
|
|
20
|
+
declare interface ButtonViewParams<T = any> {
|
|
21
|
+
/** Editor object */
|
|
22
|
+
editor: Editor;
|
|
23
|
+
/** Extension object */
|
|
24
|
+
extension: Extension<T>;
|
|
25
|
+
/** Translation function */
|
|
26
|
+
t: (path: string) => string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Represents the return value for the ButtonView component.
|
|
31
|
+
*/
|
|
32
|
+
declare interface ButtonViewReturn {
|
|
33
|
+
/** Component */
|
|
34
|
+
component: unknown;
|
|
35
|
+
/** Component props */
|
|
36
|
+
componentProps: ButtonViewReturnComponentProps;
|
|
37
|
+
/** Component slots */
|
|
38
|
+
componentSlots?: ButtonViewReturnComponentSlots;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Represents the props for the ButtonView component.
|
|
43
|
+
*/
|
|
44
|
+
declare interface ButtonViewReturnComponentProps {
|
|
45
|
+
/** Method triggered when action is performed */
|
|
46
|
+
action?: (value?: any) => void;
|
|
47
|
+
/** Whether it is in the active state */
|
|
48
|
+
isActive?: () => boolean;
|
|
49
|
+
/** Button icon */
|
|
50
|
+
icon?: any;
|
|
51
|
+
/** Text displayed on hover */
|
|
52
|
+
tooltip?: string;
|
|
53
|
+
[x: string]: any;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Represents the slots for the ButtonView component.
|
|
58
|
+
*/
|
|
59
|
+
declare interface ButtonViewReturnComponentSlots {
|
|
60
|
+
/** Dialog slot */
|
|
61
|
+
dialog: () => any;
|
|
62
|
+
[x: string]: () => any;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Represents the general options for Tiptap extensions.
|
|
67
|
+
*/
|
|
68
|
+
declare interface GeneralOptions<T> {
|
|
69
|
+
/** Enabled divider */
|
|
70
|
+
divider: boolean;
|
|
71
|
+
/** Enabled spacer */
|
|
72
|
+
spacer: boolean;
|
|
73
|
+
/** Button view function */
|
|
74
|
+
button: ButtonView<T>;
|
|
75
|
+
/** Show on Toolbar */
|
|
76
|
+
toolbar?: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { }
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
declare module '@tiptap/core' {
|
|
83
|
+
interface Commands<ReturnType> {
|
|
84
|
+
attachment: {
|
|
85
|
+
setAttachment: (attrs?: unknown) => ReturnType;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
declare module '@tiptap/core' {
|
|
92
|
+
interface Commands<ReturnType> {
|
|
93
|
+
setCodeBlock: {
|
|
94
|
+
setCodeBlock: (options?: any) => ReturnType;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
declare module '@tiptap/core' {
|
|
101
|
+
interface Commands<ReturnType> {
|
|
102
|
+
drawer: {
|
|
103
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
104
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
declare module '@tiptap/core' {
|
|
111
|
+
interface Commands<ReturnType> {
|
|
112
|
+
emoji: {
|
|
113
|
+
setEmoji: (emoji: {
|
|
114
|
+
name: string;
|
|
115
|
+
emoji: string;
|
|
116
|
+
}) => ReturnType;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
declare module '@tiptap/core' {
|
|
123
|
+
interface Commands<ReturnType> {
|
|
124
|
+
excalidraw: {
|
|
125
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
declare module '@tiptap/core' {
|
|
132
|
+
interface Commands<ReturnType> {
|
|
133
|
+
exportWord: {
|
|
134
|
+
exportToWord: () => ReturnType;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
declare module '@tiptap/core' {
|
|
141
|
+
interface Commands<ReturnType> {
|
|
142
|
+
fontSize: {
|
|
143
|
+
/**
|
|
144
|
+
* Set the text font size. ex: "12px", "2em", or "small". Must be a valid
|
|
145
|
+
* CSS font-size
|
|
146
|
+
* (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size).
|
|
147
|
+
*/
|
|
148
|
+
setFontSize: (fontSize: string) => ReturnType;
|
|
149
|
+
/**
|
|
150
|
+
* Unset the font size
|
|
151
|
+
*/
|
|
152
|
+
unsetFontSize: () => ReturnType;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
declare module '@tiptap/core' {
|
|
159
|
+
interface Commands<ReturnType> {
|
|
160
|
+
painter: {
|
|
161
|
+
setPainter: (marks: Mark[]) => ReturnType;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
declare module '@tiptap/core' {
|
|
168
|
+
interface Commands<ReturnType> {
|
|
169
|
+
iframe: {
|
|
170
|
+
/**
|
|
171
|
+
* Add an iframe
|
|
172
|
+
*/
|
|
173
|
+
setIframe: (options: {
|
|
174
|
+
src: string;
|
|
175
|
+
service: string;
|
|
176
|
+
}) => ReturnType;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
declare module '@tiptap/core' {
|
|
183
|
+
interface Commands<ReturnType> {
|
|
184
|
+
imageUpload: {
|
|
185
|
+
/**
|
|
186
|
+
* Add an image
|
|
187
|
+
*/
|
|
188
|
+
setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
189
|
+
/**
|
|
190
|
+
* Update an image
|
|
191
|
+
*/
|
|
192
|
+
updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
193
|
+
/**
|
|
194
|
+
* Set image alignment
|
|
195
|
+
*/
|
|
196
|
+
setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
declare module '@tiptap/core' {
|
|
203
|
+
interface Commands<ReturnType> {
|
|
204
|
+
imageGifUpload: {
|
|
205
|
+
/**
|
|
206
|
+
* Add an image gif
|
|
207
|
+
*/
|
|
208
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
209
|
+
/**
|
|
210
|
+
* Update an image gif
|
|
211
|
+
*/
|
|
212
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
213
|
+
/**
|
|
214
|
+
* Set image alignment
|
|
215
|
+
*/
|
|
216
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
declare module '@tiptap/core' {
|
|
223
|
+
interface Commands<ReturnType> {
|
|
224
|
+
indent: {
|
|
225
|
+
/**
|
|
226
|
+
* Set the indent attribute
|
|
227
|
+
*/
|
|
228
|
+
indent: () => ReturnType;
|
|
229
|
+
/**
|
|
230
|
+
* Set the outdent attribute
|
|
231
|
+
*/
|
|
232
|
+
outdent: () => ReturnType;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
declare module '@tiptap/core' {
|
|
239
|
+
interface Commands<ReturnType> {
|
|
240
|
+
katex: {
|
|
241
|
+
setKatex: (arg?: IKatexAttrs) => ReturnType;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
declare module '@tiptap/core' {
|
|
248
|
+
interface Commands<ReturnType> {
|
|
249
|
+
lineHeight: {
|
|
250
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
251
|
+
unsetLineHeight: () => ReturnType;
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
declare module '@tiptap/core' {
|
|
258
|
+
interface Commands<ReturnType> {
|
|
259
|
+
mermaid: {
|
|
260
|
+
setMermaid: (options: any, replace?: any) => ReturnType;
|
|
261
|
+
setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
declare module '@tiptap/core' {
|
|
268
|
+
interface Commands<ReturnType> {
|
|
269
|
+
columns: {
|
|
270
|
+
insertColumns: (attrs?: {
|
|
271
|
+
cols: number;
|
|
272
|
+
}) => ReturnType;
|
|
273
|
+
addColBefore: () => ReturnType;
|
|
274
|
+
addColAfter: () => ReturnType;
|
|
275
|
+
deleteCol: () => ReturnType;
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
declare module '@tiptap/core' {
|
|
282
|
+
interface Commands<ReturnType> {
|
|
283
|
+
search: {
|
|
284
|
+
setSearchTerm: (searchTerm: string) => ReturnType;
|
|
285
|
+
setReplaceTerm: (replaceTerm: string) => ReturnType;
|
|
286
|
+
replace: () => ReturnType;
|
|
287
|
+
replaceAll: () => ReturnType;
|
|
288
|
+
goToPrevSearchResult: () => void;
|
|
289
|
+
goToNextSearchResult: () => void;
|
|
290
|
+
setCaseSensitive: (caseSensitive: boolean) => ReturnType;
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
declare module '@tiptap/core' {
|
|
297
|
+
interface Commands<ReturnType> {
|
|
298
|
+
tableOfContents: {
|
|
299
|
+
setTableOfContents: () => ReturnType;
|
|
300
|
+
removeTableOfContents: () => ReturnType;
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
declare module '@tiptap/core' {
|
|
307
|
+
interface Commands<ReturnType> {
|
|
308
|
+
twitter: {
|
|
309
|
+
/**
|
|
310
|
+
* Insert a tweet
|
|
311
|
+
* @param options The tweet attributes
|
|
312
|
+
* @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
|
|
313
|
+
*/
|
|
314
|
+
setTweet: (options: SetTweetOptions) => ReturnType;
|
|
315
|
+
updateTweet: (options: SetTweetOptions) => ReturnType;
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
declare module '@tiptap/core' {
|
|
322
|
+
interface Commands<ReturnType> {
|
|
323
|
+
video: {
|
|
324
|
+
/**
|
|
325
|
+
* Add an video
|
|
326
|
+
*/
|
|
327
|
+
setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
|
|
328
|
+
/**
|
|
329
|
+
* Update an video
|
|
330
|
+
*/
|
|
331
|
+
updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
declare module '@tiptap/core' {
|
|
338
|
+
interface Commands<ReturnType> {
|
|
339
|
+
tableCellBackground: {
|
|
340
|
+
setTableCellBackground: (color: string) => ReturnType;
|
|
341
|
+
unsetTableCellBackground: () => ReturnType;
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
}
|