import{k as p,Q as C,l as E}from"./index-f6f689f9-1782572373740v=1.0.0.js";import{y as g,r as d,s as P,m as O,h as $,w as b,ad as F,z as h,A as w}from"./vendor-866bb149-1782572373740v=1.0.0.js";var B=Object.defineProperty,D=Object.defineProperties,j=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,_=(e,t,o)=>t in e?B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,S=(e,t)=>{for(var o in t||(t={}))A.call(t,o)&&_(e,o,t[o]);if(m)for(var o of m(t))H.call(t,o)&&_(e,o,t[o]);return e},M=(e,t)=>D(e,j(t));function u(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 v=(e,t)=>{for(const[o,a]of t)e[o]=a;return e};const V=g({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 o=d(null),a=P(null),s=d(""),i=()=>{if(!o.value)return;const l=F(e.defaultContent);p({selector:o.value,mode:e.mode,content:l||[],html:e.defaultHtml||e.modelValue||"",config:M(S({},e.defaultConfig),{onCreated(r){if(a.value=r,t.emit("onCreated",r),e.defaultConfig.onCreated){const n=u("onCreated");throw new Error(n)}},onChange(r){const n=r.getHtml();if(s.value=n,t.emit("update:modelValue",n),t.emit("onChange",r),e.defaultConfig.onChange){const f=u("onChange");throw new Error(f)}},onDestroyed(r){if(t.emit("onDestroyed",r),e.defaultConfig.onDestroyed){const n=u("onDestroyed");throw new Error(n)}},onMaxLength(r){if(t.emit("onMaxLength",r),e.defaultConfig.onMaxLength){const n=u("onMaxLength");throw new Error(n)}},onFocus(r){if(t.emit("onFocus",r),e.defaultConfig.onFocus){const n=u("onFocus");throw new Error(n)}},onBlur(r){if(t.emit("onBlur",r),e.defaultConfig.onBlur){const n=u("onBlur");throw new Error(n)}},customAlert(r,n){if(t.emit("customAlert",r,n),e.defaultConfig.customAlert){const f=u("customAlert");throw new Error(f)}},customPaste:(r,n)=>{if(e.defaultConfig.customPaste){const c=u("customPaste");throw new Error(c)}let f;return t.emit("customPaste",r,n,c=>{f=c}),f}})})};function y(l){const r=a.value;r!=null&&r.setHtml(l)}return O(()=>{i()}),$(()=>e.modelValue,l=>{l!==s.value&&y(l)}),{box:o}}}),L={ref:"box",style:{height:"100%"}};function T(e,t,o,a,s,i){return h(),w("div",L,null,512)}var z=v(V,[["render",T]]);const I=g({props:{editor:{type:Object},mode:{type:String,default:"default"},defaultConfig:{type:Object,default:{}}},setup(e){const t=d(null),o=a=>{if(!!t.value){if(a==null)throw new Error("Not found instance of Editor when create <Toolbar/> component");C.getToolbar(a)||E({editor:a,selector:t.value||"<div></div>",mode:e.mode,config:e.defaultConfig})}};return b(()=>{const{editor:a}=e;a!=null&&o(a)}),{selector:t}}}),R={ref:"selector"};function k(e,t,o,a,s,i){return h(),w("div",R,null,512)}var N=v(I,[["render",k]]);export{z as E,N as T};
