import{W as c,M as p,C as m,c as a,a as l,g as h,U as u,F as y,b as C,p as f,f as b,h as E}from"./Wrapper-Ck4XUQ1b.chunk.mjs";import{w as d,p as n}from"./vue.runtime.esm-B7-PK3p1.chunk.mjs";import{E as $}from"./MediaHandler.provider-BR4dIijC.chunk.mjs";import{n as O}from"./NcCheckboxRadioSwitch-DJmw98x9-DtB-K1TF.chunk.mjs";import"./NcLoadingIcon-CSiR05rb.chunk.mjs";import"./emoji-picker-hi3Hwbeu.chunk.mjs";import"./index-CdM8BgQf.chunk.mjs";import"./index-DCzdQJ7L.chunk.mjs";import"./logger-DS8A9d_w.chunk.mjs";import"./index-Bnw2WuIx.chunk.mjs";import"./index-D3wiQe9-.chunk.mjs";import"./preload-helper-BorfeO-5.chunk.mjs";import"./NcNoteCard-CwNXZ4vV-DTkhwURa.chunk.mjs";const g={name:"PlainTableContentEditor",components:{ContentContainer:m,MainContainer:p,Wrapper:c},props:{content:{type:String,required:!0},readOnly:{type:Boolean,default:!1}},emits:["update:content"],setup(t){const e=[h,u,y],r=new l({extensions:e}),{setEditable:s,setContent:i}=C(r);return d(()=>t.content,o=>{i(o)}),s(!t.readOnly),d(()=>t.readOnly,o=>{s(!o)}),f(r),n(b,{isPublic:!1,isRichEditor:!0,isRichWorkspace:!1,useTableOfContents:!1}),n(E,null),n($,!1),{editor:r,setContent:i}},created(){this.setContent(this.content,{addToHistory:!1}),this.editor.on("create",()=>{this.$emit("ready"),this.$parent.$emit("ready");try{const t=a(this.editor.schema).serialize(this.editor.state.doc);this.emit("create:content",{json:this.editor.state.doc,markdown:t})}catch(t){console.error("Error serializing table:",t)}}),this.editor.on("update",({editor:t})=>{try{const e=a(t.schema).serialize(t.state.doc);this.emit("update:content",{json:t.state.doc,markdown:e})}catch(e){console.error("Error serializing table:",e)}})},beforeDestroy(){this.editor.destroy()},methods:{emit(t,e){this.$emit(t,e),this.$parent?.$emit(t,e)}}};var w=function(){var t=this,e=t._self._c;return e("Wrapper",{attrs:{"content-loaded":!0}},[e("MainContainer",[e("ContentContainer",{attrs:{"read-only":t.readOnly}})],1)],1)},z=[],v=O(g,w,z,!1,null,null);const H=v.exports;export{H as default};
//# sourceMappingURL=PlainTableContentEditor-PRywEdHm.chunk.mjs.map
