f7cloud_client/apps/text/js/text-editor.mjs
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

6 lines
6.4 KiB
JavaScript

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('text', '', 'js/MarkdownContentEditor-URxyNSkx.chunk.mjs'),window.OC.filePath('text', '', 'js/EditorOutline-CZg3-0Pd.chunk.mjs'),window.OC.filePath('text', '', 'js/NcLoadingIcon-zQCGdPwE.chunk.mjs'),window.OC.filePath('text', '', 'js/emoji-picker-B23JpFV7.chunk.mjs'),window.OC.filePath('text', '', 'js/index-CYtgifWR.chunk.mjs'),window.OC.filePath('text', '', 'js/vue.runtime.esm-fahCO3eG.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DxwFe63_.chunk.mjs'),window.OC.filePath('text', '', 'css/NcLoadingIcon-CAC0K4sG.chunk.css'),window.OC.filePath('text', '', 'js/logger-DEhDull1.chunk.mjs'),window.OC.filePath('text', '', 'js/index-D3wiQe9-.chunk.mjs'),window.OC.filePath('text', '', 'js/NcNoteCard-CwNXZ4vV-dRcgmGN6.chunk.mjs'),window.OC.filePath('text', '', 'css/NcNoteCard-CwNXZ4vV-GaPUWc2b.chunk.css'),window.OC.filePath('text', '', 'js/NcCheckboxRadioSwitch-CX3HXCEk-BE36-0KV.chunk.mjs'),window.OC.filePath('text', '', 'css/NcCheckboxRadioSwitch-CX3HXCEk-35V8jJy1.chunk.css'),window.OC.filePath('text', '', 'js/_plugin-vue2_normalizer-wd1ZAbRr.chunk.mjs'),window.OC.filePath('text', '', 'js/MediaHandler.provider-BQ5p2YTP.chunk.mjs'),window.OC.filePath('text', '', 'css/EditorOutline-BRhtHk_U.chunk.css'),window.OC.filePath('text', '', 'js/MenuBar-CAS7O4-V.chunk.mjs'),window.OC.filePath('text', '', 'js/Wrapper-CwuUv6cL.chunk.mjs'),window.OC.filePath('text', '', 'css/Wrapper-CAXM0PfC.chunk.css'),window.OC.filePath('text', '', 'css/MenuBar-BUES5ttt.chunk.css'),window.OC.filePath('text', '', 'js/index-DbAfJFk8.chunk.mjs'),window.OC.filePath('text', '', 'css/MarkdownContentEditor-CMPQ_96l.chunk.css'),window.OC.filePath('text', '', 'js/Editor-C2Tl2vkV.chunk.mjs'),window.OC.filePath('text', '', 'js/index-CULZQJrn.chunk.mjs'),window.OC.filePath('text', '', 'js/dav-Rt1kTtvI-PDCKXEjH.chunk.mjs'),window.OC.filePath('text', '', 'css/Editor-DOji7-cc.chunk.css'),window.OC.filePath('text', '', 'js/PlainTableContentEditor-D9kaqeFe.chunk.mjs')])))=>i.map(i=>d[i]);
import{_ as y,s as $}from"./index-CYtgifWR.chunk.mjs";import{V as m}from"./vue.runtime.esm-fahCO3eG.chunk.mjs";import{o as I,A as P,O as S,H as k,a as E,E as M,b as H}from"./MediaHandler.provider-BQ5p2YTP.chunk.mjs";import"./emoji-picker-B23JpFV7.chunk.mjs";import"./index-D3wiQe9-.chunk.mjs";import"./index-DxwFe63_.chunk.mjs";import"./logger-DEhDull1.chunk.mjs";const j="1.2";window.OCA.Text={...window.OCA.Text};class f{#e;#n;constructor(e,t){return this.#e=e,this.#n=t,this.#o(),this}#t(){return this.#e.$children[0]}onCreate(e=()=>{}){return this.#e.$on("create:content",t=>{e(t)}),this}onLoaded(e=()=>{}){return this.#e.$on("ready",()=>{e()}),this}onUpdate(e=()=>{}){return this.#e.$on("update:content",t=>{e(t)}),this}onOutlineToggle(e=()=>{}){return this.#e.$on("outline-toggled",t=>{e(t)}),this}onSearch(e=()=>{}){return $("text:editor:search-results",e),this}render(e){e.innerHTML="";const t=document.createElement("div");return e.appendChild(t),this.#e.$mount(t),this}destroy(){this.#e.$destroy(),this.#e.$el.innerHTML=""}setContent(e){return this.#e.$set(this.#n,"content",e),this.#t()?.setContent?.(e),this}getHTML(){return this.#t()?.editor?.getHTML()}setSearchQuery(e,t){this.#t()?.editor?.commands.setSearchQuery(e,t)}searchNext(){this.#t()?.editor?.commands.nextMatch()}searchPrevious(){this.#t()?.editor?.commands.previousMatch()}async save(){return this.#t().save?.()}setShowOutline(e){return this.#e.$set(this.#n,"showOutlineOutside",e),this}setReadOnly(e){return this.#e.$set(this.#n,"readOnly",e),this}updateReadonlyBarProps(e){return this.#e.$set(this.#n,"readonlyBarProps",e),this}insertAtCursor(e){this.#t().editor?.chain().insertContent(e).focus().run()}focus(){this.#t().editor?.commands.focus()}debugYjs(){const e=this.#t().debugYjsData();console.warn(JSON.stringify(e,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".')}#o(){window?._oc_debug&&(this.vm=this.#e,window.OCA.Text._debug=[...window.OCA.Text._debug??[],this])}}window.OCA.Text.apiVersion=j,window.OCA.Text.createEditor=async function({el:u,fileId:e=void 0,useSession:t=!0,filePath:l=void 0,shareToken:s=null,content:c="",readOnly:h=!1,autofocus:i=!0,readonlyBar:o={component:null,props:null},onCreate:O=({markdown:p})=>{},onLoaded:a=()=>{},onUpdate:v=({markdown:p})=>{},onOutlineToggle:g=p=>{},onFileInsert:C=void 0,onMentionSearch:T=void 0,onMentionInsert:_=void 0,openLinkHandler:b=void 0,onSearch:L=void 0}){const{default:p}=await y(async()=>{const{default:n}=await import("./MarkdownContentEditor-URxyNSkx.chunk.mjs");return{default:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]),import.meta.url),{default:x}=await y(async()=>{const{default:n}=await import("./Editor-C2Tl2vkV.chunk.mjs").then(d=>d.a);return{default:n}},__vite__mapDeps([23,4,3,24,2,5,6,7,25,10,9,11,18,1,8,12,13,14,15,16,19,17,20,26]),import.meta.url),r=m.observable({showOutlineOutside:!1,readonlyBarProps:o.props,readOnly:h,content:c}),w=e&&t,A=new m({provide(){return{[H]:C,[M]:!!w,[E]:w?!0:T,[k]:w?!0:_,[S]:{openLink:b||I},[P]:{resolve(n,d){return[{type:"image",url:n}]}}}},data(){return r},render:n=>{const d=o?.component?{readonlyBar:()=>n(o.component,{props:r.readonlyBarProps})}:{};return w?n(x,{props:{fileId:e,relativePath:l,shareToken:s,mime:"text/markdown",active:!0,autofocus:i,showOutlineOutside:r.showOutlineOutside},scopedSlots:d}):n(p,{props:{fileId:e,content:r.content,relativePath:l,shareToken:s,readOnly:r.readOnly,showOutlineOutside:r.showOutlineOutside},scopedSlots:d})}});return new f(A,r).onCreate(O).onLoaded(a).onUpdate(v).onOutlineToggle(g).onSearch(L).render(u)},window.OCA.Text.createTable=async function({el:u,content:e="",readOnly:t=!1,autofocus:l=!0,onCreate:s=({markdown:i})=>{},onLoaded:c=()=>{},onUpdate:h=({markdown:i})=>{}}){const{default:i}=await y(async()=>{const{default:a}=await import("./PlainTableContentEditor-D9kaqeFe.chunk.mjs");return{default:a}},__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,21,18,19]),import.meta.url),o=m.observable({readOnly:t,content:e}),O=new m({data(){return o},render:a=>a(i,{props:{content:o.content,readOnly:o.readOnly,showOutlineOutside:!1}})});return new f(O,o).onCreate(s).onLoaded(c).onUpdate(h).render(u)};
//# sourceMappingURL=text-editor.mjs.map