reactjs-tiptap-editor 1.0.11 → 1.0.13
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 +1 -0
- package/lib/{ActionMenuButton-DTXFBdGX.js → ActionMenuButton-l5rSmAO_.js} +18 -14
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.js +24 -21
- package/lib/Blockquote.cjs +2 -2
- package/lib/Blockquote.js +7 -5
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +11 -9
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +14 -12
- package/lib/Callout.cjs +1 -0
- package/lib/Callout.js +230 -0
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +3 -3
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +11 -9
- package/lib/CodeBlock.cjs +39 -39
- package/lib/CodeBlock.js +840 -945
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +10 -8
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +20 -18
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +7 -5
- package/lib/{Drawer-D0yQ0wR7.js → Drawer-Cbi_MURj.js} +10 -9
- package/lib/Drawer-DKU32YW_.cjs +1 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +11 -9
- package/lib/{Excalidraw-CO4IRHmG.js → Excalidraw-CWrVL5hs.js} +28 -27
- package/lib/Excalidraw-Kb-TRcWY.cjs +1 -0
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +2 -2
- package/lib/ExportPdf.cjs +2 -2
- package/lib/ExportPdf.js +7 -5
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +7 -5
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +9 -8
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +13 -12
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +20 -19
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +9 -7
- package/lib/History.cjs +1 -1
- package/lib/History.js +11 -8
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +7 -5
- package/lib/Icon-Ctva8VeB.js +12 -0
- package/lib/Icon-yqCglrdK.cjs +1 -0
- package/lib/Iframe-BczF8Hex.cjs +1 -0
- package/lib/{Iframe-BEO28NPs.js → Iframe-C942bNjs.js} +42 -40
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +25 -23
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +50 -48
- package/lib/ImportWord.cjs +31 -31
- package/lib/ImportWord.js +8 -6
- package/lib/{Indent-CXurBbOr.js → Indent-C_O5WdyR.js} +26 -24
- package/lib/Indent-CkEC7x36.cjs +1 -0
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +12 -10
- package/lib/{Katex-Bvj469K1.js → Katex-D3PEWimM.js} +12 -10
- package/lib/Katex-DW_HjgNM.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +10 -8
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-8ePAZ-G1.cjs → LinkEditBlock-DL1e2ILk.cjs} +1 -1
- package/lib/{LinkEditBlock-DjXUEubR.js → LinkEditBlock-h5054QDo.js} +22 -20
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +3 -3
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +8 -8
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +25 -22
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +10 -8
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +43 -41
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +6 -6
- package/lib/SlashCommandNodeView-BqrmHCpu.cjs +1 -0
- package/lib/{SlashCommandNodeView-CcqL8ymb.js → SlashCommandNodeView-DXUqkx82.js} +75 -66
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +7 -5
- package/lib/{Table-9Y0Cg8Ab.js → Table-DdrY4jcM.js} +10 -8
- package/lib/Table-kY0nbqJo.cjs +9 -0
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +15 -13
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +20 -17
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +20 -17
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +7 -5
- package/lib/{Twitter-DWwd0vHR.js → Twitter-B-JQ3ZJ1.js} +51 -49
- package/lib/Twitter-DjZcVa3l.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +2 -2
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +13 -11
- package/lib/bubble.cjs +4 -4
- package/lib/bubble.js +2084 -1949
- package/lib/button-BS3n6_Aq.cjs +1 -0
- package/lib/{button-RnHbJfd-.js → button-Uv01FNnd.js} +9 -8
- package/lib/{checkbox-CTEN0q4y.cjs → checkbox-C8ByRi7-.cjs} +1 -1
- package/lib/{checkbox-CLSoR1Qj.js → checkbox-DEFNwGwb.js} +1 -1
- package/lib/{index-sVScpCFG.js → clsx-BWSGDJNJ.js} +224 -224
- package/lib/{index-BBNITgNi.cjs → clsx-CXbNJWDD.cjs} +13 -13
- package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -0
- package/lib/components/Bubble/index.d.ts +1 -0
- package/lib/components/ui/index.d.ts +1 -0
- package/lib/{dialog-CMC9hsCo.cjs → dialog-Bt5zwGYB.cjs} +1 -1
- package/lib/{dialog-D_HCtKvc.js → dialog-DwTMZSt6.js} +1 -1
- package/lib/{dropdown-menu-66q7Ofc5.js → dropdown-menu-BetI14G6.js} +1 -1
- package/lib/{dropdown-menu-DKSAS-w_.cjs → dropdown-menu-Bo68IEOT.cjs} +1 -1
- package/lib/events.constant-Dq21NPdV.cjs +1 -0
- package/lib/events.constant-do95b767.js +21 -0
- package/lib/extensions/Callout/Callout.d.ts +18 -0
- package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -0
- package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -0
- package/lib/extensions/Callout/index.d.ts +1 -0
- package/lib/{index-CApXPpjF.cjs → index-BCzvbrf5.cjs} +1 -1
- package/lib/{index-9A6-kVBM.js → index-BDKHXe7R.js} +1 -1
- package/lib/{index-DmPwbBqm.js → index-CHKWG6E8.js} +1 -1
- package/lib/index-CcoWj0mF.js +426 -0
- package/lib/index-CjhjjJsN.cjs +1 -0
- package/lib/index-Cs6cp0Y6.cjs +1 -0
- package/lib/index-D3RLYf-J.cjs +1 -0
- package/lib/{index-C3zg3DPB.js → index-DF5ZPtWM.js} +371 -1177
- package/lib/{index-DRHrDScg.js → index-DJbmnBzK.js} +1 -1
- package/lib/index-Doks9cbR.cjs +1 -0
- package/lib/{index-0OnGZkVF.js → index-Dujzr6bY.js} +179 -317
- package/lib/index-VhKd73hZ.cjs +1 -0
- package/lib/{index-DKt5wfAc.js → index-mR8PNv5P.js} +1 -1
- package/lib/{index--nUS7Y66.cjs → index-neeeY2o7.cjs} +3 -3
- package/lib/index.cjs +9 -2
- package/lib/index.js +142 -26
- package/lib/{input-CvyMYMZG.js → input-DUBdJD3L.js} +5 -5
- package/lib/{input-D555880-.cjs → input-Dt_BA_9B.cjs} +1 -1
- package/lib/{isNumber-Bv1Qhmw8.cjs → isNumber-BTYSVlKo.cjs} +1 -1
- package/lib/{isNumber-DF0fU3ob.js → isNumber-CIgubz2e.js} +1 -1
- package/lib/label-JNOksCA-.cjs +1 -0
- package/lib/label-topD46-u.js +19 -0
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +6 -7
- package/lib/locales/en.d.ts +16 -0
- package/lib/locales/fi.d.ts +16 -0
- package/lib/locales/hu.d.ts +16 -0
- package/lib/locales/index.d.ts +99 -4316
- package/lib/locales/pt-br.d.ts +16 -0
- package/lib/locales/vi.d.ts +16 -0
- package/lib/locales/zh-cn.d.ts +16 -0
- package/lib/{popover-B7ec5-u2.js → popover-LfNBhRyz.js} +1 -1
- package/lib/{popover-BSzR_R01.cjs → popover-mL-2sX5r.cjs} +1 -1
- package/lib/react-BEoMZB61.cjs +1 -0
- package/lib/react-c9FSfB30.js +27 -0
- package/lib/select-CwGYPsPq.cjs +1 -0
- package/lib/select-DctYuHLH.js +117 -0
- package/lib/separator-Ddfrhn4D.js +329 -0
- package/lib/separator-NoH_SLRW.cjs +1 -0
- package/lib/store/EditorEditableReactive.d.ts +1 -0
- package/lib/store/ThemeColorReactive.d.ts +1 -0
- package/lib/store/commandList.d.ts +1 -1
- package/lib/store/store.d.ts +6 -7
- package/lib/store-CkjKIgjQ.cjs +1 -0
- package/lib/store-DNpS8vXA.js +10 -0
- package/lib/style.css +1 -1
- package/lib/{tabs-CWr9HYaM.js → tabs-BT3AeqQQ.js} +1 -1
- package/lib/{tabs-BTwiZkWd.cjs → tabs-DRSwUeKP.cjs} +1 -1
- package/lib/{textarea-Yetl_PZi.cjs → textarea-BDO6XQoF.cjs} +1 -1
- package/lib/{textarea-BdeLXbp8.js → textarea-DZzMEDfZ.js} +1 -1
- package/lib/theme/theme.d.ts +5 -0
- package/lib/theme.cjs +1 -1
- package/lib/theme.js +37 -8
- package/lib/{throttle-DsowOft0.js → throttle-IERhwcLa.js} +1 -1
- package/lib/throttle-gTTvqDTW.cjs +1 -0
- package/lib/toggle-BQHMh_Q-.cjs +1 -0
- package/lib/toggle-DKHg5sLm.js +99 -0
- package/lib/tooltip-BYtGp6FM.cjs +1 -0
- package/lib/tooltip-DNKq7zgN.js +24 -0
- package/lib/{updatePosition-Bbd8ETMv.js → updatePosition-Bie75EFq.js} +2 -2
- package/lib/updatePosition-Cjuj2E26.cjs +1 -0
- package/lib/useButtonProps-DBJkNDS2.cjs +1 -0
- package/lib/{useButtonProps-cMoicZgd.js → useButtonProps-DVP4s_ER.js} +48 -36
- package/lib/utils/customEvents/events.constant.d.ts +0 -5
- package/package.json +3 -3
- package/lib/ActionMenuButton-BLlse5KO.cjs +0 -1
- package/lib/Drawer-kv6BU_6O.cjs +0 -1
- package/lib/Excalidraw-B82ThkJA.cjs +0 -1
- package/lib/Icon-DRuJhcHK.js +0 -10
- package/lib/Icon-DXePECFW.cjs +0 -1
- package/lib/Iframe-03dn9wcM.cjs +0 -1
- package/lib/Indent-Cqjdn3Jt.cjs +0 -1
- package/lib/Katex-DdWTV5NJ.cjs +0 -4
- package/lib/SlashCommandNodeView-Bl_gwZJB.cjs +0 -1
- package/lib/Table-DBGjezZK.cjs +0 -9
- package/lib/Twitter-Cnvt7GBg.cjs +0 -1
- package/lib/button-BW5bDPz_.cjs +0 -1
- package/lib/events.constant-DQYeJpu5.cjs +0 -1
- package/lib/events.constant-wrlJ_7JZ.js +0 -26
- package/lib/index-BZ6DfR2r.cjs +0 -1
- package/lib/index-C838s-or.cjs +0 -8
- package/lib/index-Cv9Z6dyV.cjs +0 -1
- package/lib/index-FSRjMsxW.cjs +0 -1
- package/lib/label-DsOYPjAo.js +0 -18
- package/lib/label-E6jF3Xud.cjs +0 -1
- package/lib/separator-JaTTqb3J.js +0 -241
- package/lib/separator-PGnA-6Hr.cjs +0 -1
- package/lib/store/ProviderUniqueId.d.ts +0 -6
- package/lib/store-Cf7tFiiI.js +0 -10
- package/lib/store-oDk-lTPM.cjs +0 -1
- package/lib/throttle-BM3Bmbf_.cjs +0 -1
- package/lib/updatePosition-M2IyqkI1.cjs +0 -1
- package/lib/useButtonProps-DfnJiJLV.cjs +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";const g=require("./clsx-CXbNJWDD.cjs"),_e=require("@tiptap/pm/state"),D=require("./index-neeeY2o7.cjs"),A=require("react/jsx-runtime"),Ie=require("./toggle-BQHMh_Q-.cjs"),W=require("react");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const v=require("./index-Doks9cbR.cjs"),X=require("./popover-mL-2sX5r.cjs"),Z=require("./useButtonProps-DBJkNDS2.cjs");let J,Y;if(typeof WeakMap<"u"){let t=new WeakMap;J=e=>t.get(e),Y=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;J=o=>{for(let l=0;l<t.length;l+=2)if(t[l]==o)return t[l+1]},Y=(o,l)=>(n==10&&(n=0),t[n++]=o,t[n++]=l)}var y=class{constructor(t,e,n,o){this.width=t,this.height=e,this.map=n,this.problems=o}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const o=e%this.width,l=e/this.width|0;let r=o+1,s=l+1;for(let i=1;r<this.width&&this.map[e+i]==n;i++)r++;for(let i=1;s<this.height&&this.map[e+this.width*i]==n;i++)s++;return{left:o,top:l,right:r,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:o,right:l,top:r,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?o==0:l==this.width)?null:this.map[r*this.width+(n<0?o-1:l)]:(n<0?r==0:s==this.height)?null:this.map[o+this.width*(n<0?r-1:s)]}rectBetween(t,e){const{left:n,right:o,top:l,bottom:r}=this.findCell(t),{left:s,right:i,top:c,bottom:a}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(l,c),right:Math.max(o,i),bottom:Math.max(r,a)}}cellsInRect(t){const e=[],n={};for(let o=t.top;o<t.bottom;o++)for(let l=t.left;l<t.right;l++){const r=o*this.width+l,s=this.map[r];n[s]||(n[s]=!0,!(l==t.left&&l&&this.map[r-1]==s||o==t.top&&o&&this.map[r-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let o=0,l=0;;o++){const r=l+n.child(o).nodeSize;if(o==t){let s=e+t*this.width;const i=(t+1)*this.width;for(;s<i&&this.map[s]<l;)s++;return s==i?r-1:this.map[s]}l=r}}static get(t){return J(t)||Y(t,Be(t))}};function Be(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=$e(t),n=t.childCount,o=[];let l=0,r=null;const s=[];for(let a=0,d=e*n;a<d;a++)o[a]=0;for(let a=0,d=0;a<n;a++){const u=t.child(a);d++;for(let p=0;;p++){for(;l<o.length&&o[l]!=0;)l++;if(p==u.childCount)break;const m=u.child(p),{colspan:b,rowspan:w,colwidth:x}=m.attrs;for(let R=0;R<w;R++){if(R+a>=n){(r||(r=[])).push({type:"overlong_rowspan",pos:d,n:w-R});break}const L=l+R*e;for(let M=0;M<b;M++){o[L+M]==0?o[L+M]=d:(r||(r=[])).push({type:"collision",row:a,pos:d,n:b-M});const $=x&&x[M];if($){const I=(L+M)%e*2,K=s[I];K==null||K!=$&&s[I+1]==1?(s[I]=$,s[I+1]=1):K==$&&s[I+1]++}}}l+=b,d+=m.nodeSize}const f=(a+1)*e;let h=0;for(;l<f;)o[l++]==0&&h++;h&&(r||(r=[])).push({type:"missing",row:a,n:h}),d++}(e===0||n===0)&&(r||(r=[])).push({type:"zero_sized"});const i=new y(e,n,o,r);let c=!1;for(let a=0;!c&&a<s.length;a+=2)s[a]!=null&&s[a+1]<n&&(c=!0);return c&&We(i,s,t),i}function $e(t){let e=-1,n=!1;for(let o=0;o<t.childCount;o++){const l=t.child(o);let r=0;if(n)for(let s=0;s<o;s++){const i=t.child(s);for(let c=0;c<i.childCount;c++){const a=i.child(c);s+a.attrs.rowspan>o&&(r+=a.attrs.colspan)}}for(let s=0;s<l.childCount;s++){const i=l.child(s);r+=i.attrs.colspan,i.attrs.rowspan>1&&(n=!0)}e==-1?e=r:e!=r&&(e=Math.max(e,r))}return e}function We(t,e,n){t.problems||(t.problems=[]);const o={};for(let l=0;l<t.map.length;l++){const r=t.map[l];if(o[r])continue;o[r]=!0;const s=n.nodeAt(r);if(!s)throw new RangeError(`No cell with offset ${r} found`);let i=null;const c=s.attrs;for(let a=0;a<c.colspan;a++){const d=e[(l+a)%t.width*2];d!=null&&(!c.colwidth||c.colwidth[a]!=d)&&((i||(i=Fe(c)))[a]=d)}i&&t.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:i})}}function Fe(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function S(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const o=t.nodes[n],l=o.spec.tableRole;l&&(e[l]=o)}}return e}const z=new g.PluginKey("selectingCells");function _(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Pe(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function E(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function V(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=_(e.$head)||je(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function je(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Q(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Oe(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function oe(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Se(t,e,n){const o=t.node(-1),l=y.get(o),r=t.start(-1),s=l.nextCell(t.pos-r,e,n);return s==null?null:t.node(0).resolve(r+s)}function H(t,e,n=1){const o={...t,colspan:t.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,n),o.colwidth.some(l=>l>0)||(o.colwidth=null)),o}function xe(t,e,n=1){const o={...t,colspan:t.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let l=0;l<n;l++)o.colwidth.splice(e,0,0)}return o}function qe(t,e,n){const o=S(e.type.schema).header_cell;for(let l=0;l<t.height;l++)if(e.nodeAt(t.map[n+l*t.width]).type!=o)return!1;return!0}var C=class k extends g.Selection{constructor(e,n=e){const o=e.node(-1),l=y.get(o),r=e.start(-1),s=l.rectBetween(e.pos-r,n.pos-r),i=e.node(0),c=l.cellsInRect(s).filter(d=>d!=n.pos-r);c.unshift(n.pos-r);const a=c.map(d=>{const u=o.nodeAt(d);if(!u)throw new RangeError(`No cell with offset ${d} found`);const f=r+d+1;return new g.SelectionRange(i.resolve(f),i.resolve(f+u.content.size))});super(a[0].$from,a[0].$to,a),this.$anchorCell=e,this.$headCell=n}map(e,n){const o=e.resolve(n.map(this.$anchorCell.pos)),l=e.resolve(n.map(this.$headCell.pos));if(Q(o)&&Q(l)&&oe(o,l)){const r=this.$anchorCell.node(-1)!=o.node(-1);return r&&this.isRowSelection()?k.rowSelection(o,l):r&&this.isColSelection()?k.colSelection(o,l):new k(o,l)}return g.TextSelection.between(o,l)}content(){const e=this.$anchorCell.node(-1),n=y.get(e),o=this.$anchorCell.start(-1),l=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),r={},s=[];for(let c=l.top;c<l.bottom;c++){const a=[];for(let d=c*n.width+l.left,u=l.left;u<l.right;u++,d++){const f=n.map[d];if(r[f])continue;r[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const m=l.left-h.left,b=h.right-l.right;if(m>0||b>0){let w=p.attrs;if(m>0&&(w=H(w,0,m)),b>0&&(w=H(w,w.colspan-b,b)),h.left<l.left){if(p=p.type.createAndFill(w),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(h.top<l.top||h.bottom>l.bottom){const w={...p.attrs,rowspan:Math.min(h.bottom,l.bottom)-Math.max(h.top,l.top)};h.top<l.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}a.push(p)}s.push(e.child(c).copy(g.Fragment.from(a)))}const i=this.isColSelection()&&this.isRowSelection()?e:s;return new g.Slice(g.Fragment.from(i),1,1)}replace(e,n=g.Slice.empty){const o=e.steps.length,l=this.ranges;for(let s=0;s<l.length;s++){const{$from:i,$to:c}=l[s],a=e.mapping.slice(o);e.replace(a.map(i.pos),a.map(c.pos),s?g.Slice.empty:n)}const r=g.Selection.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);r&&e.setSelection(r)}replaceWith(e,n){this.replace(e,new g.Slice(g.Fragment.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),o=y.get(n),l=this.$anchorCell.start(-1),r=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-l,this.$headCell.pos-l));for(let s=0;s<r.length;s++)e(n.nodeAt(r[s]),l+r[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,l=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,l)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const o=e.node(-1),l=y.get(o),r=e.start(-1),s=l.findCell(e.pos-r),i=l.findCell(n.pos-r),c=e.node(0);return s.top<=i.top?(s.top>0&&(e=c.resolve(r+l.map[s.left])),i.bottom<l.height&&(n=c.resolve(r+l.map[l.width*(l.height-1)+i.right-1]))):(i.top>0&&(n=c.resolve(r+l.map[i.left])),s.bottom<l.height&&(e=c.resolve(r+l.map[l.width*(l.height-1)+s.right-1]))),new k(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=y.get(e),o=this.$anchorCell.start(-1),l=n.colCount(this.$anchorCell.pos-o),r=n.colCount(this.$headCell.pos-o);if(Math.min(l,r)>0)return!1;const s=l+this.$anchorCell.nodeAfter.attrs.colspan,i=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,i)==n.width}eq(e){return e instanceof k&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const o=e.node(-1),l=y.get(o),r=e.start(-1),s=l.findCell(e.pos-r),i=l.findCell(n.pos-r),c=e.node(0);return s.left<=i.left?(s.left>0&&(e=c.resolve(r+l.map[s.top*l.width])),i.right<l.width&&(n=c.resolve(r+l.map[l.width*(i.top+1)-1]))):(i.left>0&&(n=c.resolve(r+l.map[i.top*l.width])),s.right<l.width&&(e=c.resolve(r+l.map[l.width*(s.top+1)-1]))),new k(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new k(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){return new k(e.resolve(n),e.resolve(o))}getBookmark(){return new Ge(this.$anchorCell.pos,this.$headCell.pos)}};C.prototype.visible=!1;g.Selection.jsonID("cell",C);var Ge=class Ae{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ae(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),o=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&oe(n,o)?new C(n,o):g.Selection.near(o,1)}};function Ve(t){if(!(t.selection instanceof C))return null;const e=[];return t.selection.forEachCell((n,o)=>{e.push(D.Decoration.node(o,o+n.nodeSize,{class:"selectedCell"}))}),D.DecorationSet.create(t.doc,e)}function Ke({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,o=e.pos,l=t.depth;for(;l>=0&&!(t.after(l+1)<t.end(l));l--,n++);for(let r=e.depth;r>=0&&!(e.before(r+1)>e.start(r));r--,o--);return n==o&&/row|table/.test(t.node(l).type.spec.tableRole)}function Xe({$from:t,$to:e}){let n,o;for(let l=t.depth;l>0;l--){const r=t.node(l);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){n=r;break}}for(let l=e.depth;l>0;l--){const r=e.node(l);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){o=r;break}}return n!==o&&e.parentOffset===0}function Ze(t,e,n){const o=(e||t).selection,l=(e||t).doc;let r,s;if(o instanceof g.NodeSelection&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")r=C.create(l,o.from);else if(s=="row"){const i=l.resolve(o.from+1);r=C.rowSelection(i,i)}else if(!n){const i=y.get(o.node),c=o.from+1,a=c+i.map[i.width*i.height-1];r=C.create(l,c+1,a)}}else o instanceof g.TextSelection&&Ke(o)?r=g.TextSelection.create(l,o.from):o instanceof g.TextSelection&&Xe(o)&&(r=g.TextSelection.create(l,o.$from.start(),o.$from.end()));return r&&(e||(e=t.tr)).setSelection(r),e}const Ue=new g.PluginKey("fix-tables");function Te(t,e,n,o){const l=t.childCount,r=e.childCount;e:for(let s=0,i=0;s<r;s++){const c=e.child(s);for(let a=i,d=Math.min(l,s+3);a<d;a++)if(t.child(a)==c){i=a+1,n+=c.nodeSize;continue e}o(c,n),i<l&&t.child(i).sameMarkup(c)?Te(t.child(i),c,n+1,o):c.nodesBetween(0,c.content.size,o,n+1),n+=c.nodeSize}}function Re(t,e){let n;const o=(l,r)=>{l.type.spec.tableRole=="table"&&(n=Je(t,l,r,n))};return e?e.doc!=t.doc&&Te(e.doc,t.doc,0,o):t.doc.descendants(o),n}function Je(t,e,n,o){const l=y.get(e);if(!l.problems)return o;o||(o=t.tr);const r=[];for(let c=0;c<l.height;c++)r.push(0);for(let c=0;c<l.problems.length;c++){const a=l.problems[c];if(a.type=="collision"){const d=e.nodeAt(a.pos);if(!d)continue;const u=d.attrs;for(let f=0;f<u.rowspan;f++)r[a.row+f]+=a.n;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,H(u,u.colspan-a.n,a.n))}else if(a.type=="missing")r[a.row]+=a.n;else if(a.type=="overlong_rowspan"){const d=e.nodeAt(a.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-a.n})}else if(a.type=="colwidth mismatch"){const d=e.nodeAt(a.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,{...d.attrs,colwidth:a.colwidth})}else if(a.type=="zero_sized"){const d=o.mapping.map(n);o.delete(d,d+e.nodeSize)}}let s,i;for(let c=0;c<r.length;c++)r[c]&&(s==null&&(s=c),i=c);for(let c=0,a=n+1;c<l.height;c++){const d=e.child(c),u=a+d.nodeSize,f=r[c];if(f>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const p=[];for(let b=0;b<f;b++){const w=S(t.schema)[h].createAndFill();w&&p.push(w)}const m=(c==0||s==c-1)&&i==c?a+1:u-1;o.insert(o.mapping.map(m),p)}a=u}return o.setMeta(Ue,{fixTables:!0})}function N(t){const e=t.selection,n=V(t),o=n.node(-1),l=n.start(-1),r=y.get(o);return{...e instanceof C?r.rectBetween(e.$anchorCell.pos-l,e.$headCell.pos-l):r.findCell(n.pos-l),tableStart:l,map:r,table:o}}function ve(t,{map:e,tableStart:n,table:o},l){let r=l>0?-1:0;qe(e,o,l+r)&&(r=l==0||l==e.width?null:0);for(let s=0;s<e.height;s++){const i=s*e.width+l;if(l>0&&l<e.width&&e.map[i-1]==e.map[i]){const c=e.map[i],a=o.nodeAt(c);t.setNodeMarkup(t.mapping.map(n+c),null,xe(a.attrs,l-e.colCount(c))),s+=a.attrs.rowspan-1}else{const c=r==null?S(o.type.schema).cell:o.nodeAt(e.map[i+r]).type,a=e.positionAt(s,l,o);t.insert(t.mapping.map(n+a),c.createAndFill())}}return t}function Ye(t,e){if(!E(t))return!1;if(e){const n=N(t);e(ve(t.tr,n,n.left))}return!0}function Qe(t,e){if(!E(t))return!1;if(e){const n=N(t);e(ve(t.tr,n,n.right))}return!0}function et(t,{map:e,table:n,tableStart:o},l){const r=t.mapping.maps.length;for(let s=0;s<e.height;){const i=s*e.width+l,c=e.map[i],a=n.nodeAt(c),d=a.attrs;if(l>0&&e.map[i-1]==c||l<e.width-1&&e.map[i+1]==c)t.setNodeMarkup(t.mapping.slice(r).map(o+c),null,H(d,l-e.colCount(c)));else{const u=t.mapping.slice(r).map(o+c);t.delete(u,u+a.nodeSize)}s+=d.rowspan}}function tt(t,e){if(!E(t))return!1;if(e){const n=N(t),o=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let l=n.right-1;et(o,n,l),l!=n.left;l--){const r=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!r)throw new RangeError("No table found");n.table=r,n.map=y.get(r)}e(o)}return!0}function nt(t,e,n){var o;const l=S(e.type.schema).header_cell;for(let r=0;r<t.width;r++)if(((o=e.nodeAt(t.map[r+n*t.width]))===null||o===void 0?void 0:o.type)!=l)return!1;return!0}function Me(t,{map:e,tableStart:n,table:o},l){let r=n;for(let a=0;a<l;a++)r+=o.child(a).nodeSize;const s=[];let i=l>0?-1:0;nt(e,o,l+i)&&(i=l==0||l==e.height?null:0);for(let a=0,d=e.width*l;a<e.width;a++,d++)if(l>0&&l<e.height&&e.map[d]==e.map[d-e.width]){const u=e.map[d],f=o.nodeAt(u).attrs;t.setNodeMarkup(n+u,null,{...f,rowspan:f.rowspan+1}),a+=f.colspan-1}else{var c;const u=i==null?S(o.type.schema).cell:(c=o.nodeAt(e.map[d+i*e.width]))===null||c===void 0?void 0:c.type,f=u==null?void 0:u.createAndFill();f&&s.push(f)}return t.insert(r,S(o.type.schema).row.create(null,s)),t}function ot(t,e){if(!E(t))return!1;if(e){const n=N(t);e(Me(t.tr,n,n.top))}return!0}function lt(t,e){if(!E(t))return!1;if(e){const n=N(t);e(Me(t.tr,n,n.bottom))}return!0}function rt(t,{map:e,table:n,tableStart:o},l){let r=0;for(let a=0;a<l;a++)r+=n.child(a).nodeSize;const s=r+n.child(l).nodeSize,i=t.mapping.maps.length;t.delete(r+o,s+o);const c=new Set;for(let a=0,d=l*e.width;a<e.width;a++,d++){const u=e.map[d];if(!c.has(u)){if(c.add(u),l>0&&u==e.map[d-e.width]){const f=n.nodeAt(u).attrs;t.setNodeMarkup(t.mapping.slice(i).map(u+o),null,{...f,rowspan:f.rowspan-1}),a+=f.colspan-1}else if(l<e.height&&u==e.map[d+e.width]){const f=n.nodeAt(u),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(l+1,a,n);t.insert(t.mapping.slice(i).map(o+m),p),a+=h.colspan-1}}}}function st(t,e){if(!E(t))return!1;if(e){const n=N(t),o=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let l=n.bottom-1;rt(o,n,l),l!=n.top;l--){const r=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!r)throw new RangeError("No table found");n.table=r,n.map=y.get(n.table)}e(o)}return!0}function le(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function it({width:t,height:e,map:n},o){let l=o.top*t+o.left,r=l,s=(o.bottom-1)*t+o.left,i=l+(o.right-o.left-1);for(let c=o.top;c<o.bottom;c++){if(o.left>0&&n[r]==n[r-1]||o.right<t&&n[i]==n[i+1])return!0;r+=t,i+=t}for(let c=o.left;c<o.right;c++){if(o.top>0&&n[l]==n[l-t]||o.bottom<e&&n[s]==n[s+t])return!0;l++,s++}return!1}function re(t,e){const n=t.selection;if(!(n instanceof C)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=N(t),{map:l}=o;if(it(l,o))return!1;if(e){const r=t.tr,s={};let i=g.Fragment.empty,c,a;for(let d=o.top;d<o.bottom;d++)for(let u=o.left;u<o.right;u++){const f=l.map[d*l.width+u],h=o.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,c==null)c=f,a=h;else{le(h)||(i=i.append(h.content));const p=r.mapping.map(f+o.tableStart);r.delete(p,p+h.nodeSize)}}if(c==null||a==null)return!0;if(r.setNodeMarkup(c+o.tableStart,null,{...xe(a.attrs,a.attrs.colspan,o.right-o.left-a.attrs.colspan),rowspan:o.bottom-o.top}),i.size>0){const d=c+1+a.content.size,u=le(a)?c+1:d;r.replaceWith(u+o.tableStart,d+o.tableStart,i)}r.setSelection(new C(r.doc.resolve(c+o.tableStart))),e(r)}return!0}function se(t,e){const n=S(t.schema);return ct(({node:o})=>n[o.type.spec.tableRole])(t,e)}function ct(t){return(e,n)=>{const o=e.selection;let l,r;if(o instanceof C){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;l=o.$anchorCell.nodeAfter,r=o.$anchorCell.pos}else{var s;if(l=Pe(o.$from),!l)return!1;r=(s=_(o.$from))===null||s===void 0?void 0:s.pos}if(l==null||r==null||l.attrs.colspan==1&&l.attrs.rowspan==1)return!1;if(n){let i=l.attrs;const c=[],a=i.colwidth;i.rowspan>1&&(i={...i,rowspan:1}),i.colspan>1&&(i={...i,colspan:1});const d=N(e),u=e.tr;for(let h=0;h<d.right-d.left;h++)c.push(a?{...i,colwidth:a&&a[h]?[a[h]]:null}:i);let f;for(let h=d.top;h<d.bottom;h++){let p=d.map.positionAt(h,d.left,d.table);h==d.top&&(p+=l.nodeSize);for(let m=d.left,b=0;m<d.right;m++,b++)m==d.left&&h==d.top||u.insert(f=u.mapping.map(p+d.tableStart,1),t({node:l,row:h,col:m}).createAndFill(c[b]))}u.setNodeMarkup(r,t({node:l,row:d.top,col:d.left}),c[0]),o instanceof C&&u.setSelection(new C(u.doc.resolve(o.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u)}return!0}}function at(t,e){return function(n,o){if(!E(n))return!1;const l=V(n);if(l.nodeAfter.attrs[t]===e)return!1;if(o){const r=n.tr;n.selection instanceof C?n.selection.forEachCell((s,i)=>{s.attrs[t]!==e&&r.setNodeMarkup(i,null,{...s.attrs,[t]:e})}):r.setNodeMarkup(l.pos,null,{...l.nodeAfter.attrs,[t]:e}),o(r)}return!0}}function dt(t){return function(e,n){if(!E(e))return!1;if(n){const o=S(e.schema),l=N(e),r=e.tr,s=l.map.cellsInRect(t=="column"?{left:l.left,top:0,right:l.right,bottom:l.map.height}:t=="row"?{left:0,top:l.top,right:l.map.width,bottom:l.bottom}:l),i=s.map(c=>l.table.nodeAt(c));for(let c=0;c<s.length;c++)i[c].type==o.header_cell&&r.setNodeMarkup(l.tableStart+s[c],o.cell,i[c].attrs);if(r.steps.length===0)for(let c=0;c<s.length;c++)r.setNodeMarkup(l.tableStart+s[c],o.header_cell,i[c].attrs);n(r)}return!0}}function ie(t,e,n){const o=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let l=0;l<o.length;l++){const r=e.table.nodeAt(o[l]);if(r&&r.type!==n.header_cell)return!1}return!0}function B(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?dt(t):function(n,o){if(!E(n))return!1;if(o){const l=S(n.schema),r=N(n),s=n.tr,i=ie("row",r,l),c=ie("column",r,l),a=(t==="column"?i:t==="row"&&c)?1:0,d=t=="column"?{left:0,top:a,right:1,bottom:r.map.height}:t=="row"?{left:a,top:0,right:r.map.width,bottom:1}:r,u=t=="column"?c?l.cell:l.header_cell:t=="row"?i?l.cell:l.header_cell:l.cell;r.map.cellsInRect(d).forEach(f=>{const h=f+r.tableStart,p=s.doc.nodeAt(h);p&&s.setNodeMarkup(h,u,p.attrs)}),o(s)}return!0}}B("row",{useDeprecatedLogic:!0});B("column",{useDeprecatedLogic:!0});const ut=B("cell",{useDeprecatedLogic:!0});function ft(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let o=t.index(-1)-1,l=t.before();o>=0;o--){const r=t.node(-1).child(o),s=r.lastChild;if(s)return l-1-s.nodeSize;l-=r.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let o=t.indexAfter(-1),l=t.after();o<n.childCount;o++){const r=n.child(o);if(r.childCount)return l+1;l+=r.nodeSize}}return null}function ce(t){return function(e,n){if(!E(e))return!1;const o=ft(V(e),t);if(o==null)return!1;if(n){const l=e.doc.resolve(o);n(e.tr.setSelection(g.TextSelection.between(l,Oe(l))).scrollIntoView())}return!0}}function ht(t,e){const n=t.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function F(t,e){const n=t.selection;if(!(n instanceof C))return!1;if(e){const o=t.tr,l=S(t.schema).cell.createAndFill().content;n.forEachCell((r,s)=>{r.content.eq(l)||o.replace(o.mapping.map(s+1),o.mapping.map(s+r.nodeSize-1),new g.Slice(l,0,0))}),o.docChanged&&e(o)}return!0}function pt(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:o}=t;for(;e.childCount==1&&(n>0&&o>0||e.child(0).type.spec.tableRole=="table");)n--,o--,e=e.child(0).content;const l=e.child(0),r=l.type.spec.tableRole,s=l.type.schema,i=[];if(r=="row")for(let c=0;c<e.childCount;c++){let a=e.child(c).content;const d=c?0:Math.max(0,n-1),u=c<e.childCount-1?0:Math.max(0,o-1);(d||u)&&(a=ee(S(s).row,new g.Slice(a,d,u)).content),i.push(a)}else if(r=="cell"||r=="header_cell")i.push(n||o?ee(S(s).row,new g.Slice(e,n,o)).content:e);else return null;return mt(s,i)}function mt(t,e){const n=[];for(let l=0;l<e.length;l++){const r=e[l];for(let s=r.childCount-1;s>=0;s--){const{rowspan:i,colspan:c}=r.child(s).attrs;for(let a=l;a<l+i;a++)n[a]=(n[a]||0)+c}}let o=0;for(let l=0;l<n.length;l++)o=Math.max(o,n[l]);for(let l=0;l<n.length;l++)if(l>=e.length&&e.push(g.Fragment.empty),n[l]<o){const r=S(t).cell.createAndFill(),s=[];for(let i=n[l];i<o;i++)s.push(r);e[l]=e[l].append(g.Fragment.from(s))}return{height:e.length,width:o,rows:e}}function ee(t,e){const n=t.createAndFill();return new g.Transform(n).replace(0,n.content.size,e).doc}function gt({width:t,height:e,rows:n},o,l){if(t!=o){const r=[],s=[];for(let i=0;i<n.length;i++){const c=n[i],a=[];for(let d=r[i]||0,u=0;d<o;u++){let f=c.child(u%c.childCount);d+f.attrs.colspan>o&&(f=f.type.createChecked(H(f.attrs,f.attrs.colspan,d+f.attrs.colspan-o),f.content)),a.push(f),d+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)r[i+h]=(r[i+h]||0)+f.attrs.colspan}s.push(g.Fragment.from(a))}n=s,t=o}if(e!=l){const r=[];for(let s=0,i=0;s<l;s++,i++){const c=[],a=n[i%e];for(let d=0;d<a.childCount;d++){let u=a.child(d);s+u.attrs.rowspan>l&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,l-u.attrs.rowspan)},u.content)),c.push(u)}r.push(g.Fragment.from(c))}n=r,e=l}return{width:t,height:e,rows:n}}function bt(t,e,n,o,l,r,s){const i=t.doc.type.schema,c=S(i);let a,d;if(l>e.width)for(let u=0,f=0;u<e.height;u++){const h=n.child(u);f+=h.nodeSize;const p=[];let m;h.lastChild==null||h.lastChild.type==c.cell?m=a||(a=c.cell.createAndFill()):m=d||(d=c.header_cell.createAndFill());for(let b=e.width;b<l;b++)p.push(m);t.insert(t.mapping.slice(s).map(f-1+o),p)}if(r>e.height){const u=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,l);p++){const b=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==c.header_cell;u.push(b?d||(d=c.header_cell.createAndFill()):a||(a=c.cell.createAndFill()))}const f=c.row.create(null,g.Fragment.from(u)),h=[];for(let p=e.height;p<r;p++)h.push(f);t.insert(t.mapping.slice(s).map(o+n.nodeSize-2),h)}return!!(a||d)}function ae(t,e,n,o,l,r,s,i){if(s==0||s==e.height)return!1;let c=!1;for(let a=l;a<r;a++){const d=s*e.width+a,u=e.map[d];if(e.map[d-e.width]==u){c=!0;const f=n.nodeAt(u),{top:h,left:p}=e.findCell(u);t.setNodeMarkup(t.mapping.slice(i).map(u+o),null,{...f.attrs,rowspan:s-h}),t.insert(t.mapping.slice(i).map(e.positionAt(s,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),a+=f.attrs.colspan-1}}return c}function de(t,e,n,o,l,r,s,i){if(s==0||s==e.width)return!1;let c=!1;for(let a=l;a<r;a++){const d=a*e.width+s,u=e.map[d];if(e.map[d-1]==u){c=!0;const f=n.nodeAt(u),h=e.colCount(u),p=t.mapping.slice(i).map(u+o);t.setNodeMarkup(p,null,H(f.attrs,s-h,f.attrs.colspan-(s-h))),t.insert(p+f.nodeSize,f.type.createAndFill(H(f.attrs,0,s-h))),a+=f.attrs.rowspan-1}}return c}function ue(t,e,n,o,l){let r=n?t.doc.nodeAt(n-1):t.doc;if(!r)throw new Error("No table found");let s=y.get(r);const{top:i,left:c}=o,a=c+l.width,d=i+l.height,u=t.tr;let f=0;function h(){if(r=n?u.doc.nodeAt(n-1):u.doc,!r)throw new Error("No table found");s=y.get(r),f=u.mapping.maps.length}bt(u,s,r,n,a,d,f)&&h(),ae(u,s,r,n,c,a,i,f)&&h(),ae(u,s,r,n,c,a,d,f)&&h(),de(u,s,r,n,i,d,c,f)&&h(),de(u,s,r,n,i,d,a,f)&&h();for(let p=i;p<d;p++){const m=s.positionAt(p,c,r),b=s.positionAt(p,a,r);u.replace(u.mapping.slice(f).map(m+n),u.mapping.slice(f).map(b+n),new g.Slice(l.rows[p-i],0,0))}h(),u.setSelection(new C(u.doc.resolve(n+s.positionAt(i,c,r)),u.doc.resolve(n+s.positionAt(d-1,a-1,r)))),e(u)}const wt=D.keydownHandler({ArrowLeft:P("horiz",-1),ArrowRight:P("horiz",1),ArrowUp:P("vert",-1),ArrowDown:P("vert",1),"Shift-ArrowLeft":j("horiz",-1),"Shift-ArrowRight":j("horiz",1),"Shift-ArrowUp":j("vert",-1),"Shift-ArrowDown":j("vert",1),Backspace:F,"Mod-Backspace":F,Delete:F,"Mod-Delete":F});function q(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function P(t,e){return(n,o,l)=>{if(!l)return!1;const r=n.selection;if(r instanceof C)return q(n,o,g.Selection.near(r.$headCell,e));if(t!="horiz"&&!r.empty)return!1;const s=Ee(l,t,e);if(s==null)return!1;if(t=="horiz")return q(n,o,g.Selection.near(n.doc.resolve(r.head+e),e));{const i=n.doc.resolve(s),c=Se(i,t,e);let a;return c?a=g.Selection.near(c,1):e<0?a=g.Selection.near(n.doc.resolve(i.before(-1)),-1):a=g.Selection.near(n.doc.resolve(i.after(-1)),1),q(n,o,a)}}}function j(t,e){return(n,o,l)=>{if(!l)return!1;const r=n.selection;let s;if(r instanceof C)s=r;else{const c=Ee(l,t,e);if(c==null)return!1;s=new C(n.doc.resolve(c))}const i=Se(s.$headCell,t,e);return i?q(n,o,new C(s.$anchorCell,i)):!1}}function Ct(t,e){const n=t.state.doc,o=_(n.resolve(e));return o?(t.dispatch(t.state.tr.setSelection(new C(o))),!0):!1}function yt(t,e,n){if(!E(t.state))return!1;let o=pt(n);const l=t.state.selection;if(l instanceof C){o||(o={width:1,height:1,rows:[g.Fragment.from(ee(S(t.state.schema).cell,n))]});const r=l.$anchorCell.node(-1),s=l.$anchorCell.start(-1),i=y.get(r).rectBetween(l.$anchorCell.pos-s,l.$headCell.pos-s);return o=gt(o,i.right-i.left,i.bottom-i.top),ue(t.state,t.dispatch,s,i,o),!0}else if(o){const r=V(t.state),s=r.start(-1);return ue(t.state,t.dispatch,s,y.get(r.node(-1)).findCell(r.pos-s),o),!0}else return!1}function St(t,e){var n;if(e.ctrlKey||e.metaKey)return;const o=fe(t,e.target);let l;if(e.shiftKey&&t.state.selection instanceof C)r(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(l=_(t.state.selection.$anchor))!=null&&((n=U(t,e))===null||n===void 0?void 0:n.pos)!=l.pos)r(l,e),e.preventDefault();else if(!o)return;function r(c,a){let d=U(t,a);const u=z.getState(t.state)==null;if(!d||!oe(c,d))if(u)d=c;else return;const f=new C(c,d);if(u||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);u&&h.setMeta(z,c.pos),t.dispatch(h)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",i),z.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(z,-1))}function i(c){const a=c,d=z.getState(t.state);let u;if(d!=null)u=t.state.doc.resolve(d);else if(fe(t,a.target)!=o&&(u=U(t,e),!u))return s();u&&r(u,a)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",i)}function Ee(t,e,n){if(!(t.state.selection instanceof g.TextSelection))return null;const{$head:o}=t.state.selection;for(let l=o.depth-1;l>=0;l--){const r=o.node(l);if((n<0?o.index(l):o.indexAfter(l))!=(n<0?0:r.childCount))return null;if(r.type.spec.tableRole=="cell"||r.type.spec.tableRole=="header_cell"){const s=o.before(l),i=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(i)?s:null}}return null}function fe(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function U(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;const o=n.inside>=0?n.inside:n.pos;return _(t.state.doc.resolve(o))}var xt=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),te(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,te(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function te(t,e,n,o,l,r){let s=0,i=!0,c=e.firstChild;const a=t.firstChild;if(a){for(let u=0,f=0;u<a.childCount;u++){const{colspan:h,colwidth:p}=a.child(u).attrs;for(let m=0;m<h;m++,f++){const b=l==f?r:p&&p[m],w=b?b+"px":"";if(s+=b||o,b||(i=!1),c)c.style.width!=w&&(c.style.width=w),c=c.nextSibling;else{const x=document.createElement("col");x.style.width=w,e.appendChild(x)}}}for(;c;){var d;const u=c.nextSibling;(d=c.parentNode)===null||d===void 0||d.removeChild(c),c=u}i?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const T=new g.PluginKey("tableColumnResizing");function At({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:o=xt,lastColumnResizable:l=!0}={}){const r=new g.Plugin({key:T,state:{init(s,i){var c;const a=(c=r.spec)===null||c===void 0||(c=c.props)===null||c===void 0?void 0:c.nodeViews,d=S(i.schema).table.name;return o&&a&&(a[d]=(u,f)=>new o(u,n,f)),new Tt(-1,!1)},apply(s,i){return i.apply(s)}},props:{attributes:s=>{const i=T.getState(s);return i&&i.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,i)=>{Rt(s,i,t,l)},mouseleave:s=>{vt(s)},mousedown:(s,i)=>{Mt(s,i,e,n)}},decorations:s=>{const i=T.getState(s);if(i&&i.activeHandle>-1)return zt(s,i.activeHandle)},nodeViews:{}}});return r}var Tt=class G{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,o=e.getMeta(T);if(o&&o.setHandle!=null)return new G(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new G(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&e.docChanged){let l=e.mapping.map(n.activeHandle,-1);return Q(e.doc.resolve(l))||(l=-1),new G(l,n.dragging)}return n}};function Rt(t,e,n,o){if(!t.editable)return;const l=T.getState(t.state);if(l&&!l.dragging){const r=Nt(e.target);let s=-1;if(r){const{left:i,right:c}=r.getBoundingClientRect();e.clientX-i<=n?s=he(t,e,"left",n):c-e.clientX<=n&&(s=he(t,e,"right",n))}if(s!=l.activeHandle){if(!o&&s!==-1){const i=t.state.doc.resolve(s),c=i.node(-1),a=y.get(c),d=i.start(-1);if(a.colCount(i.pos-d)+i.nodeAfter.attrs.colspan-1==a.width-1)return}Ne(t,s)}}}function vt(t){if(!t.editable)return;const e=T.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Ne(t,-1)}function Mt(t,e,n,o){var l;if(!t.editable)return!1;const r=(l=t.dom.ownerDocument.defaultView)!==null&&l!==void 0?l:window,s=T.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const i=t.state.doc.nodeAt(s.activeHandle),c=Et(t,s.activeHandle,i.attrs);t.dispatch(t.state.tr.setMeta(T,{setDragging:{startX:e.clientX,startWidth:c}}));function a(u){r.removeEventListener("mouseup",a),r.removeEventListener("mousemove",d);const f=T.getState(t.state);f!=null&&f.dragging&&(kt(t,f.activeHandle,pe(f.dragging,u,n)),t.dispatch(t.state.tr.setMeta(T,{setDragging:null})))}function d(u){if(!u.which)return a(u);const f=T.getState(t.state);if(f&&f.dragging){const h=pe(f.dragging,u,n);me(t,f.activeHandle,h,o)}}return me(t,s.activeHandle,c,o),r.addEventListener("mouseup",a),r.addEventListener("mousemove",d),e.preventDefault(),!0}function Et(t,e,{colspan:n,colwidth:o}){const l=o&&o[o.length-1];if(l)return l;const r=t.domAtPos(e);let s=r.node.childNodes[r.offset].offsetWidth,i=n;if(o)for(let c=0;c<n;c++)o[c]&&(s-=o[c],i--);return s/i}function Nt(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function he(t,e,n,o){const l=n=="right"?-o:o,r=t.posAtCoords({left:e.clientX+l,top:e.clientY});if(!r)return-1;const{pos:s}=r,i=_(t.state.doc.resolve(s));if(!i)return-1;if(n=="right")return i.pos;const c=y.get(i.node(-1)),a=i.start(-1),d=c.map.indexOf(i.pos-a);return d%c.width==0?-1:a+c.map[d-1]}function pe(t,e,n){const o=e.clientX-t.startX;return Math.max(n,t.startWidth+o)}function Ne(t,e){t.dispatch(t.state.tr.setMeta(T,{setHandle:e}))}function kt(t,e,n){const o=t.state.doc.resolve(e),l=o.node(-1),r=y.get(l),s=o.start(-1),i=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let a=0;a<r.height;a++){const d=a*r.width+i;if(a&&r.map[d]==r.map[d-r.width])continue;const u=r.map[d],f=l.nodeAt(u).attrs,h=f.colspan==1?0:i-r.colCount(u);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():Lt(f.colspan);p[h]=n,c.setNodeMarkup(s+u,null,{...f,colwidth:p})}c.docChanged&&t.dispatch(c)}function me(t,e,n,o){const l=t.state.doc.resolve(e),r=l.node(-1),s=l.start(-1),i=y.get(r).colCount(l.pos-s)+l.nodeAfter.attrs.colspan-1;let c=t.domAtPos(l.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&te(r,c.firstChild,c,o,i,n)}function Lt(t){return Array(t).fill(0)}function zt(t,e){const n=[],o=t.doc.resolve(e),l=o.node(-1);if(!l)return D.DecorationSet.empty;const r=y.get(l),s=o.start(-1),i=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let a=0;a<r.height;a++){const d=i+a*r.width;if((i==r.width-1||r.map[d]!=r.map[d+1])&&(a==0||r.map[d]!=r.map[d-r.width])){var c;const u=r.map[d],f=s+u+l.nodeAt(u).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((c=T.getState(t))===null||c===void 0)&&c.dragging&&n.push(D.Decoration.node(s+u,s+u+l.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),n.push(D.Decoration.widget(f,h))}}return D.DecorationSet.create(t.doc,n)}function Dt({allowTableNodeSelection:t=!1}={}){return new g.Plugin({key:z,state:{init(){return null},apply(e,n){const o=e.getMeta(z);if(o!=null)return o==-1?null:o;if(n==null||!e.docChanged)return n;const{deleted:l,pos:r}=e.mapping.mapResult(n);return l?null:r}},props:{decorations:Ve,handleDOMEvents:{mousedown:St},createSelectionBetween(e){return z.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Ct,handleKeyDown:wt,handlePaste:yt},appendTransaction(e,n,o){return Ze(o,Re(o,n),t)}})}var ke=g.Node3.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const o=t.getAttribute("colwidth"),l=o?o.split(",").map(r=>parseInt(r,10)):null;if(!l){const r=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),s=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(s&&s>-1&&r&&r[s]){const i=r[s].getAttribute("width");return i?[parseInt(i,10)]:null}}return l}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",g.mergeAttributes(this.options.HTMLAttributes,t),0]}}),Le=g.Node3.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",g.mergeAttributes(this.options.HTMLAttributes,t),0]}}),ze=g.Node3.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",g.mergeAttributes(this.options.HTMLAttributes,t),0]}});function ne(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function ge(t,e,n,o,l,r){var s;let i=0,c=!0,a=e.firstChild;const d=t.firstChild;if(d!==null)for(let f=0,h=0;f<d.childCount;f+=1){const{colspan:p,colwidth:m}=d.child(f).attrs;for(let b=0;b<p;b+=1,h+=1){const w=l===h?r:m&&m[b],x=w?`${w}px`:"";if(i+=w||o,w||(c=!1),a){if(a.style.width!==x){const[R,L]=ne(o,w);a.style.setProperty(R,L)}a=a.nextSibling}else{const R=document.createElement("col"),[L,M]=ne(o,w);R.style.setProperty(L,M),e.appendChild(R)}}}for(;a;){const f=a.nextSibling;(s=a.parentNode)==null||s.removeChild(a),a=f}const u=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);c&&!u?(n.style.width=`${i}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${i}px`)}var Ht=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ge(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,ge(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),o=this.contentDOM.contains(e);return!!(n&&!o&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function _t(t,e,n,o){let l=0,r=!0;const s=[],i=t.firstChild;if(!i)return{};for(let u=0,f=0;u<i.childCount;u+=1){const{colspan:h,colwidth:p}=i.child(u).attrs;for(let m=0;m<h;m+=1,f+=1){const b=n===f?o:p&&p[m];l+=b||e,b||(r=!1);const[w,x]=ne(e,b);s.push(["col",{style:`${w}: ${x}`}])}}const c=r?`${l}px`:"",a=r?"":`${l}px`;return{colgroup:["colgroup",{},...s],tableWidth:c,tableMinWidth:a}}function be(t,e){return t.createAndFill()}function It(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const o=t.nodes[n];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),t.cached.tableNodeTypes=e,e}function Bt(t,e,n,o,l){const r=It(t),s=[],i=[];for(let a=0;a<n;a+=1){const d=be(r.cell);if(d&&i.push(d),o){const u=be(r.header_cell);u&&s.push(u)}}const c=[];for(let a=0;a<e;a+=1)c.push(r.row.createChecked(null,o&&a===0?s:i));return r.table.createChecked(null,c)}function $t(t){return t instanceof C}var O=({editor:t})=>{const{selection:e}=t.state;if(!$t(e))return!1;let n=0;const o=g.findParentNodeClosestToPos(e.ranges[0].$from,r=>r.type.name==="table");return o==null||o.node.descendants(r=>{if(r.type.name==="table")return!1;["tableCell","tableHeader"].includes(r.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Wt="";function Ft(t){return(t||"").replace(/\s+/g," ").trim()}function Pt(t,e,n={}){var o;const l=(o=n.cellLineSeparator)!=null?o:Wt;if(!t||!t.content||t.content.length===0)return"";const r=[];t.content.forEach(p=>{const m=[];p.content&&p.content.forEach(b=>{let w="";b.content&&Array.isArray(b.content)&&b.content.length>1?w=b.content.map(M=>e.renderChildren(M)).join(l):w=b.content?e.renderChildren(b.content):"";const x=Ft(w),R=b.type==="tableHeader";m.push({text:x,isHeader:R})}),r.push(m)});const s=r.reduce((p,m)=>Math.max(p,m.length),0);if(s===0)return"";const i=new Array(s).fill(0);r.forEach(p=>{var m;for(let b=0;b<s;b+=1){const x=(((m=p[b])==null?void 0:m.text)||"").length;x>i[b]&&(i[b]=x),i[b]<3&&(i[b]=3)}});const c=(p,m)=>p+" ".repeat(Math.max(0,m-p.length)),a=r[0],d=a.some(p=>p.isHeader);let u=`
|
|
2
|
+
`;const f=new Array(s).fill(0).map((p,m)=>d&&a[m]&&a[m].text||"");return u+=`| ${f.map((p,m)=>c(p,i[m])).join(" | ")} |
|
|
3
|
+
`,u+=`| ${i.map(p=>"-".repeat(Math.max(3,p))).join(" | ")} |
|
|
4
|
+
`,(d?r.slice(1):r).forEach(p=>{u+=`| ${new Array(s).fill(0).map((m,b)=>c(p[b]&&p[b].text||"",i[b])).join(" | ")} |
|
|
5
|
+
`}),u}var jt=Pt,De=g.Node3.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Ht,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:o,tableMinWidth:l}=_t(t,this.options.cellMinWidth),r=e.style;function s(){return r||(o?`width: ${o}`:`min-width: ${l}`)}const i=["table",g.mergeAttributes(this.options.HTMLAttributes,e,{style:s()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},i]:i},parseMarkdown:(t,e)=>{const n=[];if(t.header){const o=[];t.header.forEach(l=>{o.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(l.tokens)}]))}),n.push(e.createNode("tableRow",{},o))}return t.rows&&t.rows.forEach(o=>{const l=[];o.forEach(r=>{l.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(r.tokens)}]))}),n.push(e.createNode("tableRow",{},l))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>jt(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:o,dispatch:l,editor:r})=>{const s=Bt(r.schema,t,e,n);if(l){const i=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(_e.TextSelection.near(o.doc.resolve(i)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Ye(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Qe(t,e),deleteColumn:()=>({state:t,dispatch:e})=>tt(t,e),addRowBefore:()=>({state:t,dispatch:e})=>ot(t,e),addRowAfter:()=>({state:t,dispatch:e})=>lt(t,e),deleteRow:()=>({state:t,dispatch:e})=>st(t,e),deleteTable:()=>({state:t,dispatch:e})=>ht(t,e),mergeCells:()=>({state:t,dispatch:e})=>re(t,e),splitCell:()=>({state:t,dispatch:e})=>se(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>B("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>B("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>ut(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>re(t,e)?!0:se(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:o})=>at(t,e)(n,o),goToNextCell:()=>({state:t,dispatch:e})=>ce(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>ce(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Re(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const o=C.create(e.doc,t.anchorCell,t.headCell);e.setSelection(o)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:O,"Mod-Backspace":O,Delete:O,"Mod-Delete":O}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[At({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Dt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:g.callOrReturn(g.getExtensionField(t,"tableRole",e))}}});g.Extension.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(De.configure(this.options.table)),this.options.tableCell!==!1&&t.push(ke.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(Le.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(ze.configure(this.options.tableRow)),t}});function Ot(t,e,n){if(!t.doc)return t;const o=t.doc.nodeAt(e);if(!o||n===o.attrs.backgroundColor)return t;const l={...o.attrs,backgroundColor:n};return t.setNodeMarkup(e,o.type,l,o.marks)}function qt(t,e,n){const{doc:o,selection:l}=t;return!o||!l||!(l instanceof C)||l.forEachCell((r,s)=>{t=Ot(t,s,n)}),t}function we(t,e){return({tr:n,state:o,dispatch:l})=>{const{selection:r}=o;return n=n.setSelection(r),n=qt(n,e,t),n.docChanged?(l==null||l(n),!0):!1}}const Gt=g.Extension.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:t=>t.style.backgroundColor||"",renderHTML:t=>!t.backgroundColor||t.backgroundColor===""?{}:{style:`background-color: ${t.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:t=>we(t,this.options),unsetTableCellBackground:()=>we("",this.options)}}}),Vt=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,Kt=/CrOS/,Xt=/android|ipad|playbook|silk/i;function Ce(t={}){let e=t.ua||typeof navigator<"u"&&navigator.userAgent;return e&&typeof e=="object"&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string"?!1:!!(Vt.test(e)&&!Kt.test(e)||t.tablet&&Xt.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const ye=t=>Array.from({length:t}).map((e,n)=>n+1);function Zt(t){var f;const[e,n]=W.useState(!1),[o,l]=W.useState(!0),[r,s]=W.useState({rows:Ce()?v.TABLE_MAX_GRID_SIZE:v.TABLE_INIT_GRID_SIZE,cols:Ce()?v.TABLE_MAX_GRID_SIZE:v.TABLE_INIT_GRID_SIZE}),[i,c]=W.useState({rows:v.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:v.TABLE_DEFAULT_SELECTED_GRID_SIZE});function a(h,p){h===r.rows&&s(m=>({...m,rows:Math.min(h+1,v.TABLE_MAX_GRID_SIZE)})),p===r.cols&&s(m=>({...m,cols:Math.min(p+1,v.TABLE_MAX_GRID_SIZE)})),c({rows:h,cols:p})}function d(h,p){t==null||t.createTable({rows:h,cols:p,withHeaderRow:o}),u(),n(!1)}function u(){l(!1),s({rows:v.TABLE_INIT_GRID_SIZE,cols:v.TABLE_INIT_GRID_SIZE}),c({rows:v.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:v.TABLE_DEFAULT_SELECTED_GRID_SIZE})}return A.jsxs(X.Popover,{modal:!0,onOpenChange:n,open:e,children:[A.jsx(X.PopoverTrigger,{asChild:!0,"data-state":t!=null&&t.dataState?"on":"off",children:t==null?void 0:t.children}),A.jsx(X.PopoverContent,{align:"start",className:"richtext-w-full !richtext-p-2",side:"bottom",children:A.jsxs("div",{className:"table-grid-size-editor richtext-p-0",children:[A.jsx("div",{className:"richtext-flex richtext-flex-col richtext-flex-wrap richtext-justify-between richtext-gap-1",children:(f=ye(r==null?void 0:r.rows))==null?void 0:f.map(h=>{var p;return A.jsx("div",{className:"richtext-flex richtext-gap-1",children:(p=ye(r==null?void 0:r.cols))==null?void 0:p.map(m=>A.jsx("div",{onMouseDown:()=>d(h,m),onMouseOver:()=>a(h,m),className:`richtext-cursor-pointer richtext-border-border ${m<=i.cols&&h<=i.rows&&"tableCellActive !richtext-bg-foreground"}`,children:A.jsx("div",{className:"richtext-box-border richtext-size-4 richtext-rounded-[2px] !richtext-border richtext-border-solid !richtext-border-border richtext-p-1"})},`richtext-table-col-${m}`))},`richtext-table-row-${h}`)})}),A.jsxs("div",{className:"richtext-mt-2 richtext-text-center richtext-text-sm richtext-text-foreground",children:[i.rows,"x",i.cols]})]})})]})}function Ut(){const t=Z.useEditorInstance(),e=Z.useButtonProps(He.name),{icon:n=void 0,tooltip:o=void 0,action:l=void 0,isActive:r=void 0,color:s}=(e==null?void 0:e.componentProps)??{},{dataState:i,disabled:c}=Z.useToggleActive(r);if(!e)return A.jsx(A.Fragment,{});function a(d){t.chain().focus().insertTable({...d,withHeaderRow:!1}).run()}return A.jsx(Zt,{createTable:a,dataState:i,children:A.jsx(Ie.ActionButton,{action:l,color:s,dataState:i,icon:n,isActive:r,tooltip:o,disabled:c})})}const He=De.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{style:`
|
|
6
|
+
border: 1px solid #000;
|
|
7
|
+
border-collapse: collapse;
|
|
8
|
+
width: 100%;
|
|
9
|
+
`},resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:e,t:n})=>({componentProps:{isActive:()=>e.isActive("table"),icon:"Table",tooltip:n("editor.table.tooltip")}})}},addExtensions(){return[ze.configure(this.options.tableRow),Le.configure(this.options.tableHeader),ke.configure(this.options.tableCell),Gt.configure(this.options.tableCellBackground)]}});exports.CellSelection=C;exports.RichTextTable=Ut;exports.Table=He;
|
package/lib/Table.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-kY0nbqJo.cjs");exports.RichTextTable=e.RichTextTable;exports.Table=e.Table;
|
package/lib/Table.js
CHANGED
package/lib/TaskList.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-BCzvbrf5.cjs"),o=require("react/jsx-runtime"),m=require("./toggle-BQHMh_Q-.cjs");require("react");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const a=require("./useButtonProps-DBJkNDS2.cjs");function g(){const t=a.useButtonProps(u.name),{icon:s=void 0,tooltip:i=void 0,shortcutKeys:e=void 0,tooltipOptions:d={},action:n=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:r,update:T}=a.useToggleActive(l),k=()=>{r||n&&(n(),T())};return t?o.jsx(m.ActionButton,{action:k,dataState:p,disabled:r,icon:s,shortcutKeys:e,tooltip:i,tooltipOptions:d}):o.jsx(o.Fragment,{})}const u=c.TaskList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"task-list"},taskItem:{HTMLAttributes:{class:"task-list-item"}},button:({editor:s,t:i,extension:e})=>({componentProps:{action:()=>s.commands.toggleTaskList(),isActive:()=>s.isActive("taskList"),disabled:!1,icon:"ListTodo",shortcutKeys:e.options.shortcutKeys??["shift","mod","9"],tooltip:i("editor.tasklist.tooltip")}})}},addExtensions(){return[c.TaskItem.configure(this.options.taskItem)]}});exports.RichTextTaskList=g;exports.TaskList=u;
|
package/lib/TaskList.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { T as u, a as l } from "./index-
|
|
1
|
+
import { T as u, a as l } from "./index-DJbmnBzK.js";
|
|
2
2
|
import { jsx as a, Fragment as f } from "react/jsx-runtime";
|
|
3
|
-
import { A as k } from "./
|
|
3
|
+
import { A as k } from "./toggle-DKHg5sLm.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import "./index-DF5ZPtWM.js";
|
|
6
|
+
import "./theme.js";
|
|
7
|
+
import { u as T, a as v } from "./useButtonProps-DVP4s_ER.js";
|
|
8
|
+
function K() {
|
|
7
9
|
const t = T(A.name), {
|
|
8
|
-
icon:
|
|
9
|
-
tooltip:
|
|
10
|
+
icon: o = void 0,
|
|
11
|
+
tooltip: s = void 0,
|
|
10
12
|
shortcutKeys: i = void 0,
|
|
11
13
|
tooltipOptions: r = {},
|
|
12
14
|
action: e = void 0,
|
|
@@ -20,9 +22,9 @@ function y() {
|
|
|
20
22
|
action: d,
|
|
21
23
|
dataState: m,
|
|
22
24
|
disabled: n,
|
|
23
|
-
icon:
|
|
25
|
+
icon: o,
|
|
24
26
|
shortcutKeys: i,
|
|
25
|
-
tooltip:
|
|
27
|
+
tooltip: s,
|
|
26
28
|
tooltipOptions: r
|
|
27
29
|
}
|
|
28
30
|
) : /* @__PURE__ */ a(f, {});
|
|
@@ -42,14 +44,14 @@ const A = /* @__PURE__ */ u.extend({
|
|
|
42
44
|
class: "task-list-item"
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
|
-
button: ({ editor:
|
|
47
|
+
button: ({ editor: o, t: s, extension: i }) => ({
|
|
46
48
|
componentProps: {
|
|
47
|
-
action: () =>
|
|
48
|
-
isActive: () =>
|
|
49
|
+
action: () => o.commands.toggleTaskList(),
|
|
50
|
+
isActive: () => o.isActive("taskList"),
|
|
49
51
|
disabled: !1,
|
|
50
52
|
icon: "ListTodo",
|
|
51
53
|
shortcutKeys: i.options.shortcutKeys ?? ["shift", "mod", "9"],
|
|
52
|
-
tooltip:
|
|
54
|
+
tooltip: s("editor.tasklist.tooltip")
|
|
53
55
|
}
|
|
54
56
|
})
|
|
55
57
|
};
|
|
@@ -59,6 +61,6 @@ const A = /* @__PURE__ */ u.extend({
|
|
|
59
61
|
}
|
|
60
62
|
});
|
|
61
63
|
export {
|
|
62
|
-
|
|
64
|
+
K as RichTextTaskList,
|
|
63
65
|
A as TaskList
|
|
64
66
|
};
|
package/lib/TextAlign.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),m=require("react"),M=require("./toggle-BQHMh_Q-.cjs");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const y=require("./useButtonProps-DBJkNDS2.cjs"),T=require("./popover-mL-2sX5r.cjs"),S=require("./Icon-yqCglrdK.cjs"),j=require("./tooltip-BYtGp6FM.cjs");var K=q.Extension.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(n=>n):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(t=>t),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),P=K;function R(){const[e,t]=m.useState(!1),n=y.useButtonProps(C.name),{icon:g=void 0,tooltip:f=void 0,items:r=[],isActive:A=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:l,dataState:c}=y.useActive(A),u=m.useMemo(()=>(c==null?void 0:c.title)||"",[c]),x=m.useMemo(()=>r==null?void 0:r.some(i=>i.title===u),[r,u]);return n?s.jsxs(T.Popover,{modal:!0,onOpenChange:t,open:e,children:[s.jsx(T.PopoverTrigger,{asChild:!0,className:"hover:richtext-bg-accent data-[state=on]:richtext-bg-accent","data-state":x?"on":"off",disabled:l,children:s.jsx(M.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:l,icon:g,tooltip:f,children:s.jsx(S.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),s.jsx(T.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",children:r==null?void 0:r.map((i,p)=>{var o,a;return s.jsxs(j.Tooltip,{children:[s.jsx(j.TooltipTrigger,{asChild:!0,children:s.jsx(M.Toggle,{className:"richtext-size-7 richtext-p-1","data-state":u===i.title?"on":"off",size:"sm",onClick:()=>{i==null||i.action(),t(!1)},children:(i==null?void 0:i.icon)&&s.jsx(S.IconComponent,{name:i.icon})})}),s.jsxs(j.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[s.jsx("span",{children:i.title}),!!((o=i.shortcutKeys)!=null&&o.length)&&s.jsx("span",{children:(a=i.shortcutKeys)==null?void 0:a.map(h=>y.getShortcutKey(h)).join(" ")})]})]},`text-align-${p}`)})})]}):s.jsx(s.Fragment,{})}const C=P.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["heading","paragraph","list_item","title"],button({editor:t,extension:n,t:g}){var c,u,x,i,p;const f=((c=n.options)==null?void 0:c.alignments)||[],r={left:((u=n.options.shortcutKeys)==null?void 0:u[0])??["mod","Shift","L"],center:((x=n.options.shortcutKeys)==null?void 0:x[1])??["mod","Shift","E"],right:((i=n.options.shortcutKeys)==null?void 0:i[2])??["mod","Shift","R"],justify:((p=n.options.shortcutKeys)==null?void 0:p[3])??["mod","Shift","J"]},A={left:"AlignLeft",center:"AlignCenter",right:"AlignRight",justify:"AlignJustify"},l=f.map(o=>{var a,h,v;return{title:g(`editor.textalign.${o}.tooltip`),icon:A[o],shortcutKeys:r[o],isActive:()=>t.isActive({textAlign:o})||!1,action:()=>{var d,b;return(b=(d=t.commands)==null?void 0:d.setTextAlign)==null?void 0:b.call(d,o)},disabled:!((v=(h=(a=t==null?void 0:t.can)==null?void 0:a.call(t))==null?void 0:h.setTextAlign)!=null&&v.call(h,o))}});return{componentProps:{icon:"AlignJustify",tooltip:g("editor.textalign.tooltip"),items:l,isActive:()=>l==null?void 0:l.find(a=>a.isActive())}}}}}});exports.RichTextAlign=R;exports.TextAlign=C;
|
package/lib/TextAlign.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { E as C } from "./
|
|
1
|
+
import { E as C } from "./clsx-BWSGDJNJ.js";
|
|
2
2
|
import { jsx as o, Fragment as K, jsxs as A } from "react/jsx-runtime";
|
|
3
3
|
import M, { useMemo as v } from "react";
|
|
4
|
-
import { A as S, T as j
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
4
|
+
import { A as S, T as j } from "./toggle-DKHg5sLm.js";
|
|
5
|
+
import "./index-DF5ZPtWM.js";
|
|
6
|
+
import "./theme.js";
|
|
7
|
+
import { u as P, b as w, h as N } from "./useButtonProps-DVP4s_ER.js";
|
|
8
|
+
import { P as z, a as L, b as O } from "./popover-LfNBhRyz.js";
|
|
9
|
+
import { I as b } from "./Icon-Ctva8VeB.js";
|
|
10
|
+
import { T as R, a as _, b as $ } from "./tooltip-DNKq7zgN.js";
|
|
8
11
|
var E = C.create({
|
|
9
12
|
name: "textAlign",
|
|
10
13
|
addOptions() {
|
|
@@ -47,22 +50,22 @@ var E = C.create({
|
|
|
47
50
|
};
|
|
48
51
|
}
|
|
49
52
|
}), J = E;
|
|
50
|
-
function
|
|
51
|
-
const [e, t] = M.useState(!1), n =
|
|
53
|
+
function X() {
|
|
54
|
+
const [e, t] = M.useState(!1), n = P(B.name), {
|
|
52
55
|
icon: p = void 0,
|
|
53
56
|
tooltip: x = void 0,
|
|
54
57
|
items: r = [],
|
|
55
58
|
isActive: m = void 0
|
|
56
|
-
} = (n == null ? void 0 : n.componentProps) ?? {}, { disabled: l, dataState: a } =
|
|
59
|
+
} = (n == null ? void 0 : n.componentProps) ?? {}, { disabled: l, dataState: a } = w(m), h = v(() => (a == null ? void 0 : a.title) || "", [a]), g = v(() => r == null ? void 0 : r.some((i) => i.title === h), [r, h]);
|
|
57
60
|
return n ? /* @__PURE__ */ A(
|
|
58
|
-
|
|
61
|
+
z,
|
|
59
62
|
{
|
|
60
63
|
modal: !0,
|
|
61
64
|
onOpenChange: t,
|
|
62
65
|
open: e,
|
|
63
66
|
children: [
|
|
64
67
|
/* @__PURE__ */ o(
|
|
65
|
-
|
|
68
|
+
L,
|
|
66
69
|
{
|
|
67
70
|
asChild: !0,
|
|
68
71
|
className: "hover:richtext-bg-accent data-[state=on]:richtext-bg-accent",
|
|
@@ -87,16 +90,16 @@ function U() {
|
|
|
87
90
|
}
|
|
88
91
|
),
|
|
89
92
|
/* @__PURE__ */ o(
|
|
90
|
-
|
|
93
|
+
O,
|
|
91
94
|
{
|
|
92
95
|
align: "start",
|
|
93
96
|
className: "richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",
|
|
94
97
|
side: "bottom",
|
|
95
98
|
children: r == null ? void 0 : r.map((i, d) => {
|
|
96
99
|
var s, c;
|
|
97
|
-
return /* @__PURE__ */ A(
|
|
98
|
-
/* @__PURE__ */ o(
|
|
99
|
-
|
|
100
|
+
return /* @__PURE__ */ A(R, { children: [
|
|
101
|
+
/* @__PURE__ */ o(_, { asChild: !0, children: /* @__PURE__ */ o(
|
|
102
|
+
j,
|
|
100
103
|
{
|
|
101
104
|
className: "richtext-size-7 richtext-p-1",
|
|
102
105
|
"data-state": h === i.title ? "on" : "off",
|
|
@@ -107,9 +110,9 @@ function U() {
|
|
|
107
110
|
children: (i == null ? void 0 : i.icon) && /* @__PURE__ */ o(b, { name: i.icon })
|
|
108
111
|
}
|
|
109
112
|
) }),
|
|
110
|
-
/* @__PURE__ */ A(
|
|
113
|
+
/* @__PURE__ */ A($, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
|
|
111
114
|
/* @__PURE__ */ o("span", { children: i.title }),
|
|
112
|
-
!!((s = i.shortcutKeys) != null && s.length) && /* @__PURE__ */ o("span", { children: (c = i.shortcutKeys) == null ? void 0 : c.map((u) =>
|
|
115
|
+
!!((s = i.shortcutKeys) != null && s.length) && /* @__PURE__ */ o("span", { children: (c = i.shortcutKeys) == null ? void 0 : c.map((u) => N(u)).join(" ") })
|
|
113
116
|
] })
|
|
114
117
|
] }, `text-align-${d}`);
|
|
115
118
|
})
|
|
@@ -170,6 +173,6 @@ const B = /* @__PURE__ */ J.extend({
|
|
|
170
173
|
}
|
|
171
174
|
});
|
|
172
175
|
export {
|
|
173
|
-
|
|
176
|
+
X as RichTextAlign,
|
|
174
177
|
B as TextAlign
|
|
175
178
|
};
|
package/lib/TextDirection.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./clsx-CXbNJWDD.cjs"),e=require("react/jsx-runtime"),j=require("react"),m=require("./toggle-BQHMh_Q-.cjs");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const d=require("./useButtonProps-DBJkNDS2.cjs"),T=require("./popover-mL-2sX5r.cjs"),D=require("./Icon-yqCglrdK.cjs"),g=require("./tooltip-BYtGp6FM.cjs");function b(){const i=d.useButtonProps(v.name),[c,u]=j.useState(!1),{icon:x=void 0,tooltip:h=void 0,items:s=[],isActive:p=void 0}=(i==null?void 0:i.componentProps)??{},{editorDisabled:l,dataState:o}=d.useActive(p),n=j.useMemo(()=>(o==null?void 0:o.dir)||"unset",[o]);return i?e.jsxs(T.Popover,{open:c,onOpenChange:u,modal:!0,children:[e.jsx(T.PopoverTrigger,{asChild:!0,disabled:l,children:e.jsx(m.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:l,icon:x,tooltip:h,children:e.jsx(D.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),e.jsx(T.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",hideWhenDetached:!0,children:s==null?void 0:s.map((t,r)=>{var a,f;return e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{"data-state":n===t.value?"on":"off",asChild:!0,children:e.jsx(m.Toggle,{className:"richtext-size-7 richtext-p-1",onClick:()=>{t==null||t.action(),u(!1)},size:"sm",children:(t==null?void 0:t.icon)&&e.jsx(D.IconComponent,{name:t.icon})})}),e.jsxs(g.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[e.jsx("span",{children:t.title}),!!((a=t.shortcutKeys)!=null&&a.length)&&e.jsx("span",{children:(f=t.shortcutKeys)==null?void 0:f.map(q=>d.getShortcutKey(q)).join(" ")})]})]},`text-direction-${r}`)})})]}):e.jsx(e.Fragment,{})}const v=C.Extension.create({name:"richTextTextDirection",addOptions(){var i;return{...(i=this.parent)==null?void 0:i.call(this),directions:["auto","ltr","rtl","unset"],defaultDirection:"auto",button({editor:c,extension:u,t:x}){var l;const h=((l=u.options)==null?void 0:l.directions)||[],s={auto:"TextDirection",ltr:"LeftToRight",rtl:"RightToLeft",unset:"X"},p=h.map(o=>({title:x(`editor.textDirection.${o}.tooltip`),value:o,icon:s[o],action:()=>{var n,t,r,a;if(o==="unset"){(t=(n=c.commands)==null?void 0:n.unsetTextDirection)==null||t.call(n);return}(a=(r=c.commands)==null?void 0:r.setTextDirection)==null||a.call(r,o)},disabled:!1}));return{componentProps:{icon:"TextDirection",tooltip:x("editor.textDirection.tooltip"),items:p,isActive:()=>c.getAttributes("paragraph")}}}}}});exports.RichTextTextDirection=b;exports.TextDirection=v;
|
package/lib/TextDirection.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { E as g } from "./
|
|
1
|
+
import { E as g } from "./clsx-BWSGDJNJ.js";
|
|
2
2
|
import { jsx as o, Fragment as D, jsxs as x } from "react/jsx-runtime";
|
|
3
3
|
import v, { useMemo as b } from "react";
|
|
4
|
-
import { A as C, T as A
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { A as C, T as A } from "./toggle-DKHg5sLm.js";
|
|
5
|
+
import "./index-DF5ZPtWM.js";
|
|
6
|
+
import "./theme.js";
|
|
7
|
+
import { u as P, b as w, h as z } from "./useButtonProps-DVP4s_ER.js";
|
|
8
|
+
import { P as N, a as R, b as j } from "./popover-LfNBhRyz.js";
|
|
9
|
+
import { I as f } from "./Icon-Ctva8VeB.js";
|
|
10
|
+
import { T as y, a as K, b as M } from "./tooltip-DNKq7zgN.js";
|
|
11
|
+
function q() {
|
|
12
|
+
const i = P(O.name), [c, h] = v.useState(!1), {
|
|
10
13
|
icon: p = void 0,
|
|
11
14
|
tooltip: u = void 0,
|
|
12
15
|
items: s = [],
|
|
13
16
|
isActive: d = void 0
|
|
14
|
-
} = (i == null ? void 0 : i.componentProps) ?? {}, { editorDisabled: a, dataState: e } =
|
|
17
|
+
} = (i == null ? void 0 : i.componentProps) ?? {}, { editorDisabled: a, dataState: e } = w(d), r = b(() => (e == null ? void 0 : e.dir) || "unset", [e]);
|
|
15
18
|
return i ? /* @__PURE__ */ x(
|
|
16
|
-
|
|
19
|
+
N,
|
|
17
20
|
{
|
|
18
21
|
open: c,
|
|
19
22
|
onOpenChange: h,
|
|
20
23
|
modal: !0,
|
|
21
24
|
children: [
|
|
22
25
|
/* @__PURE__ */ o(
|
|
23
|
-
|
|
26
|
+
R,
|
|
24
27
|
{
|
|
25
28
|
asChild: !0,
|
|
26
29
|
disabled: a,
|
|
@@ -43,7 +46,7 @@ function S() {
|
|
|
43
46
|
}
|
|
44
47
|
),
|
|
45
48
|
/* @__PURE__ */ o(
|
|
46
|
-
|
|
49
|
+
j,
|
|
47
50
|
{
|
|
48
51
|
align: "start",
|
|
49
52
|
className: "richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",
|
|
@@ -51,14 +54,14 @@ function S() {
|
|
|
51
54
|
hideWhenDetached: !0,
|
|
52
55
|
children: s == null ? void 0 : s.map((t, n) => {
|
|
53
56
|
var l, m;
|
|
54
|
-
return /* @__PURE__ */ x(
|
|
57
|
+
return /* @__PURE__ */ x(y, { children: [
|
|
55
58
|
/* @__PURE__ */ o(
|
|
56
|
-
|
|
59
|
+
K,
|
|
57
60
|
{
|
|
58
61
|
"data-state": r === t.value ? "on" : "off",
|
|
59
62
|
asChild: !0,
|
|
60
63
|
children: /* @__PURE__ */ o(
|
|
61
|
-
|
|
64
|
+
A,
|
|
62
65
|
{
|
|
63
66
|
className: "richtext-size-7 richtext-p-1",
|
|
64
67
|
onClick: () => {
|
|
@@ -70,9 +73,9 @@ function S() {
|
|
|
70
73
|
)
|
|
71
74
|
}
|
|
72
75
|
),
|
|
73
|
-
/* @__PURE__ */ x(
|
|
76
|
+
/* @__PURE__ */ x(M, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
|
|
74
77
|
/* @__PURE__ */ o("span", { children: t.title }),
|
|
75
|
-
!!((l = t.shortcutKeys) != null && l.length) && /* @__PURE__ */ o("span", { children: (m = t.shortcutKeys) == null ? void 0 : m.map((T) =>
|
|
78
|
+
!!((l = t.shortcutKeys) != null && l.length) && /* @__PURE__ */ o("span", { children: (m = t.shortcutKeys) == null ? void 0 : m.map((T) => z(T)).join(" ") })
|
|
76
79
|
] })
|
|
77
80
|
] }, `text-direction-${n}`);
|
|
78
81
|
})
|
|
@@ -128,6 +131,6 @@ const O = /* @__PURE__ */ g.create({
|
|
|
128
131
|
}
|
|
129
132
|
});
|
|
130
133
|
export {
|
|
131
|
-
|
|
134
|
+
q as RichTextTextDirection,
|
|
132
135
|
O as TextDirection
|
|
133
136
|
};
|
package/lib/TextUnderline.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),h=require("./toggle-BQHMh_Q-.cjs");require("react");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const a=require("./useButtonProps-DBJkNDS2.cjs");var k=u.Mark.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",u.mergeAttributes(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),v=k;function x(){const e=a.useButtonProps(l.name),{icon:t=void 0,tooltip:n=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:i=void 0,isActive:c=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:m,disabled:d,update:p}=a.useToggleActive(c),g=()=>{d||i&&(i(),p())};return e?s.jsx(h.ActionButton,{action:g,dataState:m,disabled:d,icon:t,shortcutKeys:o,tooltip:n,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=v.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:n,extension:o}){return{componentProps:{action:()=>t.commands.toggleUnderline(),isActive:()=>t.isActive("underline")||!1,disabled:!1,icon:"Underline",shortcutKeys:o.options.shortcutKeys??["mod","U"],tooltip:n("editor.underline.tooltip")}}}}}});exports.RichTextUnderline=x;exports.TextUnderline=l;
|
package/lib/TextUnderline.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { M as m, m as p } from "./
|
|
1
|
+
import { M as m, m as p } from "./clsx-BWSGDJNJ.js";
|
|
2
2
|
import { jsx as d, Fragment as g } from "react/jsx-runtime";
|
|
3
|
-
import { A as f } from "./
|
|
3
|
+
import { A as f } from "./toggle-DKHg5sLm.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import
|
|
5
|
+
import "./index-DF5ZPtWM.js";
|
|
6
|
+
import "./theme.js";
|
|
7
|
+
import { u as h, a as k } from "./useButtonProps-DVP4s_ER.js";
|
|
6
8
|
var M = m.create({
|
|
7
9
|
name: "underline",
|
|
8
10
|
addOptions() {
|
|
@@ -64,7 +66,7 @@ var M = m.create({
|
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
68
|
}), v = M;
|
|
67
|
-
function
|
|
69
|
+
function K() {
|
|
68
70
|
const e = h(U.name), {
|
|
69
71
|
icon: t = void 0,
|
|
70
72
|
tooltip: n = void 0,
|
|
@@ -111,6 +113,6 @@ const U = /* @__PURE__ */ v.extend({
|
|
|
111
113
|
}
|
|
112
114
|
});
|
|
113
115
|
export {
|
|
114
|
-
|
|
116
|
+
K as RichTextUnderline,
|
|
115
117
|
U as TextUnderline
|
|
116
118
|
};
|