(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-9a1fdac2"],{"03fa":function(t,e,n){"use strict";n("e69e")},"7e41":function(t,e,n){},d509:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"cl-editor-quill"},[n("div",{staticClass:"editor",style:t.style}),n("el-upload",{attrs:{"show-file-list":!1,action:t.uploadURL,"http-request":t.httpRequest,headers:Object.assign({},{Authorization:t.token},t.headers),accept:t.accept,"on-success":t.upSuccess}},[n("el-button",{attrs:{id:"quill-upload-btn"}})],1)],1)},o=[],l=n("f374"),s=(n("65f0"),n("7479"),n("6c81")),u=n.n(s),c=(n("7e41"),n("8bc2")),a=n("5880"),r={name:"cl-editor-quill",props:{options:Object,value:null,action:String,headers:Object,accept:String,height:[String,Number],width:[String,Number]},data:function(){return{uploadURL:"",content:"",quill:null,options2:{theme:"snow",placeholder:"输入内容",modules:{toolbar:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["clean"],["link","image","video"]]}}}},computed:Object(l["a"])(Object(l["a"])({},Object(a["mapGetters"])(["token"])),{},{style:function(){var t=this.height,e=this.width;return isNaN(Number(t))||(t+="px"),isNaN(Number(e))||(t+="px"),{height:t,width:e}}}),watch:{value:function(t){t?t!==this.content&&this.setContent(t):this.setContent("")},content:function(t){this.$emit("input",t)}},created:function(){var t=this.$service.common.upload(),e=t.url;this.uploadURL=this.action||e},mounted:function(){var t=this,e=Object(c["deepMerge"])(this.options2,this.options);this.quill=new u.a(this.$el.querySelector(".editor"),e),this.quill.getModule("toolbar").addHandler("image",this.uploadImageHandler),this.quill.on("text-change",(function(){t.content=t.quill.root.innerHTML})),this.setContent(this.value),this.$emit("load",this.quill)},methods:{httpRequest:function(t){var e=this,n=t.file;this.getBase64(n).then((function(n){e.$service.common.uploadImg({content:n}).then((function(e){t.onSuccess(e)}))}))},getBase64:function(t){return new Promise((function(e,n){var i=new FileReader,o="";i.readAsDataURL(t),i.onload=function(){o=i.result},i.onerror=function(t){n(t)},i.onloadend=function(){e(o)}}))},uploadImageHandler:function(){document.getElementById("quill-upload-btn").click()},upSuccess:function(t){console.log(t);var e=this.quill.getSelection(),n=e.index;this.quill.insertEmbed(n||0,"image",t.smallUrl,u.a.sources.USER)},setContent:function(t){this.quill.root.innerHTML=t||""}}},d=r,h=(n("03fa"),n("5d22")),p=Object(h["a"])(d,i,o,!1,null,null,null);e["default"]=p.exports},e69e:function(t,e,n){}}]);