@lax-wp/editor 0.2.1 → 0.2.2
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/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -74960,7 +74960,7 @@ const { Dragger: X2 } = VS, Z2 = 200 * 1024 * 1024, J2 = ({
|
|
|
74960
74960
|
/* @__PURE__ */ m.jsx("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200", children: /* @__PURE__ */ m.jsx("h2", { className: "text-lg font-semibold text-gray-900", children: "AI Assistant" }) }),
|
|
74961
74961
|
/* @__PURE__ */ m.jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ m.jsx("p", { className: "text-sm text-gray-600", children: "AI Assistant features coming soon..." }) })
|
|
74962
74962
|
] }),
|
|
74963
|
-
notVisible:
|
|
74963
|
+
notVisible: !0
|
|
74964
74964
|
},
|
|
74965
74965
|
{
|
|
74966
74966
|
id: "page-settings",
|
package/dist/index.umd.js
CHANGED
|
@@ -172,4 +172,4 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
|
|
|
172
172
|
</div>
|
|
173
173
|
</body>
|
|
174
174
|
</html>
|
|
175
|
-
`),S.close();const y=document.title;h.contentWindow&&(h.contentWindow.document.title=s),document.title=s,setTimeout(()=>{h.contentWindow&&(h.contentWindow.document.title=s),document.title=s},100),setTimeout(()=>{try{if(h.contentWindow)h.contentWindow.matchMedia&&h.contentWindow.matchMedia("print").addEventListener("change",function(b){b.matches||(document.title=y,document.body.removeChild(h))}),h.contentWindow.document.title=s||"Untitled document",h.contentWindow.focus(),h.contentWindow.print(),setTimeout(()=>{document.body.contains(h)&&document.body.removeChild(h),document.title=y},1e3);else throw new Error("Cannot access iframe content window")}catch(C){document.body.removeChild(h),document.title=y,he.message.error("Failed to export: "+String(C))}},1e3)}catch(s){he.message.error("Failed to export: "+String(s))}},[t]);return{downloadTextFile:n,downloadJsonFile:r,downloadMarkdownFile:i,downloadHtmlFile:a,downloadPdfFile:o}},kk=[{value:"A4",label:"A4 (210 × 297 mm)",description:"210 × 297 mm"},{value:"A3",label:"A3 (297 × 420 mm)",description:"297 × 420 mm"},{value:"Letter",label:"Letter (8.5 × 11 in)",description:"8.5 × 11 in"},{value:"Legal",label:"Legal (8.5 × 14 in)",description:"8.5 × 14 in"},{value:"Tabloid",label:"Tabloid (11 × 17 in)",description:"11 × 17 in"}],Lk=({onApply:e,onClose:t})=>{const{pageConfig:n,setPageConfig:r}=Tl(),{selectedBGColor:i,margins:a,inputValues:o,handleMarginInputChange:s,handleMarginInputBlur:l,handleMarginKeyDown:c,applyPresetMargins:u,handleSetPageBackgroundColor:d,applyMargins:p}=_u(),_=A.useRef(null),[f,g]=A.useState(!1);A.useEffect(()=>{_.current||(_.current={pageConfig:{...n},bgColor:i,margins:{...a}})},[]);const E=()=>{p(),_.current={pageConfig:{...n},bgColor:i,margins:{...a}},e?.(),t?.()},h=()=>{_.current&&(r(_.current.pageConfig),d(_.current.bgColor)),t?.()};return m.jsxs("div",{className:"h-full flex flex-col bg-white",children:[m.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200",children:[m.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Export"}),t&&m.jsx("button",{onClick:h,className:"text-gray-400 hover:text-gray-600 transition-colors",children:m.jsx(le.Close,{sx:{fontSize:20}})})]}),m.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[m.jsxs("div",{className:"mb-4",children:[m.jsx("h4",{className:"text-xs font-medium mb-2",children:"Orientation"}),m.jsx($E,{options:[{value:"portrait",label:"PORTRAIT",icon:m.jsx(le.CropPortrait,{sx:{fontSize:18},className:"mb-0.5"})},{value:"landscape",label:"LANDSCAPE",icon:m.jsx(le.CropLandscape,{sx:{fontSize:18},className:"mb-px"})}],value:n.orientation,onChange:S=>r({...n,orientation:S}),className:"w-full"})]}),m.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[m.jsxs("div",{className:"flex-1",children:[m.jsx("h4",{className:"text-xs font-medium mb-1",children:"Page Size"}),m.jsx(he.Select,{value:n.size,onChange:S=>r({...n,size:S}),options:kk,placeholder:"Select Page Size",className:"w-full",size:"middle",style:{borderColor:"transparent",borderWidth:1,borderStyle:"solid"},suffixIcon:f?m.jsx(le.ExpandLessOutlined,{sx:{fontSize:20}}):m.jsx(le.ExpandMoreOutlined,{sx:{fontSize:20}}),onOpenChange:S=>g(S)})]}),m.jsxs("div",{className:"w-20",children:[m.jsx("h4",{className:"text-xs font-medium mb-1",children:"Page Color"}),m.jsx(RD,{selectedBGColor:i,setSelectedBGColor:d})]})]}),m.jsxs("div",{className:"mb-4",children:[m.jsx("h4",{className:"text-xs font-medium mb-1",children:"Preset Margins"}),m.jsx("div",{className:"grid grid-cols-2 gap-1",children:Object.entries(vf).map(([S])=>m.jsx("button",{className:"h-8 text-xs py-1.5 px-2 bg-neutral-50 border border-neutral-200 hover:bg-neutral-200 rounded",onClick:()=>u(S),children:S},S))})]}),m.jsx("div",{children:m.jsx("h4",{className:"text-xs font-medium mb-1",children:"Margins"})}),m.jsx("div",{className:"mb-4 w-full bg-neutral-100 p-2 rounded border border-neutral-300",children:m.jsxs("div",{className:"w-full flex gap-2 items-center justify-center",children:[m.jsx("div",{className:"flex items-center gap-1 justify-end",children:m.jsx("div",{className:"flex items-center",children:m.jsx("input",{type:"text",value:o.left,onChange:S=>s("left",S.target.value),onKeyDown:S=>c(S,"left"),onBlur:()=>l("left"),className:"w-16 text-xs p-1 border border-gray-300 rounded",placeholder:"Left"})})}),m.jsxs("div",{className:"flex flex-col items-center gap-2",children:[m.jsx("div",{className:"flex flex-col items-center gap-0.5",children:m.jsx("div",{className:"flex items-center",children:m.jsx("input",{type:"text",value:o.top,onChange:S=>s("top",S.target.value),onKeyDown:S=>c(S,"top"),onBlur:()=>l("top"),className:"w-16 text-xs p-1 border border-gray-300 rounded",placeholder:"Top"})})}),m.jsx("div",{className:"flex items-center justify-center",children:m.jsx("div",{className:`relative ${n.orientation==="portrait"?"w-24 h-32":"w-32 h-24"} border border-gray-300 bg-white`,children:m.jsx("div",{className:"absolute bg-primary-100 border border-primary-300",style:{top:`${Math.min(a.top/10*100,80)}%`,left:`${Math.min(a.left/10*100,80)}%`,right:`${Math.min(a.right/10*100,80)}%`,bottom:`${Math.min(a.bottom/10*100,80)}%`}})})}),m.jsx("div",{className:"flex flex-col-reverse items-center gap-0.5",children:m.jsx("div",{className:"flex items-center",children:m.jsx("input",{type:"text",value:o.bottom,onChange:S=>s("bottom",S.target.value),onKeyDown:S=>c(S,"bottom"),onBlur:()=>l("bottom"),className:"w-16 text-xs p-1 border border-gray-300 rounded",placeholder:"Bottom"})})})]}),m.jsx("div",{className:"flex flex-row-reverse items-center gap-1 justify-start",children:m.jsx("div",{className:"flex items-center",children:m.jsx("input",{type:"text",value:o.right,onChange:S=>s("right",S.target.value),onKeyDown:S=>c(S,"right"),onBlur:()=>l("right"),className:"w-16 text-xs p-1 border border-gray-300 rounded",placeholder:"Right"})})})]})})]}),m.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 flex items-center justify-between bg-white",children:[m.jsx("button",{onClick:h,className:"px-3 py-1.5 border border-neutral-300 text-sm font-medium text-neutral-900 hover:bg-neutral-100 rounded-lg transition-colors",children:"Cancel"}),m.jsx("button",{onClick:E,className:"px-3 py-1.5 text-sm font-medium text-white bg-[#016DCF] hover:bg-blue-700 rounded-lg transition-colors",children:"Apply"})]})]})},Pk=({position:e="right",currentMode:t})=>{const[n,r]=A.useState(!1),{downloadTextFile:i,downloadJsonFile:a,downloadMarkdownFile:o,downloadHtmlFile:s,downloadPdfFile:l}=Mk(),c=_=>{switch(_.fileType){case"text":i();break;case"json":a();break;case"markdown":o();break;case"html":s();break;case"pdf":l();break;default:i();break}},u=_=>{console.log("Search:",_)},d=(_,f)=>{console.log("Replace:",_,"with",f)},p=[{id:"add",icon:m.jsx(oe,{name:"insert-icon",size:24}),label:"Add Element",content:m.jsx(yk,{onClose:()=>r(!1)}),notVisible:t==="viewing"},{id:"search",icon:m.jsx(oe,{name:"document-search",size:24}),label:"Find and Replace",content:m.jsx(ok,{currentMode:t,onSearch:u,onReplace:d,onClose:()=>r(!1)})},{id:"ai",icon:m.jsx(oe,{name:"ai-icon",size:24}),label:"AI Assistant",content:m.jsxs("div",{className:"h-full flex flex-col bg-white",children:[m.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200",children:m.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"AI Assistant"})}),m.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:m.jsx("p",{className:"text-sm text-gray-600",children:"AI Assistant features coming soon..."})})]}),notVisible:t==="viewing"},{id:"page-settings",icon:m.jsx(oe,{name:"page-settings",size:20}),label:"Page Settings",content:m.jsx(Lk,{onApply:()=>console.log("Apply"),onClose:()=>r(!1)}),notVisible:t==="viewing"},{id:"export",icon:m.jsx(oe,{name:"download-rounded",size:18}),label:"Export Document",content:m.jsx(ik,{onExport:c,onClose:()=>r(!1)})}];return m.jsx(rk,{tools:p,position:e,isExpanded:n,expandedWidth:320,toggleToolbar:r})},Uk=({editorPageRef:e,isPresentationMode:t})=>{const{editor:n,editorConfig:r}=_t(),{pageClass:i}=_u(),{currentMode:a}=Tl(),o=r.editable&&!r.asViewer&&!t&&a!==di.VIEWING.value;return m.jsxs("div",{className:`${r.enablePagination?i:""} editor-content`,ref:e,children:[m.jsx(Kt.EditorContent,{editor:n}),o&&m.jsx(AM,{editor:n})]})},Fk=()=>{const{currentMode:e}=Tl();return e===di.VIEWING.value?null:m.jsx(CD,{})},Bk=()=>{const e=A.useRef(null),t=A.useRef(null),{editor:n,editorConfig:r}=_t(),{pageConfig:i,setPageConfig:a}=_u(),{isPresentationMode:o,isLaserActive:s,onPresentationModeToggle:l,handleLaserToggle:c}=aD(n,t),{changes:u}=YE(),[d,p]=A.useState(!1),_=u.length>0&&!o;return A.useEffect(()=>{if(!n||!e.current)return;const f=g=>{if(e.current?.contains(g.target)){n.commands.focus();return}};return document.addEventListener("click",f),()=>{document.removeEventListener("click",f)}},[n]),A.useEffect(()=>(window.addEventListener("resize",()=>{window.innerWidth<1240?p(!1):p(!0)}),()=>{window.removeEventListener("resize",()=>{p(!1)})}),[d]),m.jsx(vD,{editorConfig:r,onPresentationModeToggle:l,pageConfig:i,setPageConfig:a,children:m.jsxs("div",{ref:t,className:`h-full relative flex flex-col bg-neutral-200 editor-container ${o?"editor-presentation-mode":""} ${s?"laser-active":""}`,children:[m.jsx(Fk,{}),m.jsxs("div",{className:"flex flex-1 min-h-0",children:[m.jsx(QM,{children:m.jsx("div",{className:"flex-1 overflow-auto",children:m.jsx("div",{className:"min-h-full w-fit min-w-full flex justify-center items-start p-4",style:{paddingRight:_&&d?"420px":"48px"},children:m.jsx(Uk,{editorPageRef:e,isPresentationMode:o})})})}),!o&&!r?.asViewer&&m.jsx(Pk,{position:"left",currentMode:r?.mode||"viewing"}),!o&&m.jsx(nk,{showFullRedlineItem:d})]}),!o&&m.jsx(IM,{onPresentationModeToggle:l}),o&&m.jsx(wM,{onPresentationModeToggle:l,onLaserToggle:c})]})})},Gk=({config:e={}})=>{const t={...Yh,...e},n=A.useRef(null),r=Kt.useEditor({extensions:iD(t),content:t.content,autofocus:!1,editable:!t.asViewer&&t.editable,onUpdate:({editor:i})=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{t.onContentChange&&t.onContentChange(i)},t.debounceTimeForContentChange)}});return A.useEffect(()=>()=>{r?.destroy()},[r]),r?m.jsx(jx,{editor:r,editorConfig:t,children:m.jsx(he.ConfigProvider,{prefixCls:"editor",children:m.jsx(Bk,{})})}):null};Oe.Editor=Gk,Object.defineProperty(Oe,Symbol.toStringTag,{value:"Module"})}));
|
|
175
|
+
`),S.close();const y=document.title;h.contentWindow&&(h.contentWindow.document.title=s),document.title=s,setTimeout(()=>{h.contentWindow&&(h.contentWindow.document.title=s),document.title=s},100),setTimeout(()=>{try{if(h.contentWindow)h.contentWindow.matchMedia&&h.contentWindow.matchMedia("print").addEventListener("change",function(b){b.matches||(document.title=y,document.body.removeChild(h))}),h.contentWindow.document.title=s||"Untitled document",h.contentWindow.focus(),h.contentWindow.print(),setTimeout(()=>{document.body.contains(h)&&document.body.removeChild(h),document.title=y},1e3);else throw new Error("Cannot access iframe content window")}catch(C){document.body.removeChild(h),document.title=y,he.message.error("Failed to export: "+String(C))}},1e3)}catch(s){he.message.error("Failed to export: "+String(s))}},[t]);return{downloadTextFile:n,downloadJsonFile:r,downloadMarkdownFile:i,downloadHtmlFile:a,downloadPdfFile:o}},kk=[{value:"A4",label:"A4 (210 × 297 mm)",description:"210 × 297 mm"},{value:"A3",label:"A3 (297 × 420 mm)",description:"297 × 420 mm"},{value:"Letter",label:"Letter (8.5 × 11 in)",description:"8.5 × 11 in"},{value:"Legal",label:"Legal (8.5 × 14 in)",description:"8.5 × 14 in"},{value:"Tabloid",label:"Tabloid (11 × 17 in)",description:"11 × 17 in"}],Lk=({onApply:e,onClose:t})=>{const{pageConfig:n,setPageConfig:r}=Tl(),{selectedBGColor:i,margins:a,inputValues:o,handleMarginInputChange:s,handleMarginInputBlur:l,handleMarginKeyDown:c,applyPresetMargins:u,handleSetPageBackgroundColor:d,applyMargins:p}=_u(),_=A.useRef(null),[f,g]=A.useState(!1);A.useEffect(()=>{_.current||(_.current={pageConfig:{...n},bgColor:i,margins:{...a}})},[]);const E=()=>{p(),_.current={pageConfig:{...n},bgColor:i,margins:{...a}},e?.(),t?.()},h=()=>{_.current&&(r(_.current.pageConfig),d(_.current.bgColor)),t?.()};return m.jsxs("div",{className:"h-full flex flex-col bg-white",children:[m.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200",children:[m.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Export"}),t&&m.jsx("button",{onClick:h,className:"text-gray-400 hover:text-gray-600 transition-colors",children:m.jsx(le.Close,{sx:{fontSize:20}})})]}),m.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[m.jsxs("div",{className:"mb-4",children:[m.jsx("h4",{className:"text-xs font-medium mb-2",children:"Orientation"}),m.jsx($E,{options:[{value:"portrait",label:"PORTRAIT",icon:m.jsx(le.CropPortrait,{sx:{fontSize:18},className:"mb-0.5"})},{value:"landscape",label:"LANDSCAPE",icon:m.jsx(le.CropLandscape,{sx:{fontSize:18},className:"mb-px"})}],value:n.orientation,onChange:S=>r({...n,orientation:S}),className:"w-full"})]}),m.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[m.jsxs("div",{className:"flex-1",children:[m.jsx("h4",{className:"text-xs font-medium mb-1",children:"Page Size"}),m.jsx(he.Select,{value:n.size,onChange:S=>r({...n,size:S}),options:kk,placeholder:"Select Page Size",className:"w-full",size:"middle",style:{borderColor:"transparent",borderWidth:1,borderStyle:"solid"},suffixIcon:f?m.jsx(le.ExpandLessOutlined,{sx:{fontSize:20}}):m.jsx(le.ExpandMoreOutlined,{sx:{fontSize:20}}),onOpenChange:S=>g(S)})]}),m.jsxs("div",{className:"w-20",children:[m.jsx("h4",{className:"text-xs font-medium mb-1",children:"Page Color"}),m.jsx(RD,{selectedBGColor:i,setSelectedBGColor:d})]})]}),m.jsxs("div",{className:"mb-4",children:[m.jsx("h4",{className:"text-xs font-medium mb-1",children:"Preset Margins"}),m.jsx("div",{className:"grid grid-cols-2 gap-1",children:Object.entries(vf).map(([S])=>m.jsx("button",{className:"h-8 text-xs py-1.5 px-2 bg-neutral-50 border border-neutral-200 hover:bg-neutral-200 rounded",onClick:()=>u(S),children:S},S))})]}),m.jsx("div",{children:m.jsx("h4",{className:"text-xs font-medium mb-1",children:"Margins"})}),m.jsx("div",{className:"mb-4 w-full bg-neutral-100 p-2 rounded border border-neutral-300",children:m.jsxs("div",{className:"w-full flex gap-2 items-center justify-center",children:[m.jsx("div",{className:"flex items-center gap-1 justify-end",children:m.jsx("div",{className:"flex items-center",children:m.jsx("input",{type:"text",value:o.left,onChange:S=>s("left",S.target.value),onKeyDown:S=>c(S,"left"),onBlur:()=>l("left"),className:"w-16 text-xs p-1 border border-gray-300 rounded",placeholder:"Left"})})}),m.jsxs("div",{className:"flex flex-col items-center gap-2",children:[m.jsx("div",{className:"flex flex-col items-center gap-0.5",children:m.jsx("div",{className:"flex items-center",children:m.jsx("input",{type:"text",value:o.top,onChange:S=>s("top",S.target.value),onKeyDown:S=>c(S,"top"),onBlur:()=>l("top"),className:"w-16 text-xs p-1 border border-gray-300 rounded",placeholder:"Top"})})}),m.jsx("div",{className:"flex items-center justify-center",children:m.jsx("div",{className:`relative ${n.orientation==="portrait"?"w-24 h-32":"w-32 h-24"} border border-gray-300 bg-white`,children:m.jsx("div",{className:"absolute bg-primary-100 border border-primary-300",style:{top:`${Math.min(a.top/10*100,80)}%`,left:`${Math.min(a.left/10*100,80)}%`,right:`${Math.min(a.right/10*100,80)}%`,bottom:`${Math.min(a.bottom/10*100,80)}%`}})})}),m.jsx("div",{className:"flex flex-col-reverse items-center gap-0.5",children:m.jsx("div",{className:"flex items-center",children:m.jsx("input",{type:"text",value:o.bottom,onChange:S=>s("bottom",S.target.value),onKeyDown:S=>c(S,"bottom"),onBlur:()=>l("bottom"),className:"w-16 text-xs p-1 border border-gray-300 rounded",placeholder:"Bottom"})})})]}),m.jsx("div",{className:"flex flex-row-reverse items-center gap-1 justify-start",children:m.jsx("div",{className:"flex items-center",children:m.jsx("input",{type:"text",value:o.right,onChange:S=>s("right",S.target.value),onKeyDown:S=>c(S,"right"),onBlur:()=>l("right"),className:"w-16 text-xs p-1 border border-gray-300 rounded",placeholder:"Right"})})})]})})]}),m.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 flex items-center justify-between bg-white",children:[m.jsx("button",{onClick:h,className:"px-3 py-1.5 border border-neutral-300 text-sm font-medium text-neutral-900 hover:bg-neutral-100 rounded-lg transition-colors",children:"Cancel"}),m.jsx("button",{onClick:E,className:"px-3 py-1.5 text-sm font-medium text-white bg-[#016DCF] hover:bg-blue-700 rounded-lg transition-colors",children:"Apply"})]})]})},Pk=({position:e="right",currentMode:t})=>{const[n,r]=A.useState(!1),{downloadTextFile:i,downloadJsonFile:a,downloadMarkdownFile:o,downloadHtmlFile:s,downloadPdfFile:l}=Mk(),c=_=>{switch(_.fileType){case"text":i();break;case"json":a();break;case"markdown":o();break;case"html":s();break;case"pdf":l();break;default:i();break}},u=_=>{console.log("Search:",_)},d=(_,f)=>{console.log("Replace:",_,"with",f)},p=[{id:"add",icon:m.jsx(oe,{name:"insert-icon",size:24}),label:"Add Element",content:m.jsx(yk,{onClose:()=>r(!1)}),notVisible:t==="viewing"},{id:"search",icon:m.jsx(oe,{name:"document-search",size:24}),label:"Find and Replace",content:m.jsx(ok,{currentMode:t,onSearch:u,onReplace:d,onClose:()=>r(!1)})},{id:"ai",icon:m.jsx(oe,{name:"ai-icon",size:24}),label:"AI Assistant",content:m.jsxs("div",{className:"h-full flex flex-col bg-white",children:[m.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200",children:m.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"AI Assistant"})}),m.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:m.jsx("p",{className:"text-sm text-gray-600",children:"AI Assistant features coming soon..."})})]}),notVisible:!0},{id:"page-settings",icon:m.jsx(oe,{name:"page-settings",size:20}),label:"Page Settings",content:m.jsx(Lk,{onApply:()=>console.log("Apply"),onClose:()=>r(!1)}),notVisible:t==="viewing"},{id:"export",icon:m.jsx(oe,{name:"download-rounded",size:18}),label:"Export Document",content:m.jsx(ik,{onExport:c,onClose:()=>r(!1)})}];return m.jsx(rk,{tools:p,position:e,isExpanded:n,expandedWidth:320,toggleToolbar:r})},Uk=({editorPageRef:e,isPresentationMode:t})=>{const{editor:n,editorConfig:r}=_t(),{pageClass:i}=_u(),{currentMode:a}=Tl(),o=r.editable&&!r.asViewer&&!t&&a!==di.VIEWING.value;return m.jsxs("div",{className:`${r.enablePagination?i:""} editor-content`,ref:e,children:[m.jsx(Kt.EditorContent,{editor:n}),o&&m.jsx(AM,{editor:n})]})},Fk=()=>{const{currentMode:e}=Tl();return e===di.VIEWING.value?null:m.jsx(CD,{})},Bk=()=>{const e=A.useRef(null),t=A.useRef(null),{editor:n,editorConfig:r}=_t(),{pageConfig:i,setPageConfig:a}=_u(),{isPresentationMode:o,isLaserActive:s,onPresentationModeToggle:l,handleLaserToggle:c}=aD(n,t),{changes:u}=YE(),[d,p]=A.useState(!1),_=u.length>0&&!o;return A.useEffect(()=>{if(!n||!e.current)return;const f=g=>{if(e.current?.contains(g.target)){n.commands.focus();return}};return document.addEventListener("click",f),()=>{document.removeEventListener("click",f)}},[n]),A.useEffect(()=>(window.addEventListener("resize",()=>{window.innerWidth<1240?p(!1):p(!0)}),()=>{window.removeEventListener("resize",()=>{p(!1)})}),[d]),m.jsx(vD,{editorConfig:r,onPresentationModeToggle:l,pageConfig:i,setPageConfig:a,children:m.jsxs("div",{ref:t,className:`h-full relative flex flex-col bg-neutral-200 editor-container ${o?"editor-presentation-mode":""} ${s?"laser-active":""}`,children:[m.jsx(Fk,{}),m.jsxs("div",{className:"flex flex-1 min-h-0",children:[m.jsx(QM,{children:m.jsx("div",{className:"flex-1 overflow-auto",children:m.jsx("div",{className:"min-h-full w-fit min-w-full flex justify-center items-start p-4",style:{paddingRight:_&&d?"420px":"48px"},children:m.jsx(Uk,{editorPageRef:e,isPresentationMode:o})})})}),!o&&!r?.asViewer&&m.jsx(Pk,{position:"left",currentMode:r?.mode||"viewing"}),!o&&m.jsx(nk,{showFullRedlineItem:d})]}),!o&&m.jsx(IM,{onPresentationModeToggle:l}),o&&m.jsx(wM,{onPresentationModeToggle:l,onLaserToggle:c})]})})},Gk=({config:e={}})=>{const t={...Yh,...e},n=A.useRef(null),r=Kt.useEditor({extensions:iD(t),content:t.content,autofocus:!1,editable:!t.asViewer&&t.editable,onUpdate:({editor:i})=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{t.onContentChange&&t.onContentChange(i)},t.debounceTimeForContentChange)}});return A.useEffect(()=>()=>{r?.destroy()},[r]),r?m.jsx(jx,{editor:r,editorConfig:t,children:m.jsx(he.ConfigProvider,{prefixCls:"editor",children:m.jsx(Bk,{})})}):null};Oe.Editor=Gk,Object.defineProperty(Oe,Symbol.toStringTag,{value:"Module"})}));
|