reactjs-tiptap-editor 0.3.31 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/lib/{ActionMenuButton-BCgqJsST.cjs → ActionMenuButton-CYdM1xx5.cjs} +1 -1
- package/lib/{ActionMenuButton-D97K0UWT.js → ActionMenuButton-DKRF6oa0.js} +1 -1
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.d.cts +25 -29
- package/lib/Attachment.d.ts +25 -29
- package/lib/Attachment.js +7 -6
- package/lib/BaseKit.cjs +3 -0
- package/lib/BaseKit.d.cts +481 -0
- package/lib/BaseKit.d.ts +481 -0
- package/lib/BaseKit.js +132 -0
- package/lib/Blockquote.cjs +5 -1
- package/lib/Blockquote.d.cts +25 -29
- package/lib/Blockquote.d.ts +25 -29
- package/lib/Blockquote.js +33 -17
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +25 -29
- package/lib/Bold.d.ts +25 -29
- package/lib/Bold.js +23 -16
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +26 -30
- package/lib/BulletList.d.ts +26 -30
- package/lib/BulletList.js +11 -57
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +25 -29
- package/lib/Clear.d.ts +25 -29
- package/lib/Clear.js +4 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +25 -29
- package/lib/Code.d.ts +25 -29
- package/lib/Code.js +29 -25
- package/lib/CodeBlock.cjs +2 -2
- package/lib/CodeBlock.d.cts +25 -29
- package/lib/CodeBlock.d.ts +25 -29
- package/lib/CodeBlock.js +3 -3
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +25 -29
- package/lib/CodeView.d.ts +25 -29
- package/lib/CodeView.js +3 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +26 -30
- package/lib/Color.d.ts +26 -30
- package/lib/Color.js +42 -74
- package/lib/Document.cjs +1 -1
- package/lib/Document.d.cts +25 -29
- package/lib/Document.d.ts +25 -29
- package/lib/Document.js +4 -8
- package/lib/{Drawer-BHkje8ys.js → Drawer-CaAfmqNo.js} +37 -35
- package/lib/{Drawer-5Q_-WRhc.cjs → Drawer-CdvCMSzN.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +25 -29
- package/lib/Drawer.d.ts +25 -29
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +28 -30
- package/lib/Emoji.d.ts +28 -30
- package/lib/Emoji.js +19795 -184
- package/lib/{Excalidraw-GUVW-IqC.cjs → Excalidraw-BbMQhNvs.cjs} +1 -1
- package/lib/{Excalidraw-CG498239.js → Excalidraw-CVWz2Vyn.js} +20 -20
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +25 -29
- package/lib/Excalidraw.d.ts +25 -29
- package/lib/Excalidraw.js +3 -3
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.d.cts +25 -29
- package/lib/ExportPdf.d.ts +25 -29
- package/lib/ExportPdf.js +4 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +25 -29
- package/lib/ExportWord.d.ts +25 -29
- package/lib/ExportWord.js +22 -51
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +26 -30
- package/lib/FontFamily.d.ts +26 -30
- package/lib/FontFamily.js +44 -73
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +25 -29
- package/lib/FontSize.d.ts +25 -29
- package/lib/FontSize.js +7 -5
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.d.cts +25 -29
- package/lib/FormatPainter.d.ts +25 -29
- package/lib/FormatPainter.js +4 -2
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +25 -29
- package/lib/Heading.d.ts +25 -29
- package/lib/Heading.js +71 -60
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +25 -29
- package/lib/Highlight.d.ts +25 -29
- package/lib/Highlight.js +5 -4
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +27 -31
- package/lib/History.d.ts +27 -31
- package/lib/History.js +39 -403
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +25 -29
- package/lib/HorizontalRule.d.ts +25 -29
- package/lib/HorizontalRule.js +16 -65
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +25 -29
- package/lib/Iframe.d.ts +25 -29
- package/lib/Iframe.js +4 -4
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +25 -29
- package/lib/Image.d.ts +25 -29
- package/lib/Image.js +3 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +25 -29
- package/lib/ImageGif.d.ts +25 -29
- package/lib/ImageGif.js +5 -5
- package/lib/ImportWord.cjs +72 -72
- package/lib/ImportWord.d.cts +25 -29
- package/lib/ImportWord.d.ts +25 -29
- package/lib/ImportWord.js +5652 -5615
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +25 -29
- package/lib/Indent.d.ts +25 -29
- package/lib/Indent.js +4 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +25 -29
- package/lib/Italic.d.ts +25 -29
- package/lib/Italic.js +20 -14
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +25 -29
- package/lib/Katex.d.ts +25 -29
- package/lib/Katex.js +12 -12
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +25 -29
- package/lib/LineHeight.d.ts +25 -29
- package/lib/LineHeight.js +5 -3
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +25 -29
- package/lib/Link.d.ts +25 -29
- package/lib/Link.js +4 -4
- package/lib/ListItem.cjs +1 -1
- package/lib/ListItem.d.cts +30 -30
- package/lib/ListItem.d.ts +30 -30
- package/lib/ListItem.js +4 -30
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.d.cts +25 -29
- package/lib/Mention.d.ts +25 -29
- package/lib/Mention.js +161 -132
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.d.cts +25 -29
- package/lib/Mermaid.d.ts +25 -29
- package/lib/Mermaid.js +50 -48
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +25 -29
- package/lib/MoreMark.d.ts +25 -29
- package/lib/MoreMark.js +5 -3
- package/lib/MultiColumn.cjs +1 -1
- package/lib/MultiColumn.d.cts +25 -29
- package/lib/MultiColumn.d.ts +25 -29
- package/lib/MultiColumn.js +2 -2
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +26 -30
- package/lib/OrderedList.d.ts +26 -30
- package/lib/OrderedList.js +11 -75
- package/lib/RichTextEditor-CxvwGvQG.cjs +142 -0
- package/lib/RichTextEditor-DGcKEUGr.js +22166 -0
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +38 -112
- package/lib/SearchAndReplace.d.ts +38 -112
- package/lib/SearchAndReplace.js +204 -192
- package/lib/Selection.cjs +1 -1
- package/lib/Selection.d.cts +25 -29
- package/lib/Selection.d.ts +25 -29
- package/lib/Selection.js +1 -1
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +25 -29
- package/lib/SlashCommand.d.ts +25 -29
- package/lib/SlashCommand.js +178 -223
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +25 -29
- package/lib/Strike.d.ts +25 -29
- package/lib/Strike.js +20 -14
- package/lib/SubAndSuperScript.cjs +1 -1
- package/lib/SubAndSuperScript.d.cts +25 -29
- package/lib/SubAndSuperScript.d.ts +25 -29
- package/lib/SubAndSuperScript.js +5 -3
- package/lib/Table.cjs +8 -10
- package/lib/Table.d.cts +28 -32
- package/lib/Table.d.ts +28 -32
- package/lib/Table.js +382 -2022
- package/lib/TableOfContent.cjs +1 -1
- package/lib/TableOfContent.d.cts +25 -29
- package/lib/TableOfContent.d.ts +25 -29
- package/lib/TableOfContent.js +5 -5
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +27 -31
- package/lib/TaskList.d.ts +27 -31
- package/lib/TaskList.js +12 -154
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +25 -29
- package/lib/TextAlign.d.ts +25 -29
- package/lib/TextAlign.js +11 -9
- package/lib/TextBubble.cjs +1 -1
- package/lib/TextBubble.d.cts +25 -29
- package/lib/TextBubble.d.ts +25 -29
- package/lib/TextBubble.js +5 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +25 -29
- package/lib/TextDirection.d.ts +25 -29
- package/lib/TextDirection.js +2 -3
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +25 -29
- package/lib/TextUnderline.d.ts +25 -29
- package/lib/TextUnderline.js +40 -12
- package/lib/TrailingNode.cjs +1 -1
- package/lib/TrailingNode.d.cts +25 -29
- package/lib/TrailingNode.d.ts +25 -29
- package/lib/TrailingNode.js +1 -1
- package/lib/Twitter-BFULyqdR.js +1628 -0
- package/lib/Twitter-Cutpkh3h.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +25 -29
- package/lib/Twitter.d.ts +25 -29
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +25 -29
- package/lib/Video.d.ts +25 -29
- package/lib/Video.js +3 -3
- package/lib/bubble-extra.cjs +2 -2
- package/lib/bubble-extra.d.cts +25 -29
- package/lib/bubble-extra.d.ts +25 -29
- package/lib/bubble-extra.js +200 -192
- package/lib/dom-dataset-_6-diIRQ.cjs +33 -0
- package/lib/dom-dataset-lYeH6gfI.js +2361 -0
- package/lib/index-5iBZLua9.cjs +12 -0
- package/lib/index-6D1J-A-o.cjs +1 -0
- package/lib/index-B96Cclrj.cjs +3 -0
- package/lib/index-BBz7Nmv9.js +55 -0
- package/lib/index-BeCTd5v2.cjs +1 -0
- package/lib/index-ByurDDMv.js +237 -0
- package/lib/index-CUogRI7j.cjs +1 -0
- package/lib/index-Ch6dBBad.js +709 -0
- package/lib/index-DF2Lp4HZ.cjs +100 -0
- package/lib/{index-LUL9mqY4.js → index-D_L6n8O8.js} +4 -4
- package/lib/index-Dbvi-Bvh.cjs +1 -0
- package/lib/index-DpCrt7xs.cjs +1 -0
- package/lib/index-DsAX1Vq8.cjs +1 -0
- package/lib/index-Dy4DlW9o.js +12 -0
- package/lib/index-J3jHHZ4d.js +200 -0
- package/lib/{index-CsK90iVd.js → index-LmrOdnen.js} +302 -389
- package/lib/index-VvXaaKe3.js +898 -0
- package/lib/index-kbO3iWqL.js +13432 -0
- package/lib/index.cjs +1 -2
- package/lib/index.d.cts +26 -229
- package/lib/index.d.ts +26 -229
- package/lib/index.js +2 -588
- package/lib/jsx-runtime-CT7Pcg-t.js +13 -0
- package/lib/jsx-runtime-C_NLcKys.cjs +1 -0
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +25 -29
- package/lib/locale-bundle.d.ts +25 -29
- package/lib/locale-bundle.js +1 -1
- package/lib/style.css +1 -1
- package/lib/{textarea-DdH64g04.cjs → textarea-DFo_aXnj.cjs} +1 -1
- package/lib/{textarea-CktfkXNe.js → textarea-aPtytkDx.js} +1 -1
- package/package.json +76 -70
- package/lib/RichTextEditor-DWlLqTl9.cjs +0 -140
- package/lib/RichTextEditor-KP2Rgcqe.js +0 -12751
- package/lib/Twitter-99ivY5qv.js +0 -1744
- package/lib/Twitter-BvfvUtNT.cjs +0 -17
- package/lib/dom-dataset-Byuf1YmW.cjs +0 -33
- package/lib/dom-dataset-Di3tIRrR.js +0 -1031
- package/lib/index-BI-IcZcN.cjs +0 -1
- package/lib/index-ByRfqzMr.cjs +0 -89
- package/lib/index-C1fzuXpN.js +0 -46
- package/lib/index-CbQQFj2T.js +0 -133
- package/lib/index-DI9T3iLd.js +0 -12354
- package/lib/index-D_A0TBRA.cjs +0 -1
- package/lib/index-DclQSrIx.cjs +0 -1
- package/lib/index-Z4b9rzn-.cjs +0 -1
package/lib/SearchAndReplace.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-DF2Lp4HZ.cjs"),r=require("react/jsx-runtime"),f=require("react"),u=require("./RichTextEditor-CxvwGvQG.cjs"),L=require("./index-6D1J-A-o.cjs");function B({editor:e,...t}){const{t:s}=L.useLocale(),[n,i]=f.useState(!1),[a,c]=f.useState(""),[o,h]=f.useState(""),[l,g]=f.useState(!1),[d,m]=f.useState(""),R=()=>{var x,I,T,C;m(`${((I=(x=e==null?void 0:e.storage)==null?void 0:x.searchAndReplace)==null?void 0:I.resultIndex)+1}/${(C=(T=e==null?void 0:e.storage)==null?void 0:T.searchAndReplace)==null?void 0:C.results.length}`)};f.useEffect(()=>{e&&R()},[e]);const A=(x=!1)=>{e&&(x&&e.commands.resetIndex(),e.commands.setSearchTerm(a),e.commands.setReplaceTerm(o),e.commands.setCaseSensitive(l),R())},v=()=>{if(!e)return;const{results:x,resultIndex:I}=e.storage.searchAndReplace,T=x[I];if(!T)return;e.commands.setTextSelection(T);const{node:C}=e.view.domAtPos(e.state.selection.anchor);C instanceof HTMLElement&&C.scrollIntoView({behavior:"smooth",block:"center"}),R()};f.useEffect(()=>{a.trim()||j(),a.trim()&&A(!0)},[a]),f.useEffect(()=>{o.trim()&&A()},[o]),f.useEffect(()=>{A(!0)},[l]);const b=()=>{e==null||e.commands.replace(),v()},y=()=>{e==null||e.commands.nextSearchResult(),v()},P=()=>{e==null||e.commands.previousSearchResult(),v()},j=()=>{c(""),h(""),e.commands.resetIndex(),R()},k=()=>{e==null||e.commands.replaceAll(),m("0/0")};return r.jsxs(u.Popover,{onOpenChange:i,open:n,children:[r.jsx(u.PopoverTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:r.jsx(u.ActionButton,{disabled:t==null?void 0:t.disabled,isActive:t==null?void 0:t.isActive,tooltip:t==null?void 0:t.tooltip,tooltipOptions:t==null?void 0:t.tooltipOptions,children:r.jsx(u.IconComponent,{name:t==null?void 0:t.icon})})}),r.jsxs(u.PopoverContent,{align:"start",className:"richtext-w-full",hideWhenDetached:!0,side:"bottom",children:[r.jsxs("div",{className:"richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between",children:[r.jsx(u.Label,{children:s("editor.search.dialog.text")}),r.jsx("span",{className:"richtext-font-semibold",children:d})]}),r.jsxs("div",{className:"richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:[r.jsx(u.Input,{autoFocus:!0,className:"richtext-w-full",onChange:x=>c(x.target.value),placeholder:"Text",required:!0,type:"text",value:a}),r.jsx(u.Button,{className:"richtext-flex-1",onClick:P,children:r.jsx(u.IconComponent,{name:"ChevronUp"})}),r.jsx(u.Button,{className:"richtext-flex-1",onClick:y,children:r.jsx(u.IconComponent,{name:"ChevronDown"})}),r.jsx(u.Button,{className:"richtext-flex-1",onClick:j,children:"Clear"})]}),r.jsx(u.Label,{className:"richtext-mb-[6px]",children:s("editor.replace.dialog.text")}),r.jsx("div",{className:"richtext-mb-[5px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:r.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:r.jsx(u.Input,{className:"richtext-w-80",onChange:x=>h(x.target.value),placeholder:"Text",required:!0,type:"text",value:o})})}),r.jsxs("div",{className:"richtext-mb-[10px] richtext-flex richtext-items-center richtext-space-x-2",children:[r.jsx(u.Switch,{checked:l,onCheckedChange:x=>{g(x),e.commands.setCaseSensitive(x)}}),r.jsx(u.Label,{children:s("editor.replace.caseSensitive")})]}),r.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[r.jsx(u.Button,{className:"richtext-flex-1",onClick:b,children:s("editor.replace.dialog.text")}),r.jsx(u.Button,{className:"richtext-flex-1",onClick:k,children:s("editor.replaceAll.dialog.text")})]})]})]})}const S=(e,t)=>t(e.tr);function $(e,t,s){return RegExp(t?e.replace(/[$()*+.?[\\\]^{|}]/g,String.raw`\$&`):e,s?"gu":"gui")}function q(e,t,s,n){const i=[],a=[];let c=[],o=0;if(!t)return{decorationsToReturn:p.DecorationSet.empty,results:[]};e==null||e.descendants((h,l)=>{h.isText?c[o]?c[o]={text:c[o].text+h.text,pos:c[o].pos}:c[o]={text:`${h.text}`,pos:l}:o+=1}),c=c.filter(Boolean);for(const h of c){const{text:l,pos:g}=h,d=Array.from(l.matchAll(t)).filter(([m])=>m.trim());for(const m of d){if(m[0]==="")break;m.index!==void 0&&a.push({from:g+m.index,to:g+m.index+m[0].length})}}for(const[h,l]of a.entries()){const g=h===n?`${s} ${s}-current`:s,d=p.Decoration.inline(l.from,l.to,{class:g});i.push(d)}return{decorationsToReturn:p.DecorationSet.create(e,i),results:a}}function N(e,t,{state:s,dispatch:n}){if(!t[0])return;const{from:a,to:c}=t[0];n&&n(s.tr.insertText(e,a,c))}function D(e,t,s,n){const i=t+1;if(!n[i])return null;const{from:a,to:c}=n[t],o=c-a-e.length+s,{from:h,to:l}=n[i];return n[i]={to:l-o,from:h-o},[o,n]}function E(e,t,{tr:s,dispatch:n}){let i=0,a=t.slice();if(a.length!==0){for(let c=0;c<a.length;c+=1){const{from:o,to:h}=a[c];s.insertText(e,o,h);const l=D(e,c,i,a);l&&(i=l[0],a=l[1])}n(s)}}const w=new p.PluginKey("searchAndReplacePlugin"),O=p.Extension.create({name:"searchAndReplace",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),searchTerm:"",replaceTerm:"",results:[],searchResultClass:"search-result",searchResultCurrentClass:"search-result-current",caseSensitive:!1,disableRegex:!0,onChange:()=>{},button:({editor:t,t:s})=>({component:B,componentProps:{action:()=>{},icon:"SearchAndReplace",tooltip:s("editor.searchAndReplace.tooltip"),isActive:()=>!1,disabled:!1,editor:t}})}},addStorage(){return{searchTerm:"",replaceTerm:"",results:[],lastSearchTerm:"",caseSensitive:!1,lastCaseSensitive:!1,resultIndex:0,lastResultIndex:0}},addCommands(){return{setSearchTerm:e=>({editor:t,state:s,dispatch:n})=>(t.storage.searchAndReplace.searchTerm=e,S(s,n),!1),setReplaceTerm:e=>({editor:t,state:s,dispatch:n})=>(t.storage.searchAndReplace.replaceTerm=e,S(s,n),!1),setCaseSensitive:e=>({editor:t,state:s,dispatch:n})=>(t.storage.searchAndReplace.caseSensitive=e,S(s,n),!1),resetIndex:()=>({editor:e,state:t,dispatch:s})=>(e.storage.searchAndReplace.resultIndex=0,S(t,s),!1),nextSearchResult:()=>({editor:e})=>{const{results:t,resultIndex:s}=e.storage.searchAndReplace,n=s+1;return t[n]?e.storage.searchAndReplace.resultIndex=n:e.storage.searchAndReplace.resultIndex=0,!1},previousSearchResult:()=>({editor:e})=>{const{results:t,resultIndex:s}=e.storage.searchAndReplace,n=s-1;return t[n]?e.storage.searchAndReplace.resultIndex=n:e.storage.searchAndReplace.resultIndex=t.length-1,!1},replace:()=>({editor:e,state:t,dispatch:s})=>{const{replaceTerm:n,results:i,resultIndex:a}=e.storage.searchAndReplace,c=i[a];return c?(N(n,[c],{state:t,dispatch:s}),e.storage.searchAndReplace.results.splice(a,1)):(N(n,i,{state:t,dispatch:s}),e.storage.searchAndReplace.results.shift()),S(t,s),!1},replaceAll:()=>({editor:e,tr:t,state:s,dispatch:n})=>{const{replaceTerm:i,results:a}=e.storage.searchAndReplace;return E(i,a,{tr:t,dispatch:n}),e.storage.searchAndReplace.resultIndex=0,e.storage.searchAndReplace.results=[],S(s,n),!1}}},addProseMirrorPlugins(){const e=this.editor,{searchResultClass:t,disableRegex:s}=this.options,n=c=>e.storage.searchAndReplace.lastSearchTerm=c,i=c=>e.storage.searchAndReplace.lastCaseSensitive=c,a=c=>e.storage.searchAndReplace.lastResultIndex=c;return[new p.Plugin({key:w,state:{init:()=>p.DecorationSet.empty,apply({doc:c,docChanged:o},h){const{searchTerm:l,lastSearchTerm:g,caseSensitive:d,lastCaseSensitive:m,resultIndex:R,lastResultIndex:A}=e.storage.searchAndReplace;if(!o&&g===l&&m===d&&A===R)return h;if(n(l),i(d),a(R),!l)return e.storage.searchAndReplace.results=[],p.DecorationSet.empty;const{decorationsToReturn:v,results:b}=q(c,$(l,s,d),t,R);return e.storage.searchAndReplace.results=b,v}},props:{decorations(c){return this.getState(c)}}})]}});exports.SearchAndReplace=O;exports.searchAndReplacePluginKey=w;
|
|
@@ -1,95 +1,25 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/react';
|
|
2
1
|
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { PluginKey } from '@tiptap/pm/state';
|
|
3
|
+
import { Range as Range_2 } from '@tiptap/core';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
* Represents the ButtonView function.
|
|
6
|
-
*/
|
|
7
|
-
declare type ButtonView<T = any> = (options: ButtonViewParams<T>) => ButtonViewReturn | ButtonViewReturn[];
|
|
5
|
+
export declare const SearchAndReplace: Extension<SearchAndReplaceOptions, SearchAndReplaceStorage>;
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
/** Shortcut keys override */
|
|
70
|
-
shortcutKeys?: string[] | string[][];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
declare interface Result {
|
|
74
|
-
from: number;
|
|
75
|
-
to: number;
|
|
7
|
+
export declare interface SearchAndReplaceOptions {
|
|
8
|
+
searchResultClass: string;
|
|
9
|
+
disableRegex: boolean;
|
|
76
10
|
}
|
|
77
11
|
|
|
78
|
-
export declare const
|
|
12
|
+
export declare const searchAndReplacePluginKey: PluginKey<any>;
|
|
79
13
|
|
|
80
|
-
declare interface
|
|
14
|
+
export declare interface SearchAndReplaceStorage {
|
|
81
15
|
searchTerm: string;
|
|
82
16
|
replaceTerm: string;
|
|
83
|
-
|
|
84
|
-
|
|
17
|
+
results: Range_2[];
|
|
18
|
+
lastSearchTerm: string;
|
|
85
19
|
caseSensitive: boolean;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
declare interface SearchStorage {
|
|
91
|
-
results: Result[];
|
|
92
|
-
currentIndex: number;
|
|
20
|
+
lastCaseSensitive: boolean;
|
|
21
|
+
resultIndex: number;
|
|
22
|
+
lastResultIndex: number;
|
|
93
23
|
}
|
|
94
24
|
|
|
95
25
|
export { }
|
|
@@ -135,18 +65,6 @@ declare module '@tiptap/core' {
|
|
|
135
65
|
}
|
|
136
66
|
|
|
137
67
|
|
|
138
|
-
declare module '@tiptap/core' {
|
|
139
|
-
interface Commands<ReturnType> {
|
|
140
|
-
emoji: {
|
|
141
|
-
setEmoji: (emoji: {
|
|
142
|
-
name: string;
|
|
143
|
-
emoji: string;
|
|
144
|
-
}) => ReturnType;
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
68
|
declare module '@tiptap/core' {
|
|
151
69
|
interface Commands<ReturnType> {
|
|
152
70
|
excalidraw: {
|
|
@@ -238,19 +156,15 @@ declare module '@tiptap/core' {
|
|
|
238
156
|
|
|
239
157
|
declare module '@tiptap/core' {
|
|
240
158
|
interface Commands<ReturnType> {
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Add an image gif
|
|
244
|
-
*/
|
|
245
|
-
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
159
|
+
indent: {
|
|
246
160
|
/**
|
|
247
|
-
*
|
|
161
|
+
* Set the indent attribute
|
|
248
162
|
*/
|
|
249
|
-
|
|
163
|
+
indent: () => ReturnType;
|
|
250
164
|
/**
|
|
251
|
-
* Set
|
|
165
|
+
* Set the outdent attribute
|
|
252
166
|
*/
|
|
253
|
-
|
|
167
|
+
outdent: () => ReturnType;
|
|
254
168
|
};
|
|
255
169
|
}
|
|
256
170
|
}
|
|
@@ -258,15 +172,19 @@ declare module '@tiptap/core' {
|
|
|
258
172
|
|
|
259
173
|
declare module '@tiptap/core' {
|
|
260
174
|
interface Commands<ReturnType> {
|
|
261
|
-
|
|
175
|
+
imageGifUpload: {
|
|
262
176
|
/**
|
|
263
|
-
*
|
|
177
|
+
* Add an image gif
|
|
264
178
|
*/
|
|
265
|
-
|
|
179
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
266
180
|
/**
|
|
267
|
-
*
|
|
181
|
+
* Update an image gif
|
|
268
182
|
*/
|
|
269
|
-
|
|
183
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
184
|
+
/**
|
|
185
|
+
* Set image alignment
|
|
186
|
+
*/
|
|
187
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
270
188
|
};
|
|
271
189
|
}
|
|
272
190
|
}
|
|
@@ -320,16 +238,24 @@ declare module '@tiptap/core' {
|
|
|
320
238
|
search: {
|
|
321
239
|
setSearchTerm: (searchTerm: string) => ReturnType;
|
|
322
240
|
setReplaceTerm: (replaceTerm: string) => ReturnType;
|
|
241
|
+
setCaseSensitive: (caseSensitive: boolean) => ReturnType;
|
|
242
|
+
resetIndex: () => ReturnType;
|
|
243
|
+
nextSearchResult: () => ReturnType;
|
|
244
|
+
previousSearchResult: () => ReturnType;
|
|
323
245
|
replace: () => ReturnType;
|
|
324
246
|
replaceAll: () => ReturnType;
|
|
325
|
-
goToPrevSearchResult: () => void;
|
|
326
|
-
goToNextSearchResult: () => void;
|
|
327
|
-
setCaseSensitive: (caseSensitive: boolean) => ReturnType;
|
|
328
247
|
};
|
|
329
248
|
}
|
|
330
249
|
}
|
|
331
250
|
|
|
332
251
|
|
|
252
|
+
declare module '@tiptap/core' {
|
|
253
|
+
interface Storage {
|
|
254
|
+
searchAndReplace: SearchAndReplaceStorage;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
|
|
333
259
|
declare module '@tiptap/core' {
|
|
334
260
|
interface Commands<ReturnType> {
|
|
335
261
|
tableOfContents: {
|
|
@@ -1,95 +1,25 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/react';
|
|
2
1
|
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { PluginKey } from '@tiptap/pm/state';
|
|
3
|
+
import { Range as Range_2 } from '@tiptap/core';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
* Represents the ButtonView function.
|
|
6
|
-
*/
|
|
7
|
-
declare type ButtonView<T = any> = (options: ButtonViewParams<T>) => ButtonViewReturn | ButtonViewReturn[];
|
|
5
|
+
export declare const SearchAndReplace: Extension<SearchAndReplaceOptions, SearchAndReplaceStorage>;
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
/** Shortcut keys override */
|
|
70
|
-
shortcutKeys?: string[] | string[][];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
declare interface Result {
|
|
74
|
-
from: number;
|
|
75
|
-
to: number;
|
|
7
|
+
export declare interface SearchAndReplaceOptions {
|
|
8
|
+
searchResultClass: string;
|
|
9
|
+
disableRegex: boolean;
|
|
76
10
|
}
|
|
77
11
|
|
|
78
|
-
export declare const
|
|
12
|
+
export declare const searchAndReplacePluginKey: PluginKey<any>;
|
|
79
13
|
|
|
80
|
-
declare interface
|
|
14
|
+
export declare interface SearchAndReplaceStorage {
|
|
81
15
|
searchTerm: string;
|
|
82
16
|
replaceTerm: string;
|
|
83
|
-
|
|
84
|
-
|
|
17
|
+
results: Range_2[];
|
|
18
|
+
lastSearchTerm: string;
|
|
85
19
|
caseSensitive: boolean;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
declare interface SearchStorage {
|
|
91
|
-
results: Result[];
|
|
92
|
-
currentIndex: number;
|
|
20
|
+
lastCaseSensitive: boolean;
|
|
21
|
+
resultIndex: number;
|
|
22
|
+
lastResultIndex: number;
|
|
93
23
|
}
|
|
94
24
|
|
|
95
25
|
export { }
|
|
@@ -135,18 +65,6 @@ declare module '@tiptap/core' {
|
|
|
135
65
|
}
|
|
136
66
|
|
|
137
67
|
|
|
138
|
-
declare module '@tiptap/core' {
|
|
139
|
-
interface Commands<ReturnType> {
|
|
140
|
-
emoji: {
|
|
141
|
-
setEmoji: (emoji: {
|
|
142
|
-
name: string;
|
|
143
|
-
emoji: string;
|
|
144
|
-
}) => ReturnType;
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
68
|
declare module '@tiptap/core' {
|
|
151
69
|
interface Commands<ReturnType> {
|
|
152
70
|
excalidraw: {
|
|
@@ -238,19 +156,15 @@ declare module '@tiptap/core' {
|
|
|
238
156
|
|
|
239
157
|
declare module '@tiptap/core' {
|
|
240
158
|
interface Commands<ReturnType> {
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Add an image gif
|
|
244
|
-
*/
|
|
245
|
-
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
159
|
+
indent: {
|
|
246
160
|
/**
|
|
247
|
-
*
|
|
161
|
+
* Set the indent attribute
|
|
248
162
|
*/
|
|
249
|
-
|
|
163
|
+
indent: () => ReturnType;
|
|
250
164
|
/**
|
|
251
|
-
* Set
|
|
165
|
+
* Set the outdent attribute
|
|
252
166
|
*/
|
|
253
|
-
|
|
167
|
+
outdent: () => ReturnType;
|
|
254
168
|
};
|
|
255
169
|
}
|
|
256
170
|
}
|
|
@@ -258,15 +172,19 @@ declare module '@tiptap/core' {
|
|
|
258
172
|
|
|
259
173
|
declare module '@tiptap/core' {
|
|
260
174
|
interface Commands<ReturnType> {
|
|
261
|
-
|
|
175
|
+
imageGifUpload: {
|
|
262
176
|
/**
|
|
263
|
-
*
|
|
177
|
+
* Add an image gif
|
|
264
178
|
*/
|
|
265
|
-
|
|
179
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
266
180
|
/**
|
|
267
|
-
*
|
|
181
|
+
* Update an image gif
|
|
268
182
|
*/
|
|
269
|
-
|
|
183
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
184
|
+
/**
|
|
185
|
+
* Set image alignment
|
|
186
|
+
*/
|
|
187
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
270
188
|
};
|
|
271
189
|
}
|
|
272
190
|
}
|
|
@@ -320,16 +238,24 @@ declare module '@tiptap/core' {
|
|
|
320
238
|
search: {
|
|
321
239
|
setSearchTerm: (searchTerm: string) => ReturnType;
|
|
322
240
|
setReplaceTerm: (replaceTerm: string) => ReturnType;
|
|
241
|
+
setCaseSensitive: (caseSensitive: boolean) => ReturnType;
|
|
242
|
+
resetIndex: () => ReturnType;
|
|
243
|
+
nextSearchResult: () => ReturnType;
|
|
244
|
+
previousSearchResult: () => ReturnType;
|
|
323
245
|
replace: () => ReturnType;
|
|
324
246
|
replaceAll: () => ReturnType;
|
|
325
|
-
goToPrevSearchResult: () => void;
|
|
326
|
-
goToNextSearchResult: () => void;
|
|
327
|
-
setCaseSensitive: (caseSensitive: boolean) => ReturnType;
|
|
328
247
|
};
|
|
329
248
|
}
|
|
330
249
|
}
|
|
331
250
|
|
|
332
251
|
|
|
252
|
+
declare module '@tiptap/core' {
|
|
253
|
+
interface Storage {
|
|
254
|
+
searchAndReplace: SearchAndReplaceStorage;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
|
|
333
259
|
declare module '@tiptap/core' {
|
|
334
260
|
interface Commands<ReturnType> {
|
|
335
261
|
tableOfContents: {
|