reactjs-tiptap-editor 0.3.25 → 0.3.27
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-Bh2ft7th.js → ActionMenuButton-D3nLtawn.js} +1 -1
- package/lib/{ActionMenuButton-B3XOtCey.cjs → ActionMenuButton-fkh63F_R.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.d.cts +26 -17
- package/lib/Attachment.d.ts +26 -17
- package/lib/Attachment.js +1 -1
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.d.cts +26 -17
- package/lib/Blockquote.d.ts +26 -17
- package/lib/Blockquote.js +1 -1
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +26 -17
- package/lib/Bold.d.ts +26 -17
- package/lib/Bold.js +1 -1
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +26 -17
- package/lib/BulletList.d.ts +26 -17
- package/lib/BulletList.js +1 -1
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +26 -17
- package/lib/Clear.d.ts +26 -17
- package/lib/Clear.js +1 -1
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +26 -17
- package/lib/Code.d.ts +26 -17
- package/lib/Code.js +1 -1
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.d.cts +26 -17
- package/lib/CodeBlock.d.ts +26 -17
- package/lib/CodeBlock.js +1 -1
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +26 -17
- package/lib/CodeView.d.ts +26 -17
- package/lib/CodeView.js +1 -1
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +26 -17
- package/lib/Color.d.ts +26 -17
- package/lib/Color.js +1 -1
- package/lib/Document.d.cts +26 -17
- package/lib/Document.d.ts +26 -17
- package/lib/{Drawer-Orz21MYs.js → Drawer-BBVUujX4.js} +1 -1
- package/lib/{Drawer-CUntRzbs.cjs → Drawer-DetzmUvQ.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +26 -17
- package/lib/Drawer.d.ts +26 -17
- package/lib/Drawer.js +2 -2
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +26 -17
- package/lib/Emoji.d.ts +26 -17
- package/lib/Emoji.js +1 -1
- package/lib/{Excalidraw-Cj-sXq5F.js → Excalidraw-BVdio4hk.js} +1 -1
- package/lib/{Excalidraw-Bu8XuykT.cjs → Excalidraw-DVnwdz-w.cjs} +1 -1
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +26 -17
- package/lib/Excalidraw.d.ts +26 -17
- package/lib/Excalidraw.js +1 -1
- package/lib/ExportPdf.cjs +4 -4
- package/lib/ExportPdf.d.cts +27 -17
- package/lib/ExportPdf.d.ts +27 -17
- package/lib/ExportPdf.js +34 -27
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +26 -17
- package/lib/ExportWord.d.ts +26 -17
- package/lib/ExportWord.js +1 -1
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +26 -17
- package/lib/FontFamily.d.ts +26 -17
- package/lib/FontFamily.js +2 -2
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +26 -17
- package/lib/FontSize.d.ts +26 -17
- package/lib/FontSize.js +2 -2
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.d.cts +26 -17
- package/lib/FormatPainter.d.ts +26 -17
- package/lib/FormatPainter.js +1 -1
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +26 -17
- package/lib/Heading.d.ts +26 -17
- package/lib/Heading.js +2 -2
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +26 -17
- package/lib/Highlight.d.ts +26 -17
- package/lib/Highlight.js +1 -1
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +26 -17
- package/lib/History.d.ts +26 -17
- package/lib/History.js +1 -1
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +26 -17
- package/lib/HorizontalRule.d.ts +26 -17
- package/lib/HorizontalRule.js +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +26 -17
- package/lib/Iframe.d.ts +26 -17
- package/lib/Iframe.js +1 -1
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +26 -17
- package/lib/Image.d.ts +26 -17
- package/lib/Image.js +1 -1
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +26 -17
- package/lib/ImageGif.d.ts +26 -17
- package/lib/ImageGif.js +1 -1
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.d.cts +26 -17
- package/lib/ImportWord.d.ts +26 -17
- package/lib/ImportWord.js +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +26 -17
- package/lib/Indent.d.ts +26 -17
- package/lib/Indent.js +1 -1
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +26 -17
- package/lib/Italic.d.ts +26 -17
- package/lib/Italic.js +1 -1
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +26 -17
- package/lib/Katex.d.ts +26 -17
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +26 -17
- package/lib/LineHeight.d.ts +26 -17
- package/lib/LineHeight.js +1 -1
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +26 -17
- package/lib/Link.d.ts +26 -17
- package/lib/Link.js +1 -1
- package/lib/ListItem.d.cts +26 -17
- package/lib/ListItem.d.ts +26 -17
- package/lib/Mention.d.cts +26 -17
- package/lib/Mention.d.ts +26 -17
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.d.cts +26 -17
- package/lib/Mermaid.d.ts +26 -17
- package/lib/Mermaid.js +2 -2
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +26 -17
- package/lib/MoreMark.d.ts +26 -17
- package/lib/MoreMark.js +1 -1
- package/lib/MultiColumn.cjs +1 -1
- package/lib/MultiColumn.d.cts +26 -17
- package/lib/MultiColumn.d.ts +26 -17
- package/lib/MultiColumn.js +1 -1
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +26 -17
- package/lib/OrderedList.d.ts +26 -17
- package/lib/OrderedList.js +1 -1
- package/lib/{RichTextEditor-CfAFp9V2.js → RichTextEditor-BJWhWz4z.js} +1460 -1446
- package/lib/{RichTextEditor-B5WYnm7K.cjs → RichTextEditor-DoMu_nCj.cjs} +7 -7
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +26 -17
- package/lib/SearchAndReplace.d.ts +26 -17
- package/lib/SearchAndReplace.js +1 -1
- package/lib/Selection.d.cts +26 -17
- package/lib/Selection.d.ts +26 -17
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +26 -17
- package/lib/SlashCommand.d.ts +26 -17
- package/lib/SlashCommand.js +1 -1
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +26 -17
- package/lib/Strike.d.ts +26 -17
- package/lib/Strike.js +1 -1
- package/lib/SubAndSuperScript.cjs +1 -1
- package/lib/SubAndSuperScript.d.cts +26 -17
- package/lib/SubAndSuperScript.d.ts +26 -17
- package/lib/SubAndSuperScript.js +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.d.cts +26 -17
- package/lib/Table.d.ts +26 -17
- package/lib/Table.js +1 -1
- package/lib/TableOfContent.cjs +1 -1
- package/lib/TableOfContent.d.cts +26 -17
- package/lib/TableOfContent.d.ts +26 -17
- package/lib/TableOfContent.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +26 -17
- package/lib/TaskList.d.ts +26 -17
- package/lib/TaskList.js +1 -1
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +26 -17
- package/lib/TextAlign.d.ts +26 -17
- package/lib/TextAlign.js +1 -1
- package/lib/TextBubble.cjs +1 -1
- package/lib/TextBubble.d.cts +26 -17
- package/lib/TextBubble.d.ts +26 -17
- package/lib/TextBubble.js +1 -1
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +26 -17
- package/lib/TextDirection.d.ts +26 -17
- package/lib/TextDirection.js +1 -1
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +26 -17
- package/lib/TextUnderline.d.ts +26 -17
- package/lib/TextUnderline.js +1 -1
- package/lib/TrailingNode.d.cts +26 -17
- package/lib/TrailingNode.d.ts +26 -17
- package/lib/{Twitter-BFwUowi8.cjs → Twitter--OkCPska.cjs} +1 -1
- package/lib/{Twitter-9AKqIK4p.js → Twitter-CXwmqolk.js} +1 -1
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +26 -17
- package/lib/Twitter.d.ts +26 -17
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +26 -17
- package/lib/Video.d.ts +26 -17
- package/lib/Video.js +1 -1
- package/lib/bubble-extra.cjs +1 -1
- package/lib/bubble-extra.d.cts +26 -17
- package/lib/bubble-extra.d.ts +26 -17
- package/lib/bubble-extra.js +5 -5
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +26 -17
- package/lib/index.d.ts +26 -17
- package/lib/index.js +2 -2
- package/lib/locale-bundle.d.cts +26 -17
- package/lib/locale-bundle.d.ts +26 -17
- package/lib/{textarea-bND4WL8o.cjs → textarea-DkVc2MIQ.cjs} +1 -1
- package/lib/{textarea-CWt0EMiJ.js → textarea-HW9QlrCS.js} +1 -1
- package/package.json +1 -1
package/lib/FormatPainter.d.ts
CHANGED
|
@@ -118,6 +118,16 @@ declare module '@tiptap/core' {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
|
|
121
|
+
declare module '@tiptap/core' {
|
|
122
|
+
interface Commands<ReturnType> {
|
|
123
|
+
drawer: {
|
|
124
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
125
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
121
131
|
declare module '@tiptap/core' {
|
|
122
132
|
interface Commands<ReturnType> {
|
|
123
133
|
emoji: {
|
|
@@ -132,9 +142,8 @@ declare module '@tiptap/core' {
|
|
|
132
142
|
|
|
133
143
|
declare module '@tiptap/core' {
|
|
134
144
|
interface Commands<ReturnType> {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
145
|
+
excalidraw: {
|
|
146
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
138
147
|
};
|
|
139
148
|
}
|
|
140
149
|
}
|
|
@@ -142,8 +151,8 @@ declare module '@tiptap/core' {
|
|
|
142
151
|
|
|
143
152
|
declare module '@tiptap/core' {
|
|
144
153
|
interface Commands<ReturnType> {
|
|
145
|
-
|
|
146
|
-
|
|
154
|
+
exportPdf: {
|
|
155
|
+
exportToPdf: () => ReturnType;
|
|
147
156
|
};
|
|
148
157
|
}
|
|
149
158
|
}
|
|
@@ -202,19 +211,19 @@ declare module '@tiptap/core' {
|
|
|
202
211
|
|
|
203
212
|
declare module '@tiptap/core' {
|
|
204
213
|
interface Commands<ReturnType> {
|
|
205
|
-
|
|
214
|
+
imageUpload: {
|
|
206
215
|
/**
|
|
207
|
-
* Add an image
|
|
216
|
+
* Add an image
|
|
208
217
|
*/
|
|
209
|
-
|
|
218
|
+
setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
210
219
|
/**
|
|
211
|
-
* Update an image
|
|
220
|
+
* Update an image
|
|
212
221
|
*/
|
|
213
|
-
|
|
222
|
+
updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
214
223
|
/**
|
|
215
224
|
* Set image alignment
|
|
216
225
|
*/
|
|
217
|
-
|
|
226
|
+
setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
218
227
|
};
|
|
219
228
|
}
|
|
220
229
|
}
|
|
@@ -222,19 +231,19 @@ declare module '@tiptap/core' {
|
|
|
222
231
|
|
|
223
232
|
declare module '@tiptap/core' {
|
|
224
233
|
interface Commands<ReturnType> {
|
|
225
|
-
|
|
234
|
+
imageGifUpload: {
|
|
226
235
|
/**
|
|
227
|
-
* Add an image
|
|
236
|
+
* Add an image gif
|
|
228
237
|
*/
|
|
229
|
-
|
|
238
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
230
239
|
/**
|
|
231
|
-
* Update an image
|
|
240
|
+
* Update an image gif
|
|
232
241
|
*/
|
|
233
|
-
|
|
242
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
234
243
|
/**
|
|
235
244
|
* Set image alignment
|
|
236
245
|
*/
|
|
237
|
-
|
|
246
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
238
247
|
};
|
|
239
248
|
}
|
|
240
249
|
}
|
package/lib/FormatPainter.js
CHANGED
package/lib/Heading.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-ByRfqzMr.cjs"),s=require("react/jsx-runtime"),g=require("react"),m=require("./ActionMenuButton-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-ByRfqzMr.cjs"),s=require("react/jsx-runtime"),g=require("react"),m=require("./ActionMenuButton-fkh63F_R.cjs"),o=require("./RichTextEditor-DoMu_nCj.cjs"),v=u.Node.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,u.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>u.textblockTypeInputRule({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});function x(e){var r;const t=g.useMemo(()=>{var l;const n=(l=e==null?void 0:e.items)==null?void 0:l.find(a=>a.isActive());return n&&!n.default?{...n}:{title:e.tooltip,level:0,isActive:()=>!1}},[e]);return s.jsxs(o.DropdownMenu,{children:[s.jsx(o.DropdownMenuTrigger,{asChild:!0,disabled:e==null?void 0:e.disabled,children:s.jsx(m.ActionMenuButton,{disabled:e==null?void 0:e.disabled,icon:"MenuDown",title:t==null?void 0:t.title,tooltip:e==null?void 0:e.tooltip})}),s.jsx(o.DropdownMenuContent,{className:"richtext-w-full",children:(r=e==null?void 0:e.items)==null?void 0:r.map((n,c)=>{var l,a;return s.jsxs(g.Fragment,{children:[s.jsxs(o.DropdownMenuCheckboxItem,{checked:(t==null?void 0:t.title)===n.title,onClick:n.action,children:[s.jsx("div",{className:`heading- richtext-ml-1 richtext-h-full${n.level}`,children:n.title}),!!((l=n==null?void 0:n.shortcutKeys)!=null&&l.length)&&s.jsx(o.DropdownMenuShortcut,{className:"richtext-pl-4",children:(a=n==null?void 0:n.shortcutKeys)==null?void 0:a.map(d=>o.getShortcutKey(d)).join(" ")})]}),n.level===0&&s.jsx(o.DropdownMenuSeparator,{})]},`heading-k-${c}`)})})]})}const b=v.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),levels:[1,2,3,4,5,6],button({editor:t,extension:r,t:n}){var h;const{extensions:c=[]}=t.extensionManager??[],l=((h=r.options)==null?void 0:h.levels)||[],a=c.find(i=>i.name==="base-kit"),d=l.map(i=>({action:()=>t.commands.toggleHeading({level:i}),isActive:()=>t.isActive("heading",{level:i})||!1,disabled:!t.can().toggleHeading({level:i}),title:n(`editor.heading.h${i}.tooltip`),level:i,shortcutKeys:["alt","mod",`${i}`]}));a&&a.options.paragraph!==!1&&d.unshift({action:()=>t.commands.setParagraph(),isActive:()=>t.isActive("paragraph")||!1,disabled:!t.can().setParagraph(),level:0,title:n("editor.paragraph.tooltip"),shortcutKeys:["alt","mod","0"]});const f=d.filter(i=>i.disabled).length===d.length;return{component:x,componentProps:{tooltip:n("editor.heading.tooltip"),disabled:f,items:d,editor:t}}}}}});exports.Heading=b;
|
package/lib/Heading.d.cts
CHANGED
|
@@ -108,6 +108,16 @@ declare module '@tiptap/core' {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
|
|
111
|
+
declare module '@tiptap/core' {
|
|
112
|
+
interface Commands<ReturnType> {
|
|
113
|
+
drawer: {
|
|
114
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
115
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
|
|
111
121
|
declare module '@tiptap/core' {
|
|
112
122
|
interface Commands<ReturnType> {
|
|
113
123
|
emoji: {
|
|
@@ -122,9 +132,8 @@ declare module '@tiptap/core' {
|
|
|
122
132
|
|
|
123
133
|
declare module '@tiptap/core' {
|
|
124
134
|
interface Commands<ReturnType> {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
135
|
+
excalidraw: {
|
|
136
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
128
137
|
};
|
|
129
138
|
}
|
|
130
139
|
}
|
|
@@ -132,8 +141,8 @@ declare module '@tiptap/core' {
|
|
|
132
141
|
|
|
133
142
|
declare module '@tiptap/core' {
|
|
134
143
|
interface Commands<ReturnType> {
|
|
135
|
-
|
|
136
|
-
|
|
144
|
+
exportPdf: {
|
|
145
|
+
exportToPdf: () => ReturnType;
|
|
137
146
|
};
|
|
138
147
|
}
|
|
139
148
|
}
|
|
@@ -192,19 +201,19 @@ declare module '@tiptap/core' {
|
|
|
192
201
|
|
|
193
202
|
declare module '@tiptap/core' {
|
|
194
203
|
interface Commands<ReturnType> {
|
|
195
|
-
|
|
204
|
+
imageUpload: {
|
|
196
205
|
/**
|
|
197
|
-
* Add an image
|
|
206
|
+
* Add an image
|
|
198
207
|
*/
|
|
199
|
-
|
|
208
|
+
setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
200
209
|
/**
|
|
201
|
-
* Update an image
|
|
210
|
+
* Update an image
|
|
202
211
|
*/
|
|
203
|
-
|
|
212
|
+
updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
204
213
|
/**
|
|
205
214
|
* Set image alignment
|
|
206
215
|
*/
|
|
207
|
-
|
|
216
|
+
setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
208
217
|
};
|
|
209
218
|
}
|
|
210
219
|
}
|
|
@@ -212,19 +221,19 @@ declare module '@tiptap/core' {
|
|
|
212
221
|
|
|
213
222
|
declare module '@tiptap/core' {
|
|
214
223
|
interface Commands<ReturnType> {
|
|
215
|
-
|
|
224
|
+
imageGifUpload: {
|
|
216
225
|
/**
|
|
217
|
-
* Add an image
|
|
226
|
+
* Add an image gif
|
|
218
227
|
*/
|
|
219
|
-
|
|
228
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
220
229
|
/**
|
|
221
|
-
* Update an image
|
|
230
|
+
* Update an image gif
|
|
222
231
|
*/
|
|
223
|
-
|
|
232
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
224
233
|
/**
|
|
225
234
|
* Set image alignment
|
|
226
235
|
*/
|
|
227
|
-
|
|
236
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
228
237
|
};
|
|
229
238
|
}
|
|
230
239
|
}
|
package/lib/Heading.d.ts
CHANGED
|
@@ -108,6 +108,16 @@ declare module '@tiptap/core' {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
|
|
111
|
+
declare module '@tiptap/core' {
|
|
112
|
+
interface Commands<ReturnType> {
|
|
113
|
+
drawer: {
|
|
114
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
115
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
|
|
111
121
|
declare module '@tiptap/core' {
|
|
112
122
|
interface Commands<ReturnType> {
|
|
113
123
|
emoji: {
|
|
@@ -122,9 +132,8 @@ declare module '@tiptap/core' {
|
|
|
122
132
|
|
|
123
133
|
declare module '@tiptap/core' {
|
|
124
134
|
interface Commands<ReturnType> {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
135
|
+
excalidraw: {
|
|
136
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
128
137
|
};
|
|
129
138
|
}
|
|
130
139
|
}
|
|
@@ -132,8 +141,8 @@ declare module '@tiptap/core' {
|
|
|
132
141
|
|
|
133
142
|
declare module '@tiptap/core' {
|
|
134
143
|
interface Commands<ReturnType> {
|
|
135
|
-
|
|
136
|
-
|
|
144
|
+
exportPdf: {
|
|
145
|
+
exportToPdf: () => ReturnType;
|
|
137
146
|
};
|
|
138
147
|
}
|
|
139
148
|
}
|
|
@@ -192,19 +201,19 @@ declare module '@tiptap/core' {
|
|
|
192
201
|
|
|
193
202
|
declare module '@tiptap/core' {
|
|
194
203
|
interface Commands<ReturnType> {
|
|
195
|
-
|
|
204
|
+
imageUpload: {
|
|
196
205
|
/**
|
|
197
|
-
* Add an image
|
|
206
|
+
* Add an image
|
|
198
207
|
*/
|
|
199
|
-
|
|
208
|
+
setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
200
209
|
/**
|
|
201
|
-
* Update an image
|
|
210
|
+
* Update an image
|
|
202
211
|
*/
|
|
203
|
-
|
|
212
|
+
updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
204
213
|
/**
|
|
205
214
|
* Set image alignment
|
|
206
215
|
*/
|
|
207
|
-
|
|
216
|
+
setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
208
217
|
};
|
|
209
218
|
}
|
|
210
219
|
}
|
|
@@ -212,19 +221,19 @@ declare module '@tiptap/core' {
|
|
|
212
221
|
|
|
213
222
|
declare module '@tiptap/core' {
|
|
214
223
|
interface Commands<ReturnType> {
|
|
215
|
-
|
|
224
|
+
imageGifUpload: {
|
|
216
225
|
/**
|
|
217
|
-
* Add an image
|
|
226
|
+
* Add an image gif
|
|
218
227
|
*/
|
|
219
|
-
|
|
228
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
220
229
|
/**
|
|
221
|
-
* Update an image
|
|
230
|
+
* Update an image gif
|
|
222
231
|
*/
|
|
223
|
-
|
|
232
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
224
233
|
/**
|
|
225
234
|
* Set image alignment
|
|
226
235
|
*/
|
|
227
|
-
|
|
236
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
228
237
|
};
|
|
229
238
|
}
|
|
230
239
|
}
|
package/lib/Heading.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { N as g, t as m, m as f } from "./index-DI9T3iLd.js";
|
|
2
2
|
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo as v, Fragment as b } from "react";
|
|
4
|
-
import { A as M } from "./ActionMenuButton-
|
|
5
|
-
import { D as x, e as A, f as H, h as $, v as p, s as w, u as y } from "./RichTextEditor-
|
|
4
|
+
import { A as M } from "./ActionMenuButton-D3nLtawn.js";
|
|
5
|
+
import { D as x, e as A, f as H, h as $, v as p, s as w, u as y } from "./RichTextEditor-BJWhWz4z.js";
|
|
6
6
|
const D = g.create({
|
|
7
7
|
name: "heading",
|
|
8
8
|
addOptions() {
|
package/lib/Highlight.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-ByRfqzMr.cjs"),n=require("./RichTextEditor-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-ByRfqzMr.cjs"),n=require("./RichTextEditor-DoMu_nCj.cjs"),s=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,u=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,l=r.Mark.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",r.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[r.markInputRule({find:s,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:u,type:this.type})]}}),h=l.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),multicolor:!0,button:({editor:e,t:o})=>({component:n.HighlightActionButton,componentProps:{action:i=>{typeof i=="string"&&e.chain().focus().setHighlight({color:i}).run(),i===void 0&&e.chain().focus().unsetHighlight().run()},editor:e,isActive:()=>e.isActive("highlight")||!1,disabled:!1,shortcutKeys:["⇧","mod","H"],tooltip:o("editor.highlight.tooltip")}})}}});exports.Highlight=h;
|
package/lib/Highlight.d.cts
CHANGED
|
@@ -109,6 +109,16 @@ declare module '@tiptap/core' {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
|
|
112
|
+
declare module '@tiptap/core' {
|
|
113
|
+
interface Commands<ReturnType> {
|
|
114
|
+
drawer: {
|
|
115
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
116
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
112
122
|
declare module '@tiptap/core' {
|
|
113
123
|
interface Commands<ReturnType> {
|
|
114
124
|
emoji: {
|
|
@@ -123,9 +133,8 @@ declare module '@tiptap/core' {
|
|
|
123
133
|
|
|
124
134
|
declare module '@tiptap/core' {
|
|
125
135
|
interface Commands<ReturnType> {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
136
|
+
excalidraw: {
|
|
137
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
129
138
|
};
|
|
130
139
|
}
|
|
131
140
|
}
|
|
@@ -133,8 +142,8 @@ declare module '@tiptap/core' {
|
|
|
133
142
|
|
|
134
143
|
declare module '@tiptap/core' {
|
|
135
144
|
interface Commands<ReturnType> {
|
|
136
|
-
|
|
137
|
-
|
|
145
|
+
exportPdf: {
|
|
146
|
+
exportToPdf: () => ReturnType;
|
|
138
147
|
};
|
|
139
148
|
}
|
|
140
149
|
}
|
|
@@ -193,19 +202,19 @@ declare module '@tiptap/core' {
|
|
|
193
202
|
|
|
194
203
|
declare module '@tiptap/core' {
|
|
195
204
|
interface Commands<ReturnType> {
|
|
196
|
-
|
|
205
|
+
imageUpload: {
|
|
197
206
|
/**
|
|
198
|
-
* Add an image
|
|
207
|
+
* Add an image
|
|
199
208
|
*/
|
|
200
|
-
|
|
209
|
+
setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
201
210
|
/**
|
|
202
|
-
* Update an image
|
|
211
|
+
* Update an image
|
|
203
212
|
*/
|
|
204
|
-
|
|
213
|
+
updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
205
214
|
/**
|
|
206
215
|
* Set image alignment
|
|
207
216
|
*/
|
|
208
|
-
|
|
217
|
+
setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
209
218
|
};
|
|
210
219
|
}
|
|
211
220
|
}
|
|
@@ -213,19 +222,19 @@ declare module '@tiptap/core' {
|
|
|
213
222
|
|
|
214
223
|
declare module '@tiptap/core' {
|
|
215
224
|
interface Commands<ReturnType> {
|
|
216
|
-
|
|
225
|
+
imageGifUpload: {
|
|
217
226
|
/**
|
|
218
|
-
* Add an image
|
|
227
|
+
* Add an image gif
|
|
219
228
|
*/
|
|
220
|
-
|
|
229
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
221
230
|
/**
|
|
222
|
-
* Update an image
|
|
231
|
+
* Update an image gif
|
|
223
232
|
*/
|
|
224
|
-
|
|
233
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
225
234
|
/**
|
|
226
235
|
* Set image alignment
|
|
227
236
|
*/
|
|
228
|
-
|
|
237
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
229
238
|
};
|
|
230
239
|
}
|
|
231
240
|
}
|
package/lib/Highlight.d.ts
CHANGED
|
@@ -109,6 +109,16 @@ declare module '@tiptap/core' {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
|
|
112
|
+
declare module '@tiptap/core' {
|
|
113
|
+
interface Commands<ReturnType> {
|
|
114
|
+
drawer: {
|
|
115
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
116
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
112
122
|
declare module '@tiptap/core' {
|
|
113
123
|
interface Commands<ReturnType> {
|
|
114
124
|
emoji: {
|
|
@@ -123,9 +133,8 @@ declare module '@tiptap/core' {
|
|
|
123
133
|
|
|
124
134
|
declare module '@tiptap/core' {
|
|
125
135
|
interface Commands<ReturnType> {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
136
|
+
excalidraw: {
|
|
137
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
129
138
|
};
|
|
130
139
|
}
|
|
131
140
|
}
|
|
@@ -133,8 +142,8 @@ declare module '@tiptap/core' {
|
|
|
133
142
|
|
|
134
143
|
declare module '@tiptap/core' {
|
|
135
144
|
interface Commands<ReturnType> {
|
|
136
|
-
|
|
137
|
-
|
|
145
|
+
exportPdf: {
|
|
146
|
+
exportToPdf: () => ReturnType;
|
|
138
147
|
};
|
|
139
148
|
}
|
|
140
149
|
}
|
|
@@ -193,19 +202,19 @@ declare module '@tiptap/core' {
|
|
|
193
202
|
|
|
194
203
|
declare module '@tiptap/core' {
|
|
195
204
|
interface Commands<ReturnType> {
|
|
196
|
-
|
|
205
|
+
imageUpload: {
|
|
197
206
|
/**
|
|
198
|
-
* Add an image
|
|
207
|
+
* Add an image
|
|
199
208
|
*/
|
|
200
|
-
|
|
209
|
+
setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
201
210
|
/**
|
|
202
|
-
* Update an image
|
|
211
|
+
* Update an image
|
|
203
212
|
*/
|
|
204
|
-
|
|
213
|
+
updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
205
214
|
/**
|
|
206
215
|
* Set image alignment
|
|
207
216
|
*/
|
|
208
|
-
|
|
217
|
+
setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
209
218
|
};
|
|
210
219
|
}
|
|
211
220
|
}
|
|
@@ -213,19 +222,19 @@ declare module '@tiptap/core' {
|
|
|
213
222
|
|
|
214
223
|
declare module '@tiptap/core' {
|
|
215
224
|
interface Commands<ReturnType> {
|
|
216
|
-
|
|
225
|
+
imageGifUpload: {
|
|
217
226
|
/**
|
|
218
|
-
* Add an image
|
|
227
|
+
* Add an image gif
|
|
219
228
|
*/
|
|
220
|
-
|
|
229
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
221
230
|
/**
|
|
222
|
-
* Update an image
|
|
231
|
+
* Update an image gif
|
|
223
232
|
*/
|
|
224
|
-
|
|
233
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
225
234
|
/**
|
|
226
235
|
* Set image alignment
|
|
227
236
|
*/
|
|
228
|
-
|
|
237
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
229
238
|
};
|
|
230
239
|
}
|
|
231
240
|
}
|
package/lib/Highlight.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { M as o, c as s, d as n, m as a } from "./index-DI9T3iLd.js";
|
|
2
|
-
import { H as u } from "./RichTextEditor-
|
|
2
|
+
import { H as u } from "./RichTextEditor-BJWhWz4z.js";
|
|
3
3
|
const h = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, l = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, g = o.create({
|
|
4
4
|
name: "highlight",
|
|
5
5
|
addOptions() {
|
package/lib/History.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./index-ByRfqzMr.cjs"),g=require("react/jsx-runtime"),M=require("./RichTextEditor-B5WYnm7K.cjs");var C=200,f=function(){};f.prototype.append=function(e){return e.length?(e=f.from(e),!this.length&&e||e.length<C&&this.leafAppend(e)||this.length<C&&e.leafPrepend(this)||this.appendInner(e)):this};f.prototype.prepend=function(e){return e.length?f.from(e).append(this):this};f.prototype.appendInner=function(e){return new _(this,e)};f.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?f.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};f.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};f.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};f.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(s,l){return r.push(e(s,l))},t,n),r};f.from=function(e){return e instanceof f?e:e&&e.length?new A(e):f.empty};var A=function(i){function e(n){i.call(this),this.values=n}i&&(e.__proto__=i),e.prototype=Object.create(i&&i.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,s){return r==0&&s==this.length?this:new e(this.values.slice(r,s))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,s,l,o){for(var p=s;p<l;p++)if(r(this.values[p],o+p)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,l,o){for(var p=s-1;p>=l;p--)if(r(this.values[p],o+p)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=C)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=C)return new e(r.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(f);f.empty=new A([]);var _=function(i){function e(t,n){i.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return i&&(e.__proto__=i),e.prototype=Object.create(i&&i.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,r,s,l){var o=this.left.length;if(r<o&&this.left.forEachInner(n,r,Math.min(s,o),l)===!1||s>o&&this.right.forEachInner(n,Math.max(r-o,0),Math.min(this.length,s)-o,l+o)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,s,l){var o=this.left.length;if(r>o&&this.right.forEachInvertedInner(n,r-o,Math.max(s,o)-o,l+o)===!1||s<o&&this.left.forEachInvertedInner(n,Math.min(r,o),s,l)===!1)return!1},e.prototype.sliceInner=function(n,r){if(n==0&&r==this.length)return this;var s=this.left.length;return r<=s?this.left.slice(n,r):n>=s?this.right.slice(n-s,r-s):this.left.slice(n,s).append(this.right.slice(0,r-s))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(f);const L=500;class m{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let r,s;t&&(r=this.remapping(n,this.items.length),s=r.maps.length);let l=e.tr,o,p,a=[],c=[];return this.items.forEach((u,h)=>{if(!u.step){r||(r=this.remapping(n,h+1),s=r.maps.length),s--,c.push(u);return}if(r){c.push(new v(u.map));let d=u.step.map(r.slice(s)),w;d&&l.maybeStep(d).doc&&(w=l.mapping.maps[l.mapping.maps.length-1],a.push(new v(w,void 0,void 0,a.length+c.length))),s--,w&&r.appendMap(w,s)}else l.maybeStep(u.step);if(u.selection)return o=r?u.selection.map(r.slice(s)):u.selection,p=new m(this.items.slice(0,n).append(c.reverse().concat(a)),this.eventCount-1),!1},this.items.length,0),{remaining:p,transform:l,selection:o}}addTransform(e,t,n,r){let s=[],l=this.eventCount,o=this.items,p=!r&&o.length?o.get(o.length-1):null;for(let c=0;c<e.steps.length;c++){let u=e.steps[c].invert(e.docs[c]),h=new v(e.mapping.maps[c],u,t),d;(d=p&&p.merge(h))&&(h=d,c?s.pop():o=o.slice(0,o.length-1)),s.push(h),t&&(l++,t=void 0),r||(p=h)}let a=l-n.depth;return a>G&&(o=S(o,a),l-=a),new m(o.append(s),l)}remapping(e,t){let n=new x.Mapping;return this.items.forEach((r,s)=>{let l=r.mirrorOffset!=null&&s-r.mirrorOffset>=e?n.maps.length-r.mirrorOffset:void 0;n.appendMap(r.map,l)},e,t),n}addMaps(e){return this.eventCount==0?this:new m(this.items.append(e.map(t=>new v(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),s=e.mapping,l=e.steps.length,o=this.eventCount;this.items.forEach(h=>{h.selection&&o--},r);let p=t;this.items.forEach(h=>{let d=s.getMirror(--p);if(d==null)return;l=Math.min(l,d);let w=s.maps[d];if(h.step){let K=e.steps[d].invert(e.docs[d]),b=h.selection&&h.selection.map(s.slice(p+1,d));b&&o++,n.push(new v(w,K,b))}else n.push(new v(w))},r);let a=[];for(let h=t;h<l;h++)a.push(new v(s.maps[h]));let c=this.items.slice(0,r).append(a).append(n),u=new m(c,o);return u.emptyItemCount()>L&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],s=0;return this.items.forEach((l,o)=>{if(o>=e)r.push(l),l.selection&&s++;else if(l.step){let p=l.step.map(t.slice(n)),a=p&&p.getMap();if(n--,a&&t.appendMap(a,n),p){let c=l.selection&&l.selection.map(t.slice(n));c&&s++;let u=new v(a.invert(),p,c),h,d=r.length-1;(h=r.length&&r[d].merge(u))?r[d]=h:r.push(u)}}else l.map&&n--},this.items.length,0),new m(f.from(r.reverse()),s)}}m.empty=new m(f.empty,0);function S(i,e){let t;return i.forEach((n,r)=>{if(n.selection&&e--==0)return t=r,!1}),i.slice(t)}class v{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new v(t.getMap().invert(),t,this.selection)}}}class y{constructor(e,t,n,r,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=s}}const G=20;function F(i,e,t,n){let r=t.getMeta(I),s;if(r)return r.historyState;t.getMeta(R)&&(i=new y(i.done,i.undone,null,0,-1));let l=t.getMeta("appendedTransaction");if(t.steps.length==0)return i;if(l&&l.getMeta(I))return l.getMeta(I).redo?new y(i.done.addTransform(t,void 0,n,E(e)),i.undone,O(t.mapping.maps),i.prevTime,i.prevComposition):new y(i.done,i.undone.addTransform(t,void 0,n,E(e)),null,i.prevTime,i.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let o=t.getMeta("composition"),p=i.prevTime==0||!l&&i.prevComposition!=o&&(i.prevTime<(t.time||0)-n.newGroupDelay||!z(t,i.prevRanges)),a=l?T(i.prevRanges,t.mapping):O(t.mapping.maps);return new y(i.done.addTransform(t,p?e.selection.getBookmark():void 0,n,E(e)),m.empty,a,t.time,o??i.prevComposition)}else return(s=t.getMeta("rebased"))?new y(i.done.rebased(t,s),i.undone.rebased(t,s),T(i.prevRanges,t.mapping),i.prevTime,i.prevComposition):new y(i.done.addMaps(t.mapping.maps),i.undone.addMaps(t.mapping.maps),T(i.prevRanges,t.mapping),i.prevTime,i.prevComposition)}function z(i,e){if(!e)return!1;if(!i.docChanged)return!0;let t=!1;return i.mapping.maps[0].forEach((n,r)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&r>=e[s]&&(t=!0)}),t}function O(i){let e=[];for(let t=i.length-1;t>=0&&e.length==0;t--)i[t].forEach((n,r,s,l)=>e.push(s,l));return e}function T(i,e){if(!i)return null;let t=[];for(let n=0;n<i.length;n+=2){let r=e.map(i[n],1),s=e.map(i[n+1],-1);r<=s&&t.push(r,s)}return t}function N(i,e,t){let n=E(e),r=I.get(e).spec.config,s=(t?i.undone:i.done).popEvent(e,n);if(!s)return null;let l=s.selection.resolve(s.transform.doc),o=(t?i.done:i.undone).addTransform(s.transform,e.selection.getBookmark(),r,n),p=new y(t?o:s.remaining,t?s.remaining:o,null,0,-1);return s.transform.setSelection(l).setMeta(I,{redo:t,historyState:p})}let P=!1,j=null;function E(i){let e=i.plugins;if(j!=e){P=!1,j=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){P=!0;break}}return P}const I=new x.PluginKey("history"),R=new x.PluginKey("closeHistory");function U(i={}){return i={depth:i.depth||100,newGroupDelay:i.newGroupDelay||500},new x.Plugin({key:I,state:{init(){return new y(m.empty,m.empty,null,0,-1)},apply(e,t,n){return F(t,n,e,i)}},config:i,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n=="historyUndo"?k:n=="historyRedo"?D:null;return r?(t.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function H(i,e){return(t,n)=>{let r=I.getState(t);if(!r||(i?r.undone:r.done).eventCount==0)return!1;if(n){let s=N(r,t,i);s&&n(e?s.scrollIntoView():s)}return!0}}const k=H(!1,!0),D=H(!0,!0),Z=x.Extension.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:i,dispatch:e})=>k(i,e),redo:()=>({state:i,dispatch:e})=>D(i,e)}},addProseMirrorPlugins(){return[U(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});function $(i){var a;const{icon:e=void 0,tooltip:t=void 0,customClass:n="",tooltipOptions:r={},action:s=void 0,isActive:l=void 0,children:o}=i,p=M.icons[e];return g.jsxs(M.Tooltip,{children:[g.jsx(M.TooltipTrigger,{asChild:!0,children:g.jsxs(M.Toggle,{size:"sm",className:`richtext-w-[32px] richtext-h-[32px] ${n}`,disabled:l==null?void 0:l(),onClick:s,children:[p&&g.jsx(p,{className:"richtext-w-4 richtext-h-4"}),o&&g.jsx(g.Fragment,{children:o})]})}),t&&g.jsx(M.TooltipContent,{...r,children:g.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-items-center richtext-text-center richtext-max-w-24",children:[g.jsx("div",{children:t}),!!((a=i==null?void 0:i.shortcutKeys)!=null&&a.length)&&g.jsx("span",{children:M.getShortcutKeys(i==null?void 0:i.shortcutKeys)})]})})]})}const V=["undo","redo"],W=Z.extend({addOptions(){var i;return{...(i=this.parent)==null?void 0:i.call(this),depth:100,newGroupDelay:500,button:({editor:e,t})=>V.map(n=>({component:$,componentProps:{action:()=>{n==="undo"&&e.chain().focus().undo().run(),n==="redo"&&e.chain().focus().redo().run()},shortcutKeys:n==="undo"?["mod","Z"]:["shift","mod","Z"],disabled:n==="undo"?!e.can().undo():!e.can().redo(),isActive:()=>n==="undo"?!e.can().undo():!e.can().redo(),icon:n==="undo"?"Undo2":"Redo2",tooltip:t(`editor.${n}.tooltip`)}}))}}});exports.History=W;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./index-ByRfqzMr.cjs"),g=require("react/jsx-runtime"),M=require("./RichTextEditor-DoMu_nCj.cjs");var C=200,f=function(){};f.prototype.append=function(e){return e.length?(e=f.from(e),!this.length&&e||e.length<C&&this.leafAppend(e)||this.length<C&&e.leafPrepend(this)||this.appendInner(e)):this};f.prototype.prepend=function(e){return e.length?f.from(e).append(this):this};f.prototype.appendInner=function(e){return new _(this,e)};f.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?f.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};f.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};f.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};f.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(s,l){return r.push(e(s,l))},t,n),r};f.from=function(e){return e instanceof f?e:e&&e.length?new A(e):f.empty};var A=function(i){function e(n){i.call(this),this.values=n}i&&(e.__proto__=i),e.prototype=Object.create(i&&i.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,s){return r==0&&s==this.length?this:new e(this.values.slice(r,s))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,s,l,o){for(var p=s;p<l;p++)if(r(this.values[p],o+p)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,l,o){for(var p=s-1;p>=l;p--)if(r(this.values[p],o+p)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=C)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=C)return new e(r.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(f);f.empty=new A([]);var _=function(i){function e(t,n){i.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return i&&(e.__proto__=i),e.prototype=Object.create(i&&i.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,r,s,l){var o=this.left.length;if(r<o&&this.left.forEachInner(n,r,Math.min(s,o),l)===!1||s>o&&this.right.forEachInner(n,Math.max(r-o,0),Math.min(this.length,s)-o,l+o)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,s,l){var o=this.left.length;if(r>o&&this.right.forEachInvertedInner(n,r-o,Math.max(s,o)-o,l+o)===!1||s<o&&this.left.forEachInvertedInner(n,Math.min(r,o),s,l)===!1)return!1},e.prototype.sliceInner=function(n,r){if(n==0&&r==this.length)return this;var s=this.left.length;return r<=s?this.left.slice(n,r):n>=s?this.right.slice(n-s,r-s):this.left.slice(n,s).append(this.right.slice(0,r-s))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(f);const L=500;class m{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let r,s;t&&(r=this.remapping(n,this.items.length),s=r.maps.length);let l=e.tr,o,p,a=[],c=[];return this.items.forEach((u,h)=>{if(!u.step){r||(r=this.remapping(n,h+1),s=r.maps.length),s--,c.push(u);return}if(r){c.push(new v(u.map));let d=u.step.map(r.slice(s)),w;d&&l.maybeStep(d).doc&&(w=l.mapping.maps[l.mapping.maps.length-1],a.push(new v(w,void 0,void 0,a.length+c.length))),s--,w&&r.appendMap(w,s)}else l.maybeStep(u.step);if(u.selection)return o=r?u.selection.map(r.slice(s)):u.selection,p=new m(this.items.slice(0,n).append(c.reverse().concat(a)),this.eventCount-1),!1},this.items.length,0),{remaining:p,transform:l,selection:o}}addTransform(e,t,n,r){let s=[],l=this.eventCount,o=this.items,p=!r&&o.length?o.get(o.length-1):null;for(let c=0;c<e.steps.length;c++){let u=e.steps[c].invert(e.docs[c]),h=new v(e.mapping.maps[c],u,t),d;(d=p&&p.merge(h))&&(h=d,c?s.pop():o=o.slice(0,o.length-1)),s.push(h),t&&(l++,t=void 0),r||(p=h)}let a=l-n.depth;return a>G&&(o=S(o,a),l-=a),new m(o.append(s),l)}remapping(e,t){let n=new x.Mapping;return this.items.forEach((r,s)=>{let l=r.mirrorOffset!=null&&s-r.mirrorOffset>=e?n.maps.length-r.mirrorOffset:void 0;n.appendMap(r.map,l)},e,t),n}addMaps(e){return this.eventCount==0?this:new m(this.items.append(e.map(t=>new v(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),s=e.mapping,l=e.steps.length,o=this.eventCount;this.items.forEach(h=>{h.selection&&o--},r);let p=t;this.items.forEach(h=>{let d=s.getMirror(--p);if(d==null)return;l=Math.min(l,d);let w=s.maps[d];if(h.step){let K=e.steps[d].invert(e.docs[d]),b=h.selection&&h.selection.map(s.slice(p+1,d));b&&o++,n.push(new v(w,K,b))}else n.push(new v(w))},r);let a=[];for(let h=t;h<l;h++)a.push(new v(s.maps[h]));let c=this.items.slice(0,r).append(a).append(n),u=new m(c,o);return u.emptyItemCount()>L&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],s=0;return this.items.forEach((l,o)=>{if(o>=e)r.push(l),l.selection&&s++;else if(l.step){let p=l.step.map(t.slice(n)),a=p&&p.getMap();if(n--,a&&t.appendMap(a,n),p){let c=l.selection&&l.selection.map(t.slice(n));c&&s++;let u=new v(a.invert(),p,c),h,d=r.length-1;(h=r.length&&r[d].merge(u))?r[d]=h:r.push(u)}}else l.map&&n--},this.items.length,0),new m(f.from(r.reverse()),s)}}m.empty=new m(f.empty,0);function S(i,e){let t;return i.forEach((n,r)=>{if(n.selection&&e--==0)return t=r,!1}),i.slice(t)}class v{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new v(t.getMap().invert(),t,this.selection)}}}class y{constructor(e,t,n,r,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=s}}const G=20;function F(i,e,t,n){let r=t.getMeta(I),s;if(r)return r.historyState;t.getMeta(R)&&(i=new y(i.done,i.undone,null,0,-1));let l=t.getMeta("appendedTransaction");if(t.steps.length==0)return i;if(l&&l.getMeta(I))return l.getMeta(I).redo?new y(i.done.addTransform(t,void 0,n,E(e)),i.undone,O(t.mapping.maps),i.prevTime,i.prevComposition):new y(i.done,i.undone.addTransform(t,void 0,n,E(e)),null,i.prevTime,i.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let o=t.getMeta("composition"),p=i.prevTime==0||!l&&i.prevComposition!=o&&(i.prevTime<(t.time||0)-n.newGroupDelay||!z(t,i.prevRanges)),a=l?T(i.prevRanges,t.mapping):O(t.mapping.maps);return new y(i.done.addTransform(t,p?e.selection.getBookmark():void 0,n,E(e)),m.empty,a,t.time,o??i.prevComposition)}else return(s=t.getMeta("rebased"))?new y(i.done.rebased(t,s),i.undone.rebased(t,s),T(i.prevRanges,t.mapping),i.prevTime,i.prevComposition):new y(i.done.addMaps(t.mapping.maps),i.undone.addMaps(t.mapping.maps),T(i.prevRanges,t.mapping),i.prevTime,i.prevComposition)}function z(i,e){if(!e)return!1;if(!i.docChanged)return!0;let t=!1;return i.mapping.maps[0].forEach((n,r)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&r>=e[s]&&(t=!0)}),t}function O(i){let e=[];for(let t=i.length-1;t>=0&&e.length==0;t--)i[t].forEach((n,r,s,l)=>e.push(s,l));return e}function T(i,e){if(!i)return null;let t=[];for(let n=0;n<i.length;n+=2){let r=e.map(i[n],1),s=e.map(i[n+1],-1);r<=s&&t.push(r,s)}return t}function N(i,e,t){let n=E(e),r=I.get(e).spec.config,s=(t?i.undone:i.done).popEvent(e,n);if(!s)return null;let l=s.selection.resolve(s.transform.doc),o=(t?i.done:i.undone).addTransform(s.transform,e.selection.getBookmark(),r,n),p=new y(t?o:s.remaining,t?s.remaining:o,null,0,-1);return s.transform.setSelection(l).setMeta(I,{redo:t,historyState:p})}let P=!1,j=null;function E(i){let e=i.plugins;if(j!=e){P=!1,j=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){P=!0;break}}return P}const I=new x.PluginKey("history"),R=new x.PluginKey("closeHistory");function U(i={}){return i={depth:i.depth||100,newGroupDelay:i.newGroupDelay||500},new x.Plugin({key:I,state:{init(){return new y(m.empty,m.empty,null,0,-1)},apply(e,t,n){return F(t,n,e,i)}},config:i,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n=="historyUndo"?k:n=="historyRedo"?D:null;return r?(t.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function H(i,e){return(t,n)=>{let r=I.getState(t);if(!r||(i?r.undone:r.done).eventCount==0)return!1;if(n){let s=N(r,t,i);s&&n(e?s.scrollIntoView():s)}return!0}}const k=H(!1,!0),D=H(!0,!0),Z=x.Extension.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:i,dispatch:e})=>k(i,e),redo:()=>({state:i,dispatch:e})=>D(i,e)}},addProseMirrorPlugins(){return[U(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});function $(i){var a;const{icon:e=void 0,tooltip:t=void 0,customClass:n="",tooltipOptions:r={},action:s=void 0,isActive:l=void 0,children:o}=i,p=M.icons[e];return g.jsxs(M.Tooltip,{children:[g.jsx(M.TooltipTrigger,{asChild:!0,children:g.jsxs(M.Toggle,{size:"sm",className:`richtext-w-[32px] richtext-h-[32px] ${n}`,disabled:l==null?void 0:l(),onClick:s,children:[p&&g.jsx(p,{className:"richtext-w-4 richtext-h-4"}),o&&g.jsx(g.Fragment,{children:o})]})}),t&&g.jsx(M.TooltipContent,{...r,children:g.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-items-center richtext-text-center richtext-max-w-24",children:[g.jsx("div",{children:t}),!!((a=i==null?void 0:i.shortcutKeys)!=null&&a.length)&&g.jsx("span",{children:M.getShortcutKeys(i==null?void 0:i.shortcutKeys)})]})})]})}const V=["undo","redo"],W=Z.extend({addOptions(){var i;return{...(i=this.parent)==null?void 0:i.call(this),depth:100,newGroupDelay:500,button:({editor:e,t})=>V.map(n=>({component:$,componentProps:{action:()=>{n==="undo"&&e.chain().focus().undo().run(),n==="redo"&&e.chain().focus().redo().run()},shortcutKeys:n==="undo"?["mod","Z"]:["shift","mod","Z"],disabled:n==="undo"?!e.can().undo():!e.can().redo(),isActive:()=>n==="undo"?!e.can().undo():!e.can().redo(),icon:n==="undo"?"Undo2":"Redo2",tooltip:t(`editor.${n}.tooltip`)}}))}}});exports.History=W;
|