1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 10:58:33 +00:00
Files
seahub/media/assets/frontend/static/js/viewFileDocument.99b2187a.js

1 line
1.8 KiB
JavaScript
Raw Normal View History

"use strict";(self.webpackChunkseahub_frontend=self.webpackChunkseahub_frontend||[]).push([[9177],{40513:function(e,t,n){var r=n(23029),s=n(92901),o=n(39874),i=n(85501),a=n(9950),c=n(17119),u=n(97011),f=n(40326),d=n(27831),p=n(44513),h=n(81446),l=n(9223),v=(n(20479),n(44414)),g=window.app.pageOptions,A=g.repoID,m=g.filePath,w=g.err,j=g.commitID,k=g.fileType,x=function(e){function t(){return(0,r.A)(this,t),(0,o.A)(this,t,arguments)}return(0,i.A)(t,e),(0,s.A)(t,[{key:"render",value:function(){return(0,v.jsx)(d.A,{content:(0,v.jsx)(S,{})})}}])}(a.Component),S=function(e){function t(e){var n;return(0,r.A)(this,t),(n=(0,o.A)(this,t,[e])).state={isLoading:!w,errorMsg:""},n}return(0,i.A)(t,e),(0,s.A)(t,[{key:"componentDidMount",value:function(){var e=this;if(!w){var t=function(){u.e.queryOfficeFileConvertStatus(A,j,m,k.toLowerCase()).then((function(n){switch(n.data.status){case"PROCESSING":e.setState({isLoading:!0}),setTimeout(t,2e3);break;case"ERROR":e.setState({isLoading:!1,errorMsg:(0,f.AP)("Document convertion failed.")});break;case"DONE":e.setState({isLoading:!1,errorMsg:""});var r=document.createElement("script");r.type="text/javascript",r.src="".concat(f.SG,"js/pdf/web/viewer.js"),document.body.append(r)}})).catch((function(t){t.response?e.setState({isLoading:!1,errorMsg:(0,f.AP)("Document convertion failed.")}):e.setState({isLoading:!1,errorMsg:(0,f.AP)("Please check the network.")})}))};t()}}},{key:"render",value:function(){var e=this.state,t=e.isLoading,n=e.errorMsg;return w?(0,v.jsx)(p.A,{}):t?(0,v.jsx)(h.A,{}):n?(0,v.jsx)(p.A,{errorMsg:n}):(0,v.jsx)("div",{className:"file-view-content flex-1 pdf-file-view",children:(0,v.jsx)(l.A,{})})}}])}(a.Component);c.render((0,v.jsx)(x,{}),document.getElementById("wrapper"))}},function(e){e.O(0,[4223],(function(){return t=40513,e(e.s=t);var t}));e.O()}]);