1import{ar as T,as as A,i as ve,aq as _e,R as ye,t as Ne,r as o,B as p,d as ee,j as e,k as t}from"./index-1d0942b5.js";import{D as je}from"./ProsemirrorEditor-c35340d8.js";import{E as n,S as I,f as te,a as Ee}from"./contentsEditor.utils-ce452b8c.js";import{S as Ie}from"./StyledSelect-94f2370b.js";import{c as we}from"./hooks-fb8278af.js";import{F as Ce,b as Pe}from"./forumEditor.constants-7f6768b9.js";import"./useModal-31db6d27.js";import"./hooks-1876da88.js";import"./hooks-63557b34.js";import"./ProductUnit-93bd24af.js";import"./react-content-loader.es-50f66e91.js";import"./Modal-465b1e93.js";import"./BottomSheetWrapper-9727f2c0.js";import"./ProseMirrorEditorView-11ad7c11.js";import"./react-select.esm-a9ce8259.js";import"./useScrapMutation-34270ca6.js";(function(){try{var m=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new m.Error().stack;i&&(m._sentryDebugIds=m._sentryDebugIds||{},m._sentryDebugIds[i]="1cc8b980-f18a-4d33-9ea3-56e80bf31275",m._sentryDebugIdIdentifier="sentry-dbid-1cc8b980-f18a-4d33-9ea3-56e80bf31275")}catch{}})();const Te=T(()=>A(()=>import("./ProsemirrorEditor-c35340d8.js").then(m=>m.b),["assets/ProsemirrorEditor-c35340d8.js","assets/index-1d0942b5.js","assets/index-62fa84c6.css","assets/useModal-31db6d27.js","assets/hooks-1876da88.js","assets/hooks-63557b34.js","assets/ProductUnit-93bd24af.js","assets/react-content-loader.es-50f66e91.js","assets/Modal-465b1e93.js","assets/BottomSheetWrapper-9727f2c0.js","assets/ProseMirrorEditorView-11ad7c11.js","assets/ProseMirrorEditorView-2f48e359.css","assets/ProsemirrorEditor-5c6589be.css"])),Ae=T(()=>A(()=>import("./editor_admin-5859344e.js"),["assets/editor_admin-5859344e.js","assets/index-1d0942b5.js","assets/index-62fa84c6.css","assets/draggable.min-6e1d46da.js","assets/draggable-b35624ca.css"])),Me=T(()=>A(()=>import("./WidgetCodeEditorModal-8e0820af.js"),["assets/WidgetCodeEditorModal-8e0820af.js","assets/index-1d0942b5.js","assets/index-62fa84c6.css","assets/Modal-465b1e93.js","assets/contentsEditor.utils-ce452b8c.js"])),Le=T(()=>A(()=>import("./ContentsPreviewModal-28f02449.js"),["assets/ContentsPreviewModal-28f02449.js","assets/index-1d0942b5.js","assets/index-62fa84c6.css","assets/Modal-465b1e93.js","assets/ZoomImg-52ae5783.js","assets/ProseMirrorEditorView-11ad7c11.js","assets/ProseMirrorEditorView-2f48e359.css","assets/FroalaEditorView-d73a25f1.js","assets/ProsemirrorEditor-c35340d8.js","assets/useModal-31db6d27.js","assets/hooks-1876da88.js","assets/hooks-63557b34.js","assets/ProductUnit-93bd24af.js","assets/react-content-loader.es-50f66e91.js","assets/BottomSheetWrapper-9727f2c0.js","assets/ProsemirrorEditor-5c6589be.css","assets/contentsEditor.utils-ce452b8c.js"])),x=Pe,Xe=()=>{const m=ve(),{bid:i}=_e(),g=ye(Ne);o.useEffect(()=>{const r=(g==null?void 0:g.user_id)==="admin",s=Ce.includes(g==null?void 0:g.customerId);!r&&!s&&m("/",{replace:!0})},[]);const[N,re]=o.useState(null),[se,oe]=o.useState(!0);o.useEffect(()=>{if(!i){p.error("ê²ìê¸ IDê° ììµëë¤"),m("/forum",{replace:!0});return}ee.get(`/forum/article/${i}`).then(r=>{re(r.data),oe(!1)}).catch(()=>{p.error("ê²ìê¸ì ë¶ë¬ì¬ ì ììµëë¤"),m("/forum",{replace:!0})})},[i]);const{data:M}=we(),z=o.useMemo(()=>M?M.map(r=>({value:r.cate_cd,label:(r==null?void 0:r.cate_name)||"",data:r})):[],[M]),[O,L]=o.useState(""),[c,j]=o.useState(""),[F,W]=o.useState(""),G=o.useMemo(()=>c.length?!!F.length:!1,[c,F]),ae=r=>{const s=r.currentTarget.value;W(""),s.length<5&&W("ì 목ì 5ê¸ì를 ëì´ì¼ í©ëë¤"),j(s)},[l,S]=o.useState(n.PROSE_MIRROR),[f,D]=o.useState(null),U=r=>{f&&r!==f||S(r)},h=o.useRef(null),[ne,_]=o.useState(null),[R,v]=o.useState(""),[le,$]=o.useState(!1),[ie,ce]=o.useState(""),de=r=>{var a;r.preventDefault();let s="";l==="PROSE_MIRROR"?s=((a=h.current)==null?void 0:a.getHtml())||"":s=te(R),ce(s),$(!0)},[xe,me]=o.useState(""),[fe,Y]=o.useState(!1),ue=r=>{var a;r.preventDefault();let s="";l==="PROSE_MIRROR"?s=((a=h.current)==null?void 0:a.getHtml())||"":s=te(R),me(s),Y(!0)},pe=r=>{var s;l==="PROSE_MIRROR"?(s=h.current)==null||s.setHTML(r):v(Ee(r))},k=o.useRef(!0),K=o.useRef(l);o.useEffect(()=>{if(!N)return;const r=N.forum;L(r.cate_cd),j(r.title||""),r.contentJson&&typeof r.contentJson=="object"?(D(n.PROSE_MIRROR),S(n.PROSE_MIRROR),_(r.contentJson)):/<[a-z][\s\S]*?>/i.test(r.content)?(D(n.FROALA),S(n.FROALA),v(r.content||"")):(D(n.PROSE_MIRROR),S(n.PROSE_MIRROR),_(null),setTimeout(()=>{var s;(s=h.current)==null||s.setHTML(r.content||"")},300));try{const s=localStorage.getItem(x.PROSE_MIRROR),a=localStorage.getItem(x.FROALA),d=s?JSON.parse(s):null,u=a?JSON.parse(a):null;d&&String(d.bid)===String(i)?(d.title!==void 0&&j(d.title),_(d.contentJson||null)):u&&String(u.bid)===String(i)&&(u.title!==void 0&&j(u.title),v(u.content||""))}catch(s){console.error("Failed to restore autosaved content for edit",s)}setTimeout(()=>{k.current=!1},500)},[N]);const w=o.useCallback(()=>{var a;if(k.current)return;const r=(a=h.current)==null?void 0:a.getEditorState(),s={bid:i,title:c,category:O};try{if(l==="PROSE_MIRROR"){if(!(c||(r==null?void 0:r.doc.textContent)))return;const u={...s,contentJson:r?r.doc.toJSON():null};localStorage.setItem(x.PROSE_MIRROR,JSON.stringify(u));const P=(r==null?void 0:r.doc.textContent.length)||0;localStorage.setItem(x.PROSE_MIRROR_LENGTH,String(c.length+P))}else{if(!(c||R))return;const u={...s,content:R};localStorage.setItem(x.FROALA,JSON.stringify(u)),localStorage.setItem(x.FROALA_LENGTH,String(c.length+R.length))}p.info("ìë ìì ì ì¥ ìë£")}catch(d){(d==null?void 0:d.name)==="QuotaExceededError"&&p.warning("ìë ì ì¥ ê³µê°ì´ ë¶ì¡±í©ëë¤")}}
1,[i,c,O,l,R]),C=o.useRef(!1),E=o.useRef(null),Re=o.useCallback(()=>{C.current=!0,E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{C.current&&(C.current=!1,w())},2e3)},[w]);o.useEffect(()=>{if(k.current)return;if(K.current!==l){K.current=l;return}const r=setTimeout(()=>{w()},2e3);return()=>clearTimeout(r)},[c,R,l,O,w,i]),o.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]);const ge=()=>{var s;if(window.confirm(`ìì± ì¤ì¸ 모ë ë³ê²½ì¬íì´ ì·¨ìë©ëë¤. 2ì본 ë°ì´í°ë¡ ë³µìë©ëë¤. 3 4ì ë§ë¡ ì´ê¸°ííìê² ìµëê¹?`)){if(localStorage.removeItem(x.PROSE_MIRROR),localStorage.removeItem(x.PROSE_MIRROR_LENGTH),localStorage.removeItem(x.FROALA),localStorage.removeItem(x.FROALA_LENGTH),N){const a=N.forum;j(a.title||""),L(a.cate_cd),a.contentJson&&typeof a.contentJson=="object"?(S(n.PROSE_MIRROR),_(a.contentJson),v("")):/<[a-z][\s\S]*?>/i.test(a.content)?(S(n.FROALA),v(a.content||""),_(null)):(S(n.PROSE_MIRROR),_(null),(s=h.current)==null||s.setHTML(a.content||""),v(""))}C.current=!1,p.success("ì본 ë°ì´í°ë¡ ë³µìëììµëë¤")}},[q,b]=o.useState(!1),he=async r=>{var a,d,u,P,Q,X,Z;if(r.preventDefault(),b(!0),!O||O===""){p.error("í¬ë¼ ì¹´í ê³ ë¦¬ë¥¼ ì íí´ì£¼ì¸ì."),b(!1);return}if(c.length<5){p.error("ì 목ì 5ê¸ì ì´ì ì ë ¥í´ì£¼ì¸ì"),b(!1);return}if(c.length>200){p.error("ì 목ì 200ì ì´ë´ë¡ ì ë ¥í´ì£¼ì¸ì"),b(!1);return}const s=(a=h.current)==null?void 0:a.getEditorState();if(l==="PROSE_MIRROR"&&(!s||!((d=s.doc.textContent)!=null&&d.trim()))){p.error("ê²ìê¸ ë´ì©ì ì ë ¥í´ì£¼ì¸ì"),b(!1);return}if(l==="FROALA"&&!R){p.error("ê²ìê¸ ë´ì©ì ì ë ¥í´ì£¼ì¸ì"),b(!1);return}try{let y="",J="",H=null,B;if(l==="PROSE_MIRROR"){const V=document.createElement("div");s!=null&&s.schema&&je.fromSchema(s.schema).serializeFragment(s.doc.content,{document},V),y=V.innerHTML,J=V.textContent||"",H=s==null?void 0:s.doc.toJSON(),B=(Q=(P=(u=y.split("<img")[1])==null?void 0:u.split("src=")[1])==null?void 0:P.split('"')[1])==null?void 0:Q.replace(/&/g,"&")}else y=R,J=new DOMParser().parseFromString(R,"text/html").body.textContent||"";const Oe={cate_cd:O,title:c,content:y,textContent:J,...H&&{contentJson:H},images:B?[B]:[]},Se=await ee.post(`/forum/modify/${i}`,Oe);l==="PROSE_MIRROR"?(localStorage.removeItem(x.PROSE_MIRROR),localStorage.removeItem(x.PROSE_MIRROR_LENGTH)):(localStorage.removeItem(x.FROALA),localStorage.removeItem(x.FROALA_LENGTH)),b(!1),m(`/forum/article/${i}`,{replace:!0}),p.success(Se.data.msg)}catch(y){b(!1),p.error(((Z=(X=y.response)==null?void 0:X.data)==null?void 0:Z.msg)||"ì ì¥ì ì¤í¨íìµëë¤")}},be=r=>{r.preventDefault(),m(`/forum/article/${i}`,{replace:!0})};return se?e.jsx("main",{className:t("max-w-[1200px]","mx-auto pt-[34px] pb-[160px]"),children:e.jsx("div",{className:t("flex justify-center items-center","h-[400px]"),children:e.jsx("p",{className:t("text-lg text-gray-500"),children:"ê²ìê¸ ë°ì´í°ë¥¼ ë¶ë¬ì¤ë ì¤..."})})}):e.jsxs("main",{className:t("max-w-[1200px]","mx-auto pt-[34px] pb-[160px]"),children:[e.jsxs("div",{className:t("relative","grid grid-cols-[400px_1fr] gap-x-[28px]","w-full"),children:[e.jsxs("section",{className:t("sticky top-[78px]","flex flex-col gap-[16px]","h-fit max-h-screen","overflow-y-auto scroll-none","pb-[200px] border-box"),children:[e.jsxs("div",{className:t("flex flex-col gap-[4px]"),children:[e.jsxs("div",{className:t("flex justify-between items-center"),children:[e.jsxs("h1",{className:t("inline-flex items-center gap-[12px]","text-2xl font-bold"),children:["ììí¬ë¼ ìì "," ",e.jsx("span",{className:t("text-lg text-gray-600 font-extrabold"),children:"V2"})]}),e.jsx(I,{className:t("!w-fit h-fit px-[16px] py-[6px]","bg-black","border border-secondary"),onClick:ge,children:e.jsx("p",{className:t("text-sm","text-white"),children:"ì본ì¼ë¡ ë³µì"})})]}),e.jsxs("p",{className:t("text-sm"),children:["ì½í ì¸ ì ë ¥ 2ì´ ì´ë´ë¡ ìì ì ì¥ì´ ì§íë©ëë¤.",e.jsx("br",{}),'ë³ê²½ì¬íì ì·¨ìíë ¤ë©´ ì°ì¸¡ ìë¨ "ì본ì¼ë¡ ë³µì" ë²í¼ì ëë¬ì£¼ì¸ì']})]}),e.jsx("div",{className:t("h-fit","p-[32px]","border border-gray-300 rounded-lg box-border shadow-md"),children:e.jsxs("div",{className:t("flex flex-col gap-[16px]","w-full"),children:[e.jsxs("div",{className:t("flex flex-col gap-[4px]","w-full"),children:[e.jsxs("div",{className:t("flex items-center gap-[6px]"),children:[e.jsxs("p",{className:t("inline-flex items-center gap-[4px]","text-sm font-bold"),children:["ìëí° íì ì í",e.jsx("span",{className:t("text-red-600"),children:"*"})]}),e.jsx("div",{className:t("size-fit","py-[2px] px-[4px]","border rounded-lg border-primary"),children:e.jsx("p",{className:t("text-xs text-primary font-bold"),children:"NEW"})})]}),e.jsxs("div",{className:t("grid grid-cols-[1fr_1fr]","w-full","border border-gray-200 rounded-md"),children:[e.jsx("div",{className:t("flex justify-center","py-[8px]",f&&f!==n.PROSE_MIRROR?"opacity-50 cursor-not-allowed bg-gray-100":"hover:cursor-pointer",l===n.PROSE_MIRROR&&"border-[2px] ring-2 roun
4ded-l-md border-primary box-border"),onClick:()=>U(n.PROSE_MIRROR),children:e.jsx("p",{className:t("text-gray-900 font-bold italic",l===n.PROSE_MIRROR&&"text-primary",f&&f!==n.PROSE_MIRROR&&"text-gray-400"),children:"ProseMirror"})}),e.jsx("div",{className:t("flex justify-center","py-[8px]",f&&f!==n.FROALA?"opacity-50 cursor-not-allowed bg-gray-100":"hover:cursor-pointer",l===n.FROALA&&"border-[2px] ring-2 rounded-r-md border-primary box-border"),onClick:()=>U(n.FROALA),children:e.jsx("p",{className:t("text-gray-900 font-bold italic",l===n.FROALA&&"text-primary",f&&f!==n.FROALA&&"text-gray-400"),children:"Froala"})})]}),f&&e.jsxs("p",{className:t("text-xs text-gray-400 mt-[4px]"),children:["ìì ììë ì본 ìëí° íì (",f==="PROSE_MIRROR"?"ProseMirror":"Froala",")ë§ ì¬ì© ê°ë¥í©ëë¤"]})]}),e.jsx("div",{className:t("w-[calc(100%_-_8px)]","border border-gray-100")}),e.jsxs("div",{className:t("flex flex-col gap-[8px]","w-full"),children:[e.jsxs("p",{className:t("inline-flex items-center gap-[4px]","text-sm font-bold"),children:["í¬ë¼ ì¹´í ê³ ë¦¬ ì í",e.jsx("span",{className:t("text-red-600"),children:"*"})]}),e.jsx(Ie,{size:"large",placeholder:"í¬ë¼ ì¹´í ê³ ë¦¬ë¥¼ ì íí´ì£¼ì¸ì",options:z,onChange:r=>{r&&L(r.value)},value:z.find(r=>r.value===O)??null,menuPortalTarget:document.body,menuPosition:"fixed"})]}),e.jsx("div",{className:t("w-[calc(100%_-_8px)]","border border-gray-100")}),e.jsxs("div",{className:t("flex flex-col gap-[8px]","w-full"),children:[e.jsxs("div",{className:t("flex flex-col gap-[4px]"),children:[e.jsxs("div",{className:t("flex items-center gap-[6px]"),children:[e.jsx("p",{className:t("text-sm font-bold"),children:"ìì ¯ ì¶ê°í기"}),e.jsx("div",{className:t("size-fit","py-[2px] px-[4px]","border rounded-lg border-primary"),children:e.jsx("p",{className:t("text-xs text-primary font-bold"),children:"NEW"})})]}),e.jsxs("p",{className:t("text-xs text-gray-400"),children:["ìì ¯ì ì¶ê°íë ¤ë©´ ",e.jsx("span",{className:t("text-primary"),children:"ìì ¯ ì½ë ìëí°"}),"를 ì¬ì©í´ë³´ì¸ì. ê²ìê¸ ë´ì ì¥ë°êµ¬ë, ìí ë±ì ìì ¯ì ë ¸ì¶í ì ììµëë¤."]})]}),e.jsx(I,{className:t("!h-[42px]","border-black"),onClick:ue,children:e.jsxs("div",{className:t("flex items-center gap-[4px]"),children:[e.jsx("p",{className:t("text-black font-bold"),children:"ìì ¯ ì½ë ìëí° ì´ê¸°"}),e.jsx("i",{className:t("ii ii-untitledui-link-external-02")})]})})]}),e.jsx("div",{className:t("w-[calc(100%_-_8px)]","border border-gray-100")}),e.jsxs("div",{className:t("flex gap-[8px]","w-full"),children:[e.jsx(I,{onClick:be,children:e.jsx("p",{className:t("text-black font-normal"),children:"ëìê°ê¸°"})}),e.jsxs("div",{className:t("relative","w-full h-fit"),children:[e.jsx(I,{className:t("bg-black","text-white"),onClick:de,children:e.jsx("p",{className:t("text-white font-normal"),children:"ì½í ì¸ ë¯¸ë¦¬ë³´ê¸°"})}),e.jsx("div",{className:t("absolute","top-[0px] right-[0px]","translate-x-[25%] translate-y-[-25%]","size-fit","py-[2px] px-[4px]","bg-white","border rounded-lg border-primary"),children:e.jsx("p",{className:t("text-xs text-primary font-bold"),children:"NEW"})})]})]}),e.jsx("div",{className:t("w-full"),children:e.jsx(I,{className:t("bg-primary","text-white"),onClick:he,disabled:q,children:q?"ì§íì¤...":"ê²ìê¸ ìì í기"})})]})})]}),e.jsxs("section",{className:t("flex flex-col gap-[24px]"),children:[e.jsxs("div",{className:t("flex flex-col gap-[16px]","w-full"),children:[e.jsxs("p",{className:t("inline-flex items-center gap-[4px]","text-lg font-bold text-black"),children:["ê²ìê¸ ì 목",e.jsx("span",{className:t("text-red-600"),children:"*"})]}),e.jsxs("div",{className:t("flex flex-col gap-[4px]","w-full"),children:[e.jsx("div",{className:t("w-full","py-[8px] px-[12px]","border border-gray-400 rounded-md box-border","focus-within:border-primary focus-within:border-[1.5px]","focus-within:ring-2 focus-within:ring-primary/20",G&&"focus-within:border-red-600 focus-within:ring-0","transition-all duration-200"),children:e.jsx("input",{name:"boardTitle",className:t("w-full truncate"),type:"text",placeholder:"5ê¸ì ì´ìì ì 목ì ì ë ¥í´ì£¼ì¸ì",maxLength:200,value:c,onInput:ae})}),e.jsx("div",{className:t("grid grid-rows-[0fr]","w-full",G&&"grid-rows-[1fr]"),children:e.jsx("div",{className:t("w-full","overflow-hidden"),children:e.jsx("p",{className:t("text-sm text-red-600"),children:F})})})]})]}),e.jsx("div",{className:t("max-w-[772px]"),children:l==="PROSE_MIRROR"?e.jsx(Te,{savedContentJson:ne,isAdmin:(g==null?void 0:g.user_id)==="admin",ref:h,placeholder:"ê²ìê¸ ë´ì©ì ìì±í´ì£¼ì¸ì",onChange:Re}):e.jsx(Ae,{content:R,setContent:v})})]})]}),e.jsx(Me,{open:fe,setOpen:Y,editorContent:xe,onWidgetCodeConfirmed:pe}),e.jsx(Le,{open:le,setOpen:$,content:ie,editorType:l,title:c,headerTitle:"í¬ë¼ 미리보기"})]})};export{Xe as default}; 5//# sourceMappingURL=ForumEditV2-8299a41e.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.