const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('text', '', 'js/MarkdownContentEditor-CvlD7ZLn.chunk.mjs'),window.OC.filePath('text', '', 'js/Wrapper-w0Q3uzRB.chunk.mjs'),window.OC.filePath('text', '', 'js/vue.runtime.esm-Dc6Ai3V6.chunk.mjs'),window.OC.filePath('text', '', 'js/EditorOutline-CKm1KV5O.chunk.mjs'),window.OC.filePath('text', '', 'js/index-CxpdPuya.chunk.mjs'),window.OC.filePath('text', '', 'js/modulepreload-polyfill-DE-oIJqv.chunk.mjs'),window.OC.filePath('text', '', 'js/emoji-picker-KVqjnXYv.chunk.mjs'),window.OC.filePath('text', '', 'js/isDarkTheme-DN65eYwk.chunk.mjs'),window.OC.filePath('text', '', 'js/NcNoteCard-C6xb7vi0-BRGoKl96.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DfiDB3im.chunk.mjs'),window.OC.filePath('text', '', 'css/NcNoteCard-C6xb7vi0-DG0nQhh6.chunk.css'),window.OC.filePath('text', '', 'js/index-Bc2S5k6V.chunk.mjs'),window.OC.filePath('text', '', 'css/isDarkTheme-qC8o6FCo.chunk.css'),window.OC.filePath('text', '', 'js/_plugin-vue2_normalizer-D_fqBVIr-DX-60dWK.chunk.mjs'),window.OC.filePath('text', '', 'js/index-_3zL-15V.chunk.mjs'),window.OC.filePath('text', '', 'js/MediaHandler.provider-D9rjA3a6.chunk.mjs'),window.OC.filePath('text', '', 'js/logger-BOSm1sVH.chunk.mjs'),window.OC.filePath('text', '', 'css/EditorOutline-Bwzui29R.chunk.css'),window.OC.filePath('text', '', 'css/Wrapper-B_aue_EG.chunk.css'),window.OC.filePath('text', '', 'css/MarkdownContentEditor-DTKD2wCg.chunk.css'),window.OC.filePath('text', '', 'js/Editor-CeoeWHBs.chunk.mjs'),window.OC.filePath('text', '', 'js/index-4461NC0J.chunk.mjs'),window.OC.filePath('text', '', 'css/Editor-DaBIVJyP.chunk.css')])))=>i.map(i=>d[i]);
import{_ as m,s as x}from"./modulepreload-polyfill-DE-oIJqv.chunk.mjs";import{V as s}from"./vue.runtime.esm-Dc6Ai3V6.chunk.mjs";import{s as A}from"./index-_3zL-15V.chunk.mjs";import{A as S,E as I,H as P,a as E,b as k}from"./MediaHandler.provider-D9rjA3a6.chunk.mjs";import"./emoji-picker-KVqjnXYv.chunk.mjs";import"./index-CxpdPuya.chunk.mjs";import"./logger-BOSm1sVH.chunk.mjs";import"./index-Bc2S5k6V.chunk.mjs";const L="1.2";s.prototype.t=window.t,s.prototype.n=window.n,s.prototype.OCA=window.OCA,window.OCA.Text={...window.OCA.Text};class M{#t;#o;constructor(t,e){return this.#t=t,this.#o=e,this.#n(),this}#e(){return this.#t.$children[0]}onCreate(t=()=>{}){return this.#t.$on("create:content",e=>{t(e)}),this}onLoaded(t=()=>{}){return this.#t.$on("ready",()=>{t()}),this}onUpdate(t=()=>{}){return this.#t.$on("update:content",e=>{t(e)}),this}onOutlineToggle(t=()=>{}){return this.#t.$on("outline-toggled",e=>{t(e)}),this}onSearch(t=()=>{}){return x("text:editor:search-results",t),this}render(t){t.innerHTML="";const e=document.createElement("div");return t.appendChild(e),this.#t.$mount(e),this}destroy(){this.#t.$destroy(),this.#t.$el.innerHTML=""}setContent(t){return this.#t.$set(this.#o,"content",t),this.#e()?.setContent?.(t),this}setSearchQuery(t,e){(this.#e()?.$editor).commands.setSearchQuery(t,e)}searchNext(){(this.#e()?.$editor).commands.nextMatch()}searchPrevious(){(this.#e()?.$editor).commands.previousMatch()}async save(){return this.#e().save?.()}setShowOutline(t){return this.#t.$set(this.#o,"showOutlineOutside",t),this}setReadOnly(t){return this.#t.$set(this.#o,"readOnly",t),this}updateReadonlyBarProps(t){return this.#t.$set(this.#o,"readonlyBarProps",t),this}insertAtCursor(t){this.#e().$editor.chain().insertContent(t).focus().run()}focus(){this.#e().$editor.commands.focus()}debugYjs(){const t=this.#e().debugYjsData();console.warn(JSON.stringify(t,null," ")),console.warn(`%c%s
%c%s
%s`,"font-weight: bold;",'Editor Yjs debug data. Copy the object below that starts with "clientId".',"font-weight: normal; font-style: italic;",'- In Chrome, select "Copy" at the end of the line.','- In Firefox, right-click on the object and select "Copy object".')}#n(){window?._oc_debug&&(this.vm=this.#t,window.OCA.Text._debug=[...window.OCA.Text._debug??[],this])}}window.OCA.Text.apiVersion=L,window.OCA.Text.createEditor=async function({el:l,fileId:t=void 0,useSession:e=!0,filePath:d=void 0,shareToken:h=null,content:c="",readOnly:p=!1,autofocus:w=!0,readonlyBar:u={component:null,props:null},onCreate:O=({markdown:i})=>{},onLoaded:y=()=>{},onUpdate:f=({markdown:i})=>{},onOutlineToggle:v=i=>{},onFileInsert:g=void 0,onMentionSearch:C=void 0,onMentionInsert:$=void 0,onSearch:T=void 0}){const{default:i}=await m(async()=>{const{default:o}=await import("./MarkdownContentEditor-CvlD7ZLn.chunk.mjs");return{default:o}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),import.meta.url),{default:b}=await m(async()=>{const{default:o}=await import("./Editor-CeoeWHBs.chunk.mjs").then(r=>r.b);return{default:o}},__vite__mapDeps([20,5,6,2,9,8,10,21,13,11,4,3,7,12,14,15,16,17,1,18,22]),import.meta.url),n=s.observable({showOutlineOutside:!1,readonlyBarProps:u.props,readOnly:p,content:c}),a=t&&e,_=new s({provide(){return{[S]:g,[I]:!!a,[P]:a?!0:C,[E]:a?!0:$,[k]:{resolve(o,r){return[{type:"image",url:o}]}}}},data(){return n},render:o=>{const r=u?.component?{readonlyBar:()=>o(u.component,{props:n.readonlyBarProps})}:{};return a?o(b,{props:{fileId:t,relativePath:d,shareToken:h,mime:"text/markdown",active:!0,autofocus:w,showOutlineOutside:n.showOutlineOutside},scopedSlots:r}):o(i,{props:{fileId:t,content:n.content,relativePath:d,shareToken:h,readOnly:n.readOnly,showOutlineOutside:n.showOutlineOutside},scopedSlots:r})},store:A});return new M(_,n).onCreate(O).onLoaded(y).onUpdate(f).onOutlineToggle(v).onSearch(T).render(l)};
//# sourceMappingURL=text-editor.mjs.map
