1import{r as c,c as f,o as B,a as L}from"./_plugin-vue_export-helper-B-nq0EyN.js";import{u as N,a as b}from"./Validators-Bj3oL1Ej.js";import{c as G,u as U,b as A}from"./useBranding-BFy5n_0u.js";import{a as D,u as M}from"./index-BDqw8SWo.js";import{b7 as O}from"./DashboardIcon-BNHeRWnK.js";import{A as F}from"./ArticleEditor-JqZNYV-n.js";import"./index-DN3rM4CW.js";import"./_commonjsHelpers-BosuxZz1.js";import"./utils.esm-CfIYYl8Y.js";import"./js.cookie-Cz0CWeBA.js";import"./index-BiJNB3Wq.js";import"./Icon-C6UTx21I.js";import"./typing-BLWL-49c.js";import"./index-C5QAEpou.js";import"./vue-dompurify-html-D_Dpv_Ot.js";import"./HelpCenterLayout-C1SxSppa.js";import"./dashboard-BxO4RE9t.js";import"./useKeyboardNavigableList-uoLl1yFe.js";import"./helper-BVTgYTlr.js";import"./module-CiEVyC2Y.js";import"./BarChart-DLqU6pMl.js";import"./constants-lVAyZKq6.js";import"./IframeLoader-CVQPRtmx.js";import"./HTMLSanitizer-cciupgGC.js";const me={__name:"PortalsArticlesNewPage",setup(H){const o=N(),n=b(),I=G(),{t:y}=U(),{portalSlug:m}=o.params,g=c(null),d=c(null),S=A("getCurrentUserID"),p=A("categories/allCategories"),C=f(()=>{var t,r;const{categorySlug:e}=o.params;if(e){const l=(t=p.value)==null?void 0:t.find(a=>a.slug===e);if(l)return l.id}return((r=p.value[0])==null?void 0:r.id)||null}),v=f(()=>o.name==="portals_categories_articles_new"),s=c({}),i=c(!1),E=c(!1),h=e=>{g.value=e},R=e=>{d.value=e},T=async({title:e,content:t})=>{var r,l;if(e&&(s.value.title=e),t&&(s.value.content=t),!(!s.value.title||i.value)){i.value=!0;try{const{locale:a}=o.params,u=d.value||C.value,k=await I.dispatch("articles/create",{portalSlug:m,content:s.value.content,title:s.value.title,locale:a,authorId:g.value||S.value,categoryId:u});D(O.CREATE_ARTICLE,{locale:a});const w=(l=(r=p.value)==null?void 0:r.find(x=>x.id===u))==null?void 0:l.slug,_=o.params.categorySlug;n.replace({name:v.value?"portals_categories_articles_edit":"portals_articles_edit",params:{articleSlug:k,portalSlug:m,locale:a,..._?{categorySlug:w||_}:{}}})}catch(a){const u=(a==null?void 0:a.message)||y("HELP_CENTER.EDIT_ARTICLE_PAGE.API.ERROR");M(u)}finally{i.value=!1}}},P=()=>{const{tab:e,categorySlug:t,locale:r}=o.params;v.value?n.push({name:"portals_categories_articles_index",params:{categorySlug:t,locale:r}}):n.push({name:"portals_articles_index",params:{tab:e,categorySlug:t,locale:r}})};return(e,t)=>(B(),L(F,{article:s.value,"is-updating":i.value,"is-saved":E.value,onCreateArticle:T,onGoBack:P,onSetAuthor:h,onSetCategory:R},null,8,["article","is-updating","is-saved"]))}};export{me as default}; 2//# sourceMappingURL=PortalsArticlesNewPage-8nYWjTrX.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.