text/js/text-editors.mjs

4 строки
6.3 KiB
JavaScript

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('text', '', 'js/MarkdownContentEditor-B8rZEbAF.chunk.mjs'),window.OC.filePath('text', '', 'js/Wrapper-CqeHBx_S.chunk.mjs'),window.OC.filePath('text', '', 'js/vue.runtime.esm-fZsuJKoo.chunk.mjs'),window.OC.filePath('text', '', 'js/RichText-Cc-yfyjL.chunk.mjs'),window.OC.filePath('text', '', 'js/_plugin-vue2_normalizer-XF5BqDH-.chunk.mjs'),window.OC.filePath('text', '', 'js/public-CBtR8U5E.chunk.mjs'),window.OC.filePath('text', '', 'js/emoji-picker-SoWZqoso.chunk.mjs'),window.OC.filePath('text', '', 'js/index-Ubm2itxG.chunk.mjs'),window.OC.filePath('text', '', 'css/public-8w2LAIqc.chunk.css'),window.OC.filePath('text', '', 'js/index-WINsn-uD.chunk.mjs'),window.OC.filePath('text', '', 'js/modulepreload-polyfill-DMTabKmO.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DkzhscpN.chunk.mjs'),window.OC.filePath('text', '', 'css/_plugin-vue2_normalizer-BVpmSrje.chunk.css'),window.OC.filePath('text', '', 'js/index-hXSjL27_.chunk.mjs'),window.OC.filePath('text', '', 'js/MediaHandler.provider-CSBQhvYP.chunk.mjs'),window.OC.filePath('text', '', 'js/logger-B4T8Bva5.chunk.mjs'),window.OC.filePath('text', '', 'js/_plugin-vue2_normalizer-CQ6iBklL-DSXPAugt.chunk.mjs'),window.OC.filePath('text', '', 'css/RichText-C17nUFcp.chunk.css'),window.OC.filePath('text', '', 'js/index-CyNrdWBa.chunk.mjs'),window.OC.filePath('text', '', 'css/Wrapper-9Tt0kL-G.chunk.css'),window.OC.filePath('text', '', 'css/MarkdownContentEditor-DbRr9cV9.chunk.css'),window.OC.filePath('text', '', 'js/Editor-C8UNDiLA.chunk.mjs'),window.OC.filePath('text', '', 'js/_commonjs-dynamic-modules-CSduYUN4.chunk.mjs'),window.OC.filePath('text', '', 'css/Editor-D1A8pt8B.chunk.css')])))=>i.map(i=>d[i]);
/*! third party licenses: js/vendor.LICENSE.txt */
var T=o=>{throw TypeError(o)};var v=(o,t,e)=>t.has(o)||T("Cannot "+e);var n=(o,t,e)=>(v(o,t,"read from private field"),e?e.call(o):t.get(o)),y=(o,t,e)=>t.has(o)?T("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),g=(o,t,e,i)=>(v(o,t,"write to private field"),i?i.call(o,e):t.set(o,e),e),a=(o,t,e)=>(v(o,t,"access private method"),e);import{_ as b,s as R}from"./modulepreload-polyfill-DMTabKmO.chunk.mjs";import{V as m}from"./vue.runtime.esm-fZsuJKoo.chunk.mjs";import{s as V}from"./index-hXSjL27_.chunk.mjs";import{A as D,E as H,H as N,a as U,b as Y}from"./MediaHandler.provider-CSBQhvYP.chunk.mjs";import"./emoji-picker-SoWZqoso.chunk.mjs";import"./index-WINsn-uD.chunk.mjs";import"./logger-B4T8Bva5.chunk.mjs";import"./index-DkzhscpN.chunk.mjs";const F="1.2";m.prototype.t=window.t,m.prototype.n=window.n,m.prototype.OCA=window.OCA,window.OCA.Text={...window.OCA.Text};var r,u,s,h,_;class Q{constructor(t,e){y(this,s);y(this,r);y(this,u);return g(this,r,t),g(this,u,e),a(this,s,_).call(this),this}onCreate(t=()=>{}){return n(this,r).$on("create:content",e=>{t(e)}),this}onLoaded(t=()=>{}){return n(this,r).$on("ready",()=>{t()}),this}onUpdate(t=()=>{}){return n(this,r).$on("update:content",e=>{t(e)}),this}onOutlineToggle(t=()=>{}){return n(this,r).$on("outline-toggled",e=>{t(e)}),this}onSearch(t=()=>{}){return R("text:editor:search-results",t),this}render(t){t.innerHTML="";const e=document.createElement("div");return t.appendChild(e),n(this,r).$mount(e),this}destroy(){n(this,r).$destroy(),n(this,r).$el.innerHTML=""}setContent(t){var e,i;return n(this,r).$set(n(this,u),"content",t),(i=(e=a(this,s,h).call(this))==null?void 0:e.setContent)==null||i.call(e,t),this}setSearchQuery(t,e){var i;((i=a(this,s,h).call(this))==null?void 0:i.$editor).commands.setSearchQuery(t,e)}searchNext(){var t;((t=a(this,s,h).call(this))==null?void 0:t.$editor).commands.nextMatch()}searchPrevious(){var t;((t=a(this,s,h).call(this))==null?void 0:t.$editor).commands.previousMatch()}async save(){var t,e;return(e=(t=a(this,s,h).call(this)).save)==null?void 0:e.call(t)}setShowOutline(t){return n(this,r).$set(n(this,u),"showOutlineOutside",t),this}setReadOnly(t){return n(this,r).$set(n(this,u),"readOnly",t),this}updateReadonlyBarProps(t){return n(this,r).$set(n(this,u),"readonlyBarProps",t),this}insertAtCursor(t){a(this,s,h).call(this).$editor.chain().insertContent(t).focus().run()}focus(){a(this,s,h).call(this).$editor.commands.focus()}debugYjs(){const t=a(this,s,h).call(this).debugYjsData();console.warn(JSON.stringify(t,null," ")),console.warn("%c%s\n%c%s\n%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".')}}r=new WeakMap,u=new WeakMap,s=new WeakSet,h=function(){return n(this,r).$children[0]},_=function(){var t;window!=null&&window._oc_debug&&(this.vm=n(this,r),window.OCA.Text._debug=[...(t=window.OCA.Text._debug)!=null?t:[],this])};window.OCA.Text.apiVersion=F,window.OCA.Text.createEditor=async function({el:o,fileId:t=void 0,useSession:e=!0,filePath:i=void 0,shareToken:f=null,content:C="",readOnly:$=!1,autofocus:x=!0,readonlyBar:l={component:null,props:null},onCreate:A=({markdown:w})=>{},onLoaded:S=()=>{},onUpdate:I=({markdown:w})=>{},onOutlineToggle:P=w=>{},onFileInsert:E=void 0,onMentionSearch:k=void 0,onMentionInsert:L=void 0,onSearch:M=void 0}){const{default:w}=await b(async()=>{const{default:d}=await import("./MarkdownContentEditor-B8rZEbAF.chunk.mjs");return{default:d}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]),import.meta.url),{default:j}=await b(async()=>{const{default:d}=await import("./Editor-C8UNDiLA.chunk.mjs").then(p=>p.b);return{default:d}},__vite__mapDeps([21,10,6,2,7,3,4,5,8,9,11,12,13,14,15,16,17,1,18,19,22,23]),import.meta.url),c=m.observable({showOutlineOutside:!1,readonlyBarProps:l.props,readOnly:$,content:C}),O=t&&e,B=new m({provide(){return{[D]:E,[H]:!!O,[N]:O?!0:k,[U]:O?!0:L,[Y]:{resolve(d,p){return[{type:"image",url:d}]}}}},data(){return c},render:d=>{const p=l!=null&&l.component?{readonlyBar:()=>d(l.component,{props:c.readonlyBarProps})}:{};return O?d(j,{props:{fileId:t,relativePath:i,shareToken:f,mime:"text/markdown",active:!0,autofocus:x,showOutlineOutside:c.showOutlineOutside},scopedSlots:p}):d(w,{props:{fileId:t,content:c.content,relativePath:i,shareToken:f,readOnly:c.readOnly,showOutlineOutside:c.showOutlineOutside},scopedSlots:p})},store:V});return new Q(B,c).onCreate(A).onLoaded(S).onUpdate(I).onOutlineToggle(P).onSearch(M).render(o)};