BookStack/public/dist/app.js

34 lines
176 KiB
JavaScript
Raw Normal View History

// See the "/licenses" URI for full package license details
var Xn=Object.defineProperty;var yo=(i,t,e)=>t in i?Xn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var fe=(i,t)=>{for(var e in t)Xn(i,e,{get:t[e],enumerable:!0})};var U=(i,t,e)=>(yo(i,typeof t!="symbol"?t+"":t,e),e),Co=(i,t,e)=>{if(!t.has(i))throw TypeError("Cannot "+e)};var Yi=(i,t,e)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,e)};var jt=(i,t,e)=>(Co(i,t,"access private method"),e);var Qi={};fe(Qi,{emit:()=>Zi,emitPublic:()=>So,error:()=>Ji,listen:()=>xo,showResponseError:()=>$o,showValidationErrors:()=>Lo,success:()=>ko});var me={},Eo=[];function Zi(i,t){Eo.push({name:i,data:t});let e=me[i]||[];for(let n of e)n(t)}function xo(i,t){typeof me[i]>"u"&&(me[i]=[]),me[i].push(t)}function So(i,t,e){let n=new CustomEvent(t,{detail:e,bubbles:!0});i.dispatchEvent(n)}function ko(i){Zi("success",i)}function Ji(i){Zi("error",i)}function Lo(i){if(i.status&&i.status===422&&i.data){let t=Object.values(i.data).flat().join(`
`);Ji(t)}}function $o(i){i.status&&i.status>=400&&i.data&&i.data.message&&Ji(i.data.message)}var tn={};fe(tn,{HttpError:()=>ge,createXMLHttpRequest:()=>Do,delete:()=>Po,get:()=>Ao,patch:()=>Bo,post:()=>Io,put:()=>Mo});async function To(i){if(i.status===204)return null;let e=(i.headers.get("Content-Type")||"").split(";")[0].split("/").pop();return e==="javascript"||e==="json"?i.json():i.text()}var ge=class extends Error{constructor(t,e){super(t.statusText),this.data=e,this.headers=t.headers,this.redirected=t.redirected,this.status=t.status,this.statusText=t.statusText,this.url=t.url,this.original=t}};function Do(i,t,e={}){let n=document.querySelector("meta[name=token]").getAttribute("content"),s=new XMLHttpRequest;for(let[o,r]of Object.entries(e))s.addEventListener(o,r.bind(s));return s.open(i,t),s.withCredentials=!0,s.setRequestHeader("X-CSRF-TOKEN",n),s}async function Gn(i,t={}){let e=i;if(e.startsWith("http")||(e=window.baseUrl(e)),t.params){let l=new URL(e);for(let c of Object.keys(t.params)){let h=t.params[c];typeof h<"u"&&h!==null&&l.searchParams.set(c,h)}e=l.toString()}let n=document.querySelector("meta[name=token]").getAttribute("content"),s={...t,credentials:"same-origin"};s.headers={...s.headers||{},baseURL:window.baseUrl(""),"X-CSRF-TOKEN":n};let o=await fetch(e,s),r=await To(o),a={data:r,headers:o.headers,redirected:o.redirected,status:o.status,statusText:o.statusText,url:o.url,original:o};if(!o.ok)throw new ge(o,r);return a}async function we(i,t,e=null){let n={method:i,body:e};return typeof e=="object"&&!(e instanceof FormData)&&(n.headers={"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},n.body=JSON.stringify(e)),e instanceof FormData&&i!=="post"&&(e.append("_method",i),n.method="post"),Gn(t,n)}async function Ao(i,t={}){return Gn(i,{method:"GET",params:t})}async function Io(i,t=null){return we("POST",i,t)}async function Mo(i,t=null){return we("PUT",i,t)}async function Bo(i,t=null){return we("PATCH",i,t)}async function Po(i,t=null){return we("DELETE",i,t)}var en=class{constructor(){this.store=new Map,this.parseTranslations()}parseTranslations(){let t=document.querySelectorAll('meta[name="translation"]');for(let e of t){let n=e.getAttribute("key"),s=e.getAttribute("value");this.store.set(n,s)}}get(t,e){let n=this.getTransText(t);return this.performReplacements(n,e)}getPlural(t,e,n){let s=this.getTransText(t);return this.parsePlural(s,e,n)}parsePlural(t,e,n){let s=t.split("|"),o=/^{([0-9]+)}/,r=/^\[([0-9]+),([0-9*]+)]/,a=null;for(let l of s){let c=l.match(o);if(c!==null&&Number(c[1])===e){a=l.replace(o,"").trim();break}let h=l.match(r);if(h!==null&&Number(h[1])<=e&&(h[2]==="*"||Number(h[2])>=e)){a=l.replace(r,"").trim();break}}return a===null&&s.length>1&&(a=e===1?s[0]:s[1]),a===null&&(a=s[0]),this.performReplacements(a,n)}getTransText(t){let e=this.store.get(t);return e===void 0&&console.warn(`Translation with key "${t}" does not exist`),e}performReplacements(t,e){if(!e)return t;let n=t.match(/:(\S+)/g);if(n===null)return t;let s=t;return n.forEach(o=>{let r=o.substring(1);typeof e[r]>"u"||(s=s.replace(o,e[r]))}),s}},Yn=en;var an={};fe(an,{first:()=>Fo,firstOnElement:()=>Ho,get:()=>Ro,init:()=>on,register:()=>rn});function nn(i){let t=n=>n.slice(0,1).toUpperCase()+n.slice(1),e=i.split("-");return e[0]+e.slice(1).map(t).join("")}function Zn(i){return i.replace(/[A-Z]/g,(t,e)=>(e>0?"-":"")+t.toLowerCase())}var Wt={},Jn={},sn=new WeakMap;function Oo(i,t){let e={},n={},s=`${i}@`,o=`[refs*="${s}"]`,r=[...t.querySelectorAll(o)];t.matches(o)&&r.push(t);for(let a of r){let l=a.getAttribute("refs").split(" ").filter(c=>c.startsWith(s)).map(c=>c.replace(s,"")).map(nn);for(let c of l)e[c]=a,typeof n[c]>"u"&&(n[c]=[]),n[c].push(a)}return{refs:e,manyRefs:n}}function _o(i,t){let e={},n=`option:${i}:`;for(let{name:s,value:o}of t.attributes)if(s.startsWith(n)){let r=s.replace(n,"");e[nn(r)]=o||""}return e}function No(i,t){let e=Jn[i];if(e===void 0)return;let n;try{n=new e,n.$name=i,n.$el=t;let o=Oo(i,t);n.$refs=o.refs,n.$manyRefs=o.manyRefs,n.$opts=_o(i,t),n.setup()}catch(o){console.error("Failed to cre
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Go="1.15.2";function lt(i){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(i)}var ct=lt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),ce=lt(/Edge/i),rs=lt(/firefox/i),se=lt(/safari/i)&&!lt(/chrome/i)&&!lt(/android/i),gs=lt(/iP(ad|od|hone)/i),ws=lt(/chrome/i)&&lt(/android/i),bs={capture:!1,passive:!1};function E(i,t,e){i.addEventListener(t,e,!ct&&bs)}function y(i,t,e){i.removeEventListener(t,e,!ct&&bs)}function Fe(i,t){if(t){if(t[0]===">"&&(t=t.substring(1)),i)try{if(i.matches)return i.matches(t);if(i.msMatchesSelector)return i.msMatchesSelector(t);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(t)}catch{return!1}return!1}}function Yo(i){return i.host&&i!==document&&i.host.nodeType?i.host:i.parentNode}function Y(i,t,e,n){if(i){e=e||document;do{if(t!=null&&(t[0]===">"?i.parentNode===e&&Fe(i,t):Fe(i,t))||n&&i===e)return i;if(i===e)break}while(i=Yo(i))}return null}var as=/\s+/g;function P(i,t,e){if(i&&t)if(i.classList)i.classList[e?"add":"remove"](t);else{var n=(" "+i.className+" ").replace(as," ").replace(" "+t+" "," ");i.className=(n+(e?" "+t:"")).replace(as," ")}}function f(i,t,e){var n=i&&i.style;if(n){if(e===void 0)return document.defaultView&&document.defaultView.getComputedStyle?e=document.defaultView.getComputedStyle(i,""):i.currentStyle&&(e=i.currentStyle),t===void 0?e:e[t];!(t in n)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),n[t]=e+(typeof e=="string"?"":"px")}}function Ct(i,t){var e="";if(typeof i=="string")e=i;else do{var n=f(i,"transform");n&&n!=="none"&&(e=n+" "+e)}while(!t&&(i=i.parentNode));var s=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return s&&new s(e)}function vs(i,t,e){if(i){var n=i.getElementsByTagName(t),s=0,o=n.length;if(e)for(;s<o;s++)e(n[s],s);return n}return[]}function st(){var i=document.scrollingElement;return i||document.documentElement}function $(i,t,e,n,s){if(!(!i.getBoundingClientRect&&i!==window)){var o,r,a,l,c,h,u;if(i!==window&&i.parentNode&&i!==st()?(o=i.getBoundingClientRect(),r=o.top,a=o.left,l=o.bottom,c=o.right,h=o.height,u=o.width):(r=0,a=0,l=window.innerHeight,c=window.innerWidth,h=window.innerHeight,u=window.innerWidth),(t||e)&&i!==window&&(s=s||i.parentNode,!ct))do if(s&&s.getBoundingClientRect&&(f(s,"transform")!=="none"||e&&f(s,"position")!=="static")){var m=s.getBoundingClientRect();r-=m.top+parseInt(f(s,"border-top-width")),a-=m.left+parseInt(f(s,"border-left-width")),l=r+o.height,c=a+o.width;break}while(s=s.parentNode);if(n&&i!==window){var C=Ct(s||i),v=C&&C.a,S=C&&C.d;C&&(r/=S,a/=v,u/=v,h/=S,l=r+h,c=a+u)}return{top:r,left:a,bottom:l,right:c,width:u,height:h}}}function ls(i,t,e){for(var n=mt(i,!0),s=$(i)[t];n;){var o=$(n)[e],r=void 0;if(e==="top"||e==="left"?r=s>=o:r=s<=o,!r)return n;if(n===st())break;n=mt(n,!1)}return!1}function Pt(i,t,e,n){for(var s=0,o=0,r=i.children;o<r.length;){if(r[o].style.display!=="none"&&r[o]!==g.ghost&&(n||r[o]!==g.dragged)&&Y(r[o],e.draggable,i,!1)){if(s===t)return r[o];s++}o++}return null}function Dn(i,t){for(var e=i.lastElementChild;e&&(e===g.ghost||f(e,"display")==="none"||t&&!Fe(e,t));)e=e.previousElementSibling;return e||null}function O(i,t){var e=0;if(!i||!i.parentNode)return-1;for(;i=i.previousElementSibling;)i.nodeName.toUpperCase()!=="TEMPLATE"&&i!==g.clone&&(!t||Fe(i,t))&&e++;return e}function cs(i){var t=0,e=0,n=st();if(i)do{var s=Ct(i),o=s.a,r=s.d;t+=i.scrollLeft*o,e+=i.scrollTop*r}while(i!==n&&(i=i.parentNode));return[t,e]}function Zo(i,t){for(var e in i)if(i.hasOwnProperty(e)){for(var n in t)if(t.hasOwnProperty(n)&&t[n]===i[e][n])return Number(e)}return-1}function mt(i,t){if(!i||!i.getBoundingClientRect)return st();var e=i,n=!1;do if(e.clientWidth<e.scrollWidth||e.clientHeight<e.scrollHeight){var s=f(e);if(e.clientWidth<e.scrollWidth&&(s.overflowX=="auto"||s.overflowX=="scroll")||e.clientHeight<e.scrollHeight&&(s.overflowY=="auto"||s.overflowY=="scroll")){if(!e.getBoundingClientRect||e===document.body)return st();if(n||t)return e;n=!0}}while(e=e.parentNode);retu
`,e.replace(n)}})}function Ar(i){i.parser.addNodeFilter("div",t=>{for(let e of t){let n=e.attr("id")||"",s=e.attr("class")||"";(n==="pointer"||s.includes("pointer"))&&e.remove()}})}function Vs(i){Dr(i),Ar(i)}function zs(i){return i.tagName.toLowerCase()==="code-block"}function Ws(i,t,e,n,s){let o=window.$components.first("code-editor"),r=i.selection.getBookmark();o.open(t,e,n,(a,l)=>{s(a,l),i.focus(),i.selection.moveToBookmark(r)},()=>{i.focus(),i.selection.moveToBookmark(r)})}function js(i,t){let e=t.getAttribute("dir")||"";Ws(i,t.getContent(),t.getLanguage(),e,(n,s)=>{t.setContent(n,s)})}function Ir(i){let t=i.getDoc(),e=t.defaultView;class n extends e.HTMLElement{constructor(){super();U(this,"editor",null);this.attachShadow({mode:"open"});let r=document.head.querySelectorAll('link[rel="stylesheet"]:not([media="print"]),style'),a=Array.from(r).map(c=>c.cloneNode(!0)),l=document.createElement("div");l.style.pointerEvents="none",l.contentEditable="false",l.classList.add("CodeMirrorContainer"),l.classList.toggle("dark-mode",document.documentElement.classList.contains("dark-mode")),this.shadowRoot.append(...a,l)}getLanguage(){let r=c=>(c.split(" ").filter(u=>u.startsWith("language-"))[0]||"").replace("language-",""),a=this.querySelector("code"),l=this.querySelector("pre");return r(l.className)||a&&r(a.className)||""}setContent(r,a){this.editor&&(this.editor.setContent(r),this.editor.setMode(a,r));let l=this.querySelector("pre");l||(l=t.createElement("pre"),this.append(l)),l.innerHTML="";let c=t.createElement("code");l.append(c),c.innerText=r,c.className=`language-${a}`}getContent(){let r=this.querySelector("code")||this.querySelector("pre"),a=document.createElement("pre");a.innerHTML=r.innerHTML.replace(/\ufeff/g,"");let l=a.querySelectorAll("br");for(let c of l)c.replaceWith(`
`);return a.textContent}connectedCallback(){let r=Date.now();if(this.editor)return;this.cleanChildContent();let a=this.getContent(),c=a.split(`
`).length*19.2+18+24;this.style.height=`${c}px`;let h=this.shadowRoot.querySelector(".CodeMirrorContainer"),u=m=>{this.editor=m.wysiwygView(h,this.shadowRoot,a,this.getLanguage()),setTimeout(()=>{this.style.height=null},12)};window.importVersioned("code").then(m=>{let C=Date.now()-r<20?20:0;setTimeout(()=>u(m),C)})}cleanChildContent(){let r=this.querySelector("pre");if(r)for(let a of r.childNodes)a.nodeName==="#text"&&a.textContent==="\uFEFF"&&a.remove()}}e.customElements.define("code-block",n)}function Mr(i){i.ui.registry.addIcon("codeblock",'<svg width="24" height="24"><path d="M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm1 2v14h14V5Z"/><path d="M11.103 15.423c.277.277.277.738 0 .922a.692.692 0 0 1-1.106 0l-4.057-3.78a.738.738 0 0 1 0-1.107l4.057-3.872c.276-.277.83-.277 1.106 0a.724.724 0 0 1 0 1.014L7.6 12.012ZM12.897 8.577c-.245-.312-.2-.675.08-.955.28-.281.727-.27 1.027.033l4.057 3.78a.738.738 0 0 1 0 1.107l-4.057 3.872c-.277.277-.83.277-1.107 0a.724.724 0 0 1 0-1.014l3.504-3.412z"/></svg>'),i.ui.registry.addButton("codeeditor",{tooltip:"Insert code block",icon:"codeblock",onAction(){i.execCommand("codeeditor")}}),i.ui.registry.addButton("editcodeeditor",{tooltip:"Edit code block",icon:"edit-block",onAction(){i.execCommand("codeeditor")}}),i.addCommand("codeeditor",()=>{let t=i.selection.getNode(),e=t.ownerDocument;if(zs(t))js(i,t);else{let n=i.selection.getContent({format:"text"}),s=document.dir==="rtl"?"ltr":"";Ws(i,n,"",s,(o,r)=>{let a=e.createElement("pre"),l=e.createElement("code");l.classList.add(`language-${r}`),l.innerText=o,s&&a.setAttribute("dir",s),a.append(l),i.insertContent(a.outerHTML)})}}),i.on("dblclick",()=>{let t=i.selection.getNode();zs(t)&&js(i,t)}),i.on("PreInit",()=>{i.parser.addNodeFilter("pre",t=>{for(let e of t){let n=window.tinymce.html.Node.create("code-block",{contenteditable:"false"}),s=e.children().filter(a=>a.name==="code")[0]||null,o=e.attr("dir")||s&&s.attr("dir")||"";o&&n.attr("dir",o);let r=e.getAll("span");for(let a of r)a.unwrap();e.attr("style",null),e.wrap(n)}}),i.parser.addNodeFilter("code-block",t=>{for(let e of t)e.attr("contenteditable","false")}),i.serializer.addNodeFilter("code-block",t=>{for(let e of t){let n=e.attr("dir");n&&e.firstChild?e.firstChild.attr("dir",n):e.firstChild&&e.firstChild.attr("dir",null),e.unwrap()}})}),i.ui.registry.addContextToolbar("codeeditor",{predicate(t){return t.nodeName.toLowerCase()==="code-block"},items:"editcodeeditor",position:"node",scope:"node"}),i.on("PreInit",()=>{Ir(i)})}function Ks(){return Mr}function yi(i){return new Promise((t,e)=>{i.oncomplete=i.onsuccess=()=>t(i.result),i.onabort=i.onerror=()=>e(i.error)})}function Br(i,t){let e=indexedDB.open(i);e.onupgradeneeded=()=>e.result.createObjectStore(t);let n=yi(e);return(s,o)=>n.then(r=>o(r.transaction(t,s).objectStore(t)))}var Pn;function On(){return Pn||(Pn=Br("keyval-store","keyval")),Pn}function _n(i,t=On()){return t("readonly",e=>yi(e.get(i)))}function Nn(i,t,e=On()){return e("readwrite",n=>(n.put(t,i),yi(n.transaction)))}function Fn(i,t=On()){return t("readwrite",e=>(e.delete(i),yi(e.transaction)))}var rt=null,qn,Ci,Rn,Hn="last-drawing-save";function Un(i){rt.contentWindow.postMessage(JSON.stringify(i),qn)}function Or(i){Nn(Hn,i.data),Rn&&Rn(i.data).then(()=>{Fn(Hn)})}function _r(i){Un({action:"export",format:"xmlpng",xml:i.xml,spin:"Updating drawing"})}function Nr(){Ci&&Ci().then(i=>{Un({action:"load",autosave:1,xml:i})})}function Fr(){let i={};window.$events.emitPublic(rt,"editor-drawio::configure",{config:i}),Un({action:"configure",config:i})}function Xs(){window.removeEventListener("message",Gs),rt&&document.body.removeChild(rt)}function Gs(i){if(!i.data||i.data.length<1||i.origin!==qn)return;let t=JSON.parse(i.data);t.event==="init"?Nr():t.event==="exit"?Xs():t.event==="save"?_r(t):t.event==="export"?Or(t):t.event==="configure"&&Fr()}async function Rr(){let i=await _n(Hn),t=document.getElementById("unsaved-drawing-dialog");t||console.error("Missing expected unsaved-drawing dialog"),i&&await window.$components.firstOnElement(t,"confirm-dialog").
`),e=t.findIndex(r=>r.trim()==="<!-- Start: custom user content -->"),n=t.findIndex(r=>r.trim()==="<!-- End: custom user content -->");if(e===-1||n===-1)return;let s=t.slice(e+1,n).join(`
`),o=i.createElement("div");o.innerHTML=s,i.head.append(...o.children)}function ha(i){return function(e){function n(){i.darkMode&&e.contentDocument.documentElement.classList.add("dark-mode"),window.$events.emit("editor-html-change","")}e.on("ExecCommand change input NodeChange ObjectResized",n),_s(e),Rs(e,i),e.on("init",()=>{n(),Ns(e),window.editor=e,Os(e)}),e.on("PreInit",()=>{Vs(e)}),lo(e),ho(e),uo(e),window.$events.emitPublic(i.containerElement,"editor-tinymce::setup",{editor:e}),e.ui.registry.addButton("inlinecode",{tooltip:"Inline code",icon:"sourcecode",onAction(){e.execCommand("mceToggleFormat",!1,"code")}})}}function mo(i){return`
html, body, html.dark-mode {
background: ${i.darkMode?"#222":"#fff"};
}
body {
padding-left: 15px !important;
padding-right: 15px !important;
height: initial !important;
margin:0!important;
margin-left: auto! important;
margin-right: auto !important;
overflow-y: hidden !important;
}`.trim().replace(`
`,"")}function go(i){return window.tinymce.addI18n(i.language,i.translationMap),{width:"100%",height:"100%",selector:"#html-editor",cache_suffix:`?version=${document.querySelector('script[src*="/dist/app.js"]').getAttribute("src").split("?version=")[1]}`,content_css:[window.baseUrl("/dist/styles.css")],branding:!1,skin:i.darkMode?"tinymce-5-dark":"tinymce-5",body_class:"page-content",browser_spellcheck:!0,relative_urls:!1,language:i.language,directionality:i.textDirection,remove_script_host:!1,document_base_url:window.baseUrl("/"),end_container_on_empty_block:!0,remove_trailing_brs:!1,statusbar:!1,menubar:!1,paste_data_images:!1,extended_valid_elements:"pre[*],svg[*],div[drawio-diagram],details[*],summary[*],div[*],li[class|checked|style]",automatic_uploads:!1,custom_elements:"doc-root,code-block",valid_children:["-div[p|h1|h2|h3|h4|h5|h6|blockquote|code-block]","+div[pre|img]","-doc-root[doc-root|#text]","-li[details]","+code-block[pre]","+doc-root[p|h1|h2|h3|h4|h5|h6|blockquote|code-block|div|hr]"].join(","),plugins:da(i),contextmenu:!1,toolbar:Hs(i),content_style:mo(i),style_formats:aa,style_formats_merge:!1,media_alt_source:!1,media_poster:!1,formats:la,table_style_by_css:!0,table_use_colgroups:!0,file_picker_types:"file image",color_map:ca,file_picker_callback:po,paste_preprocess(e,n){let{content:s}=n;s.indexOf('<img src="file://')!==-1&&(n.content="")},init_instance_callback(e){fo(e.getDoc())},setup(e){Us(e),qs(e),ha(i)(e)}}}function Ft(i){window.tinymce.addI18n(i.language,i.translationMap);let t=document.querySelector('script[src*="/dist/app.js"]').getAttribute("src").split("?version=")[1];return{width:"100%",height:"185px",target:i.containerElement,cache_suffix:`?version=${t}`,content_css:[window.baseUrl("/dist/styles.css")],branding:!1,skin:i.darkMode?"tinymce-5-dark":"tinymce-5",body_class:"wysiwyg-input",browser_spellcheck:!0,relative_urls:!1,language:i.language,directionality:i.textDirection,remove_script_host:!1,document_base_url:window.baseUrl("/"),end_container_on_empty_block:!0,remove_trailing_brs:!1,statusbar:!1,menubar:!1,plugins:"link autolink lists",contextmenu:!1,toolbar:"bold italic link bullist numlist",content_style:mo(i),file_picker_types:"file",valid_elements:"p,a[href|title|target],ol,ul,li,strong,em,br",file_picker_callback:po,init_instance_callback(e){fo(e.getDoc()),e.contentDocument.documentElement.classList.toggle("dark-mode",i.darkMode)}}}var Si=class extends d{setup(){this.commentId=this.$opts.commentId,this.commentLocalId=this.$opts.commentLocalId,this.commentParentId=this.$opts.commentParentId,this.deletedText=this.$opts.deletedText,this.updatedText=this.$opts.updatedText,this.wysiwygEditor=null,this.wysiwygLanguage=this.$opts.wysiwygLanguage,this.wysiwygTextDirection=this.$opts.wysiwygTextDirection,this.container=this.$el,this.contentContainer=this.$refs.contentContainer,this.form=this.$refs.form,this.formCancel=this.$refs.formCancel,this.editButton=this.$refs.editButton,this.deleteButton=this.$refs.deleteButton,this.replyButton=this.$refs.replyButton,this.input=this.$refs.input,this.setupListeners()}setupListeners(){this.replyButton&&this.replyButton.addEventListener("click",()=>this.$emit("reply",{id:this.commentLocalId,element:this.container})),this.editButton&&(this.editButton.addEventListener("click",this.startEdit.bind(this)),this.form.addEventListener("submit",this.update.bind(this)),this.formCancel.addEventListener("click",()=>this.toggleEditMode(!1))),this.deleteButton&&this.deleteButton.addEventListener("click",this.delete.bind(this))}toggleEditMode(t){this.contentContainer.toggleAttribute("hidden",t),this.form.toggleAttribute("hidden",!t)}startEdit(){if(this.toggleEditMode(!0),this.wysiwygEditor){this.wysiwygEditor.focus();return}let t=Ft({language:this.wysiwygLanguage,containerElement:this.input,darkMode:document.documentElement.classList.contains("dark-mode"),textDirection:this.wysiwygTextDirection,translations:{},translationMap:window.editor_translations});window.tinymce.init(t).then(e=>{this.wysiwygEditor=e[0],setTimeout(()=>this.wysiwygEditor.focus(),50)})}async update
/*! Bundled license information:
sortablejs/modular/sortable.esm.js:
(**!
* Sortable 1.15.2
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*)
*/
//# sourceMappingURL=app.js.map