reactjs-tiptap-editor 0.3.18 → 0.3.21
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-Bp3NtBKu.cjs → ActionMenuButton-BTFBZyG2.cjs} +1 -1
- package/lib/{ActionMenuButton-CK00Dg3S.js → ActionMenuButton-DXwnYZhJ.js} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.d.cts +28 -28
- package/lib/Attachment.d.ts +28 -28
- package/lib/Attachment.js +4 -4
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.d.cts +28 -28
- package/lib/Blockquote.d.ts +28 -28
- package/lib/Blockquote.js +2 -2
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +28 -28
- package/lib/Bold.d.ts +28 -28
- package/lib/Bold.js +2 -2
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +28 -28
- package/lib/BulletList.d.ts +28 -28
- package/lib/BulletList.js +2 -2
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +28 -28
- package/lib/Clear.d.ts +28 -28
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +28 -28
- package/lib/Code.d.ts +28 -28
- package/lib/Code.js +2 -2
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.d.cts +28 -28
- package/lib/CodeBlock.d.ts +28 -28
- package/lib/CodeBlock.js +3 -3
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +28 -28
- package/lib/CodeView.d.ts +28 -28
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +28 -28
- package/lib/Color.d.ts +28 -28
- package/lib/Color.js +3 -3
- package/lib/Document.cjs +1 -1
- package/lib/Document.d.cts +28 -28
- package/lib/Document.d.ts +28 -28
- package/lib/Document.js +1 -1
- package/lib/{Drawer-D7O4q7Un.cjs → Drawer-BrHHs2E9.cjs} +1 -1
- package/lib/{Drawer-B5bTsUf8.js → Drawer-CVuwyG50.js} +4 -4
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +28 -28
- package/lib/Drawer.d.ts +28 -28
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +28 -28
- package/lib/Emoji.d.ts +28 -28
- package/lib/Emoji.js +5 -5
- package/lib/Excalidraw-Be_GDV4Q.cjs +1 -0
- package/lib/Excalidraw-frMX4K62.js +289 -0
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +28 -28
- package/lib/Excalidraw.d.ts +28 -28
- package/lib/Excalidraw.js +3 -3
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.d.cts +28 -28
- package/lib/ExportPdf.d.ts +28 -28
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +28 -28
- package/lib/ExportWord.d.ts +28 -28
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +28 -28
- package/lib/FontFamily.d.ts +28 -28
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +28 -28
- package/lib/FontSize.d.ts +28 -28
- package/lib/FontSize.js +4 -4
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.d.cts +28 -28
- package/lib/FormatPainter.d.ts +28 -28
- package/lib/FormatPainter.js +2 -2
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +28 -28
- package/lib/Heading.d.ts +28 -28
- package/lib/Heading.js +3 -3
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +28 -28
- package/lib/Highlight.d.ts +28 -28
- package/lib/Highlight.js +2 -2
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +28 -28
- package/lib/History.d.ts +28 -28
- package/lib/History.js +2 -2
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +28 -28
- package/lib/HorizontalRule.d.ts +28 -28
- package/lib/HorizontalRule.js +2 -2
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +28 -28
- package/lib/Iframe.d.ts +28 -28
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +29 -28
- package/lib/Image.d.ts +29 -28
- package/lib/Image.js +3 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +28 -28
- package/lib/ImageGif.d.ts +28 -28
- package/lib/ImageGif.js +3 -3
- package/lib/ImportWord.cjs +74 -74
- package/lib/ImportWord.d.cts +28 -28
- package/lib/ImportWord.d.ts +28 -28
- package/lib/ImportWord.js +5015 -4998
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +28 -28
- package/lib/Indent.d.ts +28 -28
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +28 -28
- package/lib/Italic.d.ts +28 -28
- package/lib/Italic.js +2 -2
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +28 -28
- package/lib/Katex.d.ts +28 -28
- package/lib/Katex.js +5 -5
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +28 -28
- package/lib/LineHeight.d.ts +28 -28
- package/lib/LineHeight.js +3 -3
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +28 -28
- package/lib/Link.d.ts +28 -28
- package/lib/Link.js +2 -2
- package/lib/ListItem.cjs +1 -1
- package/lib/ListItem.d.cts +28 -28
- package/lib/ListItem.d.ts +28 -28
- package/lib/ListItem.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.d.cts +28 -28
- package/lib/Mention.d.ts +28 -28
- package/lib/Mention.js +123 -91
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.d.cts +28 -28
- package/lib/Mermaid.d.ts +28 -28
- package/lib/Mermaid.js +5 -5
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +28 -28
- package/lib/MoreMark.d.ts +28 -28
- package/lib/MoreMark.js +3 -3
- package/lib/MultiColumn.cjs +1 -1
- package/lib/MultiColumn.d.cts +28 -28
- package/lib/MultiColumn.d.ts +28 -28
- package/lib/MultiColumn.js +2 -2
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +28 -28
- package/lib/OrderedList.d.ts +28 -28
- package/lib/OrderedList.js +2 -2
- package/lib/RichTextEditor-CAxwVWUE.cjs +137 -0
- package/lib/{RichTextEditor-DWN9FEob.js → RichTextEditor-DjTnd5Uu.js} +2336 -2328
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +28 -28
- package/lib/SearchAndReplace.d.ts +28 -28
- package/lib/SearchAndReplace.js +3 -3
- package/lib/Selection.cjs +1 -1
- package/lib/Selection.d.cts +28 -28
- package/lib/Selection.d.ts +28 -28
- package/lib/Selection.js +1 -1
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +28 -28
- package/lib/SlashCommand.d.ts +28 -28
- package/lib/SlashCommand.js +5 -5
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +28 -28
- package/lib/Strike.d.ts +28 -28
- package/lib/Strike.js +2 -2
- package/lib/SubAndSuperScript.cjs +1 -1
- package/lib/SubAndSuperScript.d.cts +28 -28
- package/lib/SubAndSuperScript.d.ts +28 -28
- package/lib/SubAndSuperScript.js +3 -3
- package/lib/Table.cjs +1 -1
- package/lib/Table.d.cts +28 -28
- package/lib/Table.d.ts +28 -28
- package/lib/Table.js +3 -3
- package/lib/TableOfContent.cjs +1 -1
- package/lib/TableOfContent.d.cts +28 -28
- package/lib/TableOfContent.d.ts +28 -28
- package/lib/TableOfContent.js +4 -4
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +28 -28
- package/lib/TaskList.d.ts +28 -28
- package/lib/TaskList.js +37 -33
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +28 -28
- package/lib/TextAlign.d.ts +28 -28
- package/lib/TextAlign.js +2 -2
- package/lib/TextBubble.cjs +1 -1
- package/lib/TextBubble.d.cts +28 -28
- package/lib/TextBubble.d.ts +28 -28
- package/lib/TextBubble.js +3 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +28 -28
- package/lib/TextDirection.d.ts +28 -28
- package/lib/TextDirection.js +2 -2
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +28 -28
- package/lib/TextUnderline.d.ts +28 -28
- package/lib/TextUnderline.js +2 -2
- package/lib/TrailingNode.cjs +1 -1
- package/lib/TrailingNode.d.cts +28 -28
- package/lib/TrailingNode.d.ts +28 -28
- package/lib/TrailingNode.js +1 -1
- package/lib/{Twitter-COZu8DI2.cjs → Twitter-V0OzBT_E.cjs} +1 -1
- package/lib/{Twitter-J0XtGXRC.js → Twitter-dRxbZOad.js} +4 -4
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +28 -28
- package/lib/Twitter.d.ts +28 -28
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +28 -28
- package/lib/Video.d.ts +28 -28
- package/lib/Video.js +3 -3
- package/lib/bubble-extra.cjs +2 -2
- package/lib/bubble-extra.d.cts +28 -28
- package/lib/bubble-extra.d.ts +28 -28
- package/lib/bubble-extra.js +26 -26
- package/lib/{dom-dataset-Cuy-pIfj.cjs → dom-dataset-Byuf1YmW.cjs} +5 -5
- package/lib/{dom-dataset-CHDbKz5J.js → dom-dataset-Di3tIRrR.js} +94 -83
- package/lib/index-BI-IcZcN.cjs +1 -0
- package/lib/{index-CSvnpArE.cjs → index-ByRfqzMr.cjs} +2 -2
- package/lib/index-C19MB4Al.cjs +1 -0
- package/lib/{index-DIPntess.js → index-C1fzuXpN.js} +1 -1
- package/lib/index-CbQQFj2T.js +133 -0
- package/lib/{index-BWx1Mchx.js → index-DI9T3iLd.js} +243 -243
- package/lib/{index-CrxasX7b.cjs → index-DclQSrIx.cjs} +1 -1
- package/lib/{index-DEFQHExY.js → index-LUL9mqY4.js} +1 -1
- package/lib/{index-zcKfSGd5.js → index-Tj3Ci7xM.js} +13 -8
- package/lib/{index-h9_SDuwc.cjs → index-Z4b9rzn-.cjs} +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +28 -28
- package/lib/index.d.ts +28 -28
- package/lib/index.js +6 -6
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +33 -28
- package/lib/locale-bundle.d.ts +33 -28
- package/lib/locale-bundle.js +1 -1
- package/lib/{textarea-Bm0GTcEU.js → textarea-6c8drwXJ.js} +1 -1
- package/lib/{textarea-C_xhu0vT.cjs → textarea-BsJTSgT-.cjs} +1 -1
- package/package.json +67 -67
- package/lib/Excalidraw-CzAhPJ3k.cjs +0 -1
- package/lib/Excalidraw-D1EJKRER.js +0 -282
- package/lib/RichTextEditor-jtVXJcE2.cjs +0 -141
- package/lib/index-Cyh1yoFk.cjs +0 -1
- package/lib/index-jEB3jXoa.cjs +0 -1
- package/lib/index-oQutU45z.js +0 -129
package/lib/LineHeight.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-ByRfqzMr.cjs"),g=require("./index-C19MB4Al.cjs"),c=require("react/jsx-runtime"),L=require("react"),u=require("./RichTextEditor-CAxwVWUE.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
|
@@ -114,9 +114,11 @@ declare module '@tiptap/core' {
|
|
|
114
114
|
|
|
115
115
|
declare module '@tiptap/core' {
|
|
116
116
|
interface Commands<ReturnType> {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
emoji: {
|
|
118
|
+
setEmoji: (emoji: {
|
|
119
|
+
name: string;
|
|
120
|
+
emoji: string;
|
|
121
|
+
}) => ReturnType;
|
|
120
122
|
};
|
|
121
123
|
}
|
|
122
124
|
}
|
|
@@ -124,11 +126,9 @@ declare module '@tiptap/core' {
|
|
|
124
126
|
|
|
125
127
|
declare module '@tiptap/core' {
|
|
126
128
|
interface Commands<ReturnType> {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
emoji: string;
|
|
131
|
-
}) => ReturnType;
|
|
129
|
+
drawer: {
|
|
130
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
131
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -179,21 +179,6 @@ declare module '@tiptap/core' {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
|
|
182
|
-
declare module '@tiptap/core' {
|
|
183
|
-
interface Commands<ReturnType> {
|
|
184
|
-
iframe: {
|
|
185
|
-
/**
|
|
186
|
-
* Add an iframe
|
|
187
|
-
*/
|
|
188
|
-
setIframe: (options: {
|
|
189
|
-
src: string;
|
|
190
|
-
service: string;
|
|
191
|
-
}) => ReturnType;
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
182
|
declare module '@tiptap/core' {
|
|
198
183
|
interface Commands<ReturnType> {
|
|
199
184
|
imageUpload: {
|
|
@@ -214,6 +199,21 @@ declare module '@tiptap/core' {
|
|
|
214
199
|
}
|
|
215
200
|
|
|
216
201
|
|
|
202
|
+
declare module '@tiptap/core' {
|
|
203
|
+
interface Commands<ReturnType> {
|
|
204
|
+
iframe: {
|
|
205
|
+
/**
|
|
206
|
+
* Add an iframe
|
|
207
|
+
*/
|
|
208
|
+
setIframe: (options: {
|
|
209
|
+
src: string;
|
|
210
|
+
service: string;
|
|
211
|
+
}) => ReturnType;
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
|
|
217
217
|
declare module '@tiptap/core' {
|
|
218
218
|
interface Commands<ReturnType> {
|
|
219
219
|
imageGifUpload: {
|
|
@@ -252,8 +252,9 @@ declare module '@tiptap/core' {
|
|
|
252
252
|
|
|
253
253
|
declare module '@tiptap/core' {
|
|
254
254
|
interface Commands<ReturnType> {
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
lineHeight: {
|
|
256
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
257
|
+
unsetLineHeight: () => ReturnType;
|
|
257
258
|
};
|
|
258
259
|
}
|
|
259
260
|
}
|
|
@@ -261,9 +262,8 @@ declare module '@tiptap/core' {
|
|
|
261
262
|
|
|
262
263
|
declare module '@tiptap/core' {
|
|
263
264
|
interface Commands<ReturnType> {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
unsetLineHeight: () => ReturnType;
|
|
265
|
+
katex: {
|
|
266
|
+
setKatex: (arg?: IKatexAttrs) => ReturnType;
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
269
|
}
|
package/lib/LineHeight.d.ts
CHANGED
|
@@ -114,9 +114,11 @@ declare module '@tiptap/core' {
|
|
|
114
114
|
|
|
115
115
|
declare module '@tiptap/core' {
|
|
116
116
|
interface Commands<ReturnType> {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
emoji: {
|
|
118
|
+
setEmoji: (emoji: {
|
|
119
|
+
name: string;
|
|
120
|
+
emoji: string;
|
|
121
|
+
}) => ReturnType;
|
|
120
122
|
};
|
|
121
123
|
}
|
|
122
124
|
}
|
|
@@ -124,11 +126,9 @@ declare module '@tiptap/core' {
|
|
|
124
126
|
|
|
125
127
|
declare module '@tiptap/core' {
|
|
126
128
|
interface Commands<ReturnType> {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
emoji: string;
|
|
131
|
-
}) => ReturnType;
|
|
129
|
+
drawer: {
|
|
130
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
131
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -179,21 +179,6 @@ declare module '@tiptap/core' {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
|
|
182
|
-
declare module '@tiptap/core' {
|
|
183
|
-
interface Commands<ReturnType> {
|
|
184
|
-
iframe: {
|
|
185
|
-
/**
|
|
186
|
-
* Add an iframe
|
|
187
|
-
*/
|
|
188
|
-
setIframe: (options: {
|
|
189
|
-
src: string;
|
|
190
|
-
service: string;
|
|
191
|
-
}) => ReturnType;
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
182
|
declare module '@tiptap/core' {
|
|
198
183
|
interface Commands<ReturnType> {
|
|
199
184
|
imageUpload: {
|
|
@@ -214,6 +199,21 @@ declare module '@tiptap/core' {
|
|
|
214
199
|
}
|
|
215
200
|
|
|
216
201
|
|
|
202
|
+
declare module '@tiptap/core' {
|
|
203
|
+
interface Commands<ReturnType> {
|
|
204
|
+
iframe: {
|
|
205
|
+
/**
|
|
206
|
+
* Add an iframe
|
|
207
|
+
*/
|
|
208
|
+
setIframe: (options: {
|
|
209
|
+
src: string;
|
|
210
|
+
service: string;
|
|
211
|
+
}) => ReturnType;
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
|
|
217
217
|
declare module '@tiptap/core' {
|
|
218
218
|
interface Commands<ReturnType> {
|
|
219
219
|
imageGifUpload: {
|
|
@@ -252,8 +252,9 @@ declare module '@tiptap/core' {
|
|
|
252
252
|
|
|
253
253
|
declare module '@tiptap/core' {
|
|
254
254
|
interface Commands<ReturnType> {
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
lineHeight: {
|
|
256
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
257
|
+
unsetLineHeight: () => ReturnType;
|
|
257
258
|
};
|
|
258
259
|
}
|
|
259
260
|
}
|
|
@@ -261,9 +262,8 @@ declare module '@tiptap/core' {
|
|
|
261
262
|
|
|
262
263
|
declare module '@tiptap/core' {
|
|
263
264
|
interface Commands<ReturnType> {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
unsetLineHeight: () => ReturnType;
|
|
265
|
+
katex: {
|
|
266
|
+
setKatex: (arg?: IKatexAttrs) => ReturnType;
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
269
|
}
|
package/lib/LineHeight.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { T as f, A as H, E as L } from "./index-
|
|
2
|
-
import { u as x, j as m, k as T } from "./index-
|
|
1
|
+
import { T as f, A as H, E as L } from "./index-DI9T3iLd.js";
|
|
2
|
+
import { u as x, j as m, k as T } from "./index-Tj3Ci7xM.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-DjTnd5Uu.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-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./index-ByRfqzMr.cjs");const e=require("./RichTextEditor-CAxwVWUE.cjs");exports.Link=e.Link;exports.default=e.Link;
|
package/lib/Link.d.cts
CHANGED
|
@@ -112,9 +112,11 @@ declare module '@tiptap/core' {
|
|
|
112
112
|
|
|
113
113
|
declare module '@tiptap/core' {
|
|
114
114
|
interface Commands<ReturnType> {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
emoji: {
|
|
116
|
+
setEmoji: (emoji: {
|
|
117
|
+
name: string;
|
|
118
|
+
emoji: string;
|
|
119
|
+
}) => ReturnType;
|
|
118
120
|
};
|
|
119
121
|
}
|
|
120
122
|
}
|
|
@@ -122,11 +124,9 @@ declare module '@tiptap/core' {
|
|
|
122
124
|
|
|
123
125
|
declare module '@tiptap/core' {
|
|
124
126
|
interface Commands<ReturnType> {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
emoji: string;
|
|
129
|
-
}) => ReturnType;
|
|
127
|
+
drawer: {
|
|
128
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
129
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -177,21 +177,6 @@ declare module '@tiptap/core' {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
|
|
180
|
-
declare module '@tiptap/core' {
|
|
181
|
-
interface Commands<ReturnType> {
|
|
182
|
-
iframe: {
|
|
183
|
-
/**
|
|
184
|
-
* Add an iframe
|
|
185
|
-
*/
|
|
186
|
-
setIframe: (options: {
|
|
187
|
-
src: string;
|
|
188
|
-
service: string;
|
|
189
|
-
}) => ReturnType;
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
180
|
declare module '@tiptap/core' {
|
|
196
181
|
interface Commands<ReturnType> {
|
|
197
182
|
imageUpload: {
|
|
@@ -212,6 +197,21 @@ declare module '@tiptap/core' {
|
|
|
212
197
|
}
|
|
213
198
|
|
|
214
199
|
|
|
200
|
+
declare module '@tiptap/core' {
|
|
201
|
+
interface Commands<ReturnType> {
|
|
202
|
+
iframe: {
|
|
203
|
+
/**
|
|
204
|
+
* Add an iframe
|
|
205
|
+
*/
|
|
206
|
+
setIframe: (options: {
|
|
207
|
+
src: string;
|
|
208
|
+
service: string;
|
|
209
|
+
}) => ReturnType;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
|
|
215
215
|
declare module '@tiptap/core' {
|
|
216
216
|
interface Commands<ReturnType> {
|
|
217
217
|
imageGifUpload: {
|
|
@@ -250,8 +250,9 @@ declare module '@tiptap/core' {
|
|
|
250
250
|
|
|
251
251
|
declare module '@tiptap/core' {
|
|
252
252
|
interface Commands<ReturnType> {
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
lineHeight: {
|
|
254
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
255
|
+
unsetLineHeight: () => ReturnType;
|
|
255
256
|
};
|
|
256
257
|
}
|
|
257
258
|
}
|
|
@@ -259,9 +260,8 @@ declare module '@tiptap/core' {
|
|
|
259
260
|
|
|
260
261
|
declare module '@tiptap/core' {
|
|
261
262
|
interface Commands<ReturnType> {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
unsetLineHeight: () => ReturnType;
|
|
263
|
+
katex: {
|
|
264
|
+
setKatex: (arg?: IKatexAttrs) => ReturnType;
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
267
|
}
|
package/lib/Link.d.ts
CHANGED
|
@@ -112,9 +112,11 @@ declare module '@tiptap/core' {
|
|
|
112
112
|
|
|
113
113
|
declare module '@tiptap/core' {
|
|
114
114
|
interface Commands<ReturnType> {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
emoji: {
|
|
116
|
+
setEmoji: (emoji: {
|
|
117
|
+
name: string;
|
|
118
|
+
emoji: string;
|
|
119
|
+
}) => ReturnType;
|
|
118
120
|
};
|
|
119
121
|
}
|
|
120
122
|
}
|
|
@@ -122,11 +124,9 @@ declare module '@tiptap/core' {
|
|
|
122
124
|
|
|
123
125
|
declare module '@tiptap/core' {
|
|
124
126
|
interface Commands<ReturnType> {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
emoji: string;
|
|
129
|
-
}) => ReturnType;
|
|
127
|
+
drawer: {
|
|
128
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
129
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -177,21 +177,6 @@ declare module '@tiptap/core' {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
|
|
180
|
-
declare module '@tiptap/core' {
|
|
181
|
-
interface Commands<ReturnType> {
|
|
182
|
-
iframe: {
|
|
183
|
-
/**
|
|
184
|
-
* Add an iframe
|
|
185
|
-
*/
|
|
186
|
-
setIframe: (options: {
|
|
187
|
-
src: string;
|
|
188
|
-
service: string;
|
|
189
|
-
}) => ReturnType;
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
180
|
declare module '@tiptap/core' {
|
|
196
181
|
interface Commands<ReturnType> {
|
|
197
182
|
imageUpload: {
|
|
@@ -212,6 +197,21 @@ declare module '@tiptap/core' {
|
|
|
212
197
|
}
|
|
213
198
|
|
|
214
199
|
|
|
200
|
+
declare module '@tiptap/core' {
|
|
201
|
+
interface Commands<ReturnType> {
|
|
202
|
+
iframe: {
|
|
203
|
+
/**
|
|
204
|
+
* Add an iframe
|
|
205
|
+
*/
|
|
206
|
+
setIframe: (options: {
|
|
207
|
+
src: string;
|
|
208
|
+
service: string;
|
|
209
|
+
}) => ReturnType;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
|
|
215
215
|
declare module '@tiptap/core' {
|
|
216
216
|
interface Commands<ReturnType> {
|
|
217
217
|
imageGifUpload: {
|
|
@@ -250,8 +250,9 @@ declare module '@tiptap/core' {
|
|
|
250
250
|
|
|
251
251
|
declare module '@tiptap/core' {
|
|
252
252
|
interface Commands<ReturnType> {
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
lineHeight: {
|
|
254
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
255
|
+
unsetLineHeight: () => ReturnType;
|
|
255
256
|
};
|
|
256
257
|
}
|
|
257
258
|
}
|
|
@@ -259,9 +260,8 @@ declare module '@tiptap/core' {
|
|
|
259
260
|
|
|
260
261
|
declare module '@tiptap/core' {
|
|
261
262
|
interface Commands<ReturnType> {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
unsetLineHeight: () => ReturnType;
|
|
263
|
+
katex: {
|
|
264
|
+
setKatex: (arg?: IKatexAttrs) => ReturnType;
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
267
|
}
|
package/lib/Link.js
CHANGED
package/lib/ListItem.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-ByRfqzMr.cjs"),i=t.Node.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",t.mergeAttributes(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});exports.ListItem=i;
|
package/lib/ListItem.d.cts
CHANGED
|
@@ -36,9 +36,11 @@ declare module '@tiptap/core' {
|
|
|
36
36
|
|
|
37
37
|
declare module '@tiptap/core' {
|
|
38
38
|
interface Commands<ReturnType> {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
emoji: {
|
|
40
|
+
setEmoji: (emoji: {
|
|
41
|
+
name: string;
|
|
42
|
+
emoji: string;
|
|
43
|
+
}) => ReturnType;
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
46
|
}
|
|
@@ -46,11 +48,9 @@ declare module '@tiptap/core' {
|
|
|
46
48
|
|
|
47
49
|
declare module '@tiptap/core' {
|
|
48
50
|
interface Commands<ReturnType> {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
emoji: string;
|
|
53
|
-
}) => ReturnType;
|
|
51
|
+
drawer: {
|
|
52
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
53
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -101,21 +101,6 @@ declare module '@tiptap/core' {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
declare module '@tiptap/core' {
|
|
105
|
-
interface Commands<ReturnType> {
|
|
106
|
-
iframe: {
|
|
107
|
-
/**
|
|
108
|
-
* Add an iframe
|
|
109
|
-
*/
|
|
110
|
-
setIframe: (options: {
|
|
111
|
-
src: string;
|
|
112
|
-
service: string;
|
|
113
|
-
}) => ReturnType;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
104
|
declare module '@tiptap/core' {
|
|
120
105
|
interface Commands<ReturnType> {
|
|
121
106
|
imageUpload: {
|
|
@@ -136,6 +121,21 @@ declare module '@tiptap/core' {
|
|
|
136
121
|
}
|
|
137
122
|
|
|
138
123
|
|
|
124
|
+
declare module '@tiptap/core' {
|
|
125
|
+
interface Commands<ReturnType> {
|
|
126
|
+
iframe: {
|
|
127
|
+
/**
|
|
128
|
+
* Add an iframe
|
|
129
|
+
*/
|
|
130
|
+
setIframe: (options: {
|
|
131
|
+
src: string;
|
|
132
|
+
service: string;
|
|
133
|
+
}) => ReturnType;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
139
|
declare module '@tiptap/core' {
|
|
140
140
|
interface Commands<ReturnType> {
|
|
141
141
|
imageGifUpload: {
|
|
@@ -174,8 +174,9 @@ declare module '@tiptap/core' {
|
|
|
174
174
|
|
|
175
175
|
declare module '@tiptap/core' {
|
|
176
176
|
interface Commands<ReturnType> {
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
lineHeight: {
|
|
178
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
179
|
+
unsetLineHeight: () => ReturnType;
|
|
179
180
|
};
|
|
180
181
|
}
|
|
181
182
|
}
|
|
@@ -183,9 +184,8 @@ declare module '@tiptap/core' {
|
|
|
183
184
|
|
|
184
185
|
declare module '@tiptap/core' {
|
|
185
186
|
interface Commands<ReturnType> {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
unsetLineHeight: () => ReturnType;
|
|
187
|
+
katex: {
|
|
188
|
+
setKatex: (arg?: IKatexAttrs) => ReturnType;
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
}
|
package/lib/ListItem.d.ts
CHANGED
|
@@ -36,9 +36,11 @@ declare module '@tiptap/core' {
|
|
|
36
36
|
|
|
37
37
|
declare module '@tiptap/core' {
|
|
38
38
|
interface Commands<ReturnType> {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
emoji: {
|
|
40
|
+
setEmoji: (emoji: {
|
|
41
|
+
name: string;
|
|
42
|
+
emoji: string;
|
|
43
|
+
}) => ReturnType;
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
46
|
}
|
|
@@ -46,11 +48,9 @@ declare module '@tiptap/core' {
|
|
|
46
48
|
|
|
47
49
|
declare module '@tiptap/core' {
|
|
48
50
|
interface Commands<ReturnType> {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
emoji: string;
|
|
53
|
-
}) => ReturnType;
|
|
51
|
+
drawer: {
|
|
52
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
53
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -101,21 +101,6 @@ declare module '@tiptap/core' {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
declare module '@tiptap/core' {
|
|
105
|
-
interface Commands<ReturnType> {
|
|
106
|
-
iframe: {
|
|
107
|
-
/**
|
|
108
|
-
* Add an iframe
|
|
109
|
-
*/
|
|
110
|
-
setIframe: (options: {
|
|
111
|
-
src: string;
|
|
112
|
-
service: string;
|
|
113
|
-
}) => ReturnType;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
104
|
declare module '@tiptap/core' {
|
|
120
105
|
interface Commands<ReturnType> {
|
|
121
106
|
imageUpload: {
|
|
@@ -136,6 +121,21 @@ declare module '@tiptap/core' {
|
|
|
136
121
|
}
|
|
137
122
|
|
|
138
123
|
|
|
124
|
+
declare module '@tiptap/core' {
|
|
125
|
+
interface Commands<ReturnType> {
|
|
126
|
+
iframe: {
|
|
127
|
+
/**
|
|
128
|
+
* Add an iframe
|
|
129
|
+
*/
|
|
130
|
+
setIframe: (options: {
|
|
131
|
+
src: string;
|
|
132
|
+
service: string;
|
|
133
|
+
}) => ReturnType;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
139
|
declare module '@tiptap/core' {
|
|
140
140
|
interface Commands<ReturnType> {
|
|
141
141
|
imageGifUpload: {
|
|
@@ -174,8 +174,9 @@ declare module '@tiptap/core' {
|
|
|
174
174
|
|
|
175
175
|
declare module '@tiptap/core' {
|
|
176
176
|
interface Commands<ReturnType> {
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
lineHeight: {
|
|
178
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
179
|
+
unsetLineHeight: () => ReturnType;
|
|
179
180
|
};
|
|
180
181
|
}
|
|
181
182
|
}
|
|
@@ -183,9 +184,8 @@ declare module '@tiptap/core' {
|
|
|
183
184
|
|
|
184
185
|
declare module '@tiptap/core' {
|
|
185
186
|
interface Commands<ReturnType> {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
unsetLineHeight: () => ReturnType;
|
|
187
|
+
katex: {
|
|
188
|
+
setKatex: (arg?: IKatexAttrs) => ReturnType;
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
}
|
package/lib/ListItem.js
CHANGED
package/lib/Mention.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-ByRfqzMr.cjs"),T=require("./index-BI-IcZcN.cjs"),g=require("./dom-dataset-Byuf1YmW.cjs"),v=require("tippy.js"),h=require("react/jsx-runtime"),m=require("react"),M=require("scroll-into-view-if-needed");function L({editor:e,overrideSuggestionOptions:n,extensionName:t,char:r="@"}){const i=new c.PluginKey;return{editor:e,char:r,pluginKey:i,command:({editor:o,range:l,props:u})=>{var a,s,d;const f=o.view.state.selection.$to.nodeAfter;((a=f==null?void 0:f.text)===null||a===void 0?void 0:a.startsWith(" "))&&(l.to+=1),o.chain().focus().insertContentAt(l,[{type:t,attrs:{...u,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(d=(s=o.view.dom.ownerDocument.defaultView)===null||s===void 0?void 0:s.getSelection())===null||d===void 0||d.collapseToEnd()},allow:({state:o,range:l})=>{const u=o.doc.resolve(l.from),a=o.schema.nodes[t];return!!u.parent.type.contentMatch.matchType(a)},...n}}function y(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(n=>L({editor:e.editor,overrideSuggestionOptions:n,extensionName:e.name,char:n.char}))}function b(e,n){const t=y(e),r=t.find(i=>i.char===n);return r||(t.length?t[0]:null)}const w=c.Node.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:e,suggestion:n}){var t,r;return`${(t=n==null?void 0:n.char)!==null&&t!==void 0?t:"@"}${(r=e.attrs.label)!==null&&r!==void 0?r:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:n,suggestion:t}){var r,i;return["span",c.mergeAttributes(this.HTMLAttributes,e.HTMLAttributes),`${(r=t==null?void 0:t.char)!==null&&r!==void 0?r:"@"}${(i=n.attrs.label)!==null&&i!==void 0?i:n.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:e=>e.getAttribute("data-mention-suggestion-char"),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:n}){const t=b(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",c.mergeAttributes({"data-type":this.name},this.options.HTMLAttributes,n),this.options.renderLabel({options:this.options,node:e,suggestion:t})];const r={...this.options};r.HTMLAttributes=c.mergeAttributes({"data-type":this.name},this.options.HTMLAttributes,n);const i=this.options.renderHTML({options:r,node:e,suggestion:t});return typeof i=="string"?["span",c.mergeAttributes({"data-type":this.name},this.options.HTMLAttributes,n),i]:i},renderText({node:e}){const n={options:this.options,node:e,suggestion:b(this,e.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(n)):this.options.renderText(n)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:n})=>{let t=!1;const{selection:r}=n,{empty:i,anchor:o}=r;if(!i)return!1;n.doc.nodesBetween(o-1,o,(a,s)=>{if(a.type.name===this.name)return t=!0,e.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",s,s+a.nodeSize),!1});let l=new c.Node$1,u=0;return n.doc.nodesBetween(o-1,o,(a,s)=>{if(a.type.name===this.name)return t=!0,l=a,u=s,!1}),t&&e.insertText(this.options.deleteTriggerWithBackspace?"":l.attrs.mentionSuggestionChar,u,u+l.nodeSize),t})}},addProseMirrorPlugins(){return y(this).map(T.Suggestion)}}),S="_listUsers_en3pm_1",H="_itemUser_en3pm_10",A="_selectedUser_en3pm_31",p={listUsers:S,itemUser:H,selectedUser:A},x=m.forwardRef((e,n)=>{const t=m.useRef(null),[r,i]=m.useState(0),o=s=>{const d=e.items[s];d&&e.command({id:d,label:d})},l=()=>{i((r+e.items.length-1)%e.items.length)},u=()=>{i((r+1)%e.items.length)},a=()=>{o(r)};return m.useEffect(()=>i(0),[e.items]),m.useEffect(()=>{if(Number.isNaN(r+1))return;const s=t.current.querySelector(`span:nth-of-type(${r+1})`);s&&M(s,{behavior:"smooth",scrollMode:"if-needed"})},[r]),m.useImperativeHandle(n,()=>({onKeyDown:({event:s})=>s.key==="ArrowUp"?(l(),!0):s.key==="ArrowDown"?(u(),!0):s.key==="Enter"?(a(),!0):!1})),h.jsx("div",{className:g.clsx("listUsers",p.listUsers),children:h.jsx("div",{ref:t,children:e.items.length>0?e.items.map((s,d)=>h.jsx("span",{className:g.clsx("itemUser",p.itemUser,d===r?p.selectedUser:""),onClick:()=>o(d),children:s},d)):h.jsx("div",{className:g.clsx("itemUserEmpty",p.itemUser),children:"Empty"})})})}),U=[{id:"1",name:"John Doe"},{id:"2",name:"Jane Doe"},{id:"3",name:"Alice"},{id:"4",name:"Bob"}],_={items:async({query:e})=>U.map(t=>t.name).filter(t=>t.toLowerCase().startsWith(e.toLowerCase())),render:()=>{let e,n;return{onStart:t=>{e=new g.ReactRenderer(x,{props:t,editor:t.editor}),n=v("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate(t){e.updateProps(t),n[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var r;return t.event.key==="Escape"?(n[0].hide(),!0):(r=e.ref)==null?void 0:r.onKeyDown(t)},onExit(){n[0].destroy(),e.destroy()}}}},C=w.extend({addAttributes(){return{id:{default:"",parseHTML:g.getDatasetAttribute("id")},label:{default:"",parseHTML:g.getDatasetAttribute("label")}}}}).configure({HTMLAttributes:{class:"mention"},suggestion:_});exports.Mention=C;
|