reactjs-tiptap-editor 0.3.27 → 0.3.29
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-fkh63F_R.cjs → ActionMenuButton-5Y8QcYxD.cjs} +1 -1
- package/lib/{ActionMenuButton-D3nLtawn.js → ActionMenuButton-Cs9DM_16.js} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.d.cts +6 -4
- package/lib/Attachment.d.ts +6 -4
- package/lib/Attachment.js +1 -1
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.d.cts +6 -4
- package/lib/Blockquote.d.ts +6 -4
- package/lib/Blockquote.js +10 -10
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +6 -4
- package/lib/Bold.d.ts +6 -4
- package/lib/Bold.js +10 -10
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +6 -4
- package/lib/BulletList.d.ts +6 -4
- package/lib/BulletList.js +10 -10
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +6 -4
- package/lib/Clear.d.ts +6 -4
- package/lib/Clear.js +1 -1
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +6 -4
- package/lib/Code.d.ts +6 -4
- package/lib/Code.js +21 -21
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.d.cts +6 -4
- package/lib/CodeBlock.d.ts +6 -4
- package/lib/CodeBlock.js +1 -1
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +6 -4
- package/lib/CodeView.d.ts +6 -4
- package/lib/CodeView.js +1 -1
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +6 -4
- package/lib/Color.d.ts +6 -4
- package/lib/Color.js +1 -1
- package/lib/Document.d.cts +4 -4
- package/lib/Document.d.ts +4 -4
- package/lib/{Drawer-BBVUujX4.js → Drawer-BCmNLh31.js} +1 -1
- package/lib/{Drawer-DetzmUvQ.cjs → Drawer-DCAp7eZF.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +6 -4
- package/lib/Drawer.d.ts +6 -4
- package/lib/Drawer.js +2 -2
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +4 -4
- package/lib/Emoji.d.ts +4 -4
- package/lib/Emoji.js +1 -1
- package/lib/{Excalidraw-DVnwdz-w.cjs → Excalidraw-BI50RQL-.cjs} +1 -1
- package/lib/{Excalidraw-BVdio4hk.js → Excalidraw-CYPcjYZB.js} +1 -1
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +4 -4
- package/lib/Excalidraw.d.ts +4 -4
- package/lib/Excalidraw.js +1 -1
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.d.cts +6 -4
- package/lib/ExportPdf.d.ts +6 -4
- package/lib/ExportPdf.js +1 -1
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +6 -4
- package/lib/ExportWord.d.ts +6 -4
- package/lib/ExportWord.js +1 -1
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +6 -4
- package/lib/FontFamily.d.ts +6 -4
- package/lib/FontFamily.js +2 -2
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +6 -4
- package/lib/FontSize.d.ts +6 -4
- package/lib/FontSize.js +2 -2
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.d.cts +6 -4
- package/lib/FormatPainter.d.ts +6 -4
- package/lib/FormatPainter.js +1 -1
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +6 -4
- package/lib/Heading.d.ts +6 -4
- package/lib/Heading.js +71 -68
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +10 -4
- package/lib/Highlight.d.ts +10 -4
- package/lib/Highlight.js +14 -13
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +6 -4
- package/lib/History.d.ts +6 -4
- package/lib/History.js +163 -160
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +6 -4
- package/lib/HorizontalRule.d.ts +6 -4
- package/lib/HorizontalRule.js +14 -14
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +4 -4
- package/lib/Iframe.d.ts +4 -4
- package/lib/Iframe.js +1 -1
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +6 -4
- package/lib/Image.d.ts +6 -4
- package/lib/Image.js +1 -1
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +7 -6
- package/lib/ImageGif.d.ts +7 -6
- package/lib/ImageGif.js +1 -1
- package/lib/ImportWord.cjs +2 -2
- package/lib/ImportWord.d.cts +6 -4
- package/lib/ImportWord.d.ts +6 -4
- package/lib/ImportWord.js +2 -2
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +6 -4
- package/lib/Indent.d.ts +6 -4
- package/lib/Indent.js +12 -11
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +6 -4
- package/lib/Italic.d.ts +6 -4
- package/lib/Italic.js +13 -13
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +4 -4
- package/lib/Katex.d.ts +4 -4
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +6 -4
- package/lib/LineHeight.d.ts +6 -4
- package/lib/LineHeight.js +1 -1
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +6 -4
- package/lib/Link.d.ts +6 -4
- package/lib/Link.js +1 -1
- package/lib/ListItem.d.cts +4 -4
- package/lib/ListItem.d.ts +4 -4
- package/lib/Mention.d.cts +4 -4
- package/lib/Mention.d.ts +4 -4
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.d.cts +6 -4
- package/lib/Mermaid.d.ts +6 -4
- package/lib/Mermaid.js +2 -2
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +6 -4
- package/lib/MoreMark.d.ts +6 -4
- package/lib/MoreMark.js +46 -45
- package/lib/MultiColumn.cjs +1 -1
- package/lib/MultiColumn.d.cts +4 -4
- package/lib/MultiColumn.d.ts +4 -4
- package/lib/MultiColumn.js +1 -1
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +6 -4
- package/lib/OrderedList.d.ts +6 -4
- package/lib/OrderedList.js +9 -9
- package/lib/{RichTextEditor-DoMu_nCj.cjs → RichTextEditor-DsUcQSbm.cjs} +7 -7
- package/lib/{RichTextEditor-BJWhWz4z.js → RichTextEditor-e6q30rbV.js} +1691 -1672
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +6 -4
- package/lib/SearchAndReplace.d.ts +6 -4
- package/lib/SearchAndReplace.js +1 -1
- package/lib/Selection.d.cts +4 -4
- package/lib/Selection.d.ts +4 -4
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +4 -4
- package/lib/SlashCommand.d.ts +4 -4
- package/lib/SlashCommand.js +1 -1
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +6 -4
- package/lib/Strike.d.ts +6 -4
- package/lib/Strike.js +13 -13
- package/lib/SubAndSuperScript.cjs +1 -1
- package/lib/SubAndSuperScript.d.cts +6 -4
- package/lib/SubAndSuperScript.d.ts +6 -4
- package/lib/SubAndSuperScript.js +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.d.cts +6 -4
- package/lib/Table.d.ts +6 -4
- package/lib/Table.js +1 -1
- package/lib/TableOfContent.cjs +1 -1
- package/lib/TableOfContent.d.cts +4 -4
- package/lib/TableOfContent.d.ts +4 -4
- package/lib/TableOfContent.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +6 -4
- package/lib/TaskList.d.ts +6 -4
- package/lib/TaskList.js +15 -15
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +6 -4
- package/lib/TextAlign.d.ts +6 -4
- package/lib/TextAlign.js +41 -41
- package/lib/TextBubble.cjs +1 -1
- package/lib/TextBubble.d.cts +6 -4
- package/lib/TextBubble.d.ts +6 -4
- package/lib/TextBubble.js +1 -1
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +4 -4
- package/lib/TextDirection.d.ts +4 -4
- package/lib/TextDirection.js +1 -1
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +6 -4
- package/lib/TextUnderline.d.ts +6 -4
- package/lib/TextUnderline.js +8 -8
- package/lib/TrailingNode.d.cts +4 -4
- package/lib/TrailingNode.d.ts +4 -4
- package/lib/{Twitter--OkCPska.cjs → Twitter-D2Osj8qP.cjs} +1 -1
- package/lib/{Twitter-CXwmqolk.js → Twitter-Wb7cD3M-.js} +1 -1
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +4 -4
- package/lib/Twitter.d.ts +4 -4
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +6 -4
- package/lib/Video.d.ts +6 -4
- package/lib/Video.js +1 -1
- package/lib/bubble-extra.cjs +1 -1
- package/lib/bubble-extra.d.cts +4 -4
- package/lib/bubble-extra.d.ts +4 -4
- package/lib/bubble-extra.js +5 -5
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +23 -17
- package/lib/index.d.ts +23 -17
- package/lib/index.js +2 -2
- package/lib/locale-bundle.d.cts +4 -4
- package/lib/locale-bundle.d.ts +4 -4
- package/lib/{textarea-DkVc2MIQ.cjs → textarea-BVbzd9-k.cjs} +1 -1
- package/lib/{textarea-HW9QlrCS.js → textarea-Csmx5x-_.js} +1 -1
- package/package.json +1 -1
package/lib/Italic.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ declare interface GeneralOptions<T> {
|
|
|
68
68
|
button: ButtonView<T>;
|
|
69
69
|
/** Show on Toolbar */
|
|
70
70
|
toolbar?: boolean;
|
|
71
|
+
/** Shortcut keys override */
|
|
72
|
+
shortcutKeys?: string[] | string[][];
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
export declare const Italic: Mark<ItalicOptions, any>;
|
|
@@ -132,8 +134,8 @@ declare module '@tiptap/core' {
|
|
|
132
134
|
|
|
133
135
|
declare module '@tiptap/core' {
|
|
134
136
|
interface Commands<ReturnType> {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
exportPdf: {
|
|
138
|
+
exportToPdf: () => ReturnType;
|
|
137
139
|
};
|
|
138
140
|
}
|
|
139
141
|
}
|
|
@@ -141,8 +143,8 @@ declare module '@tiptap/core' {
|
|
|
141
143
|
|
|
142
144
|
declare module '@tiptap/core' {
|
|
143
145
|
interface Commands<ReturnType> {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
excalidraw: {
|
|
147
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
146
148
|
};
|
|
147
149
|
}
|
|
148
150
|
}
|
package/lib/Italic.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { M as
|
|
2
|
-
import { A as
|
|
3
|
-
const
|
|
1
|
+
import { M as i, c as s, d as n, m as o } from "./index-DI9T3iLd.js";
|
|
2
|
+
import { A as l } from "./RichTextEditor-e6q30rbV.js";
|
|
3
|
+
const c = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, d = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, u = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, m = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, p = i.create({
|
|
4
4
|
name: "italic",
|
|
5
5
|
addOptions() {
|
|
6
6
|
return {
|
|
@@ -26,7 +26,7 @@ const l = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, c = /(?:^|\s)(\*(?!\s+
|
|
|
26
26
|
];
|
|
27
27
|
},
|
|
28
28
|
renderHTML({ HTMLAttributes: t }) {
|
|
29
|
-
return ["em",
|
|
29
|
+
return ["em", o(this.options.HTMLAttributes, t), 0];
|
|
30
30
|
},
|
|
31
31
|
addCommands() {
|
|
32
32
|
return {
|
|
@@ -44,11 +44,11 @@ const l = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, c = /(?:^|\s)(\*(?!\s+
|
|
|
44
44
|
addInputRules() {
|
|
45
45
|
return [
|
|
46
46
|
n({
|
|
47
|
-
find:
|
|
47
|
+
find: c,
|
|
48
48
|
type: this.type
|
|
49
49
|
}),
|
|
50
50
|
n({
|
|
51
|
-
find:
|
|
51
|
+
find: u,
|
|
52
52
|
type: this.type
|
|
53
53
|
})
|
|
54
54
|
];
|
|
@@ -56,28 +56,28 @@ const l = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, c = /(?:^|\s)(\*(?!\s+
|
|
|
56
56
|
addPasteRules() {
|
|
57
57
|
return [
|
|
58
58
|
s({
|
|
59
|
-
find:
|
|
59
|
+
find: d,
|
|
60
60
|
type: this.type
|
|
61
61
|
}),
|
|
62
62
|
s({
|
|
63
|
-
find:
|
|
63
|
+
find: m,
|
|
64
64
|
type: this.type
|
|
65
65
|
})
|
|
66
66
|
];
|
|
67
67
|
}
|
|
68
|
-
}),
|
|
68
|
+
}), h = /* @__PURE__ */ p.extend({
|
|
69
69
|
addOptions() {
|
|
70
70
|
var t;
|
|
71
71
|
return {
|
|
72
72
|
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
73
|
-
button({ editor: e, t: r }) {
|
|
73
|
+
button({ editor: e, t: r, extension: a }) {
|
|
74
74
|
return {
|
|
75
|
-
component:
|
|
75
|
+
component: l,
|
|
76
76
|
componentProps: {
|
|
77
77
|
action: () => e.commands.toggleItalic(),
|
|
78
78
|
isActive: () => e.isActive("italic") || !1,
|
|
79
79
|
disabled: !1,
|
|
80
|
-
shortcutKeys: ["mod", "I"],
|
|
80
|
+
shortcutKeys: a.options.shortcutKeys ?? ["mod", "I"],
|
|
81
81
|
icon: "Italic",
|
|
82
82
|
tooltip: r("editor.italic.tooltip")
|
|
83
83
|
}
|
|
@@ -87,5 +87,5 @@ const l = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, c = /(?:^|\s)(\*(?!\s+
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
export {
|
|
90
|
-
|
|
90
|
+
h as Italic
|
|
91
91
|
};
|
package/lib/Katex.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-ByRfqzMr.cjs"),f=require("./dom-dataset-Byuf1YmW.cjs"),n=require("react/jsx-runtime"),c=require("react"),b=require("katex"),j=require("lucide-react"),u=require("./RichTextEditor-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-ByRfqzMr.cjs"),f=require("./dom-dataset-Byuf1YmW.cjs"),n=require("react/jsx-runtime"),c=require("react"),b=require("katex"),j=require("lucide-react"),u=require("./RichTextEditor-DsUcQSbm.cjs"),w=require("./textarea-BVbzd9-k.cjs"),k=require("./index-D_A0TBRA.cjs");function $({editor:e,...t}){const{t:s}=k.useLocale(),o=u.useAttributes(e,x.name,{text:"",defaultShowPicker:!1}),{text:i,defaultShowPicker:r}=o,[a,d]=c.useState(""),p=c.useCallback(()=>{e.chain().focus().setKatex({text:a}).run(),d("")},[e,a]);c.useEffect(()=>{r&&e.chain().updateAttributes(x.name,{defaultShowPicker:!1}).focus().run()},[e,r]);const h=c.useMemo(()=>{try{return b.renderToString(`${a}`)}catch{return a}},[a]),m=c.useMemo(()=>`${a}`.trim()?n.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:h||""}}):null,[a,h]);return n.jsxs(u.Popover,{modal:!0,children:[n.jsx(u.PopoverTrigger,{asChild:!0,children:n.jsx(u.ActionButton,{icon:t==null?void 0:t.icon,tooltip:t==null?void 0:t.tooltip})}),n.jsxs(u.PopoverContent,{align:"start",className:"richtext-size-full richtext-p-2",hideWhenDetached:!0,side:"bottom",children:[n.jsx(u.Label,{className:"richtext-mb-[6px]",children:s("editor.formula.dialog.text")}),n.jsx("div",{className:"richtext-mb-[16px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:n.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm",children:n.jsx(w.Textarea,{autoFocus:!0,className:"richtext-w-full",defaultValue:i,onChange:g=>d(g.target.value),placeholder:"Text",required:!0,rows:3,value:a})})}),m&&n.jsx("div",{className:"richtext-my-[10px] richtext-max-w-[286px] richtext-overflow-auto richtext-whitespace-nowrap richtext-rounded-[6px] !richtext-border richtext-p-[10px]",children:m}),n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-justify-between richtext-gap-[6px]",children:[n.jsx(u.Button,{className:"richtext-flex-1",onClick:p,children:"Submit"}),n.jsx("a",{href:"https://katex.org/docs/supported",rel:"noreferrer noopener",target:"_blank",children:n.jsx(j.HelpCircle,{size:16})})]})]})]})}function T(e,t=1){let s=0,o=0,i=0;if(e.startsWith("rgb")){const r=e.replace(/\s/g,"").match(/rgb\((.*)\)$/)[1].split(",");s=+r[0],o=+r[1],i=+r[2]}else if(e.startsWith("#")){let r=e.replace("#","");r.length===3&&(r=`${r[0]}${r[0]}${r[1]}${r[1]}${r[2]}${r[2]}`),s=Number.parseInt(r.substring(0,2),16),o=Number.parseInt(r.substring(2,4),16),i=Number.parseInt(r.substring(4,6),16)}else return e;return t>1&&t<=100&&(t=t/100),`rgba(${s},${o},${i},${t})`}function v({node:e}){const t=u.useTheme(),{text:s}=e.attrs,o=c.useMemo(()=>{const a="rgb(254, 242, 237)";return t==="dark"?T(a,.75):a},[t]),i=c.useMemo(()=>{try{return b.renderToString(`${s}`)}catch{return s}},[s]),r=c.useMemo(()=>s.trim()?n.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:i}}):n.jsx("span",{contentEditable:!1,children:"Not enter a formula"}),[s,i]);return n.jsx(f.NodeViewWrapper,{style:{display:"inline-block",backgroundColor:o},as:"span",children:r})}function N(e){return t=>t.getAttribute(e)}const x=l.Node.create({name:"katex",group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){return{HTMLAttributes:{class:"katex"},button:({editor:e,t})=>({component:$,componentProps:{editor:e,action:()=>!0,isActive:()=>!1,disabled:!1,icon:"KatexIcon",tooltip:t("editor.katex.tooltip")}})}},addAttributes(){return{text:{default:"",parseHTML:N("text")},defaultShowPicker:{default:!1}}},parseHTML(){return[{tag:"span.katex"}]},renderHTML({HTMLAttributes:e}){return["span",l.mergeAttributes(this.options&&this.options.HTMLAttributes||{},e)]},addCommands(){return{setKatex:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[l.nodeInputRule({find:/^\$katex\$$/,type:this.type,getAttributes:()=>({defaultShowPicker:!0})})]},addNodeView(){return f.ReactNodeViewRenderer(v)}});exports.Katex=x;
|
package/lib/Katex.d.cts
CHANGED
|
@@ -68,8 +68,8 @@ declare module '@tiptap/core' {
|
|
|
68
68
|
|
|
69
69
|
declare module '@tiptap/core' {
|
|
70
70
|
interface Commands<ReturnType> {
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
exportPdf: {
|
|
72
|
+
exportToPdf: () => ReturnType;
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -77,8 +77,8 @@ declare module '@tiptap/core' {
|
|
|
77
77
|
|
|
78
78
|
declare module '@tiptap/core' {
|
|
79
79
|
interface Commands<ReturnType> {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
excalidraw: {
|
|
81
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
}
|
package/lib/Katex.d.ts
CHANGED
|
@@ -68,8 +68,8 @@ declare module '@tiptap/core' {
|
|
|
68
68
|
|
|
69
69
|
declare module '@tiptap/core' {
|
|
70
70
|
interface Commands<ReturnType> {
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
exportPdf: {
|
|
72
|
+
exportToPdf: () => ReturnType;
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -77,8 +77,8 @@ declare module '@tiptap/core' {
|
|
|
77
77
|
|
|
78
78
|
declare module '@tiptap/core' {
|
|
79
79
|
interface Commands<ReturnType> {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
excalidraw: {
|
|
81
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
}
|
package/lib/Katex.js
CHANGED
|
@@ -4,8 +4,8 @@ import { jsx as n, jsxs as u } from "react/jsx-runtime";
|
|
|
4
4
|
import { useState as T, useCallback as $, useEffect as v, useMemo as c } from "react";
|
|
5
5
|
import x from "katex";
|
|
6
6
|
import { HelpCircle as A } from "lucide-react";
|
|
7
|
-
import { O as S, P as L, m as P, A as C, n as H, L as I, B as M, Q as y } from "./RichTextEditor-
|
|
8
|
-
import { T as K } from "./textarea-
|
|
7
|
+
import { O as S, P as L, m as P, A as C, n as H, L as I, B as M, Q as y } from "./RichTextEditor-e6q30rbV.js";
|
|
8
|
+
import { T as K } from "./textarea-Csmx5x-_.js";
|
|
9
9
|
import { u as R } from "./index-CsK90iVd.js";
|
|
10
10
|
function V({ editor: t, ...e }) {
|
|
11
11
|
const { t: a } = R(), o = S(t, h.name, {
|
package/lib/LineHeight.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-ByRfqzMr.cjs"),g=require("./index-D_A0TBRA.cjs"),c=require("react/jsx-runtime"),L=require("react"),u=require("./RichTextEditor-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-ByRfqzMr.cjs"),g=require("./index-D_A0TBRA.cjs"),c=require("react/jsx-runtime"),L=require("react"),u=require("./RichTextEditor-DsUcQSbm.cjs");function T(e){return Number.parseFloat(e.replace("%",""))/100}function x(e){const{t}=g.useLocale(),[n,r]=L.useState("default");function o(i){i==="default"?e.editor.commands.unsetLineHeight():e.editor.commands.setLineHeight(i),r(i)}const d=L.useMemo(()=>{const s=e.editor.extensionManager.extensions.find(l=>l.name==="lineHeight").options.lineHeights.map(l=>({label:T(l),value:l}));return s.unshift({label:t("editor.default"),value:"default"}),s},[e]);return c.jsxs(u.DropdownMenu,{children:[c.jsx(u.DropdownMenuTrigger,{asChild:!0,disabled:e==null?void 0:e.disabled,children:c.jsx(u.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:e==null?void 0:e.disabled,icon:"LineHeight",tooltip:e==null?void 0:e.tooltip,children:c.jsx(u.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),c.jsx(u.DropdownMenuContent,{className:"richtext-min-w-24",children:d==null?void 0:d.map((i,h)=>c.jsx(u.DropdownMenuCheckboxItem,{checked:i.value===n,onClick:()=>o(i.value),children:i.label},`lineHeight-${h}`))})]})}const _=["paragraph","heading","list_item","todo_item"];function E(e,t){const{selection:n,doc:r}=e;if(!n||!r||!(n instanceof m.TextSelection||n instanceof m.AllSelection))return e;const{from:o,to:d}=n,i=[],h=t&&t!==g.DEFAULT_LINE_HEIGHT?t:null;if(r.nodesBetween(o,d,(s,l)=>{const a=s.type;return _.includes(a.name)?((s.attrs.lineHeight||null)!==h&&i.push({node:s,pos:l,nodeType:a}),a.name!=="list_item"&&a.name!=="todo_item"):!0}),i.length===0)return e;for(const s of i){const{node:l,pos:a,nodeType:f}=s;let{attrs:H}=l;H={...H,lineHeight:h},e=e.setNodeMarkup(a,f,H,l.marks)}return e}function b(e){return({state:t,dispatch:n})=>{const{selection:r}=t;let{tr:o}=t;return o=o.setSelection(r),o=E(o,e),o.docChanged?(n&&n(o),!0):!1}}const I=m.Extension.create({name:"lineHeight",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["paragraph","heading","list_item","todo_item"],lineHeights:g.DEFAULT_LINE_HEIGHT_LIST,defaultHeight:g.DEFAULT_LINE_HEIGHT,button({editor:t,t:n}){return{component:x,componentProps:{editor:t,tooltip:n("editor.lineheight.tooltip")}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight||this.options.defaultHeight,renderHTML:e=>e.lineHeight===this.options.defaultHeight||!e.lineHeight?{}:{style:`line-height: ${e.lineHeight}`}}}}]},addCommands(){return{setLineHeight:e=>b(e),unsetLineHeight:()=>({commands:e})=>this.options.types.every(t=>e.resetAttributes(t,"lineHeight"))}}});exports.DEFAULT_LINE_HEIGHT_LIST=g.DEFAULT_LINE_HEIGHT_LIST;exports.LineHeight=I;
|
package/lib/LineHeight.d.cts
CHANGED
|
@@ -69,6 +69,8 @@ declare interface GeneralOptions<T> {
|
|
|
69
69
|
button: ButtonView<T>;
|
|
70
70
|
/** Show on Toolbar */
|
|
71
71
|
toolbar?: boolean;
|
|
72
|
+
/** Shortcut keys override */
|
|
73
|
+
shortcutKeys?: string[] | string[][];
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
export declare const LineHeight: Extension<LineHeightOptions, any>;
|
|
@@ -136,8 +138,8 @@ declare module '@tiptap/core' {
|
|
|
136
138
|
|
|
137
139
|
declare module '@tiptap/core' {
|
|
138
140
|
interface Commands<ReturnType> {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
exportPdf: {
|
|
142
|
+
exportToPdf: () => ReturnType;
|
|
141
143
|
};
|
|
142
144
|
}
|
|
143
145
|
}
|
|
@@ -145,8 +147,8 @@ declare module '@tiptap/core' {
|
|
|
145
147
|
|
|
146
148
|
declare module '@tiptap/core' {
|
|
147
149
|
interface Commands<ReturnType> {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
excalidraw: {
|
|
151
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
150
152
|
};
|
|
151
153
|
}
|
|
152
154
|
}
|
package/lib/LineHeight.d.ts
CHANGED
|
@@ -69,6 +69,8 @@ declare interface GeneralOptions<T> {
|
|
|
69
69
|
button: ButtonView<T>;
|
|
70
70
|
/** Show on Toolbar */
|
|
71
71
|
toolbar?: boolean;
|
|
72
|
+
/** Shortcut keys override */
|
|
73
|
+
shortcutKeys?: string[] | string[][];
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
export declare const LineHeight: Extension<LineHeightOptions, any>;
|
|
@@ -136,8 +138,8 @@ declare module '@tiptap/core' {
|
|
|
136
138
|
|
|
137
139
|
declare module '@tiptap/core' {
|
|
138
140
|
interface Commands<ReturnType> {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
exportPdf: {
|
|
142
|
+
exportToPdf: () => ReturnType;
|
|
141
143
|
};
|
|
142
144
|
}
|
|
143
145
|
}
|
|
@@ -145,8 +147,8 @@ declare module '@tiptap/core' {
|
|
|
145
147
|
|
|
146
148
|
declare module '@tiptap/core' {
|
|
147
149
|
interface Commands<ReturnType> {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
excalidraw: {
|
|
151
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
150
152
|
};
|
|
151
153
|
}
|
|
152
154
|
}
|
package/lib/LineHeight.js
CHANGED
|
@@ -2,7 +2,7 @@ import { T as f, A as H, E as L } from "./index-DI9T3iLd.js";
|
|
|
2
2
|
import { u as x, k as g, m as T } from "./index-CsK90iVd.js";
|
|
3
3
|
import { jsxs as b, jsx as h } from "react/jsx-runtime";
|
|
4
4
|
import { useState as p, useMemo as _ } from "react";
|
|
5
|
-
import { D, e as E, A as M, k as w, f as A, h as C } from "./RichTextEditor-
|
|
5
|
+
import { D, e as E, A as M, k as w, f as A, h as C } from "./RichTextEditor-e6q30rbV.js";
|
|
6
6
|
function y(e) {
|
|
7
7
|
return Number.parseFloat(e.replace("%", "")) / 100;
|
|
8
8
|
}
|
package/lib/Link.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./index-ByRfqzMr.cjs");const e=require("./RichTextEditor-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./index-ByRfqzMr.cjs");const e=require("./RichTextEditor-DsUcQSbm.cjs");exports.Link=e.Link;exports.default=e.Link;
|
package/lib/Link.d.cts
CHANGED
|
@@ -68,6 +68,8 @@ declare interface GeneralOptions<T> {
|
|
|
68
68
|
button: ButtonView<T>;
|
|
69
69
|
/** Show on Toolbar */
|
|
70
70
|
toolbar?: boolean;
|
|
71
|
+
/** Shortcut keys override */
|
|
72
|
+
shortcutKeys?: string[] | string[][];
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
declare const Link: Mark<LinkOptions, any>;
|
|
@@ -134,8 +136,8 @@ declare module '@tiptap/core' {
|
|
|
134
136
|
|
|
135
137
|
declare module '@tiptap/core' {
|
|
136
138
|
interface Commands<ReturnType> {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
exportPdf: {
|
|
140
|
+
exportToPdf: () => ReturnType;
|
|
139
141
|
};
|
|
140
142
|
}
|
|
141
143
|
}
|
|
@@ -143,8 +145,8 @@ declare module '@tiptap/core' {
|
|
|
143
145
|
|
|
144
146
|
declare module '@tiptap/core' {
|
|
145
147
|
interface Commands<ReturnType> {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
excalidraw: {
|
|
149
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
148
150
|
};
|
|
149
151
|
}
|
|
150
152
|
}
|
package/lib/Link.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ declare interface GeneralOptions<T> {
|
|
|
68
68
|
button: ButtonView<T>;
|
|
69
69
|
/** Show on Toolbar */
|
|
70
70
|
toolbar?: boolean;
|
|
71
|
+
/** Shortcut keys override */
|
|
72
|
+
shortcutKeys?: string[] | string[][];
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
declare const Link: Mark<LinkOptions, any>;
|
|
@@ -134,8 +136,8 @@ declare module '@tiptap/core' {
|
|
|
134
136
|
|
|
135
137
|
declare module '@tiptap/core' {
|
|
136
138
|
interface Commands<ReturnType> {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
exportPdf: {
|
|
140
|
+
exportToPdf: () => ReturnType;
|
|
139
141
|
};
|
|
140
142
|
}
|
|
141
143
|
}
|
|
@@ -143,8 +145,8 @@ declare module '@tiptap/core' {
|
|
|
143
145
|
|
|
144
146
|
declare module '@tiptap/core' {
|
|
145
147
|
interface Commands<ReturnType> {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
excalidraw: {
|
|
149
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
148
150
|
};
|
|
149
151
|
}
|
|
150
152
|
}
|
package/lib/Link.js
CHANGED
package/lib/ListItem.d.cts
CHANGED
|
@@ -58,8 +58,8 @@ declare module '@tiptap/core' {
|
|
|
58
58
|
|
|
59
59
|
declare module '@tiptap/core' {
|
|
60
60
|
interface Commands<ReturnType> {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
exportPdf: {
|
|
62
|
+
exportToPdf: () => ReturnType;
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -67,8 +67,8 @@ declare module '@tiptap/core' {
|
|
|
67
67
|
|
|
68
68
|
declare module '@tiptap/core' {
|
|
69
69
|
interface Commands<ReturnType> {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
excalidraw: {
|
|
71
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
}
|
package/lib/ListItem.d.ts
CHANGED
|
@@ -58,8 +58,8 @@ declare module '@tiptap/core' {
|
|
|
58
58
|
|
|
59
59
|
declare module '@tiptap/core' {
|
|
60
60
|
interface Commands<ReturnType> {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
exportPdf: {
|
|
62
|
+
exportToPdf: () => ReturnType;
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -67,8 +67,8 @@ declare module '@tiptap/core' {
|
|
|
67
67
|
|
|
68
68
|
declare module '@tiptap/core' {
|
|
69
69
|
interface Commands<ReturnType> {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
excalidraw: {
|
|
71
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
}
|
package/lib/Mention.d.cts
CHANGED
|
@@ -61,8 +61,8 @@ declare module '@tiptap/core' {
|
|
|
61
61
|
|
|
62
62
|
declare module '@tiptap/core' {
|
|
63
63
|
interface Commands<ReturnType> {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
exportPdf: {
|
|
65
|
+
exportToPdf: () => ReturnType;
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -70,8 +70,8 @@ declare module '@tiptap/core' {
|
|
|
70
70
|
|
|
71
71
|
declare module '@tiptap/core' {
|
|
72
72
|
interface Commands<ReturnType> {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
excalidraw: {
|
|
74
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
}
|
package/lib/Mention.d.ts
CHANGED
|
@@ -61,8 +61,8 @@ declare module '@tiptap/core' {
|
|
|
61
61
|
|
|
62
62
|
declare module '@tiptap/core' {
|
|
63
63
|
interface Commands<ReturnType> {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
exportPdf: {
|
|
65
|
+
exportToPdf: () => ReturnType;
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -70,8 +70,8 @@ declare module '@tiptap/core' {
|
|
|
70
70
|
|
|
71
71
|
declare module '@tiptap/core' {
|
|
72
72
|
interface Commands<ReturnType> {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
excalidraw: {
|
|
74
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
}
|
package/lib/Mermaid.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var W=Object.create;var G=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var J=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of U(e))!Y.call(t,l)&&l!==r&&G(t,l,{get:()=>e[l],enumerable:!(a=X(e,l))||a.enumerable});return t};var K=(t,e,r)=>(r=t!=null?W(Z(t)):{},J(e||!t||!t.__esModule?G(r,"default",{value:t,enumerable:!0}):r,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./index-ByRfqzMr.cjs"),u=require("./RichTextEditor-
|
|
1
|
+
"use strict";var W=Object.create;var G=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var J=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of U(e))!Y.call(t,l)&&l!==r&&G(t,l,{get:()=>e[l],enumerable:!(a=X(e,l))||a.enumerable});return t};var K=(t,e,r)=>(r=t!=null?W(Z(t)):{},J(e||!t||!t.__esModule?G(r,"default",{value:t,enumerable:!0}):r,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./index-ByRfqzMr.cjs"),u=require("./RichTextEditor-DsUcQSbm.cjs"),F=require("./dom-dataset-Byuf1YmW.cjs"),o=require("react/jsx-runtime"),s=require("react"),P=require("./shortId-Bfj8TyNr.cjs"),Q=require("./textarea-BVbzd9-k.cjs"),S=require("./index-D_A0TBRA.cjs"),$=`graph TB
|
|
2
2
|
a-->b`,ee=({editor:t,upload:e})=>{const[r,a]=s.useState($),[l,v]=s.useState(""),[T,y]=s.useState(!1),A=s.useRef(null),[d,h]=s.useState(null),E=s.useCallback(c=>{c&&import("mermaid").then(x=>{h(x.default)})},[]),_=async c=>{try{const{svg:x}=await d.render("mermaid-svg",c);v(x)}catch{v("")}},L=()=>{d.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),_(r)};s.useEffect(()=>{d&&T&&L()},[d,T]),s.useEffect(()=>{d&&T&&_(r)},[d&&r]);const R=async()=>{if(r!==""){if(r){const c=A.current.querySelector("svg"),{width:x,height:j}=c.getBoundingClientRect(),I=`mermaid-${P.shortId()}.svg`;let M=P.i(c.outerHTML);if(e){console.log({src:M});const H=u.dataURLtoFile(M,I);M=await e(H)}t==null||t.chain().focus().setMermaid({type:"mermaid",src:M,alt:encodeURIComponent(r),width:x,height:j},!!r).run()}y(!1)}};return o.jsxs(u.Dialog,{onOpenChange:y,open:T,children:[o.jsx(u.DialogTrigger,{asChild:!0,children:o.jsx(u.ActionButton,{action:()=>y(!0),icon:"Mermaid",tooltip:"Mermaid"})}),o.jsxs(u.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[o.jsx(u.DialogTitle,{children:"Mermaid"}),o.jsx("div",{ref:E,style:{height:"100%",border:"1px solid hsl(var(--border))"},children:o.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[o.jsx(Q.Textarea,{autoFocus:!0,className:"richtext-flex-1",defaultValue:$,onChange:c=>a(c.target.value),placeholder:"Text",required:!0,rows:10,value:r,style:{color:"hsl(var(--richtext-foreground))"}}),o.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:l},ref:A,style:{height:"100%",borderWidth:1,minHeight:500,background:"#fff"}})]})}),o.jsx(u.DialogFooter,{children:o.jsx(u.Button,{onClick:R,type:"button",children:"Save changes"})})]})]})},O={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function te({editor:t,node:e,updateAttributes:r,getPos:a,selected:l}){const[v,T]=s.useState({width:S.IMAGE_MAX_SIZE,height:S.IMAGE_MAX_SIZE}),[y,A]=s.useState({width:0,height:0}),[d]=s.useState([O.TOP_LEFT,O.TOP_RIGHT,O.BOTTOM_LEFT,O.BOTTOM_RIGHT]),[h,E]=s.useState(!1),[_,L]=s.useState({x:0,y:0,w:0,h:0,dir:""}),{align:R}=e==null?void 0:e.attrs,c=s.useMemo(()=>{const{src:i,alt:m,width:f,height:b}=e==null?void 0:e.attrs,w=q.isNumber(f)?`${f}px`:f,n=q.isNumber(b)?`${b}px`:b;return{src:i||void 0,alt:m||void 0,style:{width:w||void 0,height:n||void 0}}},[e==null?void 0:e.attrs]),x=s.useMemo(()=>{const{style:{width:i}}=c;return{width:i==="100%"?i:void 0}},[c]);function j(i){A({width:i.target.width,height:i.target.height})}function I(){t.commands.setNodeSelection(a())}const M=s.useCallback(u.throttle(()=>{const{width:i}=getComputedStyle(t.view.dom);T(m=>({...m,width:Number.parseInt(i,10)}))},S.IMAGE_THROTTLE_WAIT_TIME),[t]);function H(i,m){i.preventDefault(),i.stopPropagation();const f=y.width,b=y.height,w=f/b;let n=Number(e.attrs.width),p=Number(e.attrs.height);const g=v.width;n&&!p?(n=n>g?g:n,p=Math.round(n/w)):p&&!n?(n=Math.round(p*w),n=n>g?g:n):!n&&!p?(n=f>g?g:f,p=Math.round(n/w)):n=n>g?g:n,E(!0),L({x:i.clientX,y:i.clientY,w:n,h:p,dir:m})}const N=s.useCallback(u.throttle(i=>{if(i.preventDefault(),i.stopPropagation(),!h)return;const{x:m,w:f,dir:b}=_,w=(i.clientX-m)*(/l/.test(b)?-1:1),{width:n,height:p}=e==null?void 0:e.attrs,g=n/p,B=u.clamp(f+w,S.IMAGE_MIN_SIZE,v.width),V=Math.round(B/g);r({width:B,height:V})},S.IMAGE_THROTTLE_WAIT_TIME),[h,_,v,r,e==null?void 0:e.attrs]),C=s.useCallback(i=>{i.preventDefault(),i.stopPropagation(),h&&(L({x:0,y:0,w:0,h:0,dir:""}),E(!1),I())},[h,I]),D=s.useCallback(()=>{document==null||document.addEventListener("mousemove",N,!0),document==null||document.addEventListener("mouseup",C,!0)},[N,C]),z=s.useCallback(()=>{document==null||document.removeEventListener("mousemove",N,!0),document==null||document.removeEventListener("mouseup",C,!0)},[N,C]);s.useEffect(()=>(h?D():z(),()=>{z()}),[h,D,z]);const k=s.useMemo(()=>new ResizeObserver(()=>M()),[M]);return s.useEffect(()=>(k.observe(t.view.dom),()=>{k.disconnect()}),[t.view.dom,k]),o.jsx(F.NodeViewWrapper,{className:"image-view",style:{...x,width:"100%",textAlign:R},children:o.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:{...x,background:"#fff"},className:`image-view__body ${l?"image-view__body--focused":""} ${h?"image-view__body--resizing":""}`,children:[o.jsx("img",{alt:c.alt,className:"image-view__body__image block",height:"auto",onClick:I,onLoad:j,src:c.src,style:c.style}),t.view.editable&&(l||h)&&o.jsx("div",{className:"image-resizer",children:d==null?void 0:d.map(i=>o.jsx("span",{className:`image-resizer__handler image-resizer__handler--${i}`,onMouseDown:m=>H(m,i)},`image-dir-${i}`))})]})})}const re=u.Image.extend({name:"mermaid",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"mermaid"},button:({editor:e,t:r,extension:a})=>{var l;return{component:ee,componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,editor:e,icon:"Mermaid",tooltip:r("editor.mermaid.tooltip"),upload:(l=a==null?void 0:a.options)==null?void 0:l.upload}}}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:e=>{const r=e.querySelector("img"),a=r==null?void 0:r.getAttribute("width");return a?Number.parseInt(a,10):320},renderHTML:e=>({width:e.width})},height:{default:null,parseHTML:e=>{const r=e.querySelector("img"),a=r==null?void 0:r.getAttribute("height");return a?Number.parseInt(a,10):212},renderHTML:e=>({height:e.height})},align:{default:"center",parseHTML:e=>e.getAttribute("align"),renderHTML:e=>({align:e.align})}}},addNodeView(){return F.ReactNodeViewRenderer(te)},addCommands(){return{setMermaid:(t,e)=>({commands:r,editor:a})=>e?r.insertContent({type:this.name,attrs:t}):r.insertContentAt(a.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageMermaid:t=>({commands:e})=>e.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:e}=t;return["div",{style:e?`text-align: ${e};`:"",class:"imageMermaid"},["img",q.mergeAttributes(this.options.HTMLAttributes,t)]]},parseHTML(){return[{tag:"div[class=imageMermaid]",getAttrs:t=>{const e=t.querySelector("img"),r=e==null?void 0:e.getAttribute("width"),a=e==null?void 0:e.getAttribute("height");return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),width:r?Number.parseInt(r,10):null,height:a?Number.parseInt(a,10):null,align:(e==null?void 0:e.getAttribute("align"))||t.style.textAlign||null}}}]}});exports.Mermaid=re;
|
package/lib/Mermaid.d.cts
CHANGED
|
@@ -67,6 +67,8 @@ declare interface GeneralOptions<T> {
|
|
|
67
67
|
button: ButtonView<T>;
|
|
68
68
|
/** Show on Toolbar */
|
|
69
69
|
toolbar?: boolean;
|
|
70
|
+
/** Shortcut keys override */
|
|
71
|
+
shortcutKeys?: string[] | string[][];
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
export declare const Mermaid: Node_2<MermaidOptions, any>;
|
|
@@ -133,8 +135,8 @@ declare module '@tiptap/core' {
|
|
|
133
135
|
|
|
134
136
|
declare module '@tiptap/core' {
|
|
135
137
|
interface Commands<ReturnType> {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
exportPdf: {
|
|
139
|
+
exportToPdf: () => ReturnType;
|
|
138
140
|
};
|
|
139
141
|
}
|
|
140
142
|
}
|
|
@@ -142,8 +144,8 @@ declare module '@tiptap/core' {
|
|
|
142
144
|
|
|
143
145
|
declare module '@tiptap/core' {
|
|
144
146
|
interface Commands<ReturnType> {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
excalidraw: {
|
|
148
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
147
149
|
};
|
|
148
150
|
}
|
|
149
151
|
}
|
package/lib/Mermaid.d.ts
CHANGED
|
@@ -67,6 +67,8 @@ declare interface GeneralOptions<T> {
|
|
|
67
67
|
button: ButtonView<T>;
|
|
68
68
|
/** Show on Toolbar */
|
|
69
69
|
toolbar?: boolean;
|
|
70
|
+
/** Shortcut keys override */
|
|
71
|
+
shortcutKeys?: string[] | string[][];
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
export declare const Mermaid: Node_2<MermaidOptions, any>;
|
|
@@ -133,8 +135,8 @@ declare module '@tiptap/core' {
|
|
|
133
135
|
|
|
134
136
|
declare module '@tiptap/core' {
|
|
135
137
|
interface Commands<ReturnType> {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
exportPdf: {
|
|
139
|
+
exportToPdf: () => ReturnType;
|
|
138
140
|
};
|
|
139
141
|
}
|
|
140
142
|
}
|
|
@@ -142,8 +144,8 @@ declare module '@tiptap/core' {
|
|
|
142
144
|
|
|
143
145
|
declare module '@tiptap/core' {
|
|
144
146
|
interface Commands<ReturnType> {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
excalidraw: {
|
|
148
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
147
149
|
};
|
|
148
150
|
}
|
|
149
151
|
}
|
package/lib/Mermaid.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { h as $, m as X } from "./index-DI9T3iLd.js";
|
|
2
|
-
import { w as Z, x as J, A as K, y as Y, z as Q, F as tt, B as et, G as rt, J as V, K as it, N as at } from "./RichTextEditor-
|
|
2
|
+
import { w as Z, x as J, A as K, y as Y, z as Q, F as tt, B as et, G as rt, J as V, K as it, N as at } from "./RichTextEditor-e6q30rbV.js";
|
|
3
3
|
import { N as st, R as nt } from "./dom-dataset-Di3tIRrR.js";
|
|
4
4
|
import { jsxs as C, jsx as o } from "react/jsx-runtime";
|
|
5
5
|
import { useState as g, useRef as ot, useCallback as y, useEffect as E, useMemo as k } from "react";
|
|
6
6
|
import { s as lt, i as ct } from "./shortId-WJVkrvml.js";
|
|
7
|
-
import { T as dt } from "./textarea-
|
|
7
|
+
import { T as dt } from "./textarea-Csmx5x-_.js";
|
|
8
8
|
import { I as q, i as ht, j as W } from "./index-CsK90iVd.js";
|
|
9
9
|
const j = `graph TB
|
|
10
10
|
a-->b`, ut = ({ editor: r, upload: t }) => {
|
package/lib/MoreMark.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 b=require("./index-ByRfqzMr.cjs"),d=require("./index-Z4b9rzn-.cjs"),c=require("react/jsx-runtime"),m=require("react"),s=require("./RichTextEditor-DsUcQSbm.cjs");function g(t){var n;const i=m.useMemo(()=>{var r;const e=(r=t==null?void 0:t.items)==null?void 0:r.find(u=>u.isActive());return e&&!e.default?{...e,icon:e!=null&&e.icon?e==null?void 0:e.icon:t==null?void 0:t.icon}:{title:t.tooltip,icon:t.icon,isActive:()=>!1}},[t]);return c.jsxs(s.DropdownMenu,{children:[c.jsx(s.DropdownMenuTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:c.jsx(s.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:t==null?void 0:t.disabled,icon:t==null?void 0:t.icon,tooltip:t==null?void 0:t.tooltip,children:c.jsx(s.MenuDown,{className:"richtext-size-3 richtext-text-gray-500"})})}),c.jsx(s.DropdownMenuContent,{className:"w-full",children:(n=t==null?void 0:t.items)==null?void 0:n.map((e,o)=>c.jsxs(s.DropdownMenuCheckboxItem,{checked:i.title===e.title,className:"richtext-flex richtext-items-center richtext-gap-3",onClick:e.action,children:[c.jsx(s.IconComponent,{name:e==null?void 0:e.icon}),c.jsx("span",{className:"richtext-ml-1",children:e.title}),!!(e!=null&&e.shortcutKeys)&&c.jsx("span",{className:"richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60",children:s.getShortcutKeys(e.shortcutKeys)})]},`more-mark-${o}`))})]})}const f=b.Extension.create({name:"moreMark",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:i,extension:n,t:e}){var l,h;const o=n.options.subscript,r=n.options.superscript,u={action:()=>i.commands.toggleSubscript(),isActive:()=>i.isActive("subscript")||!1,disabled:!i.can().toggleSubscript(),icon:"Subscript",title:e("editor.subscript.tooltip"),shortcutKeys:((l=n.options.shortcutKeys)==null?void 0:l[0])??["mod","."]},x={action:()=>i.commands.toggleSuperscript(),isActive:()=>i.isActive("superscript")||!1,disabled:!i.can().toggleSuperscript(),icon:"Superscript",title:e("editor.superscript.tooltip"),shortcutKeys:((h=n.options.shortcutKeys)==null?void 0:h[1])??["mod",","]},a=[];return o!==!1&&a.push(u),r!==!1&&a.push(x),{component:g,componentProps:{icon:"Type",tooltip:e("editor.moremark"),disabled:!i.isEditable,items:a}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(d.Subscript.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(d.Superscript.configure(this.options.superscript)),t}});exports.MoreMark=f;
|
package/lib/MoreMark.d.cts
CHANGED
|
@@ -68,6 +68,8 @@ declare interface GeneralOptions<T> {
|
|
|
68
68
|
button: ButtonView<T>;
|
|
69
69
|
/** Show on Toolbar */
|
|
70
70
|
toolbar?: boolean;
|
|
71
|
+
/** Shortcut keys override */
|
|
72
|
+
shortcutKeys?: string[] | string[][];
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
export declare const MoreMark: Extension<MoreMarkOptions, any>;
|
|
@@ -144,8 +146,8 @@ declare module '@tiptap/core' {
|
|
|
144
146
|
|
|
145
147
|
declare module '@tiptap/core' {
|
|
146
148
|
interface Commands<ReturnType> {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
exportPdf: {
|
|
150
|
+
exportToPdf: () => ReturnType;
|
|
149
151
|
};
|
|
150
152
|
}
|
|
151
153
|
}
|
|
@@ -153,8 +155,8 @@ declare module '@tiptap/core' {
|
|
|
153
155
|
|
|
154
156
|
declare module '@tiptap/core' {
|
|
155
157
|
interface Commands<ReturnType> {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
excalidraw: {
|
|
159
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
158
160
|
};
|
|
159
161
|
}
|
|
160
162
|
}
|
package/lib/MoreMark.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ declare interface GeneralOptions<T> {
|
|
|
68
68
|
button: ButtonView<T>;
|
|
69
69
|
/** Show on Toolbar */
|
|
70
70
|
toolbar?: boolean;
|
|
71
|
+
/** Shortcut keys override */
|
|
72
|
+
shortcutKeys?: string[] | string[][];
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
export declare const MoreMark: Extension<MoreMarkOptions, any>;
|
|
@@ -144,8 +146,8 @@ declare module '@tiptap/core' {
|
|
|
144
146
|
|
|
145
147
|
declare module '@tiptap/core' {
|
|
146
148
|
interface Commands<ReturnType> {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
exportPdf: {
|
|
150
|
+
exportToPdf: () => ReturnType;
|
|
149
151
|
};
|
|
150
152
|
}
|
|
151
153
|
}
|
|
@@ -153,8 +155,8 @@ declare module '@tiptap/core' {
|
|
|
153
155
|
|
|
154
156
|
declare module '@tiptap/core' {
|
|
155
157
|
interface Commands<ReturnType> {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
excalidraw: {
|
|
159
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
158
160
|
};
|
|
159
161
|
}
|
|
160
162
|
}
|