import{it as e,n as t}from"./axios-CiYFffbI.js";import{E as n,G as r,I as i,V as a,Y as o,_ as s,d as c,it as l,kt as u,l as d,p as f,ut as p,v as m,y as h}from"./runtime-core.esm-bundler-CnFWH3R5.js";import{o as g}from"./index-BbRh5og5.js";import{t as _}from"./vue-quill.snow-BT2oa_xL.js";function v(e){let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function y(e){if(!e?.trim())return``;if(typeof document>`u`)return e;let t=document.createElement(`div`);t.innerHTML=e,t.querySelectorAll(`*`).forEach(e=>{e.removeAttribute(`style`),e.removeAttribute(`class`)}),t.querySelectorAll(`font`).forEach(e=>v(e));let n=0;for(;n<5;){let e=t.querySelectorAll(`span`),r=!1;if(e.forEach(e=>{e.attributes.length===0&&(v(e),r=!0)}),!r)break;n++}return t.innerHTML}var b={class:`rich-editor-field`},x=g(h({__name:`RichEditorField`,props:n({editorOptions:{},fieldKey:{},minHeight:{default:180}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(n){e(e=>({f58dc364:v.value}));let h=r(n,`modelValue`),g=n,v=d(()=>`${g.minHeight}px`),x=l(!1),S=l(0),C=l(``);function w(){x.value?(h.value=C.value,S.value+=1,x.value=!1):(C.value=h.value||``,x.value=!0)}function T(){let e=y(h.value||``);h.value=e,C.value=e,S.value+=1,t.success(`已清除样式`)}return(e,t)=>{let r=a(`a-button`),l=a(`a-space`),d=a(`a-textarea`);return i(),f(`div`,b,[m(l,{style:{"margin-bottom":`8px`,"flex-wrap":`wrap`}},{default:o(()=>[m(r,{size:`small`,onClick:w},{default:o(()=>[s(u(x.value?`返回可视化`:`查看源代码`),1)]),_:1}),m(r,{size:`small`,onClick:T},{default:o(()=>[...t[2]||=[s(`一键清除样式`,-1)]]),_:1})]),_:1}),x.value?(i(),c(d,{key:0,modelValue:C.value,"onUpdate:modelValue":t[0]||=e=>C.value=e,"auto-size":{minRows:14,maxRows:32},placeholder:`HTML 源代码`,style:{"font-family":`ui-monospace, monospace`,"font-size":`12px`}},null,8,[`modelValue`])):(i(),c(p(_),{key:`${n.fieldKey}-${S.value}`,content:h.value,"onUpdate:content":t[1]||=e=>h.value=e,"content-type":`html`,theme:`snow`,options:n.editorOptions},null,8,[`content`,`options`]))])}}}),[[`__scopeId`,`data-v-8ed53dd2`]]);export{x as t};