reactjs-tiptap-editor 1.0.14 → 1.0.16
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-DNj0f_A4.cjs → ActionMenuButton-BYu0NyVo.cjs} +1 -1
- package/lib/{ActionMenuButton-l5rSmAO_.js → ActionMenuButton-a8LhmHXe.js} +5 -5
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +6 -6
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +4 -4
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +4 -4
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +4 -4
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +36 -40
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +3 -3
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +4 -4
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +6 -6
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +4 -4
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +6 -6
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +4 -4
- package/lib/{Drawer-Cbi_MURj.js → Drawer-CbOJ1Igo.js} +8 -8
- package/lib/{Drawer-DKU32YW_.cjs → Drawer-DNaDMoAk.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +212 -2076
- package/lib/{Excalidraw-CWrVL5hs.js → Excalidraw-DnHTVOj8.js} +6 -6
- package/lib/{Excalidraw-Kb-TRcWY.cjs → Excalidraw-DxfO1lQ_.cjs} +1 -1
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +2 -2
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +4 -4
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +4 -4
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +6 -6
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +6 -6
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +6 -6
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +6 -6
- package/lib/History.cjs +1 -1
- package/lib/History.js +22 -22
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +4 -4
- package/lib/{Icon-Ctva8VeB.js → Icon-C0TJMAOm.js} +2 -2
- package/lib/{Icon-yqCglrdK.cjs → Icon-DzK0_ztP.cjs} +1 -1
- package/lib/{Iframe-BczF8Hex.cjs → Iframe-BSNCsofW.cjs} +1 -1
- package/lib/{Iframe-C942bNjs.js → Iframe-CmjbQQcz.js} +6 -6
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image-BZEFuS0P.js +925 -0
- package/lib/Image-iKsGKjvg.cjs +1 -0
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +5 -828
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +9 -9
- package/lib/ImportWord.cjs +1 -231
- package/lib/ImportWord.js +91 -16623
- package/lib/{Indent-C_O5WdyR.js → Indent-BoG-vpIE.js} +4 -4
- package/lib/{Indent-CkEC7x36.cjs → Indent-Bou16OcB.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +4 -4
- package/lib/Katex-BqDocr3a.cjs +4 -0
- package/lib/{Katex-D3PEWimM.js → Katex-ByL9snce.js} +369 -347
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +7 -7
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-DL1e2ILk.cjs → LinkEditBlock-B0I0EUrt.cjs} +1 -1
- package/lib/{LinkEditBlock-h5054QDo.js → LinkEditBlock-Ckih17pU.js} +11 -11
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +41 -63
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +16 -16
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +7 -7
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +4 -4
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +11 -11
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +9 -9
- package/lib/{SlashCommandNodeView-DXUqkx82.js → SlashCommandNodeView-B2g1MbgN.js} +76 -83
- package/lib/SlashCommandNodeView-BEJhEzba.cjs +1 -0
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +4 -4
- package/lib/{Table-DdrY4jcM.js → Table-BEwrZVup.js} +22 -22
- package/lib/{Table-kY0nbqJo.cjs → Table-BclWwp6P.cjs} +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +4 -4
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +7 -7
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +7 -7
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +4 -4
- package/lib/{Twitter-B-JQ3ZJ1.js → Twitter-4U_ZBhpv.js} +10 -10
- package/lib/{Twitter-DjZcVa3l.cjs → Twitter-Dtq6PEMC.cjs} +1 -1
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +2 -2
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +9 -9
- package/lib/bubble.cjs +1 -1
- package/lib/bubble.js +27 -27
- package/lib/{button-Uv01FNnd.js → button-Bwn6gUuS.js} +2 -2
- package/lib/{button-BS3n6_Aq.cjs → button-CqJztfH2.cjs} +1 -1
- package/lib/{checkbox-C8ByRi7-.cjs → checkbox-BAzbZY2Y.cjs} +1 -1
- package/lib/{checkbox-DEFNwGwb.js → checkbox-B_rpz5Xq.js} +1 -1
- package/lib/{clsx-BWSGDJNJ.js → clsx-DSzxBzvL.js} +11 -11
- package/lib/{dialog-DwTMZSt6.js → dialog-CJvpoeMm.js} +1 -1
- package/lib/{dialog-Bt5zwGYB.cjs → dialog-CWYTvz5J.cjs} +1 -1
- package/lib/{dropdown-menu-BetI14G6.js → dropdown-menu-CW3Kthwy.js} +1 -1
- package/lib/{dropdown-menu-Bo68IEOT.cjs → dropdown-menu-eUeBXQeA.cjs} +1 -1
- package/lib/extensions/Emoji/Emoji.d.ts +3 -1
- package/lib/extensions/Emoji/components/EmojiList/EmojiNodeView.d.ts +9 -1
- package/lib/{index-CHKWG6E8.js → index-4bHF5ovf.js} +1 -1
- package/lib/index-BG0kQamI.js +285 -0
- package/lib/{index-Doks9cbR.cjs → index-BsFvo9PG.cjs} +1 -1
- package/lib/{index-Dujzr6bY.js → index-C07N8gA1.js} +69 -73
- package/lib/{index-CcoWj0mF.js → index-CL7JP-Xz.js} +1 -1
- package/lib/index-Cn-t3Zxw.cjs +1 -0
- package/lib/{index-mR8PNv5P.js → index-CpTykZBR.js} +1 -1
- package/lib/{index-BDKHXe7R.js → index-D8li6EQ4.js} +1 -1
- package/lib/{index-DJbmnBzK.js → index-DR5tIdL7.js} +1 -1
- package/lib/{index-DF5ZPtWM.js → index-DoiuU6VA.js} +54 -56
- package/lib/index-NsYff_Ni.cjs +1 -0
- package/lib/index.cjs +2 -2
- package/lib/index.js +4 -4
- package/lib/{input-DUBdJD3L.js → input-B1egKb-t.js} +1 -1
- package/lib/{input-Dt_BA_9B.cjs → input-ZGRt7lWR.cjs} +1 -1
- package/lib/{isNumber-CIgubz2e.js → isNumber-ClwLypY2.js} +1 -1
- package/lib/{label-topD46-u.js → label-Cjrzc5H2.js} +2 -2
- package/lib/{label-JNOksCA-.cjs → label-tzSPdqui.cjs} +1 -1
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/locales/index.d.ts +5 -1
- package/lib/{popover-mL-2sX5r.cjs → popover-C6Cya3Cz.cjs} +1 -1
- package/lib/{popover-LfNBhRyz.js → popover-CeY3RbI5.js} +1 -1
- package/lib/renderNodeView-CSazLrKF.js +28 -0
- package/lib/renderNodeView-DfLmGrgA.cjs +1 -0
- package/lib/{select-CwGYPsPq.cjs → select-Doa_-jkZ.cjs} +1 -1
- package/lib/{select-DctYuHLH.js → select-F0ZZ3VZB.js} +1 -1
- package/lib/{separator-NoH_SLRW.cjs → separator-CUh5Y7Rh.cjs} +1 -1
- package/lib/{separator-Ddfrhn4D.js → separator-Cjn4YH8a.js} +5 -5
- package/lib/store/commandList.d.ts +1 -1
- package/lib/store/store.d.ts +7 -6
- package/lib/{store-DNpS8vXA.js → store-BsJz5QRC.js} +1 -1
- package/lib/{store-CkjKIgjQ.cjs → store-DjkMIIEN.cjs} +1 -1
- package/lib/{tabs-DRSwUeKP.cjs → tabs-BP8ypR_m.cjs} +1 -1
- package/lib/{tabs-BT3AeqQQ.js → tabs-CBDjOLl_.js} +1 -1
- package/lib/{textarea-BDO6XQoF.cjs → textarea-BAolHF_W.cjs} +1 -1
- package/lib/{textarea-DZzMEDfZ.js → textarea-tOsPnxHf.js} +1 -1
- package/lib/theme.cjs +1 -1
- package/lib/theme.js +21 -27
- package/lib/{throttle-IERhwcLa.js → throttle-D040PfWL.js} +1 -1
- package/lib/{toggle-BQHMh_Q-.cjs → toggle-C_SSvDRy.cjs} +1 -1
- package/lib/{toggle-DKHg5sLm.js → toggle-DEerYRil.js} +4 -4
- package/lib/{tooltip-DNKq7zgN.js → tooltip-BJIvosho.js} +1 -1
- package/lib/{tooltip-BYtGp6FM.cjs → tooltip-FS1rsvd3.cjs} +1 -1
- package/lib/{updatePosition-Bie75EFq.js → updatePosition-CDK7OR0i.js} +2 -2
- package/lib/{useButtonProps-DVP4s_ER.js → useButtonProps-CtZCbMQu.js} +5 -5
- package/lib/{useButtonProps-DBJkNDS2.cjs → useButtonProps-Cz4W5dC8.cjs} +1 -1
- package/lib/utils/renderNodeView.d.ts +6 -0
- package/package.json +4 -4
- package/lib/Katex-DW_HjgNM.cjs +0 -4
- package/lib/SlashCommandNodeView-BqrmHCpu.cjs +0 -1
- package/lib/_commonjsHelpers-BItOPCY9.js +0 -28
- package/lib/_commonjsHelpers-BTDuMlIz.cjs +0 -1
- package/lib/extensions/Emoji/components/EmojiList/emojis.d.ts +0 -4
- package/lib/index-D3RLYf-J.cjs +0 -1
- package/lib/react-BEoMZB61.cjs +0 -1
- package/lib/react-c9FSfB30.js +0 -27
- package/lib/use-toast-Bz3QCOtE.cjs +0 -1
- package/lib/use-toast-Crf7-q5H.js +0 -98
package/lib/SearchAndReplace.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("./clsx-CXbNJWDD.cjs"),F=require("@tiptap/pm/state"),b=require("@tiptap/pm/view"),a=require("react/jsx-runtime"),f=require("react"),Z=require("./toggle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("./clsx-CXbNJWDD.cjs"),F=require("@tiptap/pm/state"),b=require("@tiptap/pm/view"),a=require("react/jsx-runtime"),f=require("react"),Z=require("./toggle-C_SSvDRy.cjs");require("./index-Cn-t3Zxw.cjs");require("./theme.cjs");const k=require("./useButtonProps-Cz4W5dC8.cjs"),_=require("./index-BsFvo9PG.cjs"),B=require("./popover-C6Cya3Cz.cjs"),E=require("./label-tzSPdqui.cjs"),M=require("./input-ZGRt7lWR.cjs"),j=require("./button-CqJztfH2.cjs"),V=require("./Icon-DzK0_ztP.cjs"),ee=require("./checkbox-BAzbZY2Y.cjs");function te(){const{t}=_.useLocale(),e=k.useEditorInstance(),s=k.useButtonProps(W.name),{icon:n=void 0,tooltip:u=void 0,shortcutKeys:o=void 0,tooltipOptions:c={},action:x=void 0,isActive:h=void 0}=(s==null?void 0:s.componentProps)??{},{disabled:i}=k.useActive(h),[g,d]=f.useState(!1),[p,A]=f.useState(""),[T,N]=f.useState(""),[I,H]=f.useState(!1),[U,L]=f.useState(""),q=()=>{var r,l,R,m;L(`${((l=(r=e==null?void 0:e.storage)==null?void 0:r.searchAndReplace)==null?void 0:l.resultIndex)+1}/${(m=(R=e==null?void 0:e.storage)==null?void 0:R.searchAndReplace)==null?void 0:m.results.length}`)};f.useEffect(()=>{e&&q()},[e]);const z=()=>{i||x&&x()},y=(r=!1)=>{var l,R,m,v,S,D,w,O;e&&(r&&((R=(l=e==null?void 0:e.commands)==null?void 0:l.resetIndex)==null||R.call(l)),(v=(m=e==null?void 0:e.commands)==null?void 0:m.setSearchTerm)==null||v.call(m,p),(D=(S=e==null?void 0:e.commands)==null?void 0:S.setReplaceTerm)==null||D.call(S,T),(O=(w=e==null?void 0:e.commands)==null?void 0:w.setCaseSensitive)==null||O.call(w,I),q())},P=()=>{var v,S;if(!e)return;const{results:r,resultIndex:l}=e.storage.searchAndReplace,R=r[l];if(!R)return;(S=(v=e==null?void 0:e.commands)==null?void 0:v.setTextSelection)==null||S.call(v,R);const{node:m}=e.view.domAtPos(e.state.selection.anchor);m instanceof HTMLElement&&m.scrollIntoView({behavior:"smooth",block:"center"}),q()};f.useEffect(()=>{p.trim()||$(),p.trim()&&y(!0)},[p]),f.useEffect(()=>{T.trim()&&y()},[T]),f.useEffect(()=>{y(!0)},[I]);const G=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.replace)==null||l.call(r),P()},J=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.nextSearchResult)==null||l.call(r),P()},Q=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.previousSearchResult)==null||l.call(r),P()},$=()=>{var r,l;A(""),N(""),(l=(r=e==null?void 0:e.commands)==null?void 0:r.resetIndex)==null||l.call(r),q()},X=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.replaceAll)==null||l.call(r),L("0/0")};return s?a.jsxs(B.Popover,{onOpenChange:d,open:g,children:[a.jsx(B.PopoverTrigger,{asChild:!0,disabled:i,children:a.jsx(Z.ActionButton,{action:z,disabled:i,icon:n,shortcutKeys:o,tooltip:u,tooltipOptions:c})}),a.jsxs(B.PopoverContent,{align:"start",className:"richtext-w-full",hideWhenDetached:!0,side:"bottom",children:[a.jsxs("div",{className:"richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between",children:[a.jsx(E.Label,{children:t("editor.search.dialog.text")}),a.jsx("span",{className:"richtext-font-semibold",children:U})]}),a.jsxs("div",{className:"richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:[a.jsx(M.Input,{autoFocus:!0,className:"richtext-w-full",onChange:r=>A(r.target.value),placeholder:"Text",required:!0,type:"text",value:p}),a.jsx(j.Button,{className:"richtext-flex-1",onClick:Q,children:a.jsx(V.IconComponent,{name:"ChevronUp"})}),a.jsx(j.Button,{className:"richtext-flex-1",onClick:J,children:a.jsx(V.IconComponent,{name:"ChevronDown"})}),a.jsx(j.Button,{className:"richtext-flex-1",onClick:$,children:"Clear"})]}),a.jsx(E.Label,{className:"richtext-mb-[6px]",children:t("editor.replace.dialog.text")}),a.jsx("div",{className:"richtext-mb-[5px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:a.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:a.jsx(M.Input,{className:"richtext-w-80",onChange:r=>N(r.target.value),placeholder:"Text",required:!0,type:"text",value:T})})}),a.jsxs("div",{className:"richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-1",children:[a.jsx(ee.Checkbox,{checked:I,onCheckedChange:r=>{H(r),e.commands.setCaseSensitive(r)}}),a.jsx(E.Label,{children:t("editor.replace.caseSensitive")})]}),a.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[a.jsx(j.Button,{className:"richtext-flex-1",onClick:G,children:t("editor.replace.dialog.text")}),a.jsx(j.Button,{className:"richtext-flex-1",onClick:X,children:t("editor.replaceAll.dialog.text")})]})]})]}):a.jsx(a.Fragment,{})}const C=(t,e)=>e(t.tr);function se(t,e,s){return RegExp(e?t.replace(/[$()*+.?[\\\]^{|}]/g,String.raw`\$&`):t,s?"gu":"gui")}function re(t,e,s,n){const u=[],o=[];let c=[],x=0;if(!e)return{decorationsToReturn:b.DecorationSet.empty,results:[]};t==null||t.descendants((h,i)=>{h.isText?c[x]?c[x]={text:c[x].text+h.text,pos:c[x].pos}:c[x]={text:`${h.text}`,pos:i}:x+=1}),c=c.filter(Boolean);for(const h of c){const{text:i,pos:g}=h,d=Array.from(i.matchAll(e)).filter(([p])=>p.trim());for(const p of d){if(p[0]==="")break;p.index!==void 0&&o.push({from:g+p.index,to:g+p.index+p[0].length})}}for(const[h,i]of o.entries()){const g=h===n?`${s} ${s}-current`:s,d=b.Decoration.inline(i.from,i.to,{class:g});u.push(d)}return{decorationsToReturn:b.DecorationSet.create(t,u),results:o}}function K(t,e,{state:s,dispatch:n}){if(!e[0])return;const{from:o,to:c}=e[0];n&&n(s.tr.insertText(t,o,c))}function ne(t,e,s,n){const u=e+1;if(!n[u])return null;const{from:o,to:c}=n[e],x=c-o-t.length+s,{from:h,to:i}=n[u];return n[u]={to:i-x,from:h-x},[x,n]}function ce(t,e,{tr:s,dispatch:n}){let u=0,o=e.slice();if(o.length!==0){for(let c=0;c<o.length;c+=1){const{from:x,to:h}=o[c];s.insertText(t,x,h);const i=ne(t,c,u,o);i&&(u=i[0],o=i[1])}n(s)}}const W=Y.Extension.create({name:"searchAndReplace",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),searchTerm:"",replaceTerm:"",results:[],searchResultClass:"search-result",searchResultCurrentClass:"search-result-current",caseSensitive:!1,disableRegex:!0,onChange:()=>{},button:({editor:e,t:s})=>({componentProps:{action:()=>{},icon:"SearchAndReplace",tooltip:s("editor.searchAndReplace.tooltip"),isActive:()=>!0,editor:e}})}},addStorage(){return{searchTerm:"",replaceTerm:"",results:[],lastSearchTerm:"",caseSensitive:!1,lastCaseSensitive:!1,resultIndex:0,lastResultIndex:0}},addCommands(){return{setSearchTerm:t=>({editor:e,state:s,dispatch:n})=>(e.storage.searchAndReplace.searchTerm=t,C(s,n),!1),setReplaceTerm:t=>({editor:e,state:s,dispatch:n})=>(e.storage.searchAndReplace.replaceTerm=t,C(s,n),!1),setCaseSensitive:t=>({editor:e,state:s,dispatch:n})=>(e.storage.searchAndReplace.caseSensitive=t,C(s,n),!1),resetIndex:()=>({editor:t,state:e,dispatch:s})=>(t.storage.searchAndReplace.resultIndex=0,C(e,s),!1),nextSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:s}=t.storage.searchAndReplace,n=s+1;return e[n]?t.storage.searchAndReplace.resultIndex=n:t.storage.searchAndReplace.resultIndex=0,!1},previousSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:s}=t.storage.searchAndReplace,n=s-1;return e[n]?t.storage.searchAndReplace.resultIndex=n:t.storage.searchAndReplace.resultIndex=e.length-1,!1},replace:()=>({editor:t,state:e,dispatch:s})=>{const{replaceTerm:n,results:u,resultIndex:o}=t.storage.searchAndReplace,c=u[o];return c?(K(n,[c],{state:e,dispatch:s}),t.storage.searchAndReplace.results.splice(o,1)):(K(n,u,{state:e,dispatch:s}),t.storage.searchAndReplace.results.shift()),C(e,s),!1},replaceAll:()=>({editor:t,tr:e,state:s,dispatch:n})=>{const{replaceTerm:u,results:o}=t.storage.searchAndReplace;return ce(u,o,{tr:e,dispatch:n}),t.storage.searchAndReplace.resultIndex=0,t.storage.searchAndReplace.results=[],C(s,n),!1}}},addProseMirrorPlugins(){const t=this.editor,{searchResultClass:e,disableRegex:s}=this.options,n=c=>t.storage.searchAndReplace.lastSearchTerm=c,u=c=>t.storage.searchAndReplace.lastCaseSensitive=c,o=c=>t.storage.searchAndReplace.lastResultIndex=c;return[new F.Plugin({key:new F.PluginKey(`richtextCustomPlugin${this.name}`),state:{init:()=>b.DecorationSet.empty,apply({doc:c,docChanged:x},h){const{searchTerm:i,lastSearchTerm:g,caseSensitive:d,lastCaseSensitive:p,resultIndex:A,lastResultIndex:T}=t.storage.searchAndReplace;if(!x&&g===i&&p===d&&T===A)return h;if(n(i),u(d),o(A),!i)return t.storage.searchAndReplace.results=[],b.DecorationSet.empty;const{decorationsToReturn:N,results:I}=re(c,se(i,s,d),e,A);return t.storage.searchAndReplace.results=I,N}},props:{decorations(c){return this.getState(c)}}})]}});exports.RichTextSearchAndReplace=te;exports.SearchAndReplace=W;
|
package/lib/SearchAndReplace.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { E as Q } from "./clsx-
|
|
1
|
+
import { E as Q } from "./clsx-DSzxBzvL.js";
|
|
2
2
|
import { Plugin as X, PluginKey as Y } from "@tiptap/pm/state";
|
|
3
3
|
import { DecorationSet as $, Decoration as Z } from "@tiptap/pm/view";
|
|
4
4
|
import { jsx as u, Fragment as _, jsxs as T } from "react/jsx-runtime";
|
|
5
5
|
import { useState as b, useEffect as k } from "react";
|
|
6
|
-
import { A as ee } from "./toggle-
|
|
7
|
-
import "./index-
|
|
6
|
+
import { A as ee } from "./toggle-DEerYRil.js";
|
|
7
|
+
import "./index-DoiuU6VA.js";
|
|
8
8
|
import "./theme.js";
|
|
9
|
-
import { c as te, u as se, b as re } from "./useButtonProps-
|
|
10
|
-
import { u as ne } from "./index-
|
|
11
|
-
import { P as ce, a as ae, b as le } from "./popover-
|
|
12
|
-
import { L as B } from "./label-
|
|
13
|
-
import { I as V } from "./input-
|
|
14
|
-
import { B as N } from "./button-
|
|
15
|
-
import { I as q } from "./Icon-
|
|
16
|
-
import { C as oe } from "./checkbox-
|
|
9
|
+
import { c as te, u as se, b as re } from "./useButtonProps-CtZCbMQu.js";
|
|
10
|
+
import { u as ne } from "./index-C07N8gA1.js";
|
|
11
|
+
import { P as ce, a as ae, b as le } from "./popover-CeY3RbI5.js";
|
|
12
|
+
import { L as B } from "./label-Cjrzc5H2.js";
|
|
13
|
+
import { I as V } from "./input-B1egKb-t.js";
|
|
14
|
+
import { B as N } from "./button-Bwn6gUuS.js";
|
|
15
|
+
import { I as q } from "./Icon-C0TJMAOm.js";
|
|
16
|
+
import { C as oe } from "./checkbox-B_rpz5Xq.js";
|
|
17
17
|
function ke() {
|
|
18
18
|
const { t } = ne(), e = te(), s = se(pe.name), {
|
|
19
19
|
icon: n = void 0,
|
package/lib/SlashCommand.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./clsx-CXbNJWDD.cjs"),u=require("@tiptap/pm/state"),d=require("./index-Cs6cp0Y6.cjs"),r=require("./SlashCommandNodeView-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./clsx-CXbNJWDD.cjs"),u=require("@tiptap/pm/state"),d=require("./index-Cs6cp0Y6.cjs"),r=require("./SlashCommandNodeView-BEJhEzba.cjs"),a=require("./updatePosition-Cjuj2E26.cjs"),s=require("react/jsx-runtime"),l=require("react"),m=require("./index-BsFvo9PG.cjs");function c({commandList:e}){const[,t]=r.useSignalCommandList(),{t:n}=m.useLocale();return l.useEffect(()=>{if(!(e!=null&&e.length)){const o=r.renderCommandListDefault({t:n});t(o);return}t(e)},[n,e]),s.jsx(s.Fragment,{})}const C=i.Extension.create({name:"richtextSlashCommand",priority:200,addProseMirrorPlugins(){return[d.Suggestion({pluginKey:new u.PluginKey("richtextSlashCommandPlugin"),editor:this.editor,char:"/",command:({editor:e,range:t,props:n})=>{const{view:o}=e;n.action({editor:e,range:t}),o.focus()},render:()=>{let e;return{onStart:t=>{t.clientRect&&(e=new i.ReactRenderer(r.SlashCommandNodeView,{props:t,editor:t.editor}),e.element.style.position="absolute",document.body.appendChild(e.element),a.updatePosition(t.editor,e.element))},onUpdate(t){e.updateProps(t),t.clientRect&&a.updatePosition(t.editor,e.element)},onKeyDown(t){var n;return t.event.key==="Escape"?(e.destroy(),e.element.remove(),!0):(n=e.ref)==null?void 0:n.onKeyDown(t)},onExit(){e&&(e.destroy(),e.element.remove())}}}})]}});exports.renderCommandListDefault=r.renderCommandListDefault;exports.useFilterCommandList=r.useFilterCommandList;exports.SlashCommand=C;exports.SlashCommandList=c;
|
package/lib/SlashCommand.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { E as i, R as a } from "./clsx-
|
|
1
|
+
import { E as i, R as a } from "./clsx-DSzxBzvL.js";
|
|
2
2
|
import { PluginKey as m } from "@tiptap/pm/state";
|
|
3
|
-
import { S as s } from "./index-
|
|
4
|
-
import { u, r as l, S as d } from "./SlashCommandNodeView-
|
|
5
|
-
import { a as b } from "./SlashCommandNodeView-
|
|
6
|
-
import { u as o } from "./updatePosition-
|
|
3
|
+
import { S as s } from "./index-D8li6EQ4.js";
|
|
4
|
+
import { u, r as l, S as d } from "./SlashCommandNodeView-B2g1MbgN.js";
|
|
5
|
+
import { a as b } from "./SlashCommandNodeView-B2g1MbgN.js";
|
|
6
|
+
import { u as o } from "./updatePosition-CDK7OR0i.js";
|
|
7
7
|
import { jsx as f, Fragment as c } from "react/jsx-runtime";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useEffect as h } from "react";
|
|
9
|
+
import { u as C } from "./index-C07N8gA1.js";
|
|
10
10
|
function E({ commandList: e }) {
|
|
11
|
-
const [, t] = u(), { t: r } =
|
|
12
|
-
return
|
|
11
|
+
const [, t] = u(), { t: r } = C();
|
|
12
|
+
return h(() => {
|
|
13
13
|
if (!(e != null && e.length)) {
|
|
14
14
|
const n = l({ t: r });
|
|
15
15
|
t(n);
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsx as d, jsxs as b } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { c as
|
|
2
|
+
import { forwardRef as H, useState as v, useRef as w, useImperativeHandle as y, useEffect as E, Fragment as S } from "react";
|
|
3
|
+
import { c as B } from "./index-DoiuU6VA.js";
|
|
4
4
|
import "./theme.js";
|
|
5
|
-
import { H as
|
|
6
|
-
import { a as
|
|
7
|
-
import { d as
|
|
8
|
-
import {
|
|
9
|
-
import { L as
|
|
10
|
-
import { I as q } from "./Icon-
|
|
5
|
+
import { H as N, u as D } from "./index-C07N8gA1.js";
|
|
6
|
+
import { a as V } from "./store-BsJz5QRC.js";
|
|
7
|
+
import { d as $, E as z } from "./events.constant-do95b767.js";
|
|
8
|
+
import { y as G, V as O } from "./index-BG0kQamI.js";
|
|
9
|
+
import { L as T } from "./label-Cjrzc5H2.js";
|
|
10
|
+
import { I as q } from "./Icon-C0TJMAOm.js";
|
|
11
11
|
const P = {
|
|
12
|
-
setOpen: (i,
|
|
13
|
-
|
|
12
|
+
setOpen: (i, a) => {
|
|
13
|
+
$(z.UPLOAD_VIDEO(i), a);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
function
|
|
17
|
-
const
|
|
16
|
+
function ie({ t: i }) {
|
|
17
|
+
const a = [
|
|
18
18
|
{
|
|
19
19
|
name: "format",
|
|
20
20
|
title: i("editor.slash.format"),
|
|
@@ -26,17 +26,17 @@ function te({ t: i }) {
|
|
|
26
26
|
commands: []
|
|
27
27
|
}
|
|
28
28
|
];
|
|
29
|
-
return
|
|
30
|
-
|
|
29
|
+
return N.forEach((e) => {
|
|
30
|
+
a[0].commands.push({
|
|
31
31
|
name: `heading${e}`,
|
|
32
32
|
label: i(e === "Paragraph" ? "editor.paragraph.tooltip" : `editor.heading.h${e}.tooltip`),
|
|
33
33
|
aliases: [`h${e}`, "bt", `bt${e}`],
|
|
34
34
|
iconName: `Heading${e}`,
|
|
35
35
|
isActive: (t) => e === "Paragraph" ? !1 : t.isActive("heading", { level: e }) || !1,
|
|
36
36
|
action: ({ editor: t, range: l }) => {
|
|
37
|
-
const
|
|
37
|
+
const r = N.find((m) => t.isActive("heading", { level: m }));
|
|
38
38
|
if (e === "Paragraph") {
|
|
39
|
-
|
|
39
|
+
r !== void 0 && r !== "Paragraph" && t.commands.toggleHeading({ level: r }), t.chain().focus().deleteRange(l).run();
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
if (e) {
|
|
@@ -46,7 +46,7 @@ function te({ t: i }) {
|
|
|
46
46
|
t.chain().focus().deleteRange(l).run();
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
}),
|
|
49
|
+
}), a[0].commands.push({
|
|
50
50
|
name: "bulletList",
|
|
51
51
|
label: i("editor.bulletlist.tooltip"),
|
|
52
52
|
aliases: ["ul", "yxlb"],
|
|
@@ -55,7 +55,7 @@ function te({ t: i }) {
|
|
|
55
55
|
action: ({ editor: e, range: t }) => {
|
|
56
56
|
e.chain().focus().deleteRange(t).toggleBulletList().run();
|
|
57
57
|
}
|
|
58
|
-
}),
|
|
58
|
+
}), a[0].commands.push({
|
|
59
59
|
name: "orderedlist",
|
|
60
60
|
label: i("editor.orderedlist.tooltip"),
|
|
61
61
|
aliases: ["ol", "yxlb"],
|
|
@@ -64,7 +64,7 @@ function te({ t: i }) {
|
|
|
64
64
|
action: ({ editor: e, range: t }) => {
|
|
65
65
|
e.chain().focus().deleteRange(t).toggleOrderedList().run();
|
|
66
66
|
}
|
|
67
|
-
}),
|
|
67
|
+
}), a[0].commands.push({
|
|
68
68
|
name: "taskList",
|
|
69
69
|
label: i("editor.tasklist.tooltip"),
|
|
70
70
|
iconName: "ListTodo",
|
|
@@ -74,7 +74,7 @@ function te({ t: i }) {
|
|
|
74
74
|
action: ({ editor: e, range: t }) => {
|
|
75
75
|
e.chain().focus().deleteRange(t).toggleTaskList().run();
|
|
76
76
|
}
|
|
77
|
-
}),
|
|
77
|
+
}), a[0].commands.push({
|
|
78
78
|
name: "blockquote",
|
|
79
79
|
label: i("editor.blockquote.tooltip"),
|
|
80
80
|
description: "插入引入格式",
|
|
@@ -84,7 +84,7 @@ function te({ t: i }) {
|
|
|
84
84
|
action: ({ editor: e, range: t }) => {
|
|
85
85
|
e.chain().focus().deleteRange(t).setBlockquote().run();
|
|
86
86
|
}
|
|
87
|
-
}),
|
|
87
|
+
}), a[0].commands.push({
|
|
88
88
|
name: "codeBlock",
|
|
89
89
|
label: i("editor.codeblock.tooltip"),
|
|
90
90
|
iconName: "Code2",
|
|
@@ -94,7 +94,7 @@ function te({ t: i }) {
|
|
|
94
94
|
action: ({ editor: e, range: t }) => {
|
|
95
95
|
e.chain().focus().deleteRange(t).setCodeBlock().run();
|
|
96
96
|
}
|
|
97
|
-
}),
|
|
97
|
+
}), a[1].commands.push({
|
|
98
98
|
name: "image",
|
|
99
99
|
label: i("editor.image.tooltip"),
|
|
100
100
|
iconName: "ImageUp",
|
|
@@ -102,9 +102,9 @@ function te({ t: i }) {
|
|
|
102
102
|
aliases: ["image", "tp", "tupian"],
|
|
103
103
|
shouldBeHidden: (e) => e.isActive("columns"),
|
|
104
104
|
action: ({ editor: e, range: t }) => {
|
|
105
|
-
e.chain().focus().deleteRange(t).run(),
|
|
105
|
+
e.chain().focus().deleteRange(t).run(), V.setOpen(e.id, !0);
|
|
106
106
|
}
|
|
107
|
-
}),
|
|
107
|
+
}), a[1].commands.push({
|
|
108
108
|
name: "video",
|
|
109
109
|
label: i("editor.video.tooltip"),
|
|
110
110
|
iconName: "Video",
|
|
@@ -114,7 +114,7 @@ function te({ t: i }) {
|
|
|
114
114
|
action: ({ editor: e, range: t }) => {
|
|
115
115
|
e.chain().focus().deleteRange(t).run(), P.setOpen(e.id, !0);
|
|
116
116
|
}
|
|
117
|
-
}),
|
|
117
|
+
}), a[1].commands.push({
|
|
118
118
|
name: "table",
|
|
119
119
|
label: i("editor.table.tooltip"),
|
|
120
120
|
iconName: "Table",
|
|
@@ -124,7 +124,7 @@ function te({ t: i }) {
|
|
|
124
124
|
action: ({ editor: e, range: t }) => {
|
|
125
125
|
e.chain().focus().deleteRange(t).insertTable({ rows: 3, cols: 3, withHeaderRow: !1 }).run();
|
|
126
126
|
}
|
|
127
|
-
}),
|
|
127
|
+
}), a[1].commands.push({
|
|
128
128
|
name: "horizontalRule",
|
|
129
129
|
label: i("editor.horizontalrule.tooltip"),
|
|
130
130
|
iconName: "Minus",
|
|
@@ -133,7 +133,7 @@ function te({ t: i }) {
|
|
|
133
133
|
action: ({ editor: e, range: t }) => {
|
|
134
134
|
e.chain().focus().deleteRange(t).setHorizontalRule().run();
|
|
135
135
|
}
|
|
136
|
-
}),
|
|
136
|
+
}), a[1].commands.push({
|
|
137
137
|
name: "columns",
|
|
138
138
|
label: i("editor.columns.tooltip"),
|
|
139
139
|
iconName: "Columns2",
|
|
@@ -141,77 +141,70 @@ function te({ t: i }) {
|
|
|
141
141
|
action: ({ editor: e }) => {
|
|
142
142
|
e.chain().focus().insertColumns({ cols: 2 }).run();
|
|
143
143
|
}
|
|
144
|
-
}),
|
|
144
|
+
}), a;
|
|
145
145
|
}
|
|
146
|
-
function U(i,
|
|
146
|
+
function U(i, a) {
|
|
147
147
|
return i.map((l) => ({
|
|
148
148
|
...l,
|
|
149
|
-
commands: l.commands.filter((
|
|
150
|
-
const m =
|
|
151
|
-
if (
|
|
152
|
-
const x =
|
|
153
|
-
return
|
|
149
|
+
commands: l.commands.filter((r) => {
|
|
150
|
+
const m = r.label.toLowerCase().trim(), u = a.toLowerCase().trim();
|
|
151
|
+
if (r.aliases) {
|
|
152
|
+
const x = r.aliases.map((h) => h.toLowerCase().trim()), s = m.match(u), f = x.some((h) => h.match(u));
|
|
153
|
+
return s || f;
|
|
154
154
|
}
|
|
155
155
|
return m.match(u);
|
|
156
156
|
})
|
|
157
157
|
})).filter((l) => l.commands.length > 0);
|
|
158
158
|
}
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
commandList: n
|
|
164
|
-
}));
|
|
165
|
-
}
|
|
166
|
-
})));
|
|
167
|
-
function F() {
|
|
168
|
-
const i = C((e) => e.commandList), n = C((e) => e.setCommandList);
|
|
169
|
-
return [i, n];
|
|
159
|
+
const F = G([]);
|
|
160
|
+
function M() {
|
|
161
|
+
const [i, a] = O(F);
|
|
162
|
+
return [i, a];
|
|
170
163
|
}
|
|
171
|
-
function
|
|
172
|
-
const [e] =
|
|
173
|
-
|
|
164
|
+
function j(i, a) {
|
|
165
|
+
const [e] = M(), [t, l] = v(0), [r, m] = v(0), u = w(null), { t: x } = D(), s = U(e, i.query), f = w([]);
|
|
166
|
+
y(a, () => ({
|
|
174
167
|
onKeyDown: h
|
|
175
|
-
})),
|
|
168
|
+
})), E(() => {
|
|
176
169
|
if (!u.current)
|
|
177
170
|
return;
|
|
178
|
-
const
|
|
171
|
+
const n = r * 1e3 + t, o = f.current[n];
|
|
179
172
|
o && o.scrollIntoView({
|
|
180
173
|
behavior: "smooth",
|
|
181
174
|
block: "nearest"
|
|
182
175
|
});
|
|
183
|
-
}, [t,
|
|
184
|
-
function h({ event:
|
|
185
|
-
return
|
|
176
|
+
}, [t, r]);
|
|
177
|
+
function h({ event: n }) {
|
|
178
|
+
return n.key === "ArrowUp" ? (C(), !0) : n.key === "ArrowDown" ? (L(), !0) : n.key === "Enter" ? (A(), !0) : !1;
|
|
186
179
|
}
|
|
187
|
-
function
|
|
180
|
+
function C() {
|
|
188
181
|
var c;
|
|
189
|
-
if (
|
|
182
|
+
if (s.length === 0)
|
|
190
183
|
return !1;
|
|
191
|
-
let
|
|
192
|
-
|
|
184
|
+
let n = t - 1, o = r;
|
|
185
|
+
n < 0 && (o = r - 1, n = ((c = s[o]) == null ? void 0 : c.commands.length) - 1 || 0), o < 0 && (o = s.length - 1, n = s[o].commands.length - 1), l(n), m(o);
|
|
193
186
|
}
|
|
194
|
-
function
|
|
195
|
-
if (
|
|
187
|
+
function L() {
|
|
188
|
+
if (s.length === 0)
|
|
196
189
|
return !1;
|
|
197
|
-
const
|
|
198
|
-
let o = t + 1, c =
|
|
199
|
-
|
|
190
|
+
const n = s[r].commands;
|
|
191
|
+
let o = t + 1, c = r;
|
|
192
|
+
n.length - 1 < o && (o = 0, c = r + 1), s.length - 1 < c && (c = 0), l(o), m(c);
|
|
200
193
|
}
|
|
201
|
-
function
|
|
202
|
-
if (
|
|
194
|
+
function A() {
|
|
195
|
+
if (s.length === 0 || r === -1 || t === -1)
|
|
203
196
|
return !1;
|
|
204
|
-
g(
|
|
197
|
+
g(r, t);
|
|
205
198
|
}
|
|
206
|
-
function g(
|
|
207
|
-
const c =
|
|
199
|
+
function g(n, o) {
|
|
200
|
+
const c = s[n].commands[o];
|
|
208
201
|
i == null || i.command(c);
|
|
209
202
|
}
|
|
210
|
-
function
|
|
211
|
-
g(
|
|
203
|
+
function I(n, o) {
|
|
204
|
+
g(n, o);
|
|
212
205
|
}
|
|
213
|
-
function
|
|
214
|
-
f.current[
|
|
206
|
+
function k(n, o, c) {
|
|
207
|
+
f.current[n * 1e3 + o] = c;
|
|
215
208
|
}
|
|
216
209
|
return /* @__PURE__ */ d(
|
|
217
210
|
"div",
|
|
@@ -219,15 +212,15 @@ function M(i, n) {
|
|
|
219
212
|
className: "richtext-max-h-[min(80vh,24rem)] richtext-flex-wrap richtext-overflow-y-auto richtext-overflow-x-hidden richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",
|
|
220
213
|
"data-richtext-portal": !0,
|
|
221
214
|
ref: u,
|
|
222
|
-
children:
|
|
223
|
-
/* @__PURE__ */ d(
|
|
224
|
-
|
|
215
|
+
children: s != null && s.length ? /* @__PURE__ */ d("div", { className: "richtext-grid richtext-min-w-48 richtext-grid-cols-1 richtext-gap-0.5", children: s == null ? void 0 : s.map((n, o) => /* @__PURE__ */ b(S, { children: [
|
|
216
|
+
/* @__PURE__ */ d(T, { className: "richtext-mx-[4px] richtext-mb-[4px] richtext-mt-[8px] !richtext-text-[0.65rem] richtext-uppercase ", children: n.title }),
|
|
217
|
+
n.commands.map((c, p) => /* @__PURE__ */ b(
|
|
225
218
|
"button",
|
|
226
219
|
{
|
|
227
|
-
onClick: () =>
|
|
228
|
-
ref: (
|
|
229
|
-
className:
|
|
230
|
-
"bg-item-active":
|
|
220
|
+
onClick: () => I(o, p),
|
|
221
|
+
ref: (R) => k(o, p, R),
|
|
222
|
+
className: B("richtext-flex richtext-items-center richtext-gap-3 richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-text-foreground richtext-text-left richtext-w-full richtext-rounded-sm !richtext-outline-none !richtext-border-none richtext-transition-colors !richtext-bg-transparent hover:!richtext-bg-accent ", {
|
|
223
|
+
"bg-item-active": r === o && t === p
|
|
231
224
|
}),
|
|
232
225
|
children: [
|
|
233
226
|
c.iconUrl && /* @__PURE__ */ d(
|
|
@@ -250,14 +243,14 @@ function M(i, n) {
|
|
|
250
243
|
},
|
|
251
244
|
`command-${p}`
|
|
252
245
|
))
|
|
253
|
-
] }, `slash-${
|
|
246
|
+
] }, `slash-${n.title}`)) }) : /* @__PURE__ */ d("div", { className: "richtext-p-3", children: /* @__PURE__ */ d("span", { className: "richtext-text-xs richtext-text-foreground", children: x("editor.slash.empty") }) })
|
|
254
247
|
}
|
|
255
248
|
);
|
|
256
249
|
}
|
|
257
|
-
const
|
|
250
|
+
const oe = H(j);
|
|
258
251
|
export {
|
|
259
|
-
|
|
252
|
+
oe as S,
|
|
260
253
|
U as a,
|
|
261
|
-
|
|
262
|
-
|
|
254
|
+
ie as r,
|
|
255
|
+
M as u
|
|
263
256
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const d=require("react/jsx-runtime"),m=require("react"),S=require("./index-Cn-t3Zxw.cjs");require("./theme.cjs");const b=require("./index-BsFvo9PG.cjs"),y=require("./store-DjkMIIEN.cjs"),w=require("./events.constant-Dq21NPdV.cjs"),C=require("./index-NsYff_Ni.cjs"),E=require("./label-tzSPdqui.cjs"),j=require("./Icon-DzK0_ztP.cjs"),D={setOpen:(i,s)=>{w.dispatchEvent(w.EVENTS.UPLOAD_VIDEO(i),s)}};function $({t:i}){const s=[{name:"format",title:i("editor.slash.format"),commands:[]},{name:"insert",title:i("editor.slash.insert"),commands:[]}];return b.HEADINGS.forEach(e=>{s[0].commands.push({name:`heading${e}`,label:i(e==="Paragraph"?"editor.paragraph.tooltip":`editor.heading.h${e}.tooltip`),aliases:[`h${e}`,"bt",`bt${e}`],iconName:`Heading${e}`,isActive:t=>e==="Paragraph"?!1:t.isActive("heading",{level:e})||!1,action:({editor:t,range:l})=>{const a=b.HEADINGS.find(u=>t.isActive("heading",{level:u}));if(e==="Paragraph"){a!==void 0&&a!=="Paragraph"&&t.commands.toggleHeading({level:a}),t.chain().focus().deleteRange(l).run();return}if(e){t.chain().focus().deleteRange(l).setHeading({level:e}).run();return}t.chain().focus().deleteRange(l).run()}})}),s[0].commands.push({name:"bulletList",label:i("editor.bulletlist.tooltip"),aliases:["ul","yxlb"],iconName:"List",isActive:e=>e.isActive("bulletList"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleBulletList().run()}}),s[0].commands.push({name:"orderedlist",label:i("editor.orderedlist.tooltip"),aliases:["ol","yxlb"],iconName:"ListOrdered",isActive:e=>e.isActive("orderedList"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleOrderedList().run()}}),s[0].commands.push({name:"taskList",label:i("editor.tasklist.tooltip"),iconName:"ListTodo",description:"Task list with todo items",aliases:["todo"],isActive:e=>e.isActive("taskList"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleTaskList().run()}}),s[0].commands.push({name:"blockquote",label:i("editor.blockquote.tooltip"),description:"插入引入格式",aliases:["yr"],iconName:"TextQuote",isActive:e=>e.isActive("blockquote"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setBlockquote().run()}}),s[0].commands.push({name:"codeBlock",label:i("editor.codeblock.tooltip"),iconName:"Code2",description:"Code block with syntax highlighting",shouldBeHidden:e=>e.isActive("columns"),isActive:e=>e.isActive("codeBlock"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setCodeBlock().run()}}),s[1].commands.push({name:"image",label:i("editor.image.tooltip"),iconName:"ImageUp",description:"Insert a image",aliases:["image","tp","tupian"],shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).run(),y.actionDialogImage.setOpen(e.id,!0)}}),s[1].commands.push({name:"video",label:i("editor.video.tooltip"),iconName:"Video",description:"Insert a video",aliases:["video","sp","shipin"],shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).run(),D.setOpen(e.id,!0)}}),s[1].commands.push({name:"table",label:i("editor.table.tooltip"),iconName:"Table",description:"Insert a table",aliases:["table","bg","biaoge","biao"],shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).insertTable({rows:3,cols:3,withHeaderRow:!1}).run()}}),s[1].commands.push({name:"horizontalRule",label:i("editor.horizontalrule.tooltip"),iconName:"Minus",description:"Insert a horizontal divider",aliases:["hr","fgx","fg"],action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setHorizontalRule().run()}}),s[1].commands.push({name:"columns",label:i("editor.columns.tooltip"),iconName:"Columns2",description:"Add two column content",action:({editor:e})=>{e.chain().focus().insertColumns({cols:2}).run()}}),s}function N(i,s){return i.map(l=>({...l,commands:l.commands.filter(a=>{const u=a.label.toLowerCase().trim(),h=s.toLowerCase().trim();if(a.aliases){const p=a.aliases.map(x=>x.toLowerCase().trim()),r=u.match(h),f=p.some(x=>x.match(h));return r||f}return u.match(h)})})).filter(l=>l.commands.length>0)}const B=C.y([]);function L(){const[i,s]=C.V(B);return[i,s]}function V(i,s){const[e]=L(),[t,l]=m.useState(0),[a,u]=m.useState(0),h=m.useRef(null),{t:p}=b.useLocale(),r=N(e,i.query),f=m.useRef([]);m.useImperativeHandle(s,()=>({onKeyDown:x})),m.useEffect(()=>{if(!h.current)return;const o=a*1e3+t,n=f.current[o];n&&n.scrollIntoView({behavior:"smooth",block:"nearest"})},[t,a]);function x({event:o}){return o.key==="ArrowUp"?(A(),!0):o.key==="ArrowDown"?(R(),!0):o.key==="Enter"?(I(),!0):!1}function A(){var c;if(r.length===0)return!1;let o=t-1,n=a;o<0&&(n=a-1,o=((c=r[n])==null?void 0:c.commands.length)-1||0),n<0&&(n=r.length-1,o=r[n].commands.length-1),l(o),u(n)}function R(){if(r.length===0)return!1;const o=r[a].commands;let n=t+1,c=a;o.length-1<n&&(n=0,c=a+1),r.length-1<c&&(c=0),l(n),u(c)}function I(){if(r.length===0||a===-1||t===-1)return!1;v(a,t)}function v(o,n){const c=r[o].commands[n];i==null||i.command(c)}function k(o,n){v(o,n)}function q(o,n,c){f.current[o*1e3+n]=c}return d.jsx("div",{className:"richtext-max-h-[min(80vh,24rem)] richtext-flex-wrap richtext-overflow-y-auto richtext-overflow-x-hidden richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none","data-richtext-portal":!0,ref:h,children:r!=null&&r.length?d.jsx("div",{className:"richtext-grid richtext-min-w-48 richtext-grid-cols-1 richtext-gap-0.5",children:r==null?void 0:r.map((o,n)=>d.jsxs(m.Fragment,{children:[d.jsx(E.Label,{className:"richtext-mx-[4px] richtext-mb-[4px] richtext-mt-[8px] !richtext-text-[0.65rem] richtext-uppercase ",children:o.title}),o.commands.map((c,g)=>d.jsxs("button",{onClick:()=>k(n,g),ref:H=>q(n,g,H),className:S.cn("richtext-flex richtext-items-center richtext-gap-3 richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-text-foreground richtext-text-left richtext-w-full richtext-rounded-sm !richtext-outline-none !richtext-border-none richtext-transition-colors !richtext-bg-transparent hover:!richtext-bg-accent ",{"bg-item-active":a===n&&t===g}),children:[c.iconUrl&&d.jsx("img",{alt:"",className:"richtext-size-6",src:c.iconUrl}),c.iconName&&d.jsx(j.IconComponent,{className:"!richtext-mr-1 !richtext-text-lg",name:c.iconName}),c.label]},`command-${g}`))]},`slash-${o.title}`))}):d.jsx("div",{className:"richtext-p-3",children:d.jsx("span",{className:"richtext-text-xs richtext-text-foreground",children:p("editor.slash.empty")})})})}const G=m.forwardRef(V);exports.SlashCommandNodeView=G;exports.renderCommandListDefault=$;exports.useFilterCommandList=N;exports.useSignalCommandList=L;
|
package/lib/Strike.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),m=require("./toggle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),m=require("./toggle-C_SSvDRy.cjs");require("react");require("./index-Cn-t3Zxw.cjs");require("./theme.cjs");const u=require("./useButtonProps-Cz4W5dC8.cjs");var h=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,S=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,f=r.Mark.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",r.mergeAttributes(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[r.markInputRule({find:h,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:S,type:this.type})]}});function v(){const t=u.useButtonProps(d.name),{icon:e=void 0,tooltip:s=void 0,shortcutKeys:i=void 0,tooltipOptions:c={},action:o=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:a,update:k}=u.useToggleActive(l),g=()=>{a||o&&(o(),k())};return t?n.jsx(m.ActionButton,{action:g,dataState:p,disabled:a,icon:e,shortcutKeys:i,tooltip:s,tooltipOptions:c}):n.jsx(n.Fragment,{})}const d=f.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:s,extension:i})=>({componentProps:{action:()=>e.commands.toggleStrike(),isActive:()=>e.isActive("strike")||!1,disabled:!1,icon:"Strikethrough",shortcutKeys:i.options.shortcutKeys??["shift","mod","S"],tooltip:s("editor.strike.tooltip")}})}}});exports.RichTextStrike=v;exports.Strike=d;
|
package/lib/Strike.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { M as c, e as k, f as l, m as g } from "./clsx-
|
|
1
|
+
import { M as c, e as k, f as l, m as g } from "./clsx-DSzxBzvL.js";
|
|
2
2
|
import { jsx as n, Fragment as h } from "react/jsx-runtime";
|
|
3
|
-
import { A as f } from "./toggle-
|
|
3
|
+
import { A as f } from "./toggle-DEerYRil.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./index-
|
|
5
|
+
import "./index-DoiuU6VA.js";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
import { u as M, a as S } from "./useButtonProps-
|
|
7
|
+
import { u as M, a as S } from "./useButtonProps-CtZCbMQu.js";
|
|
8
8
|
var v = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, A = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, y = c.create({
|
|
9
9
|
name: "strike",
|
|
10
10
|
addOptions() {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { W as de, S as E, $ as Ve, T as $, F as v, x as L, V as ke, v as Ke, a0 as Xe, N as Z, m as J, Y as Ge, Z as Ue, E as Ee, a1 as qe } from "./clsx-DSzxBzvL.js";
|
|
2
2
|
import { TextSelection as Ze } from "@tiptap/pm/state";
|
|
3
|
-
import { k as Je, D as oe, a as ne } from "./index-
|
|
3
|
+
import { k as Je, D as oe, a as ne } from "./index-CpTykZBR.js";
|
|
4
4
|
import { jsxs as ee, jsx as k, Fragment as Ye } from "react/jsx-runtime";
|
|
5
|
-
import { A as Qe } from "./toggle-
|
|
5
|
+
import { A as Qe } from "./toggle-DEerYRil.js";
|
|
6
6
|
import { useState as _ } from "react";
|
|
7
|
-
import "./index-
|
|
7
|
+
import "./index-DoiuU6VA.js";
|
|
8
8
|
import "./theme.js";
|
|
9
|
-
import { T as O, k as F, m as j } from "./index-
|
|
10
|
-
import { P as et, a as tt, b as ot } from "./popover-
|
|
11
|
-
import { c as nt, u as lt, a as rt } from "./useButtonProps-
|
|
9
|
+
import { T as O, k as F, m as j } from "./index-C07N8gA1.js";
|
|
10
|
+
import { P as et, a as tt, b as ot } from "./popover-CeY3RbI5.js";
|
|
11
|
+
import { c as nt, u as lt, a as rt } from "./useButtonProps-CtZCbMQu.js";
|
|
12
12
|
let le, re;
|
|
13
13
|
if (typeof WeakMap < "u") {
|
|
14
14
|
let t = /* @__PURE__ */ new WeakMap();
|
|
@@ -1046,22 +1046,22 @@ const Ot = Je({
|
|
|
1046
1046
|
Delete: V,
|
|
1047
1047
|
"Mod-Delete": V
|
|
1048
1048
|
});
|
|
1049
|
-
function
|
|
1049
|
+
function U(t, e, o) {
|
|
1050
1050
|
return o.eq(t.selection) ? !1 : (e && e(t.tr.setSelection(o).scrollIntoView()), !0);
|
|
1051
1051
|
}
|
|
1052
1052
|
function K(t, e) {
|
|
1053
1053
|
return (o, n, l) => {
|
|
1054
1054
|
if (!l) return !1;
|
|
1055
1055
|
const r = o.selection;
|
|
1056
|
-
if (r instanceof w) return
|
|
1056
|
+
if (r instanceof w) return U(o, n, E.near(r.$headCell, e));
|
|
1057
1057
|
if (t != "horiz" && !r.empty) return !1;
|
|
1058
1058
|
const s = Ie(l, t, e);
|
|
1059
1059
|
if (s == null) return !1;
|
|
1060
|
-
if (t == "horiz") return
|
|
1060
|
+
if (t == "horiz") return U(o, n, E.near(o.doc.resolve(r.head + e), e));
|
|
1061
1061
|
{
|
|
1062
1062
|
const i = o.doc.resolve(s), c = ze(i, t, e);
|
|
1063
1063
|
let a;
|
|
1064
|
-
return c ? a = E.near(c, 1) : e < 0 ? a = E.near(o.doc.resolve(i.before(-1)), -1) : a = E.near(o.doc.resolve(i.after(-1)), 1),
|
|
1064
|
+
return c ? a = E.near(c, 1) : e < 0 ? a = E.near(o.doc.resolve(i.before(-1)), -1) : a = E.near(o.doc.resolve(i.after(-1)), 1), U(o, n, a);
|
|
1065
1065
|
}
|
|
1066
1066
|
};
|
|
1067
1067
|
}
|
|
@@ -1077,7 +1077,7 @@ function X(t, e) {
|
|
|
1077
1077
|
s = new w(o.doc.resolve(c));
|
|
1078
1078
|
}
|
|
1079
1079
|
const i = ze(s.$headCell, t, e);
|
|
1080
|
-
return i ?
|
|
1080
|
+
return i ? U(o, n, new w(s.$anchorCell, i)) : !1;
|
|
1081
1081
|
};
|
|
1082
1082
|
}
|
|
1083
1083
|
function Ft(t, e) {
|
|
@@ -1204,7 +1204,7 @@ function Xt({ handleWidth: t = 5, cellMinWidth: e = 25, defaultCellMinWidth: o =
|
|
|
1204
1204
|
init(s, i) {
|
|
1205
1205
|
var c;
|
|
1206
1206
|
const a = (c = r.spec) === null || c === void 0 || (c = c.props) === null || c === void 0 ? void 0 : c.nodeViews, d = y(i.schema).table.name;
|
|
1207
|
-
return n && a && (a[d] = (u, f) => new n(u, o, f)), new
|
|
1207
|
+
return n && a && (a[d] = (u, f) => new n(u, o, f)), new Gt(-1, !1);
|
|
1208
1208
|
},
|
|
1209
1209
|
apply(s, i) {
|
|
1210
1210
|
return i.apply(s);
|
|
@@ -1217,7 +1217,7 @@ function Xt({ handleWidth: t = 5, cellMinWidth: e = 25, defaultCellMinWidth: o =
|
|
|
1217
1217
|
},
|
|
1218
1218
|
handleDOMEvents: {
|
|
1219
1219
|
mousemove: (s, i) => {
|
|
1220
|
-
|
|
1220
|
+
Ut(s, i, t, l);
|
|
1221
1221
|
},
|
|
1222
1222
|
mouseleave: (s) => {
|
|
1223
1223
|
qt(s);
|
|
@@ -1235,7 +1235,7 @@ function Xt({ handleWidth: t = 5, cellMinWidth: e = 25, defaultCellMinWidth: o =
|
|
|
1235
1235
|
});
|
|
1236
1236
|
return r;
|
|
1237
1237
|
}
|
|
1238
|
-
var
|
|
1238
|
+
var Gt = class q {
|
|
1239
1239
|
constructor(e, o) {
|
|
1240
1240
|
this.activeHandle = e, this.dragging = o;
|
|
1241
1241
|
}
|
|
@@ -1250,7 +1250,7 @@ var Ut = class q {
|
|
|
1250
1250
|
return o;
|
|
1251
1251
|
}
|
|
1252
1252
|
};
|
|
1253
|
-
function
|
|
1253
|
+
function Ut(t, e, o, n) {
|
|
1254
1254
|
if (!t.editable) return;
|
|
1255
1255
|
const l = x.getState(t.state);
|
|
1256
1256
|
if (l && !l.dragging) {
|
|
@@ -1578,7 +1578,7 @@ function so(t, e, o, n, l) {
|
|
|
1578
1578
|
function io(t) {
|
|
1579
1579
|
return t instanceof w;
|
|
1580
1580
|
}
|
|
1581
|
-
var
|
|
1581
|
+
var G = ({ editor: t }) => {
|
|
1582
1582
|
const { selection: e } = t.state;
|
|
1583
1583
|
if (!io(e))
|
|
1584
1584
|
return !1;
|
|
@@ -1724,10 +1724,10 @@ var fo = uo, je = Z.create({
|
|
|
1724
1724
|
return {
|
|
1725
1725
|
Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
|
|
1726
1726
|
"Shift-Tab": () => this.editor.commands.goToPreviousCell(),
|
|
1727
|
-
Backspace:
|
|
1728
|
-
"Mod-Backspace":
|
|
1729
|
-
Delete:
|
|
1730
|
-
"Mod-Delete":
|
|
1727
|
+
Backspace: G,
|
|
1728
|
+
"Mod-Backspace": G,
|
|
1729
|
+
Delete: G,
|
|
1730
|
+
"Mod-Delete": G
|
|
1731
1731
|
};
|
|
1732
1732
|
},
|
|
1733
1733
|
addProseMirrorPlugins() {
|
|
@@ -1753,7 +1753,7 @@ var fo = uo, je = Z.create({
|
|
|
1753
1753
|
storage: t.storage
|
|
1754
1754
|
};
|
|
1755
1755
|
return {
|
|
1756
|
-
tableRole: Ue(
|
|
1756
|
+
tableRole: Ge(Ue(t, "tableRole", e))
|
|
1757
1757
|
};
|
|
1758
1758
|
}
|
|
1759
1759
|
});
|