"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("element-plus"),d=require("../../../node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.4.21/node_modules/@element-plus/icons-vue/dist/index.js"),f=require("../symbol.js"),h={style:{width:"fit-content",display:"flex","align-items":"center",color:"#06c"}},p={style:{width:"30px","font-size":"14px"}},k=e.defineComponent({__name:"header-picker",setup(m){const{quill:n}=e.inject(f.SymbolState),a=e.ref(0),c=t=>{if(t){let l=n.value.getFormat(t.index),o=l.header?l.header:0;a.value=o}};e.watch(n,t=>{t&&(n.value.on("selection-change",l=>{c(l)}),n.value.on("text-change",()=>{const l=n.value.getContents();console.log(l);const o=n.value.getSelection(!0);o&&c(o)}))},{immediate:!0});const u=e.computed(()=>{const t=i.find(l=>l.key===a.value);return t?t.label:"正文"}),i=[{key:1,label:"H1"},{key:2,label:"H2"},{key:3,label:"H3"},{key:4,label:"H4"},{key:5,label:"H5"},{key:0,label:"正文"}],s=t=>{a.value=t,n.value.format("header",t)};return(t,l)=>(e.openBlock(),e.createBlock(e.unref(r.ElDropdown),{trigger:"click"},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(r.ElDropdownMenu),null,{default:e.withCtx(()=>[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(i,o=>e.createVNode(e.unref(r.ElDropdownItem),{onClick:()=>s(o.key),key:o.key},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.label),1)]),_:2},1032,["onClick"])),64))]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("button",h,[e.createElementVNode("span",p,e.toDisplayString(u.value),1),e.createVNode(e.unref(r.ElIcon),null,{default:e.withCtx(()=>[e.createVNode(e.unref(d.CaretBottom))]),_:1})])]),_:1}))}});exports.default=k;
