"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");;/* empty css                                                                                         */const B=require("./toolbars/toolbar.js"),y=require("./types.js"),m=require("element-plus"),h=require("../../node_modules/.pnpm/@vueuse_core@10.9.0_vue@3.4.21/node_modules/@vueuse/core/index.js"),q=require("./symbol.js"),g=require("./toolbars/code-block.vue.js"),C=require("./toolbars/constom-code.js"),b=require("./toolbars/header-picker.vue.js"),w=require("./toolbars/image-insert.vue.js"),E=require("./async-import.js"),N=["value"],R={key:4,class:"ql-picker__divbox"},S=["value"],V=e.defineComponent({__name:"index",props:y.wetRichEditorProps,setup(p,{expose:k}){const c=p,a=m.useNamespace("rich-editor"),i=e.shallowRef(),s=e.ref(),{height:_}=h.useElementBounding(s),r=e.shallowRef();e.watch([r,()=>c.initialValue],([l,o])=>{var n;l&&o&&((n=r.value)==null||n.setContents(JSON.parse(o)))},{immediate:!0}),e.watch([r,()=>c.readOnly],([l,o])=>{var n;l&&((n=r.value)==null||n.enable(!o))},{immediate:!0});const f=async()=>{const l=await E.default(),o=await C.default();l.register("modules/constomCode",o),r.value=new l(i.value,{modules:{constomCode:!0,toolbar:{container:s.value,handlers:{table:function(){r.value.format("table-row",[])}}}},theme:"snow"})};return e.onMounted(()=>{f()}),e.provide(q.SymbolState,{quill:r,httpRequest:e.computed(()=>c.imageHttpRequest)}),k({getContents:(l=!1)=>{var o,n;if(l)return(o=r.value)==null?void 0:o.getSemanticHTML();{const u=(n=r.value)==null?void 0:n.getContents();return JSON.stringify(u)}}}),(l,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(a).b()])},[e.withDirectives(e.createElementVNode("div",{ref_key:"toolRef",ref:s},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(B.default),(n,u)=>(e.openBlock(),e.createElementBlock("div",{class:"ql-formats",key:u},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n,(t,v)=>(e.openBlock(),e.createBlock(e.unref(m.ElTooltip),{key:v,content:t.title,placement:"top"},{default:e.withCtx(()=>[t.render==="code-block"?(e.openBlock(),e.createBlock(g.default,{key:0})):e.createCommentVNode("",!0),t.render==="header"?(e.openBlock(),e.createBlock(b.default,{key:1})):e.createCommentVNode("",!0),t.render==="image"?(e.openBlock(),e.createBlock(w.default,{key:2})):e.createCommentVNode("",!0),!t.options&&!t.render?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(`ql-${t.key}`),value:t.value},null,10,N)):e.createCommentVNode("",!0),t.options?(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("select",{class:e.normalizeClass(`ql-${t.key}`)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,d=>(e.openBlock(),e.createElementBlock("option",{value:d,key:d},null,8,S))),128))],2)])):e.createCommentVNode("",!0)]),_:2},1032,["content"]))),128))]))),128))],512),[[e.vShow,c.showToolsbar]]),e.createElementVNode("div",{ref_key:"divRef",ref:i,class:e.normalizeClass([e.unref(a).e("inner-box"),e.unref(a).is("no-toolsbar",!c.showToolsbar)]),style:e.normalizeStyle({"--wet-richeditor-inner-h":`${e.unref(_)}px`})},null,6)],2))}});exports.default=V;
