import{W as l,M as h,C as u,c as i,m as a,E as y,a as f,p as C,u as b,e as E}from"./Wrapper-CGFHLFhQ.chunk.mjs";import{H as $}from"./index-BuYpjlUg.chunk.mjs";import{w as s,p as c}from"./vue.runtime.esm-BeQ812EV.chunk.mjs";import{E as w}from"./MediaHandler.provider-DxrIedPV.chunk.mjs";import{n as z}from"./_plugin-vue2_normalizer-wd1ZAbRr.chunk.mjs";import"./NcLoadingIcon-cTopO8-o.chunk.mjs";import"./emoji-picker-B23JpFV7.chunk.mjs";import"./index-D3QPwoaU.chunk.mjs";import"./index-DxwFe63_.chunk.mjs";import"./logger-DztlavSi.chunk.mjs";import"./index-D3wiQe9-.chunk.mjs";import"./NcCheckboxRadioSwitch-D4IV4zWy-Cnxtub33.chunk.mjs";import"./NcNoteCard-CwNXZ4vV-D7CiCihS.chunk.mjs";const O={name:"PlainTableContentEditor",components:{ContentContainer:u,MainContainer:h,Wrapper:l},props:{content:{type:String,default:""},readOnly:{type:Boolean,default:!1}},emits:["update:content","ready","create:content"],setup(t){const e=a.render(t.content),d=[f,$],r=new y({content:e,extensions:d,editable:!t.readOnly}),{setEditable:m,setContent:n}=b(r);return s(()=>t.content,o=>{const p=a.render(o);n(p)}),s(()=>t.readOnly,o=>{m(!o)}),C(r),c(E,{isPublic:!1,isRichEditor:!1,isRichWorkspace:!1}),c(w,!1),{editor:r,setContent:n}},created(){this.editor.on("create",()=>{this.$emit("ready"),this.$parent.$emit("ready");try{const t=i(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=i(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 g=function(){var t=this,e=t._self._c;return e("Wrapper",{attrs:{"content-loaded":!0,"show-outline-outside":!1}},[e("MainContainer",[e("ContentContainer",{attrs:{"read-only":t.readOnly}})],1)],1)},k=[],x=z(O,g,k,!1,null,null);const A=x.exports;export{A as default};
//# sourceMappingURL=PlainTableContentEditor-DFUQeW8M.chunk.mjs.map
