"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./main-BB7fFseo.cjs"),d=require("./style-Ba_PnUmq.cjs"),b={class:"widget-content"},_=["innerHTML"],C=e.defineComponent({__name:"index",props:{attrs:{default:()=>e.DefaultDescAttrs}},setup(u){const i=u,c=e.inject("editable"),f=e.inject("formMode"),n=e.inject("widgetStore"),m=e.computed(()=>(console.log("widgetStore.isActive: ",n.isActive),n.isActive)),a=e.shallowRef(),g=e.ref(),s=e.ref(i.attrs.value);console.log("const valueHtml: ",s.value);const v={toolbarKeys:["fontFamily","bold","fontSize","underline","italic","through","color","bgColor","clearStyle","uploadImage",{key:"group-list-style",title:"列表",iconSvg:"",menuKeys:["bulletedList","numberedList"]},{key:"group-justify-style",title:"对齐方式",iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M768 793.6v102.4H51.2v-102.4h716.8z m204.8-230.4v102.4H51.2v-102.4h921.6z m-204.8-230.4v102.4H51.2v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>',menuKeys:["justifyLeft","justifyCenter","justifyRight","justifyJustify"]}],insertKeys:{index:1,keys:""},excludeKeys:[],modalAppendToBody:!1},y={placeholder:"请在此输入字段说明",autoFocus:!0,scroll:!1,readOnly:!1,customAlert:(t,o)=>{e.ElMessage({message:t,type:o})},MENU_CONF:{uploadImage:{async customUpload(t,o){console.log("file: ",t);try{if(t.size>15*1024*1024){e.ElMessage.error("图片大小不能超过15M");return}const l=e.getFileExtension(t.name);(await e.globalInject.uploadFile(t,{name:`form-${n.id}-${e.generateUUID()}${l}`})).subscribe({error:r=>{e.ElMessage.error(r)},complete:r=>{if(!r.key){e.ElMessage.error("上传失败");return}o(e.globalInject.imagePrefix+r.key)}})}catch(l){console.error("上传错误:",l)}}}}};e.onBeforeUnmount(()=>{const t=a.value;t!=null&&t.destroy()});function p(){e.setWidgetAttrs({id:n.id,attr:"value",value:s.value})}const h=t=>{a.value=t};return(t,o)=>(e.openBlock(),e.createElementBlock("div",b,[e.createVNode(e._sfc_main),e.createVNode(e.ChoosenView,null,{default:e.withCtx(()=>[e.createBaseVNode("div",{class:e.normalizeClass(["content",{disabled:e.unref(f)==="answer-preview"}])},[e.unref(c)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createVNode(e.unref(d.Toolbar),{editor:a.value,class:"toolbar-container",ref_key:"toolbar",ref:g,defaultConfig:v,mode:"simple"},null,8,["editor"]),[[e.vShow,m.value]]),e.createVNode(e.unref(d.Editor),{style:{height:"auto"},class:"editor-container",disabled:!e.unref(c),modelValue:s.value,"onUpdate:modelValue":o[0]||(o[0]=l=>s.value=l),defaultConfig:y,mode:"simple",onOnCreated:h,onOnChange:p},null,8,["disabled","modelValue"])],64)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"descript-show-content",innerHTML:i.attrs.value},null,8,_))],2),e.createVNode(e._sfc_main$2)]),_:1})]))}}),k=e._export_sfc(C,[["__scopeId","data-v-2a5911a0"]]);exports.default=k;
