@oyat/editor 1.7.4 → 1.7.5
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-suggestion.d.ts","sourceRoot":"","sources":["../../../src/components/ui/block-suggestion.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAU/D,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,eAAe,EAKrB,MAAM,SAAS,CAAC;AAKjB,OAAO,EACL,KAAK,WAAW,EAEjB,MAAM,4CAA4C,CAAC;AAGpD,OAAO,EACL,KAAK,QAAQ,EAId,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC7D,QAAQ,EAAE,QAAQ,EAAE,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"block-suggestion.d.ts","sourceRoot":"","sources":["../../../src/components/ui/block-suggestion.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAU/D,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,eAAe,EAKrB,MAAM,SAAS,CAAC;AAKjB,OAAO,EACL,KAAK,WAAW,EAEjB,MAAM,4CAA4C,CAAC;AAGpD,OAAO,EACL,KAAK,QAAQ,EAId,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC7D,QAAQ,EAAE,QAAQ,EAAE,CAAC;CACtB;AAqCD,wBAAgB,mBAAmB,CAAC,EAClC,GAAG,EACH,MAAM,EACN,UAAU,GACX,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,kBAAkB,CAAC;CAChC,2CAkLA;AAED,eAAO,MAAM,oBAAoB,GAC/B,iBAAiB,SAAS,CAAC,QAAQ,GAAG,eAAe,CAAC,EAAE,EACxD,WAAW,IAAI,yBA8NhB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,YAAY,kBAAkB,GAAG,WAAW,KAC3C,UAAU,IAAI,kBAAkD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mark-toolbar-button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/mark-toolbar-button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"mark-toolbar-button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/mark-toolbar-button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,GAAG;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;CAC3B,2CA0BA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-node.d.ts","sourceRoot":"","sources":["../../../src/components/ui/table-node.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"table-node.d.ts","sourceRoot":"","sources":["../../../src/components/ui/table-node.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAqC/B,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EAGtB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,iBAAiB,EAavB,MAAM,eAAe,CAAC;AAsCvB,eAAO,MAAM,YAAY,+GAqDxB,CAAC;AA2TF,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,2CAiDrC;AAuCD,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,GAAG;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,2CAgHA;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,2CAGrD"}
|
package/dist/index.js
CHANGED
|
@@ -148,7 +148,7 @@ return si.jsx(Cs.Group,{"data-slot":"command-group",className:ui("text-foregroun
|
|
|
148
148
|
return si.jsx(Cs.Item,{"data-slot":"command-item",className:ui("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function _l({...e}){/* @__PURE__ */
|
|
149
149
|
return si.jsx(rs.Root,{"data-slot":"popover",...e})}function Sl({...e}){/* @__PURE__ */
|
|
150
150
|
return si.jsx(rs.Trigger,{"data-slot":"popover-trigger",...e})}function El({className:e,align:t="center",sideOffset:r=4,...s}){/* @__PURE__ */
|
|
151
|
-
return si.jsx(rs.Portal,{children:/* @__PURE__ */si.jsx(rs.Content,{"data-slot":"popover-content",align:t,sideOffset:r,className:ui("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-
|
|
151
|
+
return si.jsx(rs.Portal,{children:/* @__PURE__ */si.jsx(rs.Content,{"data-slot":"popover-content",align:t,sideOffset:r,className:ui("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-1500 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...s})})}function Bl({...e}){/* @__PURE__ */
|
|
152
152
|
return si.jsx(rs.Anchor,{"data-slot":"popover-anchor",...e})}function Tl(){const[t,r]=e.useState(!1),s=C(),n=I(),o=O(),a=o.lang||"plaintext",[i,l]=e.useState(""),c=e.useMemo(()=>Il.filter(e=>!i||e.label.toLowerCase().includes(i.toLowerCase())),[i]);return s?null:/* @__PURE__ */si.jsxs(_l,{open:t,onOpenChange:r,children:[
|
|
153
153
|
/* @__PURE__ */si.jsx(Sl,{asChild:!0,children:/* @__PURE__ */si.jsx(_i,{size:"sm",variant:"ghost",className:"h-6 select-none justify-between gap-1 px-2 text-muted-foreground text-xs","aria-expanded":t,role:"combobox",children:Il.find(e=>e.value===a)?.label??"Plain Text"})}),
|
|
154
154
|
/* @__PURE__ */si.jsx(El,{className:"w-[200px] p-0",onCloseAutoFocus:()=>l(""),children:/* @__PURE__ */si.jsxs(yl,{shouldFilter:!1,children:[
|
|
@@ -219,16 +219,18 @@ return si.jsxs("div",{className:ui("flex w-full",s),children:[
|
|
|
219
219
|
/* @__PURE__ */si.jsx("div",{className:"mt-2 mr-1 shrink-0",children:/* @__PURE__ */si.jsx(nc,{className:"size-5",children:/* @__PURE__ */si.jsx(oc,{children:m?.name?.[0]})})}),
|
|
220
220
|
/* @__PURE__ */si.jsx("div",{className:"relative flex grow gap-2",children:/* @__PURE__ */si.jsx(U,{onChange:({value:e})=>{x(e)},editor:f,children:/* @__PURE__ */si.jsxs(lc,{variant:"comment",children:[
|
|
221
221
|
/* @__PURE__ */si.jsx(dc,{variant:"comment",className:"min-h-[25px] grow pt-0.5 pr-8",onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),g())},placeholder:"Reply...",autoComplete:"off",autoFocus:t}),
|
|
222
|
-
/* @__PURE__ */si.jsx(_i,{size:"icon",variant:"ghost",className:"absolute right-0.5 bottom-0.5 ml-auto size-6 shrink-0",disabled:0===p.trim().length,onClick:e=>{e.stopPropagation(),g()},children:/* @__PURE__ */si.jsx("div",{className:"flex size-6 items-center justify-center rounded-full",children:/* @__PURE__ */si.jsx(It,{})})})]})})})]})}const fc=e=>{const t=/* @__PURE__ */new Date,r=ln(t,e),s=cn(t,e),n=dn(t,e);return r<60?`${r}m`:s<24?`${s}h`:n<2?`${n}d`:un(e,"MM/dd/yyyy")},gc="__block__",jc={[r.audio]:()=>"Audio",[r.blockquote]:()=>"Blockquote",[r.callout]:()=>"Callout",[r.codeBlock]:()=>"Code Block",[r.column]:()=>"Column",[r.equation]:()=>"Equation",[r.file]:()=>"File",[r.h1]:()=>"Heading 1",[r.h2]:()=>"Heading 2",[r.h3]:()=>"Heading 3",[r.h4]:()=>"Heading 4",[r.h5]:()=>"Heading 5",[r.h6]:()=>"Heading 6",[r.hr]:()=>"Horizontal Rule",[r.img]:()=>"Image",[r.mediaEmbed]:()=>"Media",[r.p]:e=>e?.[r.listType]===r.listTodo?"Todo List":e?.[r.listType]===r.ol?"Ordered List":e?.[r.listType]===r.ul?"List":"Paragraph",[r.table]:()=>"Table",[r.toc]:()=>"Table of Contents",[r.toggle]:()=>"Toggle",[r.video]:()=>"Video"};function bc({idx:t,isLast:r,suggestion:s}){const{api:n,editor:o}=E(an),a=T(kc,"user",s.userId),[i,l]=e.useState(!1),c=e=>e===gc?["line breaks"]:e.split(gc).filter(Boolean),[
|
|
222
|
+
/* @__PURE__ */si.jsx(_i,{size:"icon",variant:"ghost",className:"absolute right-0.5 bottom-0.5 ml-auto size-6 shrink-0",disabled:0===p.trim().length,onClick:e=>{e.stopPropagation(),g()},children:/* @__PURE__ */si.jsx("div",{className:"flex size-6 items-center justify-center rounded-full",children:/* @__PURE__ */si.jsx(It,{})})})]})})})]})}const fc=e=>{const t=/* @__PURE__ */new Date,r=ln(t,e),s=cn(t,e),n=dn(t,e);return r<60?`${r}m`:s<24?`${s}h`:n<2?`${n}d`:un(e,"MM/dd/yyyy")},gc="__block__",jc={[r.audio]:()=>"Audio",[r.blockquote]:()=>"Blockquote",[r.callout]:()=>"Callout",[r.codeBlock]:()=>"Code Block",[r.column]:()=>"Column",[r.equation]:()=>"Equation",[r.file]:()=>"File",[r.h1]:()=>"Heading 1",[r.h2]:()=>"Heading 2",[r.h3]:()=>"Heading 3",[r.h4]:()=>"Heading 4",[r.h5]:()=>"Heading 5",[r.h6]:()=>"Heading 6",[r.hr]:()=>"Horizontal Rule",[r.img]:()=>"Image",[r.mediaEmbed]:()=>"Media",[r.p]:e=>e?.[r.listType]===r.listTodo?"Todo List":e?.[r.listType]===r.ol?"Ordered List":e?.[r.listType]===r.ul?"List":"Paragraph",[r.table]:()=>"Table",[r.th]:()=>"Table Header",[r.tr]:()=>"Table Row",[r.td]:()=>"Table Cell",[r.toc]:()=>"Table of Contents",[r.toggle]:()=>"Toggle",[r.video]:()=>"Video"};function bc({idx:t,isLast:r,suggestion:s}){const{api:n,editor:o}=E(an),a=T(kc,"user",s.userId),[i,l]=e.useState(!1),c=e=>e===gc?["line breaks"]:e.split(gc).filter(Boolean),d=["Table","Table Header","Table Cell","Table Row"],[u,m]=e.useState(null);/* @__PURE__ */
|
|
223
223
|
return si.jsxs("div",{className:"relative",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[
|
|
224
224
|
/* @__PURE__ */si.jsxs("div",{className:"flex flex-col p-4",children:[
|
|
225
225
|
/* @__PURE__ */si.jsxs("div",{className:"relative flex items-center",children:[
|
|
226
226
|
/* @__PURE__ */si.jsx(nc,{className:"size-5",children:/* @__PURE__ */si.jsx(oc,{children:a?.name?.[0]})}),
|
|
227
227
|
/* @__PURE__ */si.jsx("h4",{className:"mx-2 font-semibold text-sm leading-none",children:a?.name}),
|
|
228
228
|
/* @__PURE__ */si.jsx("div",{className:"text-muted-foreground/80 text-xs leading-none",children:/* @__PURE__ */si.jsx("span",{className:"mr-1",children:fc(new Date(s.createdAt))})})]}),
|
|
229
|
-
/* @__PURE__ */si.jsx("div",{className:"relative mt-1 mb-4 pl-[32px]",children:/* @__PURE__ */si.jsxs("div",{className:"flex flex-col gap-2",children:["remove"===s.type&&
|
|
229
|
+
/* @__PURE__ */si.jsx("div",{className:"relative mt-1 mb-4 pl-[32px]",children:/* @__PURE__ */si.jsxs("div",{className:"flex flex-col gap-2",children:["remove"===s.type&&(h=s.text,c(h).some(e=>d.includes(e))?/* @__PURE__ */si.jsxs("div",{className:"flex items-center gap-2",children:[
|
|
230
230
|
/* @__PURE__ */si.jsx("span",{className:"text-muted-foreground text-sm",children:"Delete:"}),
|
|
231
|
-
/* @__PURE__ */si.jsx("span",{className:"text-sm",children:
|
|
231
|
+
/* @__PURE__ */si.jsx("span",{className:"text-sm",children:"Table Deleted"})]}):c(s.text).map((e,t)=>/* @__PURE__ */si.jsxs("div",{className:"flex items-center gap-2",children:[
|
|
232
|
+
/* @__PURE__ */si.jsx("span",{className:"text-muted-foreground text-sm",children:"Delete:"}),
|
|
233
|
+
/* @__PURE__ */si.jsx("span",{className:"text-sm",children:e},t)]},t))),"insert"===s.type&&c(s.newText).map((e,t)=>/* @__PURE__ */si.jsxs("div",{className:"flex items-center gap-2",children:[
|
|
232
234
|
/* @__PURE__ */si.jsx("span",{className:"text-muted-foreground text-sm",children:"Add:"}),
|
|
233
235
|
/* @__PURE__ */si.jsx("span",{className:"text-sm",children:e||"line breaks"},t)]},t)),"replace"===s.type&&/* @__PURE__ */si.jsxs("div",{className:"flex flex-col gap-2",children:[c(s.newText).map((t,r)=>/* @__PURE__ */si.jsx(e.Fragment,{children:/* @__PURE__ */si.jsxs("div",{className:"flex items-start gap-2 text-brand/80",children:[
|
|
234
236
|
/* @__PURE__ */si.jsx("span",{className:"text-sm",children:"with:"}),
|
|
@@ -236,10 +238,10 @@ return si.jsxs("div",{className:"relative",onMouseEnter:()=>l(!0),onMouseLeave:(
|
|
|
236
238
|
/* @__PURE__ */si.jsx("span",{className:"text-muted-foreground text-sm",children:0===r?"Replace:":"Delete:"}),
|
|
237
239
|
/* @__PURE__ */si.jsx("span",{className:"text-sm",children:t||"line breaks"})]},r)},r))]}),"update"===s.type&&/* @__PURE__ */si.jsxs("div",{className:"flex items-center gap-2",children:[
|
|
238
240
|
/* @__PURE__ */si.jsxs("span",{className:"text-muted-foreground text-sm",children:[Object.keys(s.properties).map(e=>/* @__PURE__ */si.jsxs("span",{children:["Un",e]},e)),Object.keys(s.newProperties).map(e=>/* @__PURE__ */si.jsx("span",{children:e.charAt(0).toUpperCase()+e.slice(1)},e))]}),
|
|
239
|
-
/* @__PURE__ */si.jsx("span",{className:"text-sm",children:s.newText})]})]})}),s.comments.map((e,t)=>/* @__PURE__ */si.jsx(mc,{comment:e,discussionLength:s.comments.length,documentContent:"__suggestion__",editingId:
|
|
241
|
+
/* @__PURE__ */si.jsx("span",{className:"text-sm",children:s.newText})]})]})}),s.comments.map((e,t)=>/* @__PURE__ */si.jsx(mc,{comment:e,discussionLength:s.comments.length,documentContent:"__suggestion__",editingId:u,index:t,setEditingId:m},e.id??t)),i&&/* @__PURE__ */si.jsxs("div",{className:"absolute top-4 right-4 flex gap-2",children:[
|
|
240
242
|
/* @__PURE__ */si.jsx(_i,{variant:"ghost",className:"size-6 p-1 text-muted-foreground",onClick:()=>{return e=s,void n.suggestion.withoutSuggestions(()=>{sn(o,e)});var e},children:/* @__PURE__ */si.jsx(mt,{className:"size-4"})}),
|
|
241
243
|
/* @__PURE__ */si.jsx(_i,{variant:"ghost",className:"size-6 p-1 text-muted-foreground",onClick:()=>{return e=s,void n.suggestion.withoutSuggestions(()=>{nn(o,e)});var e},children:/* @__PURE__ */si.jsx(pt,{className:"size-4"})})]}),
|
|
242
|
-
/* @__PURE__ */si.jsx(pc,{discussionId:s.suggestionId})]}),!r&&/* @__PURE__ */si.jsx("div",{className:"h-px w-full bg-muted"})]},`${s.suggestionId}-${t}`)}const vc=({blockPath:t,children:s,commentNodes:n,draftCommentNode:o,suggestionNodes:i})=>{const l=I(),c=((t,s)=>{const n=T(kc,"discussions"),{api:o,editor:i,getOption:l,setOption:c}=E(rc);return t.forEach(([e])=>{const t=o.suggestion.nodeId(e),r=l("uniquePathMap");if(!t)return;const n=r.get(t);if(a.isPath(n)){const e=o.suggestion.node({id:t,at:n,isText:!0}),a=o.node(n);let i=null;a&&u.isElement(a[0])&&(i=o.suggestion.nodeId(a[0])??null),e||i===t||c("uniquePathMap",new Map(r).set(t,s))}else c("uniquePathMap",new Map(r).set(t,s))}),e.useMemo(()=>{const e=l("uniquePathMap");if(0===t.length)return[];const c=new Set(t.flatMap(([e])=>{if(m.isText(e)){const t=o.suggestion.dataList(e);return t.some(e=>"update"===e.type)?t.filter(e=>"update"===e.type).map(e=>e.id):o.suggestion.nodeId(e)??[]}return u.isElement(e)?o.suggestion.nodeId(e)??[]:[]}).filter(Boolean)),d=[];return c.forEach(t=>{if(!t)return;const l=e.get(t);if(!l||!a.isPath(l))return;if(!a.equals(l,s))return;const c=[...i.api.nodes({at:[],mode:"all",match:e=>e[r.suggestion]&&e[tn(t)]||o.suggestion.nodeId(e)===t})];c.sort(([,e],[,t])=>a.isChild(e,t)?-1:1);let u="",h="",x={},p={};if(c.forEach(([e])=>{if(m.isText(e))o.suggestion.dataList(e).forEach(r=>{if(r.id===t)switch(r.type){case"insert":u+=e.text;break;case"remove":h+=e.text;break;case"update":x={...x,...r.properties},p={...p,...r.newProperties},u+=e.text}});else{const r=o.suggestion.isBlockSuggestion(e)?e.suggestion:void 0;r?.id===rn(t)&&("insert"===r.type?u+=r.isLineBreak?gc:gc+jc[e.type](e):"remove"===r.type&&(h+=r.isLineBreak?gc:gc+jc[e.type](e)))}}),0===c.length)return;const f=o.suggestion.suggestionData(c[0][0]);if(!f)return;const g=n.find(e=>e.id===t)?.comments||[],j=new Date(f.createdAt),b=tn(t);"update"===f.type?d.push({comments:g,createdAt:j,keyId:b,newProperties:p,newText:u,properties:x,suggestionId:rn(t),type:"update",userId:f.userId}):u.length>0&&h.length>0?d.push({comments:g,createdAt:j,keyId:b,newText:u,suggestionId:rn(t),text:h,type:"replace",userId:f.userId}):u.length>0?d.push({comments:g,createdAt:j,keyId:b,newText:u,suggestionId:rn(t),type:"insert",userId:f.userId}):h.length>0&&d.push({comments:g,createdAt:j,keyId:b,suggestionId:rn(t),text:h,type:"remove",userId:f.userId})}),d},[o.suggestion,s,n,i.api,l,t])})(i,t),d=wc(n,t),h=c.length,x=d.length,p=h+x,f=T(rc,"activeId"),g=f&&c.find(e=>e.suggestionId===f),j=T(Wl,"commentingBlock"),b=T(Wl,"activeId"),v=b===Hs(),y=b&&d.find(e=>e.id===b),w=!g&&!y,k=[...d,...c].sort((e,t)=>e.createdAt.getTime()-t.createdAt.getTime()),C=d.some(e=>e.id===b)||c.some(e=>e.suggestionId===f),[N,z]=e.useState(C),_=!!j&&a.equals(t,j),S=N||C||v&&!!o&&_,B=e.useMemo(()=>{let e;return g&&(e=i.find(([e])=>m.isText(e)&&l.getApi(an).suggestion.nodeId(e)===g.suggestionId)),b&&(e=b===Hs()?o:n.find(([e])=>l.getApi(Wl).comment.nodeId(e)===b)),e?l.api.toDOMNode(e[0]):null},[S,g,b,l.api,i,o,n]);return h+d.length!==0||o?/* @__PURE__ */si.jsx("div",{className:"flex w-full justify-between",children:/* @__PURE__ */si.jsxs(_l,{open:S,onOpenChange:e=>{!e&&v&&o&&l.tf.unsetNodes(Hs(),{at:[],mode:"lowest",match:e=>e[Hs()]}),z(e)},children:[
|
|
244
|
+
/* @__PURE__ */si.jsx(pc,{discussionId:s.suggestionId})]}),!r&&/* @__PURE__ */si.jsx("div",{className:"h-px w-full bg-muted"})]},`${s.suggestionId}-${t}`);var h}const vc=({blockPath:t,children:s,commentNodes:n,draftCommentNode:o,suggestionNodes:i})=>{const l=I(),c=((t,s)=>{const n=T(kc,"discussions"),{api:o,editor:i,getOption:l,setOption:c}=E(rc);return t.forEach(([e])=>{const t=o.suggestion.nodeId(e),r=l("uniquePathMap");if(!t)return;const n=r.get(t);if(a.isPath(n)){const e=o.suggestion.node({id:t,at:n,isText:!0}),a=o.node(n);let i=null;a&&u.isElement(a[0])&&(i=o.suggestion.nodeId(a[0])??null),e||i===t||c("uniquePathMap",new Map(r).set(t,s))}else c("uniquePathMap",new Map(r).set(t,s))}),e.useMemo(()=>{const e=l("uniquePathMap");if(0===t.length)return[];const c=new Set(t.flatMap(([e])=>{if(m.isText(e)){const t=o.suggestion.dataList(e);return t.some(e=>"update"===e.type)?t.filter(e=>"update"===e.type).map(e=>e.id):o.suggestion.nodeId(e)??[]}return u.isElement(e)?o.suggestion.nodeId(e)??[]:[]}).filter(Boolean)),d=[];return c.forEach(t=>{if(!t)return;const l=e.get(t);if(!l||!a.isPath(l))return;if(!a.equals(l,s))return;const c=[...i.api.nodes({at:[],mode:"all",match:e=>e[r.suggestion]&&e[tn(t)]||o.suggestion.nodeId(e)===t})];c.sort(([,e],[,t])=>a.isChild(e,t)?-1:1);let u="",h="",x={},p={};if(c.forEach(([e])=>{if(m.isText(e))o.suggestion.dataList(e).forEach(r=>{if(r.id===t)switch(r.type){case"insert":u+=e.text;break;case"remove":h+=e.text;break;case"update":x={...x,...r.properties},p={...p,...r.newProperties},u+=e.text}});else{const r=o.suggestion.isBlockSuggestion(e)?e.suggestion:void 0;r?.id===rn(t)&&("insert"===r.type?u+=r.isLineBreak?gc:gc+(jc[e.type]??(()=>"Block"))(e):"remove"===r.type&&(h+=r.isLineBreak?gc:gc+(jc[e.type]??(()=>"Block"))(e)))}}),0===c.length)return;const f=o.suggestion.suggestionData(c[0][0]);if(!f)return;const g=n.find(e=>e.id===t)?.comments||[],j=new Date(f.createdAt),b=tn(t);"update"===f.type?d.push({comments:g,createdAt:j,keyId:b,newProperties:p,newText:u,properties:x,suggestionId:rn(t),type:"update",userId:f.userId}):u.length>0&&h.length>0?d.push({comments:g,createdAt:j,keyId:b,newText:u,suggestionId:rn(t),text:h,type:"replace",userId:f.userId}):u.length>0?d.push({comments:g,createdAt:j,keyId:b,newText:u,suggestionId:rn(t),type:"insert",userId:f.userId}):h.length>0&&d.push({comments:g,createdAt:j,keyId:b,suggestionId:rn(t),text:h,type:"remove",userId:f.userId})}),d},[o.suggestion,s,n,i.api,l,t])})(i,t),d=wc(n,t),h=c.length,x=d.length,p=h+x,f=T(rc,"activeId"),g=f&&c.find(e=>e.suggestionId===f),j=T(Wl,"commentingBlock"),b=T(Wl,"activeId"),v=b===Hs(),y=b&&d.find(e=>e.id===b),w=!g&&!y,k=[...d,...c].sort((e,t)=>e.createdAt.getTime()-t.createdAt.getTime()),C=d.some(e=>e.id===b)||c.some(e=>e.suggestionId===f),[N,z]=e.useState(C),_=!!j&&a.equals(t,j),S=N||C||v&&!!o&&_,B=e.useMemo(()=>{let e;return g&&(e=i.find(([e])=>m.isText(e)&&l.getApi(an).suggestion.nodeId(e)===g.suggestionId)),b&&(e=b===Hs()?o:n.find(([e])=>l.getApi(Wl).comment.nodeId(e)===b)),e?l.api.toDOMNode(e[0]):null},[S,g,b,l.api,i,o,n]);return h+d.length!==0||o?/* @__PURE__ */si.jsx("div",{className:"flex w-full justify-between",children:/* @__PURE__ */si.jsxs(_l,{open:S,onOpenChange:e=>{!e&&v&&o&&l.tf.unsetNodes(Hs(),{at:[],mode:"lowest",match:e=>e[Hs()]}),z(e)},children:[
|
|
243
245
|
/* @__PURE__ */si.jsx("div",{className:"w-full",children:s}),B&&/* @__PURE__ */si.jsx(Bl,{asChild:!0,className:"w-full",virtualRef:{current:B}}),
|
|
244
246
|
/* @__PURE__ */si.jsx(El,{className:"max-h-[min(50dvh,calc(-24px+var(--radix-popper-available-height)))] w-[380px] min-w-[130px] max-w-[calc(100vw-24px)] overflow-y-auto p-0 data-[state=closed]:opacity-0",onCloseAutoFocus:e=>e.preventDefault(),onOpenAutoFocus:e=>e.preventDefault(),align:"center",side:"bottom",children:v?/* @__PURE__ */si.jsx(pc,{className:"p-4",focusOnMount:!0}):w?k.map((e,t)=>"suggestionId"in e?/* @__PURE__ */si.jsx(bc,{idx:t,isLast:t===k.length-1,suggestion:e},e.suggestionId):/* @__PURE__ */si.jsx(yc,{discussion:e,isLast:t===k.length-1},e.id)):/* @__PURE__ */si.jsxs(si.Fragment,{children:[g&&/* @__PURE__ */si.jsx(bc,{idx:0,isLast:!0,suggestion:g},g.suggestionId),y&&/* @__PURE__ */si.jsx(yc,{discussion:y,isLast:!0})]})}),p>0&&/* @__PURE__ */si.jsx("div",{className:"relative left-0 size-0 select-none",children:/* @__PURE__ */si.jsx(Sl,{asChild:!0,children:/* @__PURE__ */si.jsxs(_i,{variant:"ghost",className:"!px-1.5 mt-1 ml-1 flex h-6 gap-1 py-0 text-muted-foreground/80 hover:text-muted-foreground/80 data-[active=true]:bg-muted","data-active":S,contentEditable:!1,children:[h>0&&0===x&&/* @__PURE__ */si.jsx(Mt,{className:"size-4 shrink-0"}),0===h&&x>0&&/* @__PURE__ */si.jsx(Rt,{className:"size-4 shrink-0"}),h>0&&x>0&&/* @__PURE__ */si.jsx(Lt,{className:"size-4 shrink-0"}),
|
|
245
247
|
/* @__PURE__ */si.jsx("span",{className:"font-semibold text-xs",children:p})]})})})]})}):/* @__PURE__ */si.jsx("div",{className:"w-full",children:s})};function yc({discussion:t,isLast:r}){const[s,n]=e.useState(null);/* @__PURE__ */
|
|
@@ -314,8 +316,8 @@ return si.jsxs(Qi,{pressed:r,children:[
|
|
|
314
316
|
/* @__PURE__ */si.jsx(Mi,{onSelect:()=>Te(t,{listStyleType:Oe.UpperAlpha}),children:"Upper Alpha (A, B, C)"}),
|
|
315
317
|
/* @__PURE__ */si.jsx(Mi,{onSelect:()=>Te(t,{listStyleType:"turkish-upper-alpha"}),children:"Upper Alpha - Turkish (A, B, C, Ç)"}),
|
|
316
318
|
/* @__PURE__ */si.jsx(Mi,{onSelect:()=>Te(t,{listStyleType:Oe.LowerRoman}),children:"Lower Roman (i, ii, iii)"}),
|
|
317
|
-
/* @__PURE__ */si.jsx(Mi,{onSelect:()=>Te(t,{listStyleType:Oe.UpperRoman}),children:"Upper Roman (I, II, III)"})]})})]})]})}function Zd({clear:e,nodeType:t,...r}){const
|
|
318
|
-
return si.jsx(Ji,{...r,...
|
|
319
|
+
/* @__PURE__ */si.jsx(Mi,{onSelect:()=>Te(t,{listStyleType:Oe.UpperRoman}),children:"Upper Roman (I, II, III)"})]})})]})]})}function Zd({clear:e,nodeType:t,...r}){const{api:s}=E(rc),n=T(rc,"isSuggesting"),o=G({clear:e,nodeType:t}),{props:a}=Y(o),i=e=>e?t=>{n?(t.preventDefault?.(),s.suggestion.withoutSuggestions(()=>e(t))):e(t)}:void 0;/* @__PURE__ */
|
|
320
|
+
return si.jsx(Ji,{...r,...a,onClick:i(a.onClick),onMouseDown:i(a.onMouseDown)})}function Gd({...e}){/* @__PURE__ */
|
|
319
321
|
return si.jsx(Yr.Root,{"data-slot":"alert-dialog",...e})}function Yd({...e}){/* @__PURE__ */
|
|
320
322
|
return si.jsx(Yr.Portal,{"data-slot":"alert-dialog-portal",...e})}function Jd({className:e,...t}){/* @__PURE__ */
|
|
321
323
|
return si.jsx(Yr.Overlay,{"data-slot":"alert-dialog-overlay",className:ui("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function Xd({className:e,size:t="default",...r}){/* @__PURE__ */
|
|
@@ -716,21 +718,21 @@ return si.jsxs("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xml
|
|
|
716
718
|
/* @__PURE__ */si.jsx("rect",{fill:"currentColor",height:"1",rx:".5",transform:"rotate(-180 14 14)",width:"1",x:"14",y:"14"}),
|
|
717
719
|
/* @__PURE__ */si.jsx("rect",{fill:"currentColor",height:"1",rx:".5",transform:"rotate(-180 14 6)",width:"1",x:"14",y:"6"}),
|
|
718
720
|
/* @__PURE__ */si.jsx("rect",{fill:"currentColor",height:"1",rx:".5",transform:"rotate(-180 14 4)",width:"1",x:"14",y:"4"})]})}const Dm=A(uo,function({children:e,...t}){const r=C(),s=T(nt,"isSelectionAreaVisible"),n=!r&&!s,{isSelectingCell:o,marginLeft:a,props:i}=mo(),l=at(t.element.id),c=/* @__PURE__ */si.jsx(k,{...t,className:ui("overflow-x-auto py-5",n&&"-ml-2 *:data-[slot=block-selection]:left-2"),style:{paddingLeft:a},children:/* @__PURE__ */si.jsxs("div",{className:"group/table relative w-fit",children:[
|
|
719
|
-
/* @__PURE__ */si.jsx("table",{className:ui("mr-0 ml-px table h-px table-fixed border-collapse",o&&"selection:bg-transparent"),...i,children:/* @__PURE__ */si.jsx("tbody",{className:"min-w-full",children:e})}),l&&/* @__PURE__ */si.jsx("div",{className:wi(),contentEditable:!1})]})});return r?c:/* @__PURE__ */si.jsx(Im,{children:c})});function Im({children:e,...t}){const{tf:
|
|
720
|
-
return si.jsxs(_l,{open:
|
|
721
|
+
/* @__PURE__ */si.jsx("table",{className:ui("mr-0 ml-px table h-px table-fixed border-collapse",o&&"selection:bg-transparent"),...i,children:/* @__PURE__ */si.jsx("tbody",{className:"min-w-full",children:e})}),l&&/* @__PURE__ */si.jsx("div",{className:wi(),contentEditable:!1})]})});return r?c:/* @__PURE__ */si.jsx(Im,{children:c})});function Im({children:e,...t}){const r=I(),{api:s}=E(rc),{tf:n}=E(lo),o=N(),a=O(),{props:i}=F({element:a}),l=M(e=>o&&e.api.isCollapsed(),[o]),c=R(),{canMerge:d,canSplit:u}=co();/* @__PURE__ */
|
|
722
|
+
return si.jsxs(_l,{open:c&&(d||u||l),modal:!1,children:[
|
|
721
723
|
/* @__PURE__ */si.jsx(ss,{asChild:!0,children:e}),
|
|
722
724
|
/* @__PURE__ */si.jsx(El,{asChild:!0,onOpenAutoFocus:e=>e.preventDefault(),contentEditable:!1,...t,children:/* @__PURE__ */si.jsxs(Ki,{className:"scrollbar-hide flex w-auto max-w-[80vw] flex-row overflow-x-auto rounded-md border bg-popover p-1 shadow-md print:hidden",contentEditable:!1,children:[
|
|
723
725
|
/* @__PURE__ */si.jsxs(sl,{children:[
|
|
724
|
-
/* @__PURE__ */si.jsx(Am,{tooltip:"Background color",children:/* @__PURE__ */si.jsx(Ir,{})}),
|
|
726
|
+
/* @__PURE__ */si.jsx(Am,{tooltip:"Background color",children:/* @__PURE__ */si.jsx(Ir,{})}),d&&/* @__PURE__ */si.jsx(Ji,{onClick:()=>s.suggestion.withoutSuggestions(()=>n.table.merge()),onMouseDown:e=>e.preventDefault(),tooltip:"Merge cells",children:/* @__PURE__ */si.jsx(Wr,{})}),u&&/* @__PURE__ */si.jsx(Ji,{onClick:()=>s.suggestion.withoutSuggestions(()=>n.table.split()),onMouseDown:e=>e.preventDefault(),tooltip:"Split cell",children:/* @__PURE__ */si.jsx(Kr,{})}),
|
|
725
727
|
/* @__PURE__ */si.jsxs(Di,{modal:!1,children:[
|
|
726
728
|
/* @__PURE__ */si.jsx(Oi,{asChild:!0,children:/* @__PURE__ */si.jsx(Ji,{tooltip:"Cell borders",children:/* @__PURE__ */si.jsx(Zr,{})})}),
|
|
727
|
-
/* @__PURE__ */si.jsx(Ii,{children:/* @__PURE__ */si.jsx(Om,{})})]}),
|
|
728
|
-
/* @__PURE__ */si.jsx(Ji,{onClick:()=>
|
|
729
|
-
/* @__PURE__ */si.jsx(Ji,{onClick:()=>
|
|
730
|
-
/* @__PURE__ */si.jsx(Ji,{onClick:()=>
|
|
731
|
-
/* @__PURE__ */si.jsx(Ji,{onClick:()=>
|
|
732
|
-
/* @__PURE__ */si.jsx(Ji,{onClick:()=>
|
|
733
|
-
/* @__PURE__ */si.jsx(Ji,{onClick:()=>
|
|
729
|
+
/* @__PURE__ */si.jsx(Ii,{children:/* @__PURE__ */si.jsx(Om,{})})]}),l&&/* @__PURE__ */si.jsx(sl,{children:/* @__PURE__ */si.jsx(Ji,{tooltip:"Delete table",...i,onClick:()=>{const e=r.api.findPath(a);(e?[...r.getApi(an).suggestion.nodes({at:e})].filter(([e])=>!e[on()]):[]).length>0?s.suggestion.withoutSuggestions(()=>i.onClick?.()):(n.select(a),n.remove.table(),r.tf.focus())},children:/* @__PURE__ */si.jsx(Et,{})})})]}),l&&/* @__PURE__ */si.jsxs(sl,{children:[
|
|
730
|
+
/* @__PURE__ */si.jsx(Ji,{onClick:()=>s.suggestion.withoutSuggestions(()=>n.insert.tableRow({before:!0})),onMouseDown:e=>e.preventDefault(),tooltip:"Insert row before",children:/* @__PURE__ */si.jsx(cr,{})}),
|
|
731
|
+
/* @__PURE__ */si.jsx(Ji,{onClick:()=>s.suggestion.withoutSuggestions(()=>n.insert.tableRow()),onMouseDown:e=>e.preventDefault(),tooltip:"Insert row after",children:/* @__PURE__ */si.jsx(dr,{})}),
|
|
732
|
+
/* @__PURE__ */si.jsx(Ji,{onClick:()=>s.suggestion.withoutSuggestions(()=>n.remove.tableRow()),onMouseDown:e=>e.preventDefault(),tooltip:"Delete row",children:/* @__PURE__ */si.jsx(pt,{})})]}),l&&/* @__PURE__ */si.jsxs(sl,{children:[
|
|
733
|
+
/* @__PURE__ */si.jsx(Ji,{onClick:()=>s.suggestion.withoutSuggestions(()=>n.insert.tableColumn({before:!0})),onMouseDown:e=>e.preventDefault(),tooltip:"Insert column before",children:/* @__PURE__ */si.jsx(ur,{})}),
|
|
734
|
+
/* @__PURE__ */si.jsx(Ji,{onClick:()=>s.suggestion.withoutSuggestions(()=>n.insert.tableColumn()),onMouseDown:e=>e.preventDefault(),tooltip:"Insert column after",children:/* @__PURE__ */si.jsx(mr,{})}),
|
|
735
|
+
/* @__PURE__ */si.jsx(Ji,{onClick:()=>s.suggestion.withoutSuggestions(()=>n.remove.tableColumn()),onMouseDown:e=>e.preventDefault(),tooltip:"Delete column",children:/* @__PURE__ */si.jsx(pt,{})})]})]})})]})}function Om(e){const t=I(),{getOnSelectTableBorder:r,hasBottomBorder:s,hasLeftBorder:n,hasNoBorders:o,hasOuterBorders:a,hasRightBorder:i,hasTopBorder:l}=ho();/* @__PURE__ */
|
|
734
736
|
return si.jsxs(Ai,{className:"min-w-[220px]",onCloseAutoFocus:e=>{e.preventDefault(),t.tf.focus()},align:"start",side:"right",sideOffset:0,...e,children:[
|
|
735
737
|
/* @__PURE__ */si.jsxs(Fi,{children:[
|
|
736
738
|
/* @__PURE__ */si.jsxs(Ri,{checked:l,onCheckedChange:r("top"),children:[
|