2 lines
3.5 KiB
JavaScript
2 lines
3.5 KiB
JavaScript
|
(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[49269],{66683:function(b){b.exports={mdEditorbox:"mdEditorbox___pnfhw"}},49269:function(b,L,e){"use strict";e.r(L),e.d(L,{default:function(){return q}});var U=e(39428),z=e(3182),se=e(34792),G=e(48086),N=e(34895),V=e(28216),R=e(37406),H=e(16605),$=e(90505),J=e(96132),ae=e.n(J),Q=e(67294),K=e(30672),X=e(66683),Y=e.n(X),s=e(85893),W,j,q=(W=(0,V.$j)(w=>{var t=w.common;return{common:t}}),W(j=class extends Q.PureComponent{constructor(){super(...arguments);this.state={modelZindex:100,fileInfo:{},isinit:!1,toolbarsExclude:["github"],text:"",preview:!0,taskID:(0,R.fW)()},this.getvideoinfo=()=>{var t=this.props,a=t.dispatch,D=t.sourceID,M=t.isedit,A=M===void 0?!1:M,x=t.common,I=t.f,v=t.fileType,_=v===void 0?"":v,d=t.zipData,m=d===void 0?{}:d,o=t.isZipModal,P=o===void 0?0:o,p=t.password,h=p===void 0?"":p,n=t.name,f=x.shareCode;if(P){a({type:"common/getunzipList",payload:{sourceID:m.sourceID,fullName:m.fileName,index:m.index,password:h},callback:l=>{if(l.success){var i=l.data||"";this.setState({fileInfo:{name:n},text:i||"",preview:_=="md",toolbarsExclude:_!="md"?["github","quote","unorderedList","orderedList","task","-","codeRow","code","link","image","table","mermaid","katex","preview","htmlPreview","catalog","bold","underline","italic","strikeThrough","sub","sup","title"]:["github"],isinit:!0})}}});return}a({type:"common/getFilePreview",payload:{busType:"cloud",sourceID:D,shareCode:f||void 0,view:f?1:void 0,f:I},callback:l=>{var i=l.data||{};this.setState({fileInfo:i,text:i.text||"",preview:i.fileType=="md",toolbarsExclude:i.fileType!="md"?["github","quote","unorderedList","orderedList","task","-","codeRow","code","link","image","table","mermaid","katex","preview","htmlPreview","catalog","bold","underline","italic","strikeThrough","sub","sup","title"]:["github"],isinit:!0})}})}}componentDidMount(){var t=this;t.getvideoinfo()}render(){var t=this,a=t.props,D=a.dispatch,M=a.common,A=a.open,x=a.setOpenModel,I=a.sourceID,v=a.issmall,_=a.isedit,d=_===void 0?!1:_,m=a.showIndex,o=this.state,P=o.modelZindex,p=o.fileInfo,h=p===void 0?{}:p,n=o.text,f=o.toolbarsExclude,l=o.preview,i=o.isinit,ee=o.taskID,te=r=>{t.setState({modelZindex:r})},B=r=>{!d||D({type:"common/fileSave",payload:{content:n,sourceID:I,taskID:ee},callback:u=>{var E=(0,K.lw)((0,K.Kd)());u.success&&G.ZP.success(E.formatMessage({id:u.code}))}})},Z=r=>{t.setState({text:r})},k=function(){var r=(0,z.Z)((0,U.Z)().mark(function u(E,S){var F;return(0,U.Z)().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,Promise.all(E.map(O=>new Promise((g,T)=>{var C=new FormData;C.append("file",O),C.append("busType","image"),H.Z.post("/api/disk/upload",C,{headers:{"Content-Type":"multipart/form-data",token:(0,R.ej)("token")}}).then(y=>g(y)).catch(y=>T(y))})));case 2:F=c.sent,S(F.map(O=>{var g=O.data||{},T=g.data||{};return""+T.path}));case 4:case"end":return c.stop()}},u)}));return function(E,S){return r.apply(this,arguments)}}();return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(N.Z,{open:A,issmall:v,showIndex:m,modelZindex:P,setOpenModel:x,setModelZindex:te,type:"doc",title:h.name,children:(0,s.jsx)("div",{className:Y().mdEditorbox,style:{padding:i&&!d?12:0},children:i&&(0,s.jsx)(s.Fragment,{children:d?(0,s.jsx)($.E,{modelValue:n,onChange:Z,onSave:B,onUploadImg:k,preview:l,toolbarsExclude:f}):(0,s.jsx)(s.Fragment,{children:h.fileType!="md"?(0,s.jsx)("pre",{"data-lang":"html",children:(0,s.jsx)("code",{children:n})}):(0,s.jsx)($.E,{modelValue:n,onChange:Z,onSave:B,onUploadImg:k,toolbars:[],previewOnly:!0})})})})})})}})||j)}}]);
|