(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{AKud:function(h,u,t){h.exports={articleEdit:"articleEdit___1zrD7",main:"main___12KB9",topBar:"topBar___1NGPN",title:"title___JkBZp",actions:"actions___3pT2g",backBtn:"backBtn___3p96Y",saveBtn:"saveBtn___36HUX",editor:"editor___3hiYF",footer:"footer___1eIEn",contentWrapper:"contentWrapper___1sGQY",content:"content___KlhZj",codeMirror:"codeMirror___30r-Z"}},OZZq:function(h,u,t){"use strict";t.r(u);var I=t("+L6B"),f=t("2/Rp"),U=t("5NDa"),y=t("5rEg"),g=t("WmNS"),m=t.n(g),S=t("miYZ"),d=t("tsqr"),j=t("9og8"),E=t("q1tI"),i=t("nKUr"),B=function(o){var a=o.children;return Object(i.jsx)("div",{style:{minHeight:"100vh"},children:a})},x=B,p=t("9kvl"),C=t("1M3H"),O=t.n(C),b=t("56rK"),N=t.n(b),T=t("AKud"),c=t.n(T),Y=t("lZu9"),D=function(o){var a=o.dispatch,n=o.article,A=function(){return!!location.hash.match(/edit/)||!!n.currentArticle&&!!n.currentArticle._id};Object(E.useEffect)(function(){if(a&&A()){var r=location.hash.split("/");a({type:"article/fetchArticle",payload:{id:r[r.length-1]}})}TDAPP.onEvent("\u6587\u7AE0\u7F16\u8F91-\u8BBF\u95EE\u9875\u9762")},[]);var H=function(l){a&&a({type:"article/setArticleTitle",payload:{title:l.target.value}})},P=function(l){var s=l.text,e=l.html;a&&a({type:"article/setArticleContent",payload:{content:s,contentHtml:e}})},L=function(l){console.log(l)},Z=new O.a;setTimeout(function(){var r=document.querySelector(".CodeMirror");r&&r.setAttribute("style","min-height:calc(100vh - 50px - 50px);box-shadow:none")},100);var K=function(){var r=Object(j.a)(m.a.mark(function l(){return m.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.currentArticle){e.next=7;break}if(!(n.currentArticle.title.length<5)){e.next=4;break}return d.default.error("\u6807\u9898\u5B57\u6570\u4E0D\u5F97\u5C0F\u4E8E5"),e.abrupt("return");case 4:if(!(n.currentArticle.content.length<10)){e.next=7;break}return d.default.error("\u5185\u5BB9\u5B57\u6570\u4E0D\u5F97\u5C0F\u4E8E9"),e.abrupt("return");case 7:if(!A()){e.next=13;break}return e.next=10,a({type:"article/saveCurrentArticle",payload:n.currentArticle});case 10:d.default.success("\u6587\u7AE0\u4FDD\u5B58\u6210\u529F"),e.next=16;break;case 13:return e.next=15,a({type:"article/newArticle",payload:n.currentArticle});case 15:d.default.success("\u6587\u7AE0\u4FDD\u5B58\u6210\u529F");case 16:TDAPP.onEvent("\u6587\u7AE0\u7F16\u8F91-\u4FDD\u5B58\u6587\u7AE0");case 17:case"end":return e.stop()}},l)}));return function(){return r.apply(this,arguments)}}(),M=function(){p.b.push("/articles"),TDAPP.onEvent("\u6587\u7AE0\u7F16\u8F91-\u8FD4\u56DE")};return Object(i.jsx)(x,{children:Object(i.jsxs)("div",{className:c.a.articleEdit,children:[Object(i.jsxs)("div",{className:c.a.topBar,children:[Object(i.jsx)(y.a,{className:c.a.title,placeholder:"\u6587\u7AE0\u6807\u9898",value:n.currentArticle?n.currentArticle.title:"",onChange:H}),Object(i.jsxs)("div",{className:c.a.actions,children:[Object(i.jsx)(f.a,{className:c.a.backBtn,type:"default",onClick:M,children:"\u8FD4\u56DE"}),Object(i.jsx)(f.a,{className:c.a.saveBtn,type:"primary",onClick:K,children:"\u4FDD\u5B58"})]})]}),Object(i.jsx)("div",{className:c.a.main,children:Object(i.jsx)(N.a,{name:"md",style:{width:"100%",height:"calc(100vh - 50px)"},value:n.currentArticle?n.currentArticle.content:"",renderHTML:function(l){var s=Z.render(l);return a({type:"article/setArticleContentHtml",payload:{contentHtml:s}}),s},onChange:P,onImageUpload:L})})]})})},k=u.default=Object(p.a)(function(v){var o=v.article;return{article:o}})(D)}}]);
