15.js 11 KB

1
  1. webpackJsonp([15],{293:function(t,e,o){var n=o(2)(o(298),o(299),!1,function(t){o(294),o(296)},"data-v-d62fe56a",null);t.exports=n.exports},294:function(t,e,o){var n=o(295);"string"==typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);o(1)("61c60bb2",n,!0,{})},295:function(t,e,o){(t.exports=o(0)(!1)).push([t.i,".teditor-box textarea{opacity:0}.teditor-box .tox-tinymce{-webkit-box-shadow:none;box-shadow:none;-webkit-box-sizing:border-box;box-sizing:border-box;border-color:#dddee1;border-radius:4px;overflow:hidden}.teditor-box .tox-tinymce .tox-statusbar span.tox-statusbar__branding a{display:none}.teditor-transfer{background-color:#fff}.teditor-transfer .tox-toolbar>div:last-child>button:last-child{margin-right:64px}.teditor-transfer .ivu-modal-header{display:none}.teditor-transfer .ivu-modal-close{top:7px;z-index:2}.teditor-transfer .teditor-transfer-body{position:absolute;top:0;left:0;width:100%;height:100%;padding:0;margin:0}.teditor-transfer .teditor-transfer-body textarea{opacity:0}.teditor-transfer .teditor-transfer-body .tox-tinymce{border:0}.teditor-transfer .teditor-transfer-body .tox-tinymce .tox-statusbar span.tox-statusbar__branding a{display:none}.tox.tox-silver-sink{z-index:13000}",""])},296:function(t,e,o){var n=o(297);"string"==typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);o(1)("6538e1bf",n,!0,{})},297:function(t,e,o){(t.exports=o(0)(!1)).push([t.i,".teditor-loadstyle[data-v-d62fe56a]{width:100%;height:180px;overflow:hidden;position:relative}.teditor-loadedstyle[data-v-d62fe56a]{width:100%;max-height:inherit;overflow:inherit;position:relative}.upload-control[data-v-d62fe56a]{display:none;width:0;height:0;overflow:hidden}",""])},298:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=o(53),i=o.n(n),a=o(17),r=o.n(a),s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.default={name:"TEditor",components:{ImgUpload:r.a},props:{id:{type:String,default:function(){return"tinymce_"+Math.round(1e4*Math.random())}},value:{default:""},height:{default:360},htmlClass:{default:"",type:String},plugins:{type:Array,default:function(){return["advlist autolink lists link image charmap print preview hr anchor pagebreak imagetools","searchreplace visualblocks visualchars code","insertdatetime media nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker imagetools codesample"]}},toolbar:{type:String,default:" undo redo | styleselect | uploadImages | uploadFiles | bold italic underline forecolor backcolor | alignleft aligncenter alignright | bullist numlist outdent indent | link image emoticons media codesample | preview screenload"},other_options:{type:Object,default:function(){return{}}},readonly:{type:Boolean,default:!1}},data:function(){return{content:"",editor:null,editorT:null,cTinyMce:null,checkerTimeout:null,isTyping:!1,spinShow:!0,transfer:!1,uploadIng:0,uploadFormat:["jpg","jpeg","png","gif","doc","docx","xls","xlsx","ppt","pptx","txt","esp","pdf","rar","zip","gz","ai","avi","bmp","cdr","eps","mov","mp3","mp4","pr","psd","svg","tif"],actionUrl:$A.apiUrl("system/fileupload"),params:{token:$A.getToken()},maxSize:204800}},mounted:function(){this.content=this.value,this.init()},activated:function(){this.content=this.value,this.init()},deactivated:function(){null!==this.editor&&this.editor.destroy(),this.spinShow=!0,$A(this.$refs.myTextarea).show()},watch:{value:function(t){null==t&&(t=""),this.isTyping||(null!==this.getEditor()?this.getEditor().setContent(t):this.content=t)},readonly:function(t){null!==this.editor&&(t?this.editor.setMode("readonly"):this.editor.setMode("design"))}},methods:{init:function(){var t=this;this.$nextTick(function(){i.a.init(t.concatAssciativeArrays(t.options(!1),t.other_options))})},initTransfer:function(){var t=this;this.$nextTick(function(){i.a.init(t.concatAssciativeArrays(t.options(!0),t.other_options))})},options:function(t){var e=this;return{selector:(t?"#T_":"#")+this.id,base_url:$A.serverUrl("js/build"),language:"zh_CN",toolbar:this.toolbar,plugins:this.plugins,save_onsavecallback:function(t){e.$emit("editorSave",t)},paste_data_images:!0,menu:{view:{title:"View",items:"code | visualaid visualchars visualblocks | spellchecker | preview fullscreen screenload | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime | uploadImages browseImages | uploadFiles"}},codesample_languages:[{text:"HTML/VUE/XML",value:"markup"},{text:"JavaScript",value:"javascript"},{text:"CSS",value:"css"},{text:"PHP",value:"php"},{text:"Ruby",value:"ruby"},{text:"Python",value:"python"},{text:"Java",value:"java"},{text:"C",value:"c"},{text:"C#",value:"csharp"},{text:"C++",value:"cpp"}],height:t?"100%":$A.rightExists(this.height,"%")?this.height:$A.runNum(this.height)||360,resize:!t,convert_urls:!1,toolbar_mode:"sliding",toolbar_drawer:"floating",setup:function(o){o.ui.registry.addMenuButton("uploadImages",{text:e.$L("图片"),tooltip:e.$L("上传/浏览 图片"),fetch:function(t){t([{type:"menuitem",text:e.$L("上传图片"),onAction:function(){e.$refs.myUpload.handleClick()}},{type:"menuitem",text:e.$L("浏览图片"),onAction:function(){e.$refs.myUpload.browsePicture()}}])}}),o.ui.registry.addMenuItem("uploadImages",{text:e.$L("上传图片"),onAction:function(){e.$refs.myUpload.handleClick()}}),o.ui.registry.addMenuItem("browseImages",{text:e.$L("浏览图片"),onAction:function(){e.$refs.myUpload.browsePicture()}}),o.ui.registry.addButton("uploadFiles",{text:e.$L("文件"),tooltip:e.$L("上传文件"),onAction:function(){e.handleBeforeUpload()&&e.$refs.fileUpload.handleClick()}}),o.ui.registry.addMenuItem("uploadFiles",{text:e.$L("上传文件"),onAction:function(){e.handleBeforeUpload()&&e.$refs.fileUpload.handleClick()}}),t?(o.ui.registry.addButton("screenload",{icon:"fullscreen",tooltip:e.$L("退出全屏"),onAction:function(){e.closeFull()}}),o.ui.registry.addMenuItem("screenload",{text:e.$L("退出全屏"),onAction:function(){e.closeFull()}}),o.on("Init",function(t){e.editorT=o,e.editorT.setContent(e.content),e.readonly?e.editorT.setMode("readonly"):e.editorT.setMode("design")})):(o.ui.registry.addButton("screenload",{icon:"fullscreen",tooltip:e.$L("全屏"),onAction:function(){e.content=o.getContent(),e.transfer=!0,e.initTransfer()}}),o.ui.registry.addMenuItem("screenload",{text:e.$L("全屏"),onAction:function(){e.content=o.getContent(),e.transfer=!0,e.initTransfer()}}),o.on("Init",function(t){e.spinShow=!1,e.editor=o,e.editor.setContent(e.content),e.readonly?e.editor.setMode("readonly"):e.editor.setMode("design"),e.$emit("editorInit",e.editor)}),o.on("KeyUp",function(t){null!==e.editor&&e.submitNewContent()}),o.on("Change",function(t){null!==e.editor&&(e.getContent()!==e.value&&e.submitNewContent(),e.$emit("editorChange",t))}))}}},closeFull:function(){this.content=this.getContent(),this.$emit("input",this.content),this.transfer=!1,null!=this.editorT&&(this.editorT.destroy(),this.editorT=null)},transferChange:function(t){t||null==this.editorT||(this.content=this.editorT.getContent(),this.$emit("input",this.content),this.editorT.destroy(),this.editorT=null)},getEditor:function(){return this.transfer?this.editorT:this.editor},concatAssciativeArrays:function(t,e){if(0===e.length)return t;if(0===t.length)return e;var o=[];for(var n in t)t.hasOwnProperty(n)&&(o[n]=t[n]);for(var i in e)e.hasOwnProperty(i)&&(o[i]=e[i]);return o},submitNewContent:function(){var t=this;this.isTyping=!0,null!==this.checkerTimeout&&clearTimeout(this.checkerTimeout),this.checkerTimeout=setTimeout(function(){t.isTyping=!1},300),this.$emit("input",this.getContent())},insertContent:function(t){null!==this.getEditor()?this.getEditor().insertContent(t):this.content+=t},getContent:function(){return null===this.getEditor()?"":this.getEditor().getContent()},insertImage:function(t){this.insertContent('<img src="'+t+'">')},editorImage:function(t){for(var e=0;e<t.length;e++){var o=t[e];"object"===(void 0===o?"undefined":s(o))&&"string"==typeof o.url&&this.insertImage(o.url)}},handleProgress:function(){this.uploadIng++},handleSuccess:function(t,e){this.uploadIng--,1===t.ret?this.insertContent('<a href="'+t.data.url+'" target="_blank">'+t.data.name+" ("+$A.bytesToSize(1024*t.data.size)+")</a>"):this.$Modal.warning({title:this.$L("上传失败"),content:this.$L("文件 % 上传失败,%",e.name,t.msg)})},handleError:function(){this.uploadIng--},handleFormatError:function(t){this.$Modal.warning({title:this.$L("文件格式不正确"),content:this.$L("文件 % 格式不正确,仅支持上传:%",t.name,this.uploadFormat.join(","))})},handleMaxSize:function(t){this.$Modal.warning({title:this.$L("超出文件大小限制"),content:this.$L("文件 % 太大,不能超过%。",t.name,$A.bytesToSize(1024*this.maxSize))})},handleBeforeUpload:function(){return this.params={token:$A.getToken()},!0}}}},299:function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",[o("div",{staticClass:"teditor-box",class:[t.spinShow?"teditor-loadstyle":"teditor-loadedstyle"]},[o("textarea",{ref:"myTextarea",attrs:{id:t.id}},[t._v(t._s(t.content))]),t._v(" "),t.spinShow?o("Spin",{attrs:{fix:""}},[o("Icon",{staticClass:"upload-control-spin-icon-load",attrs:{type:"ios-loading",size:"18"}}),t._v(" "),o("div",[t._v(t._s(t.$L("加载组件中...")))])],1):t._e(),t._v(" "),o("ImgUpload",{ref:"myUpload",staticClass:"upload-control",attrs:{type:"callback",uploadIng:t.uploadIng,num:"50"},on:{"update:uploadIng":function(e){t.uploadIng=e},"update:upload-ing":function(e){t.uploadIng=e},"on-callback":t.editorImage}}),t._v(" "),o("Upload",{ref:"fileUpload",staticClass:"upload-control",attrs:{name:"files",action:t.actionUrl,data:t.params,multiple:"",format:t.uploadFormat,"show-upload-list":!1,"max-size":t.maxSize,"on-progress":t.handleProgress,"on-success":t.handleSuccess,"on-error":t.handleError,"on-format-error":t.handleFormatError,"on-exceeded-size":t.handleMaxSize,"before-upload":t.handleBeforeUpload}})],1),t._v(" "),t.uploadIng>0?o("Spin",{attrs:{fix:""}},[o("Icon",{staticClass:"upload-control-spin-icon-load",attrs:{type:"ios-loading"}}),t._v(" "),o("div",[t._v(t._s(t.$L("正在上传文件...")))])],1):t._e(),t._v(" "),o("Modal",{staticClass:"teditor-transfer",attrs:{"footer-hide":"",fullscreen:"",transfer:""},on:{"on-visible-change":t.transferChange},model:{value:t.transfer,callback:function(e){t.transfer=e},expression:"transfer"}},[o("div",{attrs:{slot:"close"},slot:"close"},[o("Button",{attrs:{type:"primary",size:"small"}},[t._v(t._s(t.$L("完成")))])],1),t._v(" "),o("div",{staticClass:"teditor-transfer-body"},[o("textarea",{attrs:{id:"T_"+t.id}},[t._v(t._s(t.content))])]),t._v(" "),t.uploadIng>0?o("Spin",{attrs:{fix:""}},[o("Icon",{staticClass:"upload-control-spin-icon-load",attrs:{type:"ios-loading"}}),t._v(" "),o("div",[t._v(t._s(t.$L("正在上传文件...")))])],1):t._e()],1)],1)},staticRenderFns:[]}}});