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,p as C,b as f,f as b,h as E}from"./Wrapper-CRloqIX3.chunk.mjs";import{w as d,p as n}from"./vue.runtime.esm-BF-IvmLA.chunk.mjs";import{E as $}from"./MediaHandler.provider-JHoeYdEY.chunk.mjs";import{n as O}from"./NcCheckboxRadioSwitch-D4IV4zWy-C7R54kfi.chunk.mjs";import"./NcLoadingIcon-CVPmhDs9.chunk.mjs";import"./emoji-picker-C0wQOMkK.chunk.mjs";import"./index-BBRfwPzy.chunk.mjs";import"./logger-Cig2S1Ru.chunk.mjs";import"./index-zDAq7SQt.chunk.mjs";import"./index-Dl858C8_.chunk.mjs";import"./preload-helper-BorfeO-5.chunk.mjs";import"./NcNoteCard-CwNXZ4vV-CGCPj_4W.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}=f(r);return d(()=>t.content,o=>{i(o)}),s(!t.readOnly),d(()=>t.readOnly,o=>{s(!o)}),C(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=[],x=O(g,w,z,!1,null,null);const F=x.exports;export{F as default};
//# sourceMappingURL=PlainTableContentEditor-BzyAKIf6.chunk.mjs.map
