reactjs-tiptap-editor 0.2.29 → 0.3.0
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-Bycn676n.js +33 -0
- package/lib/ActionMenuButton-CpFNwSUZ.cjs +1 -0
- package/lib/Attachment.cjs +19 -0
- package/lib/Attachment.d.cts +344 -0
- package/lib/Attachment.d.ts +344 -0
- package/lib/Attachment.js +259 -0
- package/lib/Blockquote.cjs +1 -0
- package/lib/Blockquote.d.cts +343 -0
- package/lib/Blockquote.d.ts +343 -0
- package/lib/Blockquote.js +65 -0
- package/lib/Bold.cjs +1 -0
- package/lib/Bold.d.cts +343 -0
- package/lib/Bold.d.ts +343 -0
- package/lib/Bold.js +90 -0
- package/lib/BulletList.cjs +1 -0
- package/lib/BulletList.d.cts +343 -0
- package/lib/BulletList.d.ts +343 -0
- package/lib/BulletList.js +72 -0
- package/lib/Clear.cjs +1 -0
- package/lib/Clear.d.cts +342 -0
- package/lib/Clear.d.ts +342 -0
- package/lib/Clear.js +23 -0
- package/lib/Code.cjs +1 -0
- package/lib/Code.d.cts +343 -0
- package/lib/Code.d.ts +343 -0
- package/lib/Code.js +70 -0
- package/lib/CodeBlock.cjs +39 -0
- package/lib/CodeBlock.d.cts +352 -0
- package/lib/CodeBlock.d.ts +352 -0
- package/lib/CodeBlock.js +3639 -0
- package/lib/Color.cjs +1 -0
- package/lib/Color.d.cts +350 -0
- package/lib/Color.d.ts +350 -0
- package/lib/Color.js +141 -0
- package/lib/Document.cjs +1 -0
- package/lib/Document.d.cts +272 -0
- package/lib/Document.d.ts +272 -0
- package/lib/Document.js +13 -0
- package/lib/Drawer-BZadE1gM.js +1367 -0
- package/lib/Drawer-rwnFvgZR.cjs +1 -0
- package/lib/Drawer.cjs +1 -0
- package/lib/Drawer.d.cts +344 -0
- package/lib/Drawer.d.ts +344 -0
- package/lib/Drawer.js +7 -0
- package/lib/Emoji.cjs +1 -0
- package/lib/Emoji.d.cts +277 -0
- package/lib/Emoji.d.ts +277 -0
- package/lib/Emoji.js +2168 -0
- package/lib/Excalidraw-B2414Smc.js +651 -0
- package/lib/Excalidraw-D21vMFe0.cjs +1 -0
- package/lib/Excalidraw.cjs +1 -0
- package/lib/Excalidraw.d.cts +278 -0
- package/lib/Excalidraw.d.ts +278 -0
- package/lib/Excalidraw.js +6 -0
- package/lib/ExportPdf.cjs +15 -0
- package/lib/ExportPdf.d.cts +270 -0
- package/lib/ExportPdf.d.ts +270 -0
- package/lib/ExportPdf.js +67 -0
- package/lib/ExportWord.cjs +1 -0
- package/lib/ExportWord.d.cts +341 -0
- package/lib/ExportWord.d.ts +341 -0
- package/lib/ExportWord.js +72 -0
- package/lib/FontFamily.cjs +1 -0
- package/lib/FontFamily.d.cts +354 -0
- package/lib/FontFamily.d.ts +354 -0
- package/lib/FontFamily.js +136 -0
- package/lib/FontSize.cjs +1 -0
- package/lib/FontSize.d.cts +359 -0
- package/lib/FontSize.d.ts +359 -0
- package/lib/FontSize.js +110 -0
- package/lib/FormatPainter.cjs +1 -0
- package/lib/FormatPainter.d.cts +353 -0
- package/lib/FormatPainter.d.ts +353 -0
- package/lib/FormatPainter.js +74 -0
- package/lib/Heading.cjs +1 -0
- package/lib/Heading.d.cts +343 -0
- package/lib/Heading.d.ts +343 -0
- package/lib/Heading.js +147 -0
- package/lib/Highlight.cjs +1 -0
- package/lib/Highlight.d.cts +344 -0
- package/lib/Highlight.d.ts +344 -0
- package/lib/Highlight.js +85 -0
- package/lib/History.cjs +1 -0
- package/lib/History.d.cts +343 -0
- package/lib/History.d.ts +343 -0
- package/lib/History.js +431 -0
- package/lib/HorizontalRule.cjs +1 -0
- package/lib/HorizontalRule.d.cts +343 -0
- package/lib/HorizontalRule.d.ts +343 -0
- package/lib/HorizontalRule.js +87 -0
- package/lib/Iframe.cjs +1 -0
- package/lib/Iframe.d.cts +277 -0
- package/lib/Iframe.d.ts +277 -0
- package/lib/Iframe.js +6 -0
- package/lib/Image.cjs +1 -0
- package/lib/Image.d.cts +370 -0
- package/lib/Image.d.ts +370 -0
- package/lib/Image.js +7 -0
- package/lib/ImageGif.cjs +1 -0
- package/lib/ImageGif.d.cts +292 -0
- package/lib/ImageGif.d.ts +292 -0
- package/lib/ImageGif.js +7 -0
- package/lib/ImportWord.cjs +231 -0
- package/lib/ImportWord.d.cts +353 -0
- package/lib/ImportWord.d.ts +353 -0
- package/lib/ImportWord.js +16620 -0
- package/lib/Indent.cjs +1 -0
- package/lib/Indent.d.cts +344 -0
- package/lib/Indent.d.ts +344 -0
- package/lib/Indent.js +78 -0
- package/lib/Italic.cjs +1 -0
- package/lib/Italic.d.cts +343 -0
- package/lib/Italic.d.ts +343 -0
- package/lib/Italic.js +91 -0
- package/lib/Katex.cjs +1 -0
- package/lib/Katex.d.cts +279 -0
- package/lib/Katex.d.ts +279 -0
- package/lib/Katex.js +197 -0
- package/lib/LineHeight.cjs +1 -0
- package/lib/LineHeight.d.cts +347 -0
- package/lib/LineHeight.d.ts +347 -0
- package/lib/LineHeight.js +137 -0
- package/lib/Link.cjs +5 -0
- package/lib/Link.d.cts +343 -0
- package/lib/Link.d.ts +343 -0
- package/lib/Link.js +1048 -0
- package/lib/ListItem.cjs +1 -0
- package/lib/ListItem.d.cts +269 -0
- package/lib/ListItem.d.ts +269 -0
- package/lib/ListItem.js +33 -0
- package/lib/Mention.cjs +1 -0
- package/lib/Mention.d.cts +272 -0
- package/lib/Mention.d.ts +272 -0
- package/lib/Mention.js +233 -0
- package/lib/Mermaid.cjs +2 -0
- package/lib/Mermaid.d.cts +344 -0
- package/lib/Mermaid.d.ts +344 -0
- package/lib/Mermaid.js +390 -0
- package/lib/MoreMark.cjs +1 -0
- package/lib/MoreMark.d.cts +355 -0
- package/lib/MoreMark.d.ts +355 -0
- package/lib/MoreMark.js +95 -0
- package/lib/MultiColumn.cjs +1 -0
- package/lib/MultiColumn.d.cts +277 -0
- package/lib/MultiColumn.d.ts +277 -0
- package/lib/MultiColumn.js +8 -0
- package/lib/OrderedList.cjs +1 -0
- package/lib/OrderedList.d.cts +343 -0
- package/lib/OrderedList.d.ts +343 -0
- package/lib/OrderedList.js +90 -0
- package/lib/RichTextEditor-Cy9XKEI5.js +11178 -0
- package/lib/RichTextEditor-DkpDEr5U.cjs +137 -0
- package/lib/SearchAndReplace.cjs +1 -0
- package/lib/SearchAndReplace.d.cts +358 -0
- package/lib/SearchAndReplace.d.ts +358 -0
- package/lib/SearchAndReplace.js +339 -0
- package/lib/Selection.cjs +1 -0
- package/lib/Selection.d.cts +272 -0
- package/lib/Selection.d.ts +272 -0
- package/lib/Selection.js +25 -0
- package/lib/SlashCommand.cjs +1 -0
- package/lib/SlashCommand.d.cts +299 -0
- package/lib/SlashCommand.d.ts +299 -0
- package/lib/SlashCommand.js +369 -0
- package/lib/Strike.cjs +1 -0
- package/lib/Strike.d.cts +343 -0
- package/lib/Strike.d.ts +343 -0
- package/lib/Strike.js +80 -0
- package/lib/SubAndSuperScript.cjs +1 -0
- package/lib/SubAndSuperScript.d.cts +358 -0
- package/lib/SubAndSuperScript.d.ts +358 -0
- package/lib/SubAndSuperScript.js +41 -0
- package/lib/Table.cjs +1 -0
- package/lib/Table.d.cts +366 -0
- package/lib/Table.d.ts +366 -0
- package/lib/Table.js +2165 -0
- package/lib/TableOfContent.cjs +1 -0
- package/lib/TableOfContent.d.cts +274 -0
- package/lib/TableOfContent.d.ts +274 -0
- package/lib/TableOfContent.js +184 -0
- package/lib/TaskList.cjs +1 -0
- package/lib/TaskList.d.cts +349 -0
- package/lib/TaskList.d.ts +349 -0
- package/lib/TaskList.js +175 -0
- package/lib/TextAlign.cjs +1 -0
- package/lib/TextAlign.d.cts +353 -0
- package/lib/TextAlign.d.ts +353 -0
- package/lib/TextAlign.js +165 -0
- package/lib/TextBubble.cjs +1 -0
- package/lib/TextBubble.d.cts +343 -0
- package/lib/TextBubble.d.ts +343 -0
- package/lib/TextBubble.js +131 -0
- package/lib/TextDirection.cjs +1 -0
- package/lib/TextDirection.d.cts +270 -0
- package/lib/TextDirection.d.ts +270 -0
- package/lib/TextDirection.js +142 -0
- package/lib/TextUnderline.cjs +1 -0
- package/lib/TextUnderline.d.cts +343 -0
- package/lib/TextUnderline.d.ts +343 -0
- package/lib/TextUnderline.js +61 -0
- package/lib/TrailingNode.cjs +1 -0
- package/lib/TrailingNode.d.cts +280 -0
- package/lib/TrailingNode.d.ts +280 -0
- package/lib/TrailingNode.js +41 -0
- package/lib/Twitter-B_tSItrW.js +1743 -0
- package/lib/Twitter-CfDC4bFV.cjs +17 -0
- package/lib/Twitter.cjs +1 -0
- package/lib/Twitter.d.cts +295 -0
- package/lib/Twitter.d.ts +295 -0
- package/lib/Twitter.js +6 -0
- package/lib/Video.cjs +1 -0
- package/lib/Video.d.cts +371 -0
- package/lib/Video.d.ts +371 -0
- package/lib/Video.js +6 -0
- package/lib/bubble-extra.cjs +2 -0
- package/lib/bubble-extra.d.cts +294 -0
- package/lib/bubble-extra.d.ts +294 -0
- package/lib/bubble-extra.js +623 -0
- package/lib/dom-dataset-CAXnsjYE.cjs +33 -0
- package/lib/dom-dataset-CJ7GyQ2E.js +999 -0
- package/lib/index-COecBbaE.cjs +89 -0
- package/lib/index-ClFtfQ0J.cjs +1 -0
- package/lib/index-CvYIX2-x.js +129 -0
- package/lib/index-CySbCeQd.cjs +1 -0
- package/lib/{index-CO-iymkb.js → index-D9llIWB5.js} +442 -101
- package/lib/index-DXBa3JBo.js +46 -0
- package/lib/index-DjP7Onch.cjs +1 -0
- package/lib/index-Drmyqk9P.js +12322 -0
- package/lib/index-DuhDIOel.js +76 -0
- package/lib/index-LbrE7K9i.cjs +1 -0
- package/lib/index.cjs +2 -1
- package/lib/index.d.cts +290 -108
- package/lib/index.d.ts +290 -108
- package/lib/index.js +587 -13
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +108 -108
- package/lib/locale-bundle.d.ts +108 -108
- package/lib/locale-bundle.js +1 -1
- package/lib/shortId-Bfj8TyNr.cjs +2 -0
- package/lib/shortId-WJVkrvml.js +30 -0
- package/lib/style.css +1 -1
- package/lib/textarea-B45fP3gP.cjs +1 -0
- package/lib/textarea-DXTdXr2y.js +20 -0
- package/package.json +678 -15
- package/lib/RichTextEditor-Ce2IeNE6.js +0 -8265
- package/lib/RichTextEditor-hDDApaDD.cjs +0 -136
- package/lib/extension-bundle.cjs +0 -33
- package/lib/extension-bundle.d.cts +0 -951
- package/lib/extension-bundle.d.ts +0 -951
- package/lib/extension-bundle.js +0 -5982
- package/lib/index-CJ6Hb9MN.cjs +0 -1
- package/lib/tiptap-DOP8lVCQ.js +0 -5950
- package/lib/tiptap-Dq62HiQ9.cjs +0 -113
- package/lib/vendor-BbgkyoD-.js +0 -40297
- package/lib/vendor-DdwtMmSr.cjs +0 -302
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index-COecBbaE.cjs"),P=require("scroll-into-view-if-needed"),i=require("react/jsx-runtime"),f=require("react"),c=require("./RichTextEditor-DkpDEr5U.cjs"),A=require("./index-LbrE7K9i.cjs");function w({editor:e,...t}){const{t:s}=A.useLocale(),[a,n]=f.useState(-1),[r,l]=f.useState([]),[o,x]=f.useState(""),[u,h]=f.useState(""),[m,C]=f.useState(!1),[p,I]=f.useState(!1);return f.useEffect(()=>{m||(x(""),h(""),n(-1),l([]),e.commands.setSearchTerm(""),e.commands.setReplaceTerm(""))},[e,m]),f.useEffect(()=>{m&&e&&e.commands&&e.commands.setSearchTerm&&e.commands.setSearchTerm(o)},[m,o,e]),f.useEffect(()=>{m&&e&&e.commands&&e.commands.setReplaceTerm&&e.commands.setReplaceTerm(u)},[m,u,e]),f.useEffect(()=>{if(!e)return;const d=e.extensionManager.extensions.find(R=>R.name===j.name);if(!d)return;const T=()=>{if(!m)return;const R=d?d.storage.currentIndex:-1,v=d?d.storage.results:[];n(E=>E!==R?R:E),l(E=>c.deepEqual(E,v)?E:v)};return c.listenEvent(c.EVENTS.SEARCH_REPLCE,T),()=>{d&&c.listenEvent(c.EVENTS.SEARCH_REPLCE,T)}},[m,e]),i.jsxs(c.Popover,{onOpenChange:C,open:m,children:[i.jsx(c.PopoverTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:i.jsx(c.ActionButton,{disabled:t==null?void 0:t.disabled,isActive:t==null?void 0:t.isActive,tooltip:t==null?void 0:t.tooltip,children:i.jsx(c.IconComponent,{name:t==null?void 0:t.icon})})}),i.jsxs(c.PopoverContent,{align:"start",className:"richtext-w-full",hideWhenDetached:!0,side:"bottom",children:[i.jsxs("div",{className:"richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between",children:[i.jsx(c.Label,{children:s("editor.search.dialog.text")}),i.jsx("span",{className:"richtext-font-semibold",children:r.length>0?`${a+1}/${r.length}`:"0/0"})]}),i.jsxs("div",{className:"richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:[i.jsx(c.Input,{autoFocus:!0,className:"richtext-w-full",onChange:d=>x(d.target.value),placeholder:"Text",required:!0,type:"text",value:o}),i.jsx(c.Button,{className:"richtext-flex-1",disabled:r.length===0,onClick:e.commands.goToPrevSearchResult,children:i.jsx(c.IconComponent,{name:"ChevronUp"})}),i.jsx(c.Button,{className:"richtext-flex-1",disabled:r.length===0,onClick:e.commands.goToNextSearchResult,children:i.jsx(c.IconComponent,{name:"ChevronDown"})})]}),i.jsx(c.Label,{className:"richtext-mb-[6px]",children:s("editor.replace.dialog.text")}),i.jsx("div",{className:"richtext-mb-[5px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:i.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:i.jsx(c.Input,{className:"richtext-w-80",onChange:d=>h(d.target.value),placeholder:"Text",required:!0,type:"text",value:u})})}),i.jsxs("div",{className:"richtext-mb-[10px] richtext-flex richtext-items-center richtext-space-x-2",children:[i.jsx(c.Switch,{checked:p,onCheckedChange:d=>{I(d),e.commands.setCaseSensitive(d)}}),i.jsx(c.Label,{children:s("editor.replace.caseSensitive")})]}),i.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[i.jsx(c.Button,{className:"richtext-flex-1",disabled:r.length===0,onClick:e.commands.replace,children:s("editor.replace.dialog.text")}),i.jsx(c.Button,{className:"richtext-flex-1",disabled:r.length===0,onClick:e.commands.replaceAll,children:s("editor.replaceAll.dialog.text")})]})]})]})}const S=(e,t)=>t(e.tr);function V(e,t,s){return RegExp(t?e.replace(/[$()*+./?[\\\]^{|}-]/g,String.raw`\$&`):e,s?"gu":"gui")}function L(e,t,s){const a=[];let n=[];const r=[];let l=0;if(!t)return{decorationsToReturn:[],results:[]};e==null||e.descendants((o,x)=>{o.isText?n[l]?n[l]={text:n[l].text+o.text,pos:n[l].pos}:n[l]={text:`${o.text}`,pos:x}:l+=1}),n=n.filter(Boolean);for(const{text:o,pos:x}of n){const u=[...o.matchAll(t)];for(const h of u){if(h[0]==="")break;h.index!==void 0&&r.push({from:x+h.index,to:x+h.index+h[0].length})}}for(const o of r)a.push(g.Decoration.inline(o.from,o.to,{class:s}));return{decorationsToReturn:a,results:r}}function b(e,t,{state:s,dispatch:a}){if(!t[0])return;const{from:r,to:l}=t[0];a&&a(s.tr.insertText(e,r,l))}function y(e,t,s,a){const n=t+1;if(!a[n])return null;const{from:r,to:l}=a[t],o=l-r-e.length+s,{from:x,to:u}=a[n];return a[n]={to:u-o,from:x-o},[o,a]}function D(e,t,{tr:s,dispatch:a}){let n=0,r=t.slice();if(r.length===0)return!1;for(let l=0;l<r.length;l+=1){const{from:o,to:x}=r[l];s.insertText(e,o,x);const u=y(e,l,n,r);u&&(n=u[0],r=u[1])}return a(s),!0}function N({view:e,tr:t,searchResults:s,searchResultCurrentClass:a,gotoIndex:n}){const r=s[n];if(r){const l=t.setMeta("directDecoration",{fromPos:r.from,toPos:r.to,attrs:{class:a}});return e==null||e.dispatch(l),setTimeout(()=>{const o=window.document.querySelector(`.${a}`);o&&P(o,{behavior:"smooth",scrollMode:"if-needed"})},0),!0}return!1}const j=g.Extension.create({name:"search",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),searchTerm:"",replaceTerm:"",results:[],currentIndex:0,searchResultClass:"search-result",searchResultCurrentClass:"search-result-current",caseSensitive:!1,disableRegex:!1,onChange:()=>{},button:({editor:t,t:s})=>({component:w,componentProps:{action:()=>{},icon:"SearchAndReplace",tooltip:s("editor.searchAndReplace.tooltip"),isActive:()=>!1,disabled:!1,editor:t}})}},addStorage(){return{results:[],currentIndex:-1}},addCommands(){return{setSearchTerm:e=>({state:t,dispatch:s})=>(this.options.searchTerm=e,this.storage.results=[],this.storage.currentIndex=0,c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),S(t,s),!1),setReplaceTerm:e=>({state:t,dispatch:s})=>(this.options.replaceTerm=e,S(t,s),!1),setCaseSensitive:e=>({state:t,dispatch:s})=>(this.options.caseSensitive=e,S(t,s),!1),replace:()=>({state:e,dispatch:t})=>{const{replaceTerm:s}=this.options,{currentIndex:a,results:n}=this.storage,r=n[a];return r?(b(s,[r],{state:e,dispatch:t}),this.storage.results.splice(a,1)):(b(s,n,{state:e,dispatch:t}),this.storage.results.shift()),c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),S(e,t),!1},replaceAll:()=>({state:e,tr:t,dispatch:s})=>{const{replaceTerm:a}=this.options,{results:n}=this.storage;return D(a,n,{tr:t,dispatch:s}),this.storage.currentIndex=-1,this.storage.results=[],c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),S(e,s),!1},goToPrevSearchResult:()=>({view:e,tr:t})=>{const{searchResultCurrentClass:s}=this.options,{currentIndex:a,results:n}=this.storage,r=(a+n.length-1)%n.length;return this.storage.currentIndex=r,c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),N({view:e,tr:t,searchResults:n,searchResultCurrentClass:s,gotoIndex:r})},goToNextSearchResult:()=>({view:e,tr:t})=>{const{searchResultCurrentClass:s}=this.options,{currentIndex:a,results:n}=this.storage,r=(a+1)%n.length;return this.storage.currentIndex=r,this.options.onChange&&this.options.onChange(),c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),N({view:e,tr:t,searchResults:n,searchResultCurrentClass:s,gotoIndex:r})}}},addProseMirrorPlugins(){const e=this;return[new g.Plugin({key:new g.PluginKey("search"),state:{init(){return g.DecorationSet.empty},apply(t){const{doc:s,docChanged:a}=t,{searchTerm:n,searchResultClass:r,searchResultCurrentClass:l,disableRegex:o,caseSensitive:x}=e.options;if(a||n){const{decorationsToReturn:u,results:h}=L(s,V(n,o,x),r);if(e.storage.results=h,e.storage.currentIndex>h.length-1&&(e.storage.currentIndex=0),c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),t.getMeta("directDecoration")){const{fromPos:m,toPos:C,attrs:p}=t.getMeta("directDecoration");u.push(g.Decoration.inline(m,C,p))}else h.length>0&&(u[0]=g.Decoration.inline(h[0].from,h[0].to,{class:l}));return g.DecorationSet.create(s,u)}return g.DecorationSet.empty}},props:{decorations(t){return this.getState(t)}}})]}});exports.SearchAndReplace=j;
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { Extension } from '@tiptap/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents the ButtonView function.
|
|
6
|
+
*/
|
|
7
|
+
declare type ButtonView<T = any> = (options: ButtonViewParams<T>) => ButtonViewReturn | ButtonViewReturn[];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Represents the parameters for the ButtonView function.
|
|
11
|
+
*/
|
|
12
|
+
declare interface ButtonViewParams<T = any> {
|
|
13
|
+
/** Editor object */
|
|
14
|
+
editor: Editor;
|
|
15
|
+
/** Extension object */
|
|
16
|
+
extension: Extension<T>;
|
|
17
|
+
/** Translation function */
|
|
18
|
+
t: (path: string) => string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Represents the return value for the ButtonView component.
|
|
23
|
+
*/
|
|
24
|
+
declare interface ButtonViewReturn {
|
|
25
|
+
/** Component */
|
|
26
|
+
component: unknown;
|
|
27
|
+
/** Component props */
|
|
28
|
+
componentProps: ButtonViewReturnComponentProps;
|
|
29
|
+
/** Component slots */
|
|
30
|
+
componentSlots?: ButtonViewReturnComponentSlots;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the props for the ButtonView component.
|
|
35
|
+
*/
|
|
36
|
+
declare interface ButtonViewReturnComponentProps {
|
|
37
|
+
/** Method triggered when action is performed */
|
|
38
|
+
action?: (value?: any) => void;
|
|
39
|
+
/** Whether it is in the active state */
|
|
40
|
+
isActive?: () => boolean;
|
|
41
|
+
/** Button icon */
|
|
42
|
+
icon?: any;
|
|
43
|
+
/** Text displayed on hover */
|
|
44
|
+
tooltip?: string;
|
|
45
|
+
[x: string]: any;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Represents the slots for the ButtonView component.
|
|
50
|
+
*/
|
|
51
|
+
declare interface ButtonViewReturnComponentSlots {
|
|
52
|
+
/** Dialog slot */
|
|
53
|
+
dialog: () => any;
|
|
54
|
+
[x: string]: () => any;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Represents the general options for Tiptap extensions.
|
|
59
|
+
*/
|
|
60
|
+
declare interface GeneralOptions<T> {
|
|
61
|
+
/** Enabled divider */
|
|
62
|
+
divider: boolean;
|
|
63
|
+
/** Enabled spacer */
|
|
64
|
+
spacer: boolean;
|
|
65
|
+
/** Button view function */
|
|
66
|
+
button: ButtonView<T>;
|
|
67
|
+
/** Show on Toolbar */
|
|
68
|
+
toolbar?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare interface Result {
|
|
72
|
+
from: number;
|
|
73
|
+
to: number;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export declare const SearchAndReplace: Extension<SearchOptions, SearchStorage>;
|
|
77
|
+
|
|
78
|
+
declare interface SearchOptions extends GeneralOptions<SearchOptions> {
|
|
79
|
+
searchTerm: string;
|
|
80
|
+
replaceTerm: string;
|
|
81
|
+
searchResultClass: string;
|
|
82
|
+
searchResultCurrentClass: string;
|
|
83
|
+
caseSensitive: boolean;
|
|
84
|
+
disableRegex: boolean;
|
|
85
|
+
onChange?: () => void;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
declare interface SearchStorage {
|
|
89
|
+
results: Result[];
|
|
90
|
+
currentIndex: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { }
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
declare module '@tiptap/core' {
|
|
97
|
+
interface Commands<ReturnType> {
|
|
98
|
+
attachment: {
|
|
99
|
+
setAttachment: (attrs?: unknown) => ReturnType;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
declare module '@tiptap/core' {
|
|
106
|
+
interface Commands<ReturnType> {
|
|
107
|
+
setCodeBlock: {
|
|
108
|
+
setCodeBlock: (options?: any) => ReturnType;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
declare module '@tiptap/core' {
|
|
115
|
+
interface Commands<ReturnType> {
|
|
116
|
+
excalidraw: {
|
|
117
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
declare module '@tiptap/core' {
|
|
124
|
+
interface Commands<ReturnType> {
|
|
125
|
+
emoji: {
|
|
126
|
+
setEmoji: (emoji: {
|
|
127
|
+
name: string;
|
|
128
|
+
emoji: string;
|
|
129
|
+
}) => ReturnType;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
declare module '@tiptap/core' {
|
|
136
|
+
interface Commands<ReturnType> {
|
|
137
|
+
drawer: {
|
|
138
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
139
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
declare module '@tiptap/core' {
|
|
146
|
+
interface Commands<ReturnType> {
|
|
147
|
+
exportWord: {
|
|
148
|
+
exportToWord: () => ReturnType;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
declare module '@tiptap/core' {
|
|
155
|
+
interface Commands<ReturnType> {
|
|
156
|
+
fontSize: {
|
|
157
|
+
/**
|
|
158
|
+
* Set the text font size. ex: "12px", "2em", or "small". Must be a valid
|
|
159
|
+
* CSS font-size
|
|
160
|
+
* (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size).
|
|
161
|
+
*/
|
|
162
|
+
setFontSize: (fontSize: string) => ReturnType;
|
|
163
|
+
/**
|
|
164
|
+
* Unset the font size
|
|
165
|
+
*/
|
|
166
|
+
unsetFontSize: () => ReturnType;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
declare module '@tiptap/core' {
|
|
173
|
+
interface Commands<ReturnType> {
|
|
174
|
+
painter: {
|
|
175
|
+
setPainter: (marks: Mark[]) => ReturnType;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
declare module '@tiptap/core' {
|
|
182
|
+
interface Commands<ReturnType> {
|
|
183
|
+
iframe: {
|
|
184
|
+
/**
|
|
185
|
+
* Add an iframe
|
|
186
|
+
*/
|
|
187
|
+
setIframe: (options: {
|
|
188
|
+
src: string;
|
|
189
|
+
service: string;
|
|
190
|
+
}) => ReturnType;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
declare module '@tiptap/core' {
|
|
197
|
+
interface Commands<ReturnType> {
|
|
198
|
+
imageUpload: {
|
|
199
|
+
/**
|
|
200
|
+
* Add an image
|
|
201
|
+
*/
|
|
202
|
+
setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
203
|
+
/**
|
|
204
|
+
* Update an image
|
|
205
|
+
*/
|
|
206
|
+
updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
207
|
+
/**
|
|
208
|
+
* Set image alignment
|
|
209
|
+
*/
|
|
210
|
+
setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
declare module '@tiptap/core' {
|
|
217
|
+
interface Commands<ReturnType> {
|
|
218
|
+
imageGifUpload: {
|
|
219
|
+
/**
|
|
220
|
+
* Add an image gif
|
|
221
|
+
*/
|
|
222
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
223
|
+
/**
|
|
224
|
+
* Update an image gif
|
|
225
|
+
*/
|
|
226
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
227
|
+
/**
|
|
228
|
+
* Set image alignment
|
|
229
|
+
*/
|
|
230
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
declare module '@tiptap/core' {
|
|
237
|
+
interface Commands<ReturnType> {
|
|
238
|
+
indent: {
|
|
239
|
+
/**
|
|
240
|
+
* Set the indent attribute
|
|
241
|
+
*/
|
|
242
|
+
indent: () => ReturnType;
|
|
243
|
+
/**
|
|
244
|
+
* Set the outdent attribute
|
|
245
|
+
*/
|
|
246
|
+
outdent: () => ReturnType;
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
declare module '@tiptap/core' {
|
|
253
|
+
interface Commands<ReturnType> {
|
|
254
|
+
katex: {
|
|
255
|
+
setKatex: (arg?: IKatexAttrs) => ReturnType;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
declare module '@tiptap/core' {
|
|
262
|
+
interface Commands<ReturnType> {
|
|
263
|
+
lineHeight: {
|
|
264
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
265
|
+
unsetLineHeight: () => ReturnType;
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
declare module '@tiptap/core' {
|
|
272
|
+
interface Commands<ReturnType> {
|
|
273
|
+
mermaid: {
|
|
274
|
+
setMermaid: (options: any, replace?: any) => ReturnType;
|
|
275
|
+
setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
declare module '@tiptap/core' {
|
|
282
|
+
interface Commands<ReturnType> {
|
|
283
|
+
columns: {
|
|
284
|
+
insertColumns: (attrs?: {
|
|
285
|
+
cols: number;
|
|
286
|
+
}) => ReturnType;
|
|
287
|
+
addColBefore: () => ReturnType;
|
|
288
|
+
addColAfter: () => ReturnType;
|
|
289
|
+
deleteCol: () => ReturnType;
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
declare module '@tiptap/core' {
|
|
296
|
+
interface Commands<ReturnType> {
|
|
297
|
+
search: {
|
|
298
|
+
setSearchTerm: (searchTerm: string) => ReturnType;
|
|
299
|
+
setReplaceTerm: (replaceTerm: string) => ReturnType;
|
|
300
|
+
replace: () => ReturnType;
|
|
301
|
+
replaceAll: () => ReturnType;
|
|
302
|
+
goToPrevSearchResult: () => void;
|
|
303
|
+
goToNextSearchResult: () => void;
|
|
304
|
+
setCaseSensitive: (caseSensitive: boolean) => ReturnType;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
declare module '@tiptap/core' {
|
|
311
|
+
interface Commands<ReturnType> {
|
|
312
|
+
tableOfContents: {
|
|
313
|
+
setTableOfContents: () => ReturnType;
|
|
314
|
+
removeTableOfContents: () => ReturnType;
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
declare module '@tiptap/core' {
|
|
321
|
+
interface Commands<ReturnType> {
|
|
322
|
+
twitter: {
|
|
323
|
+
/**
|
|
324
|
+
* Insert a tweet
|
|
325
|
+
* @param options The tweet attributes
|
|
326
|
+
* @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
|
|
327
|
+
*/
|
|
328
|
+
setTweet: (options: SetTweetOptions) => ReturnType;
|
|
329
|
+
updateTweet: (options: SetTweetOptions) => ReturnType;
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
declare module '@tiptap/core' {
|
|
336
|
+
interface Commands<ReturnType> {
|
|
337
|
+
video: {
|
|
338
|
+
/**
|
|
339
|
+
* Add an video
|
|
340
|
+
*/
|
|
341
|
+
setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
|
|
342
|
+
/**
|
|
343
|
+
* Update an video
|
|
344
|
+
*/
|
|
345
|
+
updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
declare module '@tiptap/core' {
|
|
352
|
+
interface Commands<ReturnType> {
|
|
353
|
+
tableCellBackground: {
|
|
354
|
+
setTableCellBackground: (color: string) => ReturnType;
|
|
355
|
+
unsetTableCellBackground: () => ReturnType;
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
}
|