import{o as e,h as t,w as l,i as o,j as i,k as a,F as n,l as s,A as c,W as r,t as u,y as d,z as f,p as h,bc as k,ba as m,bb as C,N as v,c5 as _,S as F}from"./index-DXvjTqMr.js";import{_ as g}from"./_plugin-vue_export-helper.BCo6x5W8.js";const b=g({components:{FontSizec:g({props:["editorCtx"],data:()=>({fontList:[{check:!1,name:"bold",value:"",ico:"icon-jiacu"},{check:!1,name:"italic",value:"",ico:"icon-bianji-qingxie"},{check:!1,name:"underline",value:"",ico:"icon-ziyuan"},{check:!1,name:"strike",value:"",ico:"icon-strikethrough"}],fontTwoList:[{check:!1,name:"fontSize",value:"12px",ico:"小"},{check:!1,name:"fontSize",value:"16px",ico:"标准"},{check:!1,name:"fontSize",value:"20px",ico:"大"},{check:!1,name:"fontSize",value:"24px",ico:"超大"}],fontColorList:[{check:!1,name:"color",value:"#000000"},{check:!1,name:"color",value:"#ff0000"},{check:!1,name:"color",value:"#00ff00"},{check:!1,name:"color",value:"#0000ff"},{check:!1,name:"color",value:"#ffaa00"},{check:!1,name:"color",value:"#9e9e9e"},{check:!1,name:"color",value:"#aa00ff"}],backgroundColorList:[{check:!1,name:"backgroundColor",value:"#ffffff"},{check:!1,name:"backgroundColor",value:"#f44336"},{check:!1,name:"backgroundColor",value:"#8bc34a"},{check:!1,name:"backgroundColor",value:"#00bcd4"},{check:!1,name:"backgroundColor",value:"#ffeb3b"},{check:!1,name:"backgroundColor",value:"#d9d6d6"},{check:!1,name:"backgroundColor",value:"#9c27b0"}],aligenList:[{check:!1,name:"align",value:"left",ico:"icon-juzuoduiqi"},{check:!1,name:"align",value:"center",ico:"icon-juzhong"},{check:!1,name:"align",value:"right",ico:"icon-juyouduiqi"}],styleList:[],styleListOld:[],isFontTwoClass:"16px",isFontColorClass:"#000000",isBackgroundColorClass:"#ffffff",isAligenListClass:"left"}),methods:{forFn(e,t){e.forEach((e=>{e.value==t?e.check=!0:e.check=!1}))},iterationFn(e,t){"fontTwo"==t?this.forFn(this.fontTwoList,e):"color"==t?this.forFn(this.fontColorList,e):"bgcolor"==t?this.forFn(this.backgroundColorList,e):"align"==t&&this.forFn(this.aligenList,e)},formatFn(e,t,l){let{name:o,value:i,ico:a}=e;"fontOne"==t?e.check=!e.check:"fontTwo"==t?(this.isFontTwoClass=e.value,this.iterationFn(e.value,t)):"color"==t?(this.isFontColorClass=e.value,this.iterationFn(e.value,t)):"bgcolor"==t?(this.isBackgroundColorClass=e.value,this.iterationFn(e.value,t)):"align"==t&&(this.isAligenListClass=e.value,this.iterationFn(e.value,t)),"fontOne"!==t?this.editorCtx.format(o,i):this.editorCtx.format(o),document.activeElement.blur(),requestAnimationFrame((function(){document.activeElement.blur()}))}}},[["render",function(h,k,m,C,v,_){const F=d,g=f;return e(),t(g,{class:"fontsizec-warp"},{default:l((()=>[o(F,{class:"editor-ul_label"},{default:l((()=>[i("文字格式")])),_:1}),o(g,{class:"editor-ul_font"},{default:l((()=>[o(g,{class:"editor-ul_fontOne faj bg"},{default:l((()=>[(e(!0),a(n,null,s(v.fontList,(l=>(e(),t(F,{class:c([{bgColor:l.check},"iconfont",l.ico]),key:l.name,onClick:e=>_.formatFn(l,"fontOne")},null,8,["class","onClick"])))),128))])),_:1}),o(g,{class:"editor-ul_fontTwo faj bg"},{default:l((()=>[(e(!0),a(n,null,s(v.fontTwoList,(o=>(e(),t(F,{class:c({bgColor:v.isFontTwoClass==o.value}),key:o.value,style:r(`fontSize:${2*o.value.replace("px","")}rpx`),onClick:e=>_.formatFn(o,"fontTwo")},{default:l((()=>[i(u(o.ico),1)])),_:2},1032,["class","style","onClick"])))),128))])),_:1})])),_:1}),o(F,{class:"editor-ul_label"},{default:l((()=>[i("文字颜色")])),_:1}),o(g,{class:"editor-ul_color faj bg"},{default:l((()=>[(e(!0),a(n,null,s(v.fontColorList,(l=>(e(),t(F,{class:c(["text",{selectFontColor:v.isFontColorClass==l.value}]),key:l.value,style:r({backgroundColor:l.value}),onClick:e=>_.formatFn(l,"color")},null,8,["class","style","onClick"])))),128))])),_:1}),o(F,{class:"editor-ul_label"},{default:l((()=>[i("高亮颜色")])),_:1}),o(g,{class:"editor-ul_color editor-ul_bgcolor faj bg"},{default:l((()=>[(e(!0),a(n,null,s(v.backgroundColorList,(l=>(e(),t(F,{class:c(["text",{selectFontColor:v.isBackgroundColorClass==l.value}]),key:l.value,style:r({backgroundColor:l.value}),onClick:e=>_.formatFn(l,"bgcolor")},null,8,["class","style","onClick"])))),128))])),_:1}),o(F,{class:"editor-ul_label"},{default:l((()=>[i("对齐方式")])),_:1}),o(g,{class:"editor-ul_align faj bg"},{default:l((()=>[(e(!0),a(n,null,s(v.aligenList,(l=>(e(),t(F,{class:c([{bgColor:v.isAligenListClass==l.value},"iconfont",l.ico]),key:l.value,onClick:e=>_.formatFn(l,"align")},null,8,["class","onClick"])))),128))])),_:1})])),_:1})}],["__scopeId","data-v-a0463a97"]]),Titlep:g({data:()=>({headerList:[{name:"header",value:"h1",ioc:"H1"},{name:"header",value:"h2",ioc:"H2"},{name:"header",value:"h3",ioc:"H3"},{name:"header",value:"h4",ioc:"H4"},{name:"header",value:"h5",ioc:"H5"},{name:"header",value:"h6",ioc:"H6"}],pUllist:[{name:"list",value:"ordered",ioc:"icon-24gl-ol"},{name:"list",value:"bullet",ioc:"icon-24gf-ul"},{name:"list",value:"check",ioc:"icon-liebiao5"}],isHeaderClass:""}),methods:{headerListFn(e){this.isHeaderClass=e.value,this.$emit("headerListFn_emit",e)},pUllistFn(e){this.isHeaderClass=e.value,this.$emit("pUllistFn_emit",e)}}},[["render",function(r,h,k,m,C,v){const _=d,F=f;return e(),t(F,{class:"titlep-warp"},{default:l((()=>[o(_,{class:"editor-ul_label"},{default:l((()=>[i("标题格式")])),_:1}),o(F,{class:"editor-ul_header faj bg"},{default:l((()=>[(e(!0),a(n,null,s(C.headerList,(o=>(e(),t(_,{class:c({bgColor:C.isHeaderClass==o.value}),key:o.value,onClick:e=>v.headerListFn(o)},{default:l((()=>[i(u(o.ioc),1)])),_:2},1032,["class","onClick"])))),128))])),_:1}),o(_,{class:"editor-ul_label"},{default:l((()=>[i("段落")])),_:1}),o(F,{class:"editor-ul_header faj bg"},{default:l((()=>[(e(!0),a(n,null,s(C.pUllist,(l=>(e(),t(_,{class:c([{bgColor:C.isHeaderClass==l.value},"iconfont",l.ioc]),key:l.value,onClick:e=>v.pUllistFn(l)},null,8,["class","onClick"])))),128))])),_:1})])),_:1})}],["__scopeId","data-v-9ba5fe7b"]])},props:{placeholder:{type:String,default:"尽情创造你的个人笔记吧"},content:{type:String,default:""}},name:"editor",data:()=>({editorCtx:null,editorBtnList:[{id:0,value:"Aa",check:!1},{id:1,value:"T",check:!1}],isSelectBtn:null,isReadOnly:!1,editeorLength:0,setTime:null}),watch:{content:{handler:function(e,t){e&&this.setValidationFn(e)},deep:!0,immediate:!0}},methods:{onEditorReady(){h().in(this).select("#editor").context((e=>{this.editorCtx=e.context,this.content&&this.setValidationFn(this.content)})).exec()},saveValidationFn(){let e=this;this.editorCtx.getContents({complete:function(t){e.$emit("saveValidation",t)}})},setValidationFn(e){let t=this;setTimeout((()=>{t.editorCtx.setContents({html:e,success:function(e){t.editorCtx.getContents({success:function(e){t.editeorLength=e.text.replace("\n","").length}})}})}),200)},editorBtnFn(e){this.editorBtnList.forEach((t=>{t.id==e.id?(e.check=!e.check,e.check?setTimeout((()=>{this.isSelectBtn=e.id}),100):setTimeout((()=>{this.isSelectBtn=null}),100)):t.check=!1}))},focusFn(e){null!==this.isSelectBtn&&(this.isSelectBtn=null,this.editorBtnList.forEach((e=>{e.check=!1})),this.$refs.fontSizecRef.styleList=[])},blurFn(){},onClickFn(e){document.activeElement.blur(),requestAnimationFrame((function(){document.activeElement.blur()}))},clearfontFn(){this.$refs.fontSizecRef.fontList.forEach((e=>{e.check=!1}))},headerListFn_emit(e){this.editorCtx.format(e.name,e.value),this.onClickFn()},pUllistFn_emit(e){this.editorCtx.format(e.name,e.value),this.onClickFn()},revokeFn(){this.editorCtx.undo(),this.onClickFn()},forwarpFn(){this.editorCtx.redo(),this.onClickFn()},editorInputFn(e){let t=e.detail.text.replace("\n","");this.setTime&&clearTimeout(this.setTime),this.setTime=setTimeout((()=>{this.editeorLength=t.length||0,this.$emit("saveContent",e.detail.html)}),500)}}},[["render",function(r,h,g,b,p,L){const x=_,y=F,T=f,w=d,S=k("FontSizec"),B=k("Titlep");return e(),t(T,{class:"editor-warp"},{default:l((()=>[o(T,{class:"editor-content"},{default:l((()=>[o(y,{"scroll-y":"true",style:{width:"100%"}},{default:l((()=>[o(x,{ref:"editorRef",id:"editor",onReady:L.onEditorReady,placeholder:g.placeholder,style:{width:"100%"},onClick:L.focusFn,onBlur:L.blurFn,onInput:L.editorInputFn},null,8,["onReady","placeholder","onClick","onBlur","onInput"])])),_:1})])),_:1}),o(T,{class:"editor-tool"},{default:l((()=>[o(T,{class:"editor-tool_ul faj"},{default:l((()=>[(e(!0),a(n,null,s(p.editorBtnList,(a=>(e(),t(T,{class:"editor-tool_li",key:a.id,onClick:e=>L.editorBtnFn(a)},{default:l((()=>[o(w,{class:c(["iconfont",{fontColor:a.check}])},{default:l((()=>[i(u(a.value),1)])),_:2},1032,["class"])])),_:2},1032,["onClick"])))),128)),o(T,{class:"editor-tool_li"},{default:l((()=>[o(w,{class:"editor-tool_revoke iconfont icon-chexiao",onClick:L.revokeFn},null,8,["onClick"]),o(w,{class:"editor-tool_forwarp iconfont icon-chexiao",onClick:L.forwarpFn},null,8,["onClick"])])),_:1})])),_:1}),o(T,{class:"editor-ul_ctool"},{default:l((()=>[o(y,{"scroll-y":"true",class:c(["scrollClassTwo",null!==p.isSelectBtn&&"scrollClass"])},{default:l((()=>[m(o(S,{editorCtx:p.editorCtx,ref:"fontSizecRef"},null,8,["editorCtx"]),[[C,0==p.isSelectBtn]]),1==p.isSelectBtn?(e(),t(B,{key:0,onHeaderListFn_emit:L.headerListFn_emit,onPUllistFn_emit:L.pUllistFn_emit},null,8,["onHeaderListFn_emit","onPUllistFn_emit"])):v("",!0)])),_:1},8,["class"])])),_:1})])),_:1})])),_:1})}],["__scopeId","data-v-94f2e0aa"]]);export{b as c};