2 lines
29 KiB
JavaScript
2 lines
29 KiB
JavaScript
|
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).WebOfficeSDK=t()}(this,function(){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};function t(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n,i,r,s,o=function(){return(o=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function a(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}c((i=i.apply(e,t||[])).next())})}function c(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=(r=o.trys).length>0&&r[r.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}!function(e){e.refreshToken="api.getToken"}(n||(n={})),function(e){e.unknown="unknown",e.spreadsheet="s",e.writer="w",e.presentation="p",e.pdf="f",e.otl="o",e.dbt="d",e.ksheet="k"}(i||(i={})),function(e){e.nomal="nomal",e.simple="simple",e.embed="embed"}(r||(r={})),function(e){e[e.requestFullscreen=1]="requestFullscreen",e[e.exitFullscreen=0]="exitFullscreen"}(s||(s={}));var l=window.navigator.userAgent.toLowerCase(),u=/iPhone|iPod|iPad/i.test(l);function d(e){if(!e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var h=function(){function e(e,t,n,i,r,s,o){var a=this;void 0===r&&(r=!0),void 0===s&&(s=!1),void 0===o&&(o={}),this.instance=e,this.instanceId=t,this.url=n,this.mount=i,this.isListenResize=r,this.addedStyles=s,this.customAttrs=o,this.handleResize=function(){var e=a.mount,t=a.mountResizeObserver,n=e.clientHeight,i=e.clientWidth;0!==n||0!==i||t?0===n&&0===i||!t||(t.disconnect(),t=null):window.ResizeObserver&&(t=new ResizeObserver(function(e){a.handleResize()})).observe(e),a.iframe.style.cssText+="height: "+e.clientHeight+"px; width: "+e.clientWidth+"px"},this.iframe=this.initIframe()}return e.prototype.initIframe=function(){var e=this,t=this.mount,n=document.createElement("iframe");n.classList.add("web-office-iframe");var i=this.mergeAttrs({id:"office-iframe-"+this.instanceId,src:this.url,scrolling:"no",frameborder:"0",allowfullscreen:"allowfullscreen",webkitallowfullscreen:"true",mozallowfullscreen:"true",allow:"clipboard-read; clipboard-write"});for(var r in t?(i.style="width: "+t.clientWidth+"px; height: "+t.clientHeight+"px;",this.isListenResize&&window.addEventListener("resize",this.handleResize)):((t=document.createElement("div")).classList.add("web-office-default-container"),this.addedStyles||this.addStylesheetRules(".web-office-default-container {position: absolute; padding: 0; margin: 0; width: 100vw; height: 100vh; left: 0; top: 0;}"),document.body.appendChild(t),i.style="width: 100vw; height: 100vh;")
|