const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('text', '', 'js/MarkdownContentEditor-BJMoEscS.chunk.mjs'),window.OC.filePath('text', '', 'js/Wrapper-DqEnz7y4.chunk.mjs'),window.OC.filePath('text', '', 'js/vue.runtime.esm-C7aVrvtW.chunk.mjs'),window.OC.filePath('text', '', 'js/NcColorPicker-XDaKLzO9.chunk.mjs'),window.OC.filePath('text', '', 'js/index-y0wjO9Xi.chunk.mjs'),window.OC.filePath('text', '', 'js/modulepreload-polyfill-Pz2ckkzf.chunk.mjs'),window.OC.filePath('text', '', 'js/emoji-picker-DlAAdvrL.chunk.mjs'),window.OC.filePath('text', '', 'js/_plugin-vue2_normalizer-wd1ZAbRr.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DawQzGlC.chunk.mjs'),window.OC.filePath('text', '', 'js/NcLoadingIcon-CHw5fok5.chunk.mjs'),window.OC.filePath('text', '', 'css/NcLoadingIcon-CFe6qyTF.chunk.css'),window.OC.filePath('text', '', 'js/NcCheckboxRadioSwitch-ip_mRd2T-kNk9kCSa.chunk.mjs'),window.OC.filePath('text', '', 'css/NcCheckboxRadioSwitch-ip_mRd2T-Bebqso8K.chunk.css'),window.OC.filePath('text', '', 'js/NcNoteCard-ChweF_5Q-B9TcuHH8.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DfiDB3im.chunk.mjs'),window.OC.filePath('text', '', 'css/NcNoteCard-ChweF_5Q-DY8mPymx.chunk.css'),window.OC.filePath('text', '', 'js/MediaHandler.provider-_u2LRYyP.chunk.mjs'),window.OC.filePath('text', '', 'js/logger-Bvti-6nU.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DJ2hczD-.chunk.mjs'),window.OC.filePath('text', '', 'css/NcColorPicker-DdkqwxF4.chunk.css'),window.OC.filePath('text', '', 'css/Wrapper-TpwULYFq.chunk.css'),window.OC.filePath('text', '', 'css/MarkdownContentEditor-BN-uFoRR.chunk.css'),window.OC.filePath('text', '', 'js/Editor-DyiZA1ob.chunk.mjs'),window.OC.filePath('text', '', 'js/index-D86mgGtX.chunk.mjs'),window.OC.filePath('text', '', 'css/Editor-BBVTY_PD.chunk.css')])))=>i.map(i=>d[i]);
import{_ as m,s as A}from"./modulepreload-polyfill-Pz2ckkzf.chunk.mjs";import{V as s}from"./vue.runtime.esm-C7aVrvtW.chunk.mjs";import{s as S}from"./index-DawQzGlC.chunk.mjs";import{A as I,E as P,H as L,a as k,O as E,o as j,b as M}from"./MediaHandler.provider-_u2LRYyP.chunk.mjs";import"./emoji-picker-DlAAdvrL.chunk.mjs";import"./index-y0wjO9Xi.chunk.mjs";import"./index-DfiDB3im.chunk.mjs";import"./logger-Bvti-6nU.chunk.mjs";import"./index-DJ2hczD-.chunk.mjs";const B="1.2";s.prototype.t=window.t,s.prototype.n=window.n,s.prototype.OCA=window.OCA,window.OCA.Text={...window.OCA.Text};class H{#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 A("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=B,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:C=void 0,onMentionSearch:g=void 0,onMentionInsert:$=void 0,openLinkHandler:T=void 0,onSearch:b=void 0}){const{default:i}=await m(async()=>{const{default:o}=await import("./MarkdownContentEditor-BJMoEscS.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,20,21]),import.meta.url),{default:_}=await m(async()=>{const{default:o}=await import("./Editor-DyiZA1ob.chunk.mjs").then(r=>r.b);return{default:o}},__vite__mapDeps([22,5,6,2,14,13,9,10,15,23,4,18,3,7,8,11,12,16,17,19,1,20,24]),import.meta.url),n=s.observable({showOutlineOutside:!1,readonlyBarProps:u.props,readOnly:p,content:c}),a=t&&e,x=new s({provide(){return{[I]:C,[P]:!!a,[L]:a?!0:g,[k]:a?!0:$,[E]:{openLink:T||j},[M]:{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(_,{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:S});return new H(x,n).onCreate(O).onLoaded(y).onUpdate(f).onOutlineToggle(v).onSearch(b).render(l)};
//# sourceMappingURL=text-editor.mjs.map
