reactjs-tiptap-editor 1.0.18 → 1.0.19
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-BOjCHFTA.js → ActionMenuButton-B1Nfn5Hm.js} +1 -1
- package/lib/{ActionMenuButton-Df077oOH.cjs → ActionMenuButton-D3b_bcin.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +23 -23
- package/lib/Blockquote.cjs +3 -3
- package/lib/Blockquote.js +33 -28
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +16 -10
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -2
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +21 -22
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +2 -2
- package/lib/CodeBlock.cjs +37 -37
- package/lib/CodeBlock.js +15 -16
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +3 -3
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +2 -2
- package/lib/{Drawer-DxOoRiGQ.js → Drawer-B1-7Y4HB.js} +3 -3
- package/lib/{Drawer-DwrlY_lY.cjs → Drawer-kEO7KzzC.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +12 -12
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +17 -17
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +4 -4
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +4 -4
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +9 -9
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +3 -3
- package/lib/History.cjs +1 -1
- package/lib/History.js +5 -3
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -2
- package/lib/{Iframe-C6pBw-AF.cjs → Iframe-Bk5OIlvy.cjs} +1 -1
- package/lib/{Iframe-AhNV5WH5.js → Iframe-XlAb03_r.js} +7 -7
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +6 -5
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +36 -36
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +13 -13
- package/lib/{Indent-Do-X0AsY.cjs → Indent-XaZNTsOk.cjs} +1 -1
- package/lib/{Indent-DZ5PcJA4.js → Indent-ruPuj5xn.js} +2 -2
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +24 -18
- package/lib/Katex-BFIYLrwm.cjs +4 -0
- package/lib/{Katex-bIgoenn_.js → Katex-DKspCn-p.js} +5 -6
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +3 -3
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +3 -3
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-D_cF9fnc.js → LinkEditBlock-BWm2Ypt2.js} +26 -26
- package/lib/{LinkEditBlock-B0ZaACZO.cjs → LinkEditBlock-DhesHreq.cjs} +1 -1
- package/lib/MarkdownPaste.cjs +1 -1
- package/lib/MarkdownPaste.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +4 -4
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +41 -42
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +5 -5
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -2
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +8 -8
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +6 -6
- package/lib/{SlashCommandNodeView-Ba03hlVZ.cjs → SlashCommandNodeView-CojfS61Q.cjs} +1 -1
- package/lib/{SlashCommandNodeView-cg0x3NRF.js → SlashCommandNodeView-Hf2DX4km.js} +6 -6
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -2
- package/lib/{Table-KqLiT5wG.js → Table-BTkFUATL.js} +4 -4
- package/lib/{Table-ddU2LSc6.cjs → Table-C1_xLqV0.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 +2 -2
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +3 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +3 -3
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +2 -2
- package/lib/{Twitter-BIiR78Jh.cjs → Twitter-Cj-0yyQQ.cjs} +1 -1
- package/lib/{Twitter-C1Lzqc7u.js → Twitter-D5mUTILj.js} +9 -9
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +4 -4
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +1835 -1634
- package/lib/{clsx-BWE7vnna.cjs → clsx-BSBE1eoY.cjs} +1 -1
- package/lib/{clsx-eGVyq7ot.js → clsx-OumA9x-8.js} +1 -1
- package/lib/{dropdown-menu-CexIkt_V.js → dropdown-menu-Bragdu5m.js} +1 -1
- package/lib/{dropdown-menu-oSKIntXM.cjs → dropdown-menu-CUeq1boX.cjs} +1 -1
- package/lib/extensions/Image/Image.d.ts +1 -0
- package/lib/{index-D_8P0LE5.js → index-B-7eHzaO.js} +1 -1
- package/lib/{index-RIXs7STX.js → index-BKlbc8Qo.js} +1 -1
- package/lib/index-BLrMslr7.cjs +1 -0
- package/lib/{index-mfGK4pFo.js → index-BVRHx_ha.js} +94 -90
- package/lib/{index-DHUN85fV.js → index-CDFAs4RT.js} +1149 -1019
- package/lib/{index-CJ9pyCM4.cjs → index-CMLwKzI0.cjs} +1 -1
- package/lib/index-COCTP78Y.cjs +12 -0
- package/lib/{index-BnW6t8z6.js → index-CZ1_8JQQ.js} +1 -1
- package/lib/{index-D0lc95kr.cjs → index-CnePcUeF.cjs} +1 -1
- package/lib/{index-DUpSE1Gb.cjs → index-D7wfvzJg.cjs} +1 -1
- package/lib/{index-zig3Dj7A.cjs → index-DwSnESy-.cjs} +7 -5
- package/lib/{index-C6xmkxrQ.js → index-cPEuL4Zr.js} +140 -138
- package/lib/index.cjs +1 -1
- package/lib/index.js +12 -12
- package/lib/{popover-BYSZ3zBi.js → popover-C2BbhsXH.js} +1 -1
- package/lib/{popover-BcHDZqBt.cjs → popover-DCJpsZx0.cjs} +1 -1
- package/lib/{renderNodeView-BrM5kUj_.js → renderNodeView-CmnUEfby.js} +2 -2
- package/lib/{renderNodeView-D1zydtli.cjs → renderNodeView-DQjWzXDA.cjs} +1 -1
- package/lib/{separator-BmixLrnJ.cjs → separator-BuG1zwKa.cjs} +1 -1
- package/lib/{separator-CFKVxAea.js → separator-lkMWuUvf.js} +14 -14
- package/lib/{updatePosition-CfmY5Trk.cjs → updatePosition-D6AScA-1.cjs} +1 -1
- package/lib/{updatePosition-CBRjbQMH.js → updatePosition-DYuAiqx-.js} +2 -2
- package/package.json +1 -1
- package/lib/Katex-CIC9ygbL.cjs +0 -4
- package/lib/index-BUTn2LY6.cjs +0 -1
- package/lib/index-BtxvYLJ1.cjs +0 -12
- package/lib/select-C5SHDLFj.js +0 -120
- package/lib/select-DHjzKkcu.cjs +0 -1
- package/lib/textarea-CasDcv3u.cjs +0 -1
- package/lib/textarea-DNLrJoRl.js +0 -20
package/lib/MarkdownPaste.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var we=Object.defineProperty;var ye=(n,e,t)=>e in n?we(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var d=(n,e,t)=>ye(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Se=require("./index-
|
|
1
|
+
"use strict";var we=Object.defineProperty;var ye=(n,e,t)=>e in n?we(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var d=(n,e,t)=>ye(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Se=require("./index-DwSnESy-.cjs"),ne=require("@tiptap/pm/state");function j(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var R=j();function oe(n){R=n}var _={exec:()=>null};function u(n,e=""){let t=typeof n=="string"?n:n.source;const r={replace:(s,i)=>{let c=typeof i=="string"?i:i.source;return c=c.replace(x.caret,"$1"),t=t.replace(s,c),r},getRegex:()=>new RegExp(t,e)};return r}var x={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i")},$e=/^(?:[ \t]*(?:\n|$))+/,Re=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ve=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,A=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Te=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,H=/(?:[*+-]|\d{1,9}[.)])/,ce=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,he=u(ce).replace(/bull/g,H).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ze=u(ce).replace(/bull/g,H).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Q=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,_e=/^[^\n]+/,W=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ae=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",W).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Pe=u(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,H).getRegex(),E="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",F=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Le=u("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",F).replace("tag",E).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pe=u(Q).replace("hr",A).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",E).getRegex(),Ce=u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",pe).getRegex(),U={blockquote:Ce,code:Re,def:Ae,fences:ve,heading:Te,hr:A,html:Le,lheading:he,list:Pe,newline:$e,paragraph:pe,table:_,text:_e},re=u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",A).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",E).getRegex(),Ie={...U,lheading:ze,table:re,paragraph:u(Q).replace("hr",A).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",re).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",E).getRegex()},Be={...U,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",F).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:_,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(Q).replace("hr",A).replace("heading",` *#{1,6} *[^
|
|
2
2
|
]`).replace("lheading",he).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ee=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,qe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ue=/^( {2,}|\\)\n(?!\s*$)/,De=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,q=/[\p{P}\p{S}]/u,X=/[\s\p{P}\p{S}]/u,ge=/[^\s\p{P}\p{S}]/u,Ze=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,X).getRegex(),fe=/(?!~)[\p{P}\p{S}]/u,Me=/(?!~)[\s\p{P}\p{S}]/u,Oe=/(?:[^\s\p{P}\p{S}]|~)/u,Ge=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,de=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Ne=u(de,"u").replace(/punct/g,q).getRegex(),je=u(de,"u").replace(/punct/g,fe).getRegex(),ke="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",He=u(ke,"gu").replace(/notPunctSpace/g,ge).replace(/punctSpace/g,X).replace(/punct/g,q).getRegex(),Qe=u(ke,"gu").replace(/notPunctSpace/g,Oe).replace(/punctSpace/g,Me).replace(/punct/g,fe).getRegex(),We=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ge).replace(/punctSpace/g,X).replace(/punct/g,q).getRegex(),Fe=u(/\\(punct)/,"gu").replace(/punct/g,q).getRegex(),Ue=u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Xe=u(F).replace("(?:-->|$)","-->").getRegex(),Ke=u("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Xe).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),C=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Je=u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",C).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),be=u(/^!?\[(label)\]\[(ref)\]/).replace("label",C).replace("ref",W).getRegex(),xe=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",W).getRegex(),Ve=u("reflink|nolink(?!\\()","g").replace("reflink",be).replace("nolink",xe).getRegex(),K={_backpedal:_,anyPunctuation:Fe,autolink:Ue,blockSkip:Ge,br:ue,code:qe,del:_,emStrongLDelim:Ne,emStrongRDelimAst:He,emStrongRDelimUnd:We,escape:Ee,link:Je,nolink:xe,punctuation:Ze,reflink:be,reflinkSearch:Ve,tag:Ke,text:De,url:_},Ye={...K,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",C).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",C).getRegex()},O={...K,emStrongRDelimAst:Qe,emStrongLDelim:je,url:u(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},et={...O,br:u(ue).replace("{2,}","*").getRegex(),text:u(O.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},P={normal:U,gfm:Ie,pedantic:Be},T={normal:K,gfm:O,breaks:et,pedantic:Ye},tt={"&":"&","<":"<",">":">",'"':""","'":"'"},se=n=>tt[n];function w(n,e){if(e){if(x.escapeTest.test(n))return n.replace(x.escapeReplace,se)}else if(x.escapeTestNoEncode.test(n))return n.replace(x.escapeReplaceNoEncode,se);return n}function ie(n){try{n=encodeURI(n).replace(x.percentDecode,"%")}catch{return null}return n}function le(n,e){var i;const t=n.replace(x.findPipe,(c,l,h)=>{let a=!1,o=l;for(;--o>=0&&h[o]==="\\";)a=!a;return a?"|":" |"}),r=t.split(x.splitPipe);let s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(x.slashPipe,"|");return r}function z(n,e,t){const r=n.length;if(r===0)return"";let s=0;for(;s<r&&n.charAt(r-s-1)===e;)s++;return n.slice(0,r-s)}function nt(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===e[0])t++;else if(n[r]===e[1]&&(t--,t<0))return r;return t>0?-2:-1}function ae(n,e,t,r,s){const i=e.href,c=e.title||null,l=n[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;const h={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:c,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,h}function rt(n,e,t){const r=n.match(t.other.indentCodeCompensation);if(r===null)return e;const s=r[1];return e.split(`
|
|
3
3
|
`).map(i=>{const c=i.match(t.other.beginningSpace);if(c===null)return i;const[l]=c;return l.length>=s.length?i.slice(s.length):i}).join(`
|
|
4
4
|
`)}var I=class{constructor(n){d(this,"options");d(this,"rules");d(this,"lexer");this.options=n||R}space(n){const e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){const e=this.rules.block.code.exec(n);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:z(t,`
|
package/lib/MarkdownPaste.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var me = Object.defineProperty;
|
|
2
2
|
var we = (n, e, t) => e in n ? me(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var d = (n, e, t) => we(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { E as ye } from "./index-
|
|
4
|
+
import { E as ye } from "./index-BVRHx_ha.js";
|
|
5
5
|
import { Plugin as $e, PluginKey as Re } from "@tiptap/pm/state";
|
|
6
6
|
function j() {
|
|
7
7
|
return {
|
package/lib/Mention.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-DwSnESy-.cjs"),y=require("@tiptap/pm/model"),T=require("./index-D7wfvzJg.cjs"),M=require("@tiptap/pm/state"),m=require("react/jsx-runtime"),x=require("./clsx-BSBE1eoY.cjs"),h=require("react"),L=require("scroll-into-view-if-needed"),f=require("./renderNodeView-DQjWzXDA.cjs");function S({editor:e,overrideSuggestionOptions:t,extensionName:n,char:r="@"}){const s=new M.PluginKey;return{editor:e,char:r,pluginKey:s,command:({editor:o,range:a,props:l})=>{var u,i,c;const g=o.view.state.selection.$to.nodeAfter;((u=g==null?void 0:g.text)==null?void 0:u.startsWith(" "))&&(a.to+=1),o.chain().focus().insertContentAt(a,[{type:n,attrs:{...l,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(c=(i=o.view.dom.ownerDocument.defaultView)==null?void 0:i.getSelection())==null||c.collapseToEnd()},allow:({state:o,range:a})=>{const l=o.doc.resolve(a.from),u=o.schema.nodes[n];return!!l.parent.type.contentMatch.matchType(u)},...t}}function w(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(t=>S({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function b(e,t){const n=w(e),r=n.find(s=>s.char===t);return r||(n.length?n[0]:null)}var A=d.Node3.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:e,suggestion:t}){var n,r;return`${(n=t==null?void 0:t.char)!=null?n:"@"}${(r=e.attrs.label)!=null?r:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:t,suggestion:n}){var r,s;return["span",d.mergeAttributes(this.HTMLAttributes,e.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(s=t.attrs.label)!=null?s:t.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:e=>e.getAttribute("data-mention-suggestion-char"),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){const n=b(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",d.mergeAttributes({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e,suggestion:n})];const r={...this.options};r.HTMLAttributes=d.mergeAttributes({"data-type":this.name},this.options.HTMLAttributes,t);const s=this.options.renderHTML({options:r,node:e,suggestion:n});return typeof s=="string"?["span",d.mergeAttributes({"data-type":this.name},this.options.HTMLAttributes,t),s]:s},...d.createInlineMarkdownSpec({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:e=>{const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;r!==null;){const[,s,o,a]=r,l=o??a;t[s==="char"?"mentionSuggestionChar":s]=l,r=n.exec(e)}return t},serializeAttributes:e=>Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t==="mentionSuggestionChar"?"char":t}="${n}"`).join(" ")}),renderText({node:e}){const t={options:this.options,node:e,suggestion:b(this,e.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(t)):this.options.renderText(t)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1;const{selection:r}=t,{empty:s,anchor:o}=r;if(!s)return!1;let a=new y.Node,l=0;return t.doc.nodesBetween(o-1,o,(u,i)=>{if(u.type.name===this.name)return n=!0,a=u,l=i,!1}),n&&e.insertText(this.options.deleteTriggerWithBackspace?"":a.attrs.mentionSuggestionChar,l,l+a.nodeSize),n})}},addProseMirrorPlugins(){return w(this).map(T.Suggestion)}}),H=A;const v=h.forwardRef((e,t)=>{const n=h.useRef(null),[r,s]=h.useState(0),o=i=>{const c=e.items[i];c&&e.command(c)},a=()=>{s((r+e.items.length-1)%e.items.length)},l=()=>{s((r+1)%e.items.length)},u=()=>{o(r)};return h.useEffect(()=>s(0),[e.items]),h.useEffect(()=>{if(Number.isNaN(r+1))return;const i=n.current.querySelector(`span:nth-of-type(${r+1})`);i&&L(i,{behavior:"smooth",scrollMode:"if-needed"})},[r]),h.useImperativeHandle(t,()=>({onKeyDown:({event:i})=>i.key==="ArrowUp"?(a(),!0):i.key==="ArrowDown"?(l(),!0):i.key==="Enter"?(u(),!0):!1})),m.jsx("div",{className:"!richtext-max-h-[320px] !richtext-w-[160px] 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:n,children:m.jsx("div",{children:e.items.length>0?e.items.map((i,c)=>{var g;return m.jsxs("span",{className:x.clsx("richtext-flex richtext-w-full richtext-items-center richtext-gap-3 richtext-rounded-sm !richtext-border-none !richtext-bg-transparent richtext-px-2 richtext-py-1.5 richtext-text-left richtext-text-sm richtext-text-foreground !richtext-outline-none richtext-transition-colors hover:!richtext-bg-accent",{"bg-item-active":c===r}),onClick:p=>{p.preventDefault(),o(c)},children:[((g=i==null?void 0:i.avatar)==null?void 0:g.src)&&m.jsx("img",{alt:i.label,className:"richtext-size-5 richtext-rounded-full",src:i.avatar.src}),i==null?void 0:i.label]},`mention-item-${i.id}`)}):m.jsx("div",{className:x.clsx("itemUserEmpty, richtext-text-foreground"),children:"Empty"})})})}),N=d.Extension.create({name:"richTextMentionWrapper",addExtensions(){var t,n,r,s;const e={...this.options};return(t=this.options)!=null&&t.suggestion&&(e.suggestion={render:f.renderNodeViewClosure(v),...this.options.suggestion}),(r=(n=this.options)==null?void 0:n.suggestions)!=null&&r.length&&(e.suggestions=(s=this.options.suggestions)==null?void 0:s.map(o=>({render:f.renderNodeViewClosure(v),...o}))),[H.configure({HTMLAttributes:{class:"mention"},...e})]}});exports.Mention=N;
|
package/lib/Mention.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { N as y, y as T, m as h, E as M } from "./index-
|
|
1
|
+
import { N as y, y as T, m as h, E as M } from "./index-BVRHx_ha.js";
|
|
2
2
|
import { Node as L } from "@tiptap/pm/model";
|
|
3
|
-
import { S } from "./index-
|
|
3
|
+
import { S } from "./index-B-7eHzaO.js";
|
|
4
4
|
import { PluginKey as H } from "@tiptap/pm/state";
|
|
5
5
|
import { jsx as g, jsxs as A } from "react/jsx-runtime";
|
|
6
|
-
import { c as p } from "./clsx-
|
|
6
|
+
import { c as p } from "./clsx-OumA9x-8.js";
|
|
7
7
|
import { forwardRef as N, useRef as C, useState as $, useEffect as f, useImperativeHandle as k } from "react";
|
|
8
8
|
import E from "scroll-into-view-if-needed";
|
|
9
|
-
import { r as x } from "./renderNodeView-
|
|
9
|
+
import { r as x } from "./renderNodeView-CmnUEfby.js";
|
|
10
10
|
function _({
|
|
11
11
|
editor: e,
|
|
12
12
|
overrideSuggestionOptions: t,
|
package/lib/Mermaid.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var V=Object.create;var B=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var J=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of U(e))!Y.call(t,c)&&c!==r&&B(t,c,{get:()=>e[c],enumerable:!(a=X(e,c))||a.enumerable});return t};var K=(t,e,r)=>(r=t!=null?V(Z(t)):{},J(e||!t||!t.__esModule?B(r,"default",{value:t,enumerable:!0}):r,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("./index-
|
|
2
|
-
a-->b`;function
|
|
1
|
+
"use strict";var V=Object.create;var B=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var J=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of U(e))!Y.call(t,c)&&c!==r&&B(t,c,{get:()=>e[c],enumerable:!(a=X(e,c))||a.enumerable});return t};var K=(t,e,r)=>(r=t!=null?V(Z(t)):{},J(e||!t||!t.__esModule?B(r,"default",{value:t,enumerable:!0}):r,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("./index-DwSnESy-.cjs"),l=require("./index-BLrMslr7.cjs"),$=require("./clsx-BSBE1eoY.cjs"),o=require("react/jsx-runtime"),s=require("react"),L=require("./index-BqL4vAWE.cjs"),G=require("./shortId-Bfj8TyNr.cjs"),j={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function Q({editor:t,node:e,updateAttributes:r,getPos:a,selected:c}){const[y,h]=s.useState({width:L.IMAGE_MAX_SIZE,height:L.IMAGE_MAX_SIZE}),[N,H]=s.useState({width:0,height:0}),[_]=s.useState([j.TOP_LEFT,j.TOP_RIGHT,j.BOTTOM_LEFT,j.BOTTOM_RIGHT]),[u,I]=s.useState(!1),[A,g]=s.useState({x:0,y:0,w:0,h:0,dir:""}),{align:z}=e==null?void 0:e.attrs,p=s.useMemo(()=>{const{src:i,alt:x,width:M,height:w}=e==null?void 0:e.attrs,T=D.isNumber(M)?`${M}px`:M,n=D.isNumber(w)?`${w}px`:w;return{src:i||void 0,alt:x||void 0,style:{width:T||void 0,height:n||void 0}}},[e==null?void 0:e.attrs]),C=s.useMemo(()=>{const{style:{width:i}}=p;return{width:i==="100%"?i:void 0}},[p]);function k(i){H({width:i.target.width,height:i.target.height})}function S(){t.commands.setNodeSelection(a())}const O=s.useCallback(l.throttle(()=>{const{width:i}=getComputedStyle(t.view.dom);h(x=>({...x,width:Number.parseInt(i,10)}))},L.IMAGE_THROTTLE_WAIT_TIME),[t]);function q(i,x){i.preventDefault(),i.stopPropagation();const M=N.width,w=N.height,T=M/w;let n=Number(e.attrs.width),b=Number(e.attrs.height);const f=y.width;n&&!b?(n=n>f?f:n,b=Math.round(n/T)):b&&!n?(n=Math.round(b*T),n=n>f?f:n):!n&&!b?(n=M>f?f:M,b=Math.round(n/T)):n=n>f?f:n,I(!0),g({x:i.clientX,y:i.clientY,w:n,h:b,dir:x})}const d=s.useCallback(l.throttle(i=>{if(i.preventDefault(),i.stopPropagation(),!u)return;const{x,w:M,dir:w}=A,T=(i.clientX-x)*(/l/.test(w)?-1:1),{width:n,height:b}=e==null?void 0:e.attrs,f=n/b,P=l.clamp(M+T,L.IMAGE_MIN_SIZE,y.width),W=Math.round(P/f);r({width:P,height:W})},L.IMAGE_THROTTLE_WAIT_TIME),[u,A,y,r,e==null?void 0:e.attrs]),m=s.useCallback(i=>{i.preventDefault(),i.stopPropagation(),u&&(g({x:0,y:0,w:0,h:0,dir:""}),I(!1),S())},[u,S]),R=s.useCallback(()=>{document==null||document.addEventListener("mousemove",d,!0),document==null||document.addEventListener("mouseup",m,!0)},[d,m]),E=s.useCallback(()=>{document==null||document.removeEventListener("mousemove",d,!0),document==null||document.removeEventListener("mouseup",m,!0)},[d,m]);s.useEffect(()=>(u?R():E(),()=>{E()}),[u,R,E]);const v=s.useMemo(()=>new ResizeObserver(()=>O()),[O]);return s.useEffect(()=>(v.observe(t.view.dom),()=>{v.disconnect()}),[t.view.dom,v]),o.jsx($.NodeViewWrapper,{className:"image-view",style:{...C,width:"100%",textAlign:z},children:o.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:{...C,background:"#fff"},className:`image-view__body ${c?"image-view__body--focused":""} ${u?"image-view__body--resizing":""}`,children:[o.jsx("img",{alt:p.alt,className:"image-view__body__image block",height:"auto",onClick:S,onLoad:k,src:p.src,style:p.style}),t.view.editable&&(c||u)&&o.jsx("div",{className:"image-resizer",children:_==null?void 0:_.map(i=>o.jsx("span",{className:`image-resizer__handler image-resizer__handler--${i}`,onMouseDown:x=>q(x,i)},`image-dir-${i}`))})]})})}const ee=`graph TB
|
|
2
|
+
a-->b`;function te(){const t=l.useEditorInstance(),e=l.useButtonProps(F.name),{tooltipOptions:r={},isActive:a=void 0,upload:c}=(e==null?void 0:e.componentProps)??{},{editorDisabled:y}=l.useToggleActive(a),[h,N]=s.useState(ee),[H,_]=s.useState(""),[u,I]=s.useState(!1),A=s.useRef(null),[g,z]=s.useState(null),[p,C]=s.useState(!0),k=s.useCallback(d=>{d&&import("mermaid").then(m=>{z(m.default)}).finally(()=>C(!1))},[]),S=async d=>{try{const{svg:m}=await g.render("mermaid-svg",d);_(m)}catch{_("")}},O=()=>{g.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),S(h)};s.useEffect(()=>{!p&&g&&u&&O()},[g,u]),s.useEffect(()=>{!p&&g&&u&&S(h)},[g&&h]);const q=async()=>{if(h!==""){if(h){const d=A.current.querySelector("svg"),{width:m,height:R}=d.getBoundingClientRect(),E=`mermaid-${G.shortId()}.svg`;let v=G.i(d.outerHTML);if(c){const i=l.dataURLtoFile(v,E);v=await c(i)}t==null||t.chain().focus().setMermaid({type:"mermaid",src:v,alt:encodeURIComponent(h),width:m,height:R},!!h).run()}I(!1)}};return o.jsxs(l.Dialog,{onOpenChange:I,open:u,children:[o.jsx(l.DialogTrigger,{asChild:!0,children:o.jsx(l.ActionButton,{disabled:y,icon:"Mermaid",tooltip:"Mermaid",tooltipOptions:r,action:()=>{y||I(!0)}})}),o.jsxs(l.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[o.jsx(l.DialogTitle,{children:"Mermaid"}),o.jsx("div",{ref:k,style:{height:"100%",border:"1px solid hsl(var(--border))"},children:p?o.jsx("p",{children:"Loading..."}):o.jsx(o.Fragment,{children:o.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[o.jsx(l.Textarea,{autoFocus:!0,className:"richtext-flex-1",onChange:d=>N(d.target.value),placeholder:"Text",required:!0,rows:10,value:h,style:{color:"hsl(var(--foreground))"}}),o.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:H},ref:A,style:{height:"100%",borderWidth:1,minHeight:500,background:"#fff"}})]})})}),o.jsx(l.DialogFooter,{children:o.jsx(l.Button,{disabled:!g,onClick:q,type:"button",children:"Save changes"})})]})]})}const F=l.index_default.extend({name:"mermaid",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"mermaid"},button:({editor:e,t:r,extension:a})=>{var c;return{componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,editor:e,icon:"Mermaid",tooltip:r("editor.mermaid.tooltip"),upload:(c=a==null?void 0:a.options)==null?void 0:c.upload}}}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:e=>{const r=e.querySelector("img"),a=r==null?void 0:r.getAttribute("width");return a?Number.parseInt(a,10):320},renderHTML:e=>({width:e.width})},height:{default:null,parseHTML:e=>{const r=e.querySelector("img"),a=r==null?void 0:r.getAttribute("height");return a?Number.parseInt(a,10):212},renderHTML:e=>({height:e.height})},align:{default:"center",parseHTML:e=>e.getAttribute("align"),renderHTML:e=>({align:e.align})}}},addNodeView(){return $.ReactNodeViewRenderer(Q)},addCommands(){return{setMermaid:(t,e)=>({commands:r,editor:a})=>e?r.insertContent({type:this.name,attrs:t}):r.insertContentAt(a.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageMermaid:t=>({commands:e})=>e.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:e}=t;return["div",{style:e?`text-align: ${e};`:"",class:"imageMermaid"},["img",D.mergeAttributes(this.options.HTMLAttributes,t)]]},parseHTML(){return[{tag:"div[class=imageMermaid]",getAttrs:t=>{const e=t.querySelector("img"),r=e==null?void 0:e.getAttribute("width"),a=e==null?void 0:e.getAttribute("height");return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),width:r?Number.parseInt(r,10):null,height:a?Number.parseInt(a,10):null,align:(e==null?void 0:e.getAttribute("align"))||t.style.textAlign||null}}}]}});exports.Mermaid=F;exports.RichTextMermaid=te;
|
package/lib/Mermaid.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { q as
|
|
2
|
-
import {
|
|
3
|
-
import { N as
|
|
4
|
-
import { jsx as n, jsxs as
|
|
5
|
-
import { useState as m, useMemo as
|
|
6
|
-
import { I as V, i as W, j as
|
|
7
|
-
import { s as
|
|
8
|
-
|
|
9
|
-
const C = {
|
|
1
|
+
import { q as $, m as U } from "./index-BVRHx_ha.js";
|
|
2
|
+
import { z as q, E as X, h as Z, u as Y, d as J, D as K, m as Q, A as tt, n as et, o as rt, F as it, t as at, B as st, G as nt, H as ot } from "./index-CDFAs4RT.js";
|
|
3
|
+
import { N as lt, a as ct } from "./clsx-OumA9x-8.js";
|
|
4
|
+
import { jsx as n, jsxs as C, Fragment as dt } from "react/jsx-runtime";
|
|
5
|
+
import { useState as m, useMemo as F, useCallback as A, useEffect as R, useRef as ut } from "react";
|
|
6
|
+
import { I as V, i as W, j as ht } from "./index-BlXGgvT-.js";
|
|
7
|
+
import { s as mt, i as gt } from "./shortId-WJVkrvml.js";
|
|
8
|
+
const H = {
|
|
10
9
|
TOP_LEFT: "tl",
|
|
11
10
|
TOP_RIGHT: "tr",
|
|
12
11
|
BOTTOM_LEFT: "bl",
|
|
@@ -20,18 +19,18 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
20
19
|
width: 0,
|
|
21
20
|
height: 0
|
|
22
21
|
}), [y] = m([
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
H.TOP_LEFT,
|
|
23
|
+
H.TOP_RIGHT,
|
|
24
|
+
H.BOTTOM_LEFT,
|
|
25
|
+
H.BOTTOM_RIGHT
|
|
27
26
|
]), [o, _] = m(!1), [L, d] = m({
|
|
28
27
|
x: 0,
|
|
29
28
|
y: 0,
|
|
30
29
|
w: 0,
|
|
31
30
|
h: 0,
|
|
32
31
|
dir: ""
|
|
33
|
-
}), { align: B } = t == null ? void 0 : t.attrs, g =
|
|
34
|
-
const { src: r, alt: p, width: f, height: b } = t == null ? void 0 : t.attrs, x =
|
|
32
|
+
}), { align: B } = t == null ? void 0 : t.attrs, g = F(() => {
|
|
33
|
+
const { src: r, alt: p, width: f, height: b } = t == null ? void 0 : t.attrs, x = $(f) ? `${f}px` : f, a = $(b) ? `${b}px` : b;
|
|
35
34
|
return {
|
|
36
35
|
src: r || void 0,
|
|
37
36
|
alt: p || void 0,
|
|
@@ -40,7 +39,7 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
40
39
|
height: a || void 0
|
|
41
40
|
}
|
|
42
41
|
};
|
|
43
|
-
}, [t == null ? void 0 : t.attrs]),
|
|
42
|
+
}, [t == null ? void 0 : t.attrs]), E = F(() => {
|
|
44
43
|
const {
|
|
45
44
|
style: { width: r }
|
|
46
45
|
} = g;
|
|
@@ -55,7 +54,7 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
55
54
|
function I() {
|
|
56
55
|
e.commands.setNodeSelection(s());
|
|
57
56
|
}
|
|
58
|
-
const
|
|
57
|
+
const O = A(
|
|
59
58
|
q(() => {
|
|
60
59
|
const { width: r } = getComputedStyle(e.view.dom);
|
|
61
60
|
c((p) => ({
|
|
@@ -65,7 +64,7 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
65
64
|
}, W),
|
|
66
65
|
[e]
|
|
67
66
|
);
|
|
68
|
-
function
|
|
67
|
+
function P(r, p) {
|
|
69
68
|
r.preventDefault(), r.stopPropagation();
|
|
70
69
|
const f = S.width, b = S.height, x = f / b;
|
|
71
70
|
let a = Number(t.attrs.width), v = Number(t.attrs.height);
|
|
@@ -82,9 +81,9 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
82
81
|
q((r) => {
|
|
83
82
|
if (r.preventDefault(), r.stopPropagation(), !o)
|
|
84
83
|
return;
|
|
85
|
-
const { x: p, w: f, dir: b } = L, x = (r.clientX - p) * (/l/.test(b) ? -1 : 1), { width: a, height: v } = t == null ? void 0 : t.attrs, h = a / v,
|
|
84
|
+
const { x: p, w: f, dir: b } = L, x = (r.clientX - p) * (/l/.test(b) ? -1 : 1), { width: a, height: v } = t == null ? void 0 : t.attrs, h = a / v, G = X(f + x, ht, T.width), j = Math.round(G / h);
|
|
86
85
|
i({
|
|
87
|
-
width:
|
|
86
|
+
width: G,
|
|
88
87
|
height: j
|
|
89
88
|
});
|
|
90
89
|
}, W),
|
|
@@ -108,20 +107,20 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
108
107
|
R(() => (o ? z() : N(), () => {
|
|
109
108
|
N();
|
|
110
109
|
}), [o, z, N]);
|
|
111
|
-
const M =
|
|
110
|
+
const M = F(() => new ResizeObserver(() => O()), [O]);
|
|
112
111
|
return R(() => (M.observe(e.view.dom), () => {
|
|
113
112
|
M.disconnect();
|
|
114
113
|
}), [e.view.dom, M]), /* @__PURE__ */ n(
|
|
115
|
-
|
|
114
|
+
lt,
|
|
116
115
|
{
|
|
117
116
|
className: "image-view",
|
|
118
|
-
style: { ...
|
|
119
|
-
children: /* @__PURE__ */
|
|
117
|
+
style: { ...E, width: "100%", textAlign: B },
|
|
118
|
+
children: /* @__PURE__ */ C(
|
|
120
119
|
"div",
|
|
121
120
|
{
|
|
122
121
|
"data-drag-handle": !0,
|
|
123
122
|
draggable: "true",
|
|
124
|
-
style: { ...
|
|
123
|
+
style: { ...E, background: "#fff" },
|
|
125
124
|
className: `image-view__body ${w ? "image-view__body--focused" : ""} ${o ? "image-view__body--resizing" : ""}`,
|
|
126
125
|
children: [
|
|
127
126
|
/* @__PURE__ */ n(
|
|
@@ -140,7 +139,7 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
140
139
|
"span",
|
|
141
140
|
{
|
|
142
141
|
className: `image-resizer__handler image-resizer__handler--${r}`,
|
|
143
|
-
onMouseDown: (p) =>
|
|
142
|
+
onMouseDown: (p) => P(p, r)
|
|
144
143
|
},
|
|
145
144
|
`image-dir-${r}`
|
|
146
145
|
)) })
|
|
@@ -152,11 +151,11 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
152
151
|
}
|
|
153
152
|
const ft = `graph TB
|
|
154
153
|
a-->b`;
|
|
155
|
-
function
|
|
156
|
-
const e = Z(), t = Y(vt.name), { tooltipOptions: i = {}, isActive: s = void 0, upload: w } = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: T } = J(s), [c, S] = m(ft), [D, y] = m(""), [o, _] = m(!1), L =
|
|
154
|
+
function It() {
|
|
155
|
+
const e = Z(), t = Y(vt.name), { tooltipOptions: i = {}, isActive: s = void 0, upload: w } = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: T } = J(s), [c, S] = m(ft), [D, y] = m(""), [o, _] = m(!1), L = ut(null), [d, B] = m(null), [g, E] = m(!0), k = A((l) => {
|
|
157
156
|
l && import("mermaid").then((u) => {
|
|
158
157
|
B(u.default);
|
|
159
|
-
}).finally(() =>
|
|
158
|
+
}).finally(() => E(!1));
|
|
160
159
|
}, []), I = async (l) => {
|
|
161
160
|
try {
|
|
162
161
|
const { svg: u } = await d.render("mermaid-svg", l);
|
|
@@ -164,7 +163,7 @@ function At() {
|
|
|
164
163
|
} catch {
|
|
165
164
|
y("");
|
|
166
165
|
}
|
|
167
|
-
},
|
|
166
|
+
}, O = () => {
|
|
168
167
|
d.initialize({
|
|
169
168
|
darkMode: !1,
|
|
170
169
|
startOnLoad: !1,
|
|
@@ -174,10 +173,10 @@ function At() {
|
|
|
174
173
|
}), I(c);
|
|
175
174
|
};
|
|
176
175
|
return R(() => {
|
|
177
|
-
!g && d && o &&
|
|
176
|
+
!g && d && o && O();
|
|
178
177
|
}, [d, o]), R(() => {
|
|
179
178
|
!g && d && o && I(c);
|
|
180
|
-
}, [d && c]), /* @__PURE__ */
|
|
179
|
+
}, [d && c]), /* @__PURE__ */ C(K, { onOpenChange: _, open: o, children: [
|
|
181
180
|
/* @__PURE__ */ n(Q, { asChild: !0, children: /* @__PURE__ */ n(
|
|
182
181
|
tt,
|
|
183
182
|
{
|
|
@@ -190,11 +189,11 @@ function At() {
|
|
|
190
189
|
}
|
|
191
190
|
}
|
|
192
191
|
) }),
|
|
193
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ C(et, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
|
|
194
193
|
/* @__PURE__ */ n(rt, { children: "Mermaid" }),
|
|
195
|
-
/* @__PURE__ */ n("div", { ref: k, style: { height: "100%", border: "1px solid hsl(var(--border))" }, children: g ? /* @__PURE__ */ n("p", { children: "Loading..." }) : /* @__PURE__ */ n(
|
|
194
|
+
/* @__PURE__ */ n("div", { ref: k, style: { height: "100%", border: "1px solid hsl(var(--border))" }, children: g ? /* @__PURE__ */ n("p", { children: "Loading..." }) : /* @__PURE__ */ n(dt, { children: /* @__PURE__ */ C("div", { className: "richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]", children: [
|
|
196
195
|
/* @__PURE__ */ n(
|
|
197
|
-
|
|
196
|
+
it,
|
|
198
197
|
{
|
|
199
198
|
autoFocus: !0,
|
|
200
199
|
className: "richtext-flex-1",
|
|
@@ -223,13 +222,13 @@ function At() {
|
|
|
223
222
|
}
|
|
224
223
|
)
|
|
225
224
|
] }) }) }),
|
|
226
|
-
/* @__PURE__ */ n(
|
|
225
|
+
/* @__PURE__ */ n(at, { children: /* @__PURE__ */ n(st, { disabled: !d, onClick: async () => {
|
|
227
226
|
if (c !== "") {
|
|
228
227
|
if (c) {
|
|
229
|
-
const l = L.current.querySelector("svg"), { width: u, height: z } = l.getBoundingClientRect(), N = `mermaid-${
|
|
230
|
-
let M =
|
|
228
|
+
const l = L.current.querySelector("svg"), { width: u, height: z } = l.getBoundingClientRect(), N = `mermaid-${mt()}.svg`;
|
|
229
|
+
let M = gt(l.outerHTML);
|
|
231
230
|
if (w) {
|
|
232
|
-
const r =
|
|
231
|
+
const r = nt(M, N);
|
|
233
232
|
M = await w(r);
|
|
234
233
|
}
|
|
235
234
|
e == null || e.chain().focus().setMermaid(
|
|
@@ -249,7 +248,7 @@ function At() {
|
|
|
249
248
|
] })
|
|
250
249
|
] });
|
|
251
250
|
}
|
|
252
|
-
const vt = /* @__PURE__ */
|
|
251
|
+
const vt = /* @__PURE__ */ ot.extend({
|
|
253
252
|
name: "mermaid",
|
|
254
253
|
//@ts-expect-error
|
|
255
254
|
addOptions() {
|
|
@@ -316,7 +315,7 @@ const vt = /* @__PURE__ */ nt.extend({
|
|
|
316
315
|
};
|
|
317
316
|
},
|
|
318
317
|
addNodeView() {
|
|
319
|
-
return
|
|
318
|
+
return ct(pt);
|
|
320
319
|
},
|
|
321
320
|
// @ts-ignore
|
|
322
321
|
addCommands() {
|
|
@@ -370,5 +369,5 @@ const vt = /* @__PURE__ */ nt.extend({
|
|
|
370
369
|
});
|
|
371
370
|
export {
|
|
372
371
|
vt as Mermaid,
|
|
373
|
-
|
|
372
|
+
It as RichTextMermaid
|
|
374
373
|
};
|
package/lib/MoreMark.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-DwSnESy-.cjs"),r=require("react/jsx-runtime"),M=require("react"),c=require("./index-BLrMslr7.cjs");require("./theme.cjs");const l=require("./dropdown-menu-CUeq1boX.cjs");var x=u.Mark.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",u.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),f=u.Mark.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",u.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});function S(){const t=c.useButtonProps(m.name),{icon:s=void 0,tooltip:n=void 0,items:i=[],isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{disabled:a,dataState:o}=c.useActive(d),h=M.useMemo(()=>(o==null?void 0:o.title)||"",[o]);return t?r.jsxs(l.DropdownMenu,{children:[r.jsx(l.DropdownMenuTrigger,{asChild:!0,disabled:a,children:r.jsx(c.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:a,icon:s,tooltip:n,children:r.jsx(c.MenuDown,{className:"richtext-size-3 richtext-text-gray-500"})})}),r.jsx(l.DropdownMenuContent,{className:"w-full",children:i==null?void 0:i.map((e,p)=>r.jsxs(l.DropdownMenuCheckboxItem,{checked:h===e.title,className:"richtext-flex richtext-items-center richtext-gap-3",onClick:e.action,children:[r.jsx(c.IconComponent,{name:e==null?void 0:e.icon}),r.jsx("span",{className:"richtext-ml-1",children:e.title}),!!(e!=null&&e.shortcutKeys)&&r.jsx("span",{className:"richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60",children:c.getShortcutKeys(e.shortcutKeys)})]},`more-mark-${p}`))})]}):r.jsx(r.Fragment,{})}const m=u.Extension.create({name:"moreMark",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:s,extension:n,t:i}){var p,g;const d=n.options.subscript,a=n.options.superscript,o={action:()=>s.commands.toggleSubscript(),isActive:()=>s.isActive("subscript")||!1,disabled:!s.can().toggleSubscript(),icon:"Subscript",title:i("editor.subscript.tooltip"),shortcutKeys:((p=n.options.shortcutKeys)==null?void 0:p[0])??["mod","."]},h={action:()=>s.commands.toggleSuperscript(),isActive:()=>s.isActive("superscript")||!1,disabled:!s.can().toggleSuperscript(),icon:"Superscript",title:i("editor.superscript.tooltip"),shortcutKeys:((g=n.options.shortcutKeys)==null?void 0:g[1])??["mod",","]},e=[];return d!==!1&&e.push(o),a!==!1&&e.push(h),{componentProps:{icon:"Type",tooltip:i("editor.moremark"),disabled:!s.isEditable,items:e,isActive:()=>e==null?void 0:e.find(b=>b.isActive())}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(x.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(f.configure(this.options.superscript)),t}});exports.MoreMark=m;exports.RichTextMoreMark=S;
|
package/lib/MoreMark.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { M as h, m, E as b } from "./index-
|
|
1
|
+
import { M as h, m, E as b } from "./index-BVRHx_ha.js";
|
|
2
2
|
import { jsx as e, Fragment as M, jsxs as d } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo as f } from "react";
|
|
4
|
-
import { u as x, e as A, A as S,
|
|
4
|
+
import { u as x, e as A, A as S, R as k, I as v, g as y } from "./index-CDFAs4RT.js";
|
|
5
5
|
import "./theme.js";
|
|
6
|
-
import { D as T, a as K, b as w, c as C } from "./dropdown-menu-
|
|
6
|
+
import { D as T, a as K, b as w, c as C } from "./dropdown-menu-Bragdu5m.js";
|
|
7
7
|
var H = h.create({
|
|
8
8
|
name: "subscript",
|
|
9
9
|
addOptions() {
|
|
@@ -75,7 +75,7 @@ var H = h.create({
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
|
-
function
|
|
78
|
+
function R() {
|
|
79
79
|
const t = x(D.name), {
|
|
80
80
|
icon: s = void 0,
|
|
81
81
|
tooltip: n = void 0,
|
|
@@ -153,5 +153,5 @@ const D = /* @__PURE__ */ b.create({
|
|
|
153
153
|
});
|
|
154
154
|
export {
|
|
155
155
|
D as MoreMark,
|
|
156
|
-
|
|
156
|
+
R as RichTextMoreMark
|
|
157
157
|
};
|
package/lib/OrderedList.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-COCTP78Y.cjs"),r=require("react/jsx-runtime"),s=require("./index-BLrMslr7.cjs");require("react");require("./theme.cjs");function O(){const t=s.useButtonProps(c.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:u={},action:n=void 0,isActive:a=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:d,update:l}=s.useToggleActive(a),m=()=>{d||n&&(n(),l())};return t?r.jsx(s.ActionButton,{action:m,dataState:p,disabled:d,icon:e,shortcutKeys:o,tooltip:i,tooltipOptions:u}):r.jsx(r.Fragment,{})}const c=v.OrderedList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:i,extension:o})=>({componentProps:{action:()=>e.commands.toggleOrderedList(),isActive:()=>e.isActive("orderedList"),disabled:!1,icon:"ListOrdered",shortcutKeys:o.options.shortcutKeys??["mod","shift","7"],tooltip:i("editor.orderedlist.tooltip")}})}}});exports.OrderedList=c;exports.RichTextOrderedList=O;
|
package/lib/OrderedList.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { O as u } from "./index-
|
|
1
|
+
import { O as u } from "./index-cPEuL4Zr.js";
|
|
2
2
|
import { jsx as n, Fragment as l } from "react/jsx-runtime";
|
|
3
|
-
import { u as f, d as v, A as O } from "./index-
|
|
3
|
+
import { u as f, d as v, A as O } from "./index-CDFAs4RT.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
function K() {
|
package/lib/SearchAndReplace.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("./index-DwSnESy-.cjs"),D=require("@tiptap/pm/state"),b=require("@tiptap/pm/view"),a=require("react/jsx-runtime"),g=require("react"),h=require("./index-BLrMslr7.cjs");require("./theme.cjs");const q=require("./popover-DCJpsZx0.cjs"),J=require("./index-BqL4vAWE.cjs");function Q(){const{t}=J.useLocale(),e=h.useEditorInstance(),s=h.useButtonProps(F.name),{icon:n=void 0,tooltip:u=void 0,shortcutKeys:o=void 0,tooltipOptions:c={},action:x=void 0,isActive:m=void 0}=(s==null?void 0:s.componentProps)??{},{disabled:i}=h.useActive(m),[R,f]=g.useState(!1),[p,T]=g.useState(""),[C,N]=g.useState(""),[j,M]=g.useState(!1),[V,$]=g.useState(""),w=()=>{var r,l,v,d;$(`${((l=(r=e==null?void 0:e.storage)==null?void 0:r.searchAndReplace)==null?void 0:l.resultIndex)+1}/${(d=(v=e==null?void 0:e.storage)==null?void 0:v.searchAndReplace)==null?void 0:d.results.length}`)};g.useEffect(()=>{e&&w()},[e]);const K=()=>{i||x&&x()},P=(r=!1)=>{var l,v,d,S,A,E,y,L;e&&(r&&((v=(l=e==null?void 0:e.commands)==null?void 0:l.resetIndex)==null||v.call(l)),(S=(d=e==null?void 0:e.commands)==null?void 0:d.setSearchTerm)==null||S.call(d,p),(E=(A=e==null?void 0:e.commands)==null?void 0:A.setReplaceTerm)==null||E.call(A,C),(L=(y=e==null?void 0:e.commands)==null?void 0:y.setCaseSensitive)==null||L.call(y,j),w())},k=()=>{var S,A;if(!e)return;const{results:r,resultIndex:l}=e.storage.searchAndReplace,v=r[l];if(!v)return;(A=(S=e==null?void 0:e.commands)==null?void 0:S.setTextSelection)==null||A.call(S,v);const{node:d}=e.view.domAtPos(e.state.selection.anchor);d instanceof HTMLElement&&d.scrollIntoView({behavior:"smooth",block:"center"}),w()};g.useEffect(()=>{p.trim()||B(),p.trim()&&P(!0)},[p]),g.useEffect(()=>{C.trim()&&P()},[C]),g.useEffect(()=>{P(!0)},[j]);const W=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.replace)==null||l.call(r),k()},H=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.nextSearchResult)==null||l.call(r),k()},U=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.previousSearchResult)==null||l.call(r),k()},B=()=>{var r,l;T(""),N(""),(l=(r=e==null?void 0:e.commands)==null?void 0:r.resetIndex)==null||l.call(r),w()},z=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.replaceAll)==null||l.call(r),$("0/0")};return s?a.jsxs(q.Popover,{onOpenChange:f,open:R,children:[a.jsx(q.PopoverTrigger,{asChild:!0,disabled:i,children:a.jsx(h.ActionButton,{action:K,disabled:i,icon:n,shortcutKeys:o,tooltip:u,tooltipOptions:c})}),a.jsxs(q.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(h.Label,{children:t("editor.search.dialog.text")}),a.jsx("span",{className:"richtext-font-semibold",children:V})]}),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(h.Input,{autoFocus:!0,className:"richtext-w-full",onChange:r=>T(r.target.value),placeholder:"Text",required:!0,type:"text",value:p}),a.jsx(h.Button,{className:"richtext-flex-1",onClick:U,children:a.jsx(h.IconComponent,{name:"ChevronUp"})}),a.jsx(h.Button,{className:"richtext-flex-1",onClick:H,children:a.jsx(h.IconComponent,{name:"ChevronDown"})}),a.jsx(h.Button,{className:"richtext-flex-1",onClick:B,children:"Clear"})]}),a.jsx(h.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(h.Input,{className:"richtext-w-80",onChange:r=>N(r.target.value),placeholder:"Text",required:!0,type:"text",value:C})})}),a.jsxs("div",{className:"richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-1",children:[a.jsx(h.Checkbox,{checked:j,onCheckedChange:r=>{M(r),e.commands.setCaseSensitive(r)}}),a.jsx(h.Label,{children:t("editor.replace.caseSensitive")})]}),a.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[a.jsx(h.Button,{className:"richtext-flex-1",onClick:W,children:t("editor.replace.dialog.text")}),a.jsx(h.Button,{className:"richtext-flex-1",onClick:z,children:t("editor.replaceAll.dialog.text")})]})]})]}):a.jsx(a.Fragment,{})}const I=(t,e)=>e(t.tr);function X(t,e,s){return RegExp(e?t.replace(/[$()*+.?[\\\]^{|}]/g,String.raw`\$&`):t,s?"gu":"gui")}function Y(t,e,s,n){const u=[],o=[];let c=[],x=0;if(!e)return{decorationsToReturn:b.DecorationSet.empty,results:[]};t==null||t.descendants((m,i)=>{m.isText?c[x]?c[x]={text:c[x].text+m.text,pos:c[x].pos}:c[x]={text:`${m.text}`,pos:i}:x+=1}),c=c.filter(Boolean);for(const m of c){const{text:i,pos:R}=m,f=Array.from(i.matchAll(e)).filter(([p])=>p.trim());for(const p of f){if(p[0]==="")break;p.index!==void 0&&o.push({from:R+p.index,to:R+p.index+p[0].length})}}for(const[m,i]of o.entries()){const R=m===n?`${s} ${s}-current`:s,f=b.Decoration.inline(i.from,i.to,{class:R});u.push(f)}return{decorationsToReturn:b.DecorationSet.create(t,u),results:o}}function O(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 Z(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:m,to:i}=n[u];return n[u]={to:i-x,from:m-x},[x,n]}function _(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:m}=o[c];s.insertText(t,x,m);const i=Z(t,c,u,o);i&&(u=i[0],o=i[1])}n(s)}}const F=G.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,I(s,n),!1),setReplaceTerm:t=>({editor:e,state:s,dispatch:n})=>(e.storage.searchAndReplace.replaceTerm=t,I(s,n),!1),setCaseSensitive:t=>({editor:e,state:s,dispatch:n})=>(e.storage.searchAndReplace.caseSensitive=t,I(s,n),!1),resetIndex:()=>({editor:t,state:e,dispatch:s})=>(t.storage.searchAndReplace.resultIndex=0,I(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?(O(n,[c],{state:e,dispatch:s}),t.storage.searchAndReplace.results.splice(o,1)):(O(n,u,{state:e,dispatch:s}),t.storage.searchAndReplace.results.shift()),I(e,s),!1},replaceAll:()=>({editor:t,tr:e,state:s,dispatch:n})=>{const{replaceTerm:u,results:o}=t.storage.searchAndReplace;return _(u,o,{tr:e,dispatch:n}),t.storage.searchAndReplace.resultIndex=0,t.storage.searchAndReplace.results=[],I(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 D.Plugin({key:new D.PluginKey(`richtextCustomPlugin${this.name}`),state:{init:()=>b.DecorationSet.empty,apply({doc:c,docChanged:x},m){const{searchTerm:i,lastSearchTerm:R,caseSensitive:f,lastCaseSensitive:p,resultIndex:T,lastResultIndex:C}=t.storage.searchAndReplace;if(!x&&R===i&&p===f&&C===T)return m;if(n(i),u(f),o(T),!i)return t.storage.searchAndReplace.results=[],b.DecorationSet.empty;const{decorationsToReturn:N,results:j}=Y(c,X(i,s,f),e,T);return t.storage.searchAndReplace.results=j,N}},props:{decorations(c){return this.getState(c)}}})]}});exports.RichTextSearchAndReplace=Q;exports.SearchAndReplace=F;
|
package/lib/SearchAndReplace.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { E as Q } from "./index-
|
|
1
|
+
import { E as Q } from "./index-BVRHx_ha.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 { h as ee, u as te, e as se, A as re, L as B, j as V, B as N, I as q, C as ne } from "./index-
|
|
6
|
+
import { h as ee, u as te, e as se, A as re, L as B, j as V, B as N, I as q, C as ne } from "./index-CDFAs4RT.js";
|
|
7
7
|
import "./theme.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { P as ce, a as ae, b as le } from "./popover-C2BbhsXH.js";
|
|
9
|
+
import { u as oe } from "./index-BlXGgvT-.js";
|
|
10
10
|
function Ce() {
|
|
11
|
-
const { t } =
|
|
11
|
+
const { t } = oe(), e = ee(), s = te(xe.name), {
|
|
12
12
|
icon: n = void 0,
|
|
13
13
|
tooltip: i = void 0,
|
|
14
14
|
shortcutKeys: l = void 0,
|
|
@@ -61,8 +61,8 @@ function Ce() {
|
|
|
61
61
|
var r, a;
|
|
62
62
|
(a = (r = e == null ? void 0 : e.commands) == null ? void 0 : r.replaceAll) == null || a.call(r), j("0/0");
|
|
63
63
|
};
|
|
64
|
-
return s ? /* @__PURE__ */ T(
|
|
65
|
-
/* @__PURE__ */ u(
|
|
64
|
+
return s ? /* @__PURE__ */ T(ce, { onOpenChange: d, open: f, children: [
|
|
65
|
+
/* @__PURE__ */ u(ae, { asChild: !0, disabled: o, children: /* @__PURE__ */ u(
|
|
66
66
|
re,
|
|
67
67
|
{
|
|
68
68
|
action: H,
|
|
@@ -73,7 +73,7 @@ function Ce() {
|
|
|
73
73
|
tooltipOptions: c
|
|
74
74
|
}
|
|
75
75
|
) }),
|
|
76
|
-
/* @__PURE__ */ T(
|
|
76
|
+
/* @__PURE__ */ T(le, { align: "start", className: "richtext-w-full", hideWhenDetached: !0, side: "bottom", children: [
|
|
77
77
|
/* @__PURE__ */ T("div", { className: "richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between", children: [
|
|
78
78
|
/* @__PURE__ */ u(B, { children: t("editor.search.dialog.text") }),
|
|
79
79
|
/* @__PURE__ */ u("span", { className: "richtext-font-semibold", children: W })
|
package/lib/SlashCommand.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-DwSnESy-.cjs"),u=require("@tiptap/pm/state"),d=require("./clsx-BSBE1eoY.cjs"),l=require("./index-D7wfvzJg.cjs"),r=require("./SlashCommandNodeView-CojfS61Q.cjs"),o=require("./updatePosition-D6AScA-1.cjs"),a=require("react/jsx-runtime"),m=require("react"),c=require("./index-BqL4vAWE.cjs");function C({commandList:e}){const[,t]=r.useSignalCommandList(),{t:n}=c.useLocale();return m.useEffect(()=>{if(!(e!=null&&e.length)){const i=r.renderCommandListDefault({t:n});t(i);return}t(e)},[n,e]),a.jsx(a.Fragment,{})}const f=s.Extension.create({name:"richtextSlashCommand",priority:200,addProseMirrorPlugins(){return[l.Suggestion({pluginKey:new u.PluginKey("richtextSlashCommandPlugin"),editor:this.editor,char:"/",command:({editor:e,range:t,props:n})=>{const{view:i}=e;n.action({editor:e,range:t}),i.focus()},render:()=>{let e;return{onStart:t=>{t.clientRect&&(e=new d.ReactRenderer(r.SlashCommandNodeView,{props:t,editor:t.editor}),e.element.style.position="absolute",document.body.appendChild(e.element),o.updatePosition(t.editor,e.element))},onUpdate(t){e.updateProps(t),t.clientRect&&o.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=f;exports.SlashCommandList=C;
|
package/lib/SlashCommand.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as i } from "./index-
|
|
1
|
+
import { E as i } from "./index-BVRHx_ha.js";
|
|
2
2
|
import { PluginKey as a } from "@tiptap/pm/state";
|
|
3
|
-
import { R as m } from "./clsx-
|
|
4
|
-
import { S as s } from "./index-
|
|
5
|
-
import { u, r as l, S as d } from "./SlashCommandNodeView-
|
|
6
|
-
import { a as F } from "./SlashCommandNodeView-
|
|
7
|
-
import { u as o } from "./updatePosition-
|
|
3
|
+
import { R as m } from "./clsx-OumA9x-8.js";
|
|
4
|
+
import { S as s } from "./index-B-7eHzaO.js";
|
|
5
|
+
import { u, r as l, S as d } from "./SlashCommandNodeView-Hf2DX4km.js";
|
|
6
|
+
import { a as F } from "./SlashCommandNodeView-Hf2DX4km.js";
|
|
7
|
+
import { u as o } from "./updatePosition-DYuAiqx-.js";
|
|
8
8
|
import { jsx as f, Fragment as c } from "react/jsx-runtime";
|
|
9
9
|
import { useEffect as h } from "react";
|
|
10
10
|
import { u as C } from "./index-BlXGgvT-.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const d=require("react/jsx-runtime"),m=require("react"),h=require("./index-
|
|
1
|
+
"use strict";const d=require("react/jsx-runtime"),m=require("react"),h=require("./index-BLrMslr7.cjs");require("./theme.cjs");const w=require("./index-BqL4vAWE.cjs"),v=require("./index-NsYff_Ni.cjs");function S({t:i}){const s=[{name:"format",title:i("editor.slash.format"),commands:[]},{name:"insert",title:i("editor.slash.insert"),commands:[]}];return w.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=w.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();const l=h.EVENTS.UPLOAD_IMAGE(e.id);h.emit(l,!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();const l=h.EVENTS.UPLOAD_VIDEO(e.id);h.emit(l,!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 C(i,s){return i.map(l=>({...l,commands:l.commands.filter(a=>{const u=a.label.toLowerCase().trim(),x=s.toLowerCase().trim();if(a.aliases){const b=a.aliases.map(f=>f.toLowerCase().trim()),r=u.match(x),g=b.some(f=>f.match(x));return r||g}return u.match(x)})})).filter(l=>l.commands.length>0)}const y=v.y([]);function L(){const[i,s]=v.V(y);return[i,s]}function q(i,s){const[e]=L(),[t,l]=m.useState(0),[a,u]=m.useState(0),x=m.useRef(null),{t:b}=w.useLocale(),r=C(e,i.query),g=m.useRef([]);m.useImperativeHandle(s,()=>({onKeyDown:f})),m.useEffect(()=>{if(!x.current)return;const o=a*1e3+t,n=g.current[o];n&&n.scrollIntoView({behavior:"smooth",block:"nearest"})},[t,a]);function f({event:o}){return o.key==="ArrowUp"?(A(),!0):o.key==="ArrowDown"?(I(),!0):o.key==="Enter"?(R(),!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 I(){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 R(){if(r.length===0||a===-1||t===-1)return!1;N(a,t)}function N(o,n){const c=r[o].commands[n];i==null||i.command(c)}function k(o,n){N(o,n)}function E(o,n,c){g.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:x,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(h.Label,{className:"richtext-mx-[4px] richtext-mb-[4px] richtext-mt-[8px] !richtext-text-[0.65rem] richtext-uppercase",children:o.title}),o.commands.map((c,p)=>d.jsxs("button",{onClick:()=>k(n,p),ref:H=>E(n,p,H),className:h.cn("richtext-flex richtext-w-full richtext-items-center richtext-gap-3 richtext-rounded-sm !richtext-border-none !richtext-bg-transparent richtext-px-2 richtext-py-1.5 richtext-text-left richtext-text-sm richtext-text-foreground !richtext-outline-none richtext-transition-colors hover:!richtext-bg-accent",{"bg-item-active":a===n&&t===p}),children:[c.iconUrl&&d.jsx("img",{alt:"",className:"richtext-size-6",src:c.iconUrl}),c.iconName&&d.jsx(h.IconComponent,{className:"!richtext-mr-1 !richtext-text-lg",name:c.iconName}),c.label]},`command-${p}`))]},`slash-${o.title}`))}):d.jsx("div",{className:"richtext-p-3",children:d.jsx("span",{className:"richtext-text-xs richtext-text-foreground",children:b("editor.slash.empty")})})})}const D=m.forwardRef(q);exports.SlashCommandNodeView=D;exports.renderCommandListDefault=S;exports.useFilterCommandList=C;exports.useSignalCommandList=L;
|