import{d as F,r as b,$ as k,b as M,a0 as T,a1 as A,a2 as j,a3 as H,o as g,c as v,a4 as I,a5 as L,a6 as R,a as O,a7 as W,K as z,a8 as K,m as Q,e as V,n as y,g as C,h as _,p as E,a9 as q,w as P,l as $,aa as G,_ as J}from"./index-17740f03-1778929502341v=1.0.0.js";var X=Object.defineProperty,Y=Object.defineProperties,Z=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,x=(e,t,a)=>t in e?X(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,oe=(e,t)=>{for(var a in t||(t={}))ee.call(t,a)&&x(e,a,t[a]);if(D)for(var a of D(t))te.call(t,a)&&x(e,a,t[a]);return e},ne=(e,t)=>Y(e,Z(t));function c(e){let t=`\u8BF7\u4F7F\u7528 '@${e}' \u4E8B\u4EF6\uFF0C\u4E0D\u8981\u653E\u5728 props \u4E2D`;return t+=`
Please use '@${e}' event instead of props`,t}var N=(e,t)=>{for(const[a,r]of t)e[a]=r;return e};const ae=F({props:{mode:{type:String,default:"default"},defaultContent:{type:Array,default:[]},defaultHtml:{type:String,default:""},defaultConfig:{type:Object,default:{}},modelValue:{type:String,default:""}},setup(e,t){const a=b(null),r=k(null),p=b(""),i=()=>{if(!a.value)return;const d=j(e.defaultContent);H({selector:a.value,mode:e.mode,content:d||[],html:e.defaultHtml||e.modelValue||"",config:ne(oe({},e.defaultConfig),{onCreated(n){if(r.value=n,t.emit("onCreated",n),e.defaultConfig.onCreated){const o=c("onCreated");throw new Error(o)}},onChange(n){const o=n.getHtml();if(p.value=o,t.emit("update:modelValue",o),t.emit("onChange",n),e.defaultConfig.onChange){const f=c("onChange");throw new Error(f)}},onDestroyed(n){if(t.emit("onDestroyed",n),e.defaultConfig.onDestroyed){const o=c("onDestroyed");throw new Error(o)}},onMaxLength(n){if(t.emit("onMaxLength",n),e.defaultConfig.onMaxLength){const o=c("onMaxLength");throw new Error(o)}},onFocus(n){if(t.emit("onFocus",n),e.defaultConfig.onFocus){const o=c("onFocus");throw new Error(o)}},onBlur(n){if(t.emit("onBlur",n),e.defaultConfig.onBlur){const o=c("onBlur");throw new Error(o)}},customAlert(n,o){if(t.emit("customAlert",n,o),e.defaultConfig.customAlert){const f=c("customAlert");throw new Error(f)}},customPaste:(n,o)=>{if(e.defaultConfig.customPaste){const h=c("customPaste");throw new Error(h)}let f;return t.emit("customPaste",n,o,h=>{f=h}),f}})})};function w(d){const n=r.value;n!=null&&n.setHtml(d)}return M(()=>{i()}),T(()=>e.modelValue,d=>{d!==p.value&&w(d)}),{box:a}}}),re={ref:"box",style:{height:"100%"}};function le(e,t,a,r,p,i){return g(),v("div",re,null,512)}var ue=N(ae,[["render",le]]);const ie=F({props:{editor:{type:Object},mode:{type:String,default:"default"},defaultConfig:{type:Object,default:{}}},setup(e){const t=b(null),a=r=>{if(!!t.value){if(r==null)throw new Error("Not found instance of Editor when create <Toolbar/> component");I.getToolbar(r)||L({editor:r,selector:t.value||"<div></div>",mode:e.mode,config:e.defaultConfig})}};return A(()=>{const{editor:r}=e;r!=null&&a(r)}),{selector:t}}}),se={ref:"selector"};function de(e,t,a,r,p,i){return g(),v("div",se,null,512)}var fe=N(ie,[["render",de]]);const ce={id:"editor-main-container-component"},me={key:0,class:"toolbar-container"},pe={id:"content"},_e={id:"editor-container"},ge={key:0,id:"title-container"},ve={id:"editor-text-area"},he={key:0,class:"button"},ye=F({name:"WangEditor"}),Ce=F({...ye,props:{value:{},title:{},toolbarConfig:{default:()=>({insertKeys:{index:105,keys:["myFullScreen"]},excludeKeys:["insertVideo","codeBlock","group-video","fullScreen","insertLink"]})},editorConfig:{default:()=>({placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9...",MENU_CONF:{}})},height:{default:"500px"},mode:{default:"default"},hideToolBar:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},showEditorAll:{type:Boolean},titleLimit:{default:40}},emits:["update:value","update:title","update:full","check-validate","edit"],setup(e,{expose:t,emit:a}){const r=k(),p=l=>{r.value=l},i=e;i.disabled&&R(()=>{r.value.disable()});const w=a,d=O({get(){return i.value},set(l){r.value.isEmpty()&&(l=""),w("update:value",l)}}),n=O({get(){return i.title},set(l){w("update:title",l)}}),o=b(!1);i.editorConfig.MENU_CONF.uploadImage={async customUpload(l,u){if(!f())return;const m=new FormData;m.append("image",l);try{const s=await W(m);if(s.code!=200){z.warning(s.msg);return}u(s.data.imgUrl)}catch{}},metaWithUrl:!0},i.editorConfig.MENU_CONF.myFullScreen={toggleFull(){o.value=!o.value}};const f=l=>!0;i.editorConfig.MENU_CONF.uploadVideo={async customUpload(l,u){if(!h())return;let m=new FormData;m.append("file",l);try{const{data:s}=await K(m);u(s.fileUrl)}catch{}}};const h=l=>!0;Q(()=>{!r.value||r.value.destroy()}),t({editor:r});const U=()=>{o.value=!1},S=()=>{o.value=!1};return(l,u)=>{const m=V("el-input"),s=V("el-button");return g(),v("div",{class:G([_(o)?"w-e-full-screen-container":"editor-box"])},[y("div",ce,[l.hideToolBar?E("v-if",!0):(g(),v("div",me,[C(_(fe),{class:"editor-toolbar",editor:r.value,defaultConfig:l.toolbarConfig},null,8,["editor","defaultConfig"])])),y("div",pe,[y("div",_e,[_(o)?(g(),v("div",ge,[C(m,{modelValue:n.value,"onUpdate:modelValue":u[0]||(u[0]=B=>n.value=B),type:"textarea",class:"textarea",autosize:"",placeholder:"\u8BF7\u8F93\u5165\u6587\u7AE0\u7684\u6807\u9898",maxlength:l.titleLimit,"show-word-limit":""},null,8,["modelValue","maxlength"])])):E("v-if",!0),y("div",ve,[C(_(ue),{style:q([{height:_(o)?"":l.height},{background:"#ffffff"}]),modelValue:d.value,"onUpdate:modelValue":u[1]||(u[1]=B=>d.value=B),defaultConfig:l.editorConfig,onOnCreated:p,id:"editor"},null,8,["style","modelValue","defaultConfig"])]),E(` <div class="button_box" v-show="showEditorAll && !valueFull">\r
						<el-button type="primary" @click="handleToEditor">\u5168\u5C4F\u7F16\u8F91</el-button>\r
					</div> `)]),_(o)?(g(),v("div",he,[y("div",null,[C(s,{type:"primary",onClick:S},{default:P(()=>u[2]||(u[2]=[$("\u4FDD\u5B58")])),_:1}),C(s,{onClick:U},{default:P(()=>u[3]||(u[3]=[$("\u8FD4\u56DE")])),_:1})])])):E("v-if",!0)])])],2)}}});const Ee=J(Ce,[["__scopeId","data-v-723a487b"]]);export{Ee as W};
