bookstack/public/dist/app.js

34 lines
188 KiB
JavaScript
Raw Normal View History

// See the "/licenses" URI for full package license details
var Yi=Object.defineProperty;var Ji=n=>{throw TypeError(n)};var Ss=(n,t,e)=>t in n?Yi(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var ks=(n,t)=>{for(var e in t)Yi(n,e,{get:t[e],enumerable:!0})};var U=(n,t,e)=>Ss(n,typeof t!="symbol"?t+"":t,e),$s=(n,t,e)=>t.has(n)||Ji("Cannot "+e);var Zi=(n,t,e)=>t.has(n)?Ji("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e);var Zt=(n,t,e)=>($s(n,t,"access private method"),e);var ve=class{constructor(){this.listeners={};this.stack=[]}emit(t,e={}){this.stack.push({name:t,data:e});let i=this.listeners[t]||[];for(let o of i)o(e)}listen(t,e){typeof this.listeners[t]>"u"&&(this.listeners[t]=[]),this.listeners[t].push(e)}remove(t,e){let i=this.listeners[t]||[],o=i.indexOf(e);o!==-1&&i.splice(o,1)}emitPublic(t,e,i){let o=new CustomEvent(e,{detail:i,bubbles:!0});t.dispatchEvent(o)}success(t){this.emit("success",t)}error(t){this.emit("error",t)}showValidationErrors(t){if(t.status===422&&t.data){let e=Object.values(t.data).flat().join(`
`);this.error(e)}}showResponseError(t){t.status&&t.status>=400&&typeof t.data=="object"&&t.data.message&&this.error(t.data.message)}};var xt=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}},we=class{async getResponseContent(t){if(t.status===204)return null;let i=(t.headers.get("Content-Type")||"").split(";")[0].split("/").pop();return i==="javascript"||i==="json"?t.json():t.text()}createXMLHttpRequest(t,e,i={}){let o=document.querySelector("meta[name=token]")?.getAttribute("content"),s=new XMLHttpRequest;for(let[r,a]of Object.entries(i))s.addEventListener(r,a.bind(s));return s.open(t,e),s.withCredentials=!0,s.setRequestHeader("X-CSRF-TOKEN",o||""),s}async request(t,e={}){let i=t;if(i.startsWith("http")||(i=window.baseUrl(i)),e.params){let c=new URL(i);for(let u of Object.keys(e.params)){let h=e.params[u];typeof h<"u"&&h!==null&&c.searchParams.set(u,h)}i=c.toString()}let o=document.querySelector("meta[name=token]")?.getAttribute("content")||"",s={...e,credentials:"same-origin"};s.headers={...s.headers||{},baseURL:window.baseUrl(""),"X-CSRF-TOKEN":o};let r=await fetch(i,s),a=await this.getResponseContent(r)||"",l={data:a,headers:r.headers,redirected:r.redirected,status:r.status,statusText:r.statusText,url:r.url,original:r};if(!r.ok)throw new xt(r,a);return l}async dataRequest(t,e,i){let o={method:t,body:i};return typeof i=="object"&&!(i instanceof FormData)&&(o.headers={"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},o.body=JSON.stringify(i)),i instanceof FormData&&t!=="post"&&(i.append("_method",t),o.method="post"),this.request(e,o)}async get(t,e={}){return this.request(t,{method:"GET",params:e})}async post(t,e=null){return this.dataRequest("POST",t,e)}async put(t,e=null){return this.dataRequest("PUT",t,e)}async patch(t,e=null){return this.dataRequest("PATCH",t,e)}async delete(t,e=null){return this.dataRequest("DELETE",t,e)}formatErrorResponseText(t){let e=t.startsWith("{")?JSON.parse(t):{message:t};if(!e)return t;if(e.message||e.error)return e.message||e.error;let i=Object.values(e);return i.every(s=>Array.isArray(s)&&s.every(r=>typeof r=="string"))?i.flat().join(" "):t}};var be=class{choice(t,e,i={}){i=Object.assign({},{count:String(e)},i);let o=t.split("|"),s=/^{([0-9]+)}/,r=/^\[([0-9]+),([0-9*]+)]/,a=null;for(let l of o){let c=l.match(s);if(c!==null&&Number(c[1])===e){a=l.replace(s,"").trim();break}let u=l.match(r);if(u!==null&&Number(u[1])<=e&&(u[2]==="*"||Number(u[2])>=e)){a=l.replace(r,"").trim();break}}return a===null&&o.length>1&&(a=e===1?o[0]:o[1]),a===null&&(a=o[0]),this.performReplacements(a,i)}performReplacements(t,e){let i=t.match(/:(\S+)/g);if(i===null)return t;let o=t;for(let s of i){let r=s.substring(1);typeof e[r]>"u"||(o=o.replace(s,e[r]))}return o}};var Ki={};ks(Ki,{AddRemoveRows:()=>xe,AjaxDeleteRow:()=>Le,AjaxForm:()=>Te,Attachments:()=>Se,AttachmentsList:()=>ke,AutoSubmit:()=>De,AutoSuggest:()=>$e,BackToTop:()=>Me,BookSort:()=>Xe,ChapterContents:()=>Ye,CodeEditor:()=>Je,CodeHighlighter:()=>Ze,CodeTextarea:()=>Qe,Collapsible:()=>tn,ConfirmDialog:()=>en,CustomCheckbox:()=>nn,DetailsHighlighter:()=>on,Dropdown:()=>sn,DropdownSearch:()=>rn,Dropzone:()=>an,EditorToolbox:()=>ln,EntityPermissions:()=>cn,EntitySearch:()=>dn,EntitySelector:()=>hn,EntitySelectorPopup:()=>un,EventEmitSelect:()=>pn,ExpandToggle:()=>mn,GlobalSearch:()=>fn,HeaderMobileToggle:()=>gn,ImageManager:()=>vn,ImagePicker:()=>wn,ListSortControl:()=>bn,LoadingButton:()=>yn,MarkdownEditor:()=>En,NewUserPassword:()=>Cn,Notification:()=>xn,OptionalInput:()=>Ln,PageComment:()=>Mn,PageCommentReference:()=>An,PageComments:()=>In,PageDisplay:()=>Hn,PageEditor:()=>Bn,PagePicker:()=>Rn,PermissionsTable:()=>On,Pointer:()=>_n,Popup:()=>Nn,SettingAppColorScheme:()=>Fn,SettingColorPicker:()=>qn,SettingHomepageControl:()=>Un,ShelfSort:()=>jn,ShortcutInput:()=>Kn,Shortcuts:()=>zn,SortRuleManager:()=>Gn,SortableList:()=>Xn,SubmitOnChange:()=>Yn,Tabs:()=>zt,TagManager:()=>Jn,Templ
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Ns="1.15.6";function ct(n){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(n)}var dt=ct(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),ue=ct(/Edge/i),co=ct(/firefox/i),ae=ct(/safari/i)&&!ct(/chrome/i)&&!ct(/android/i),$i=ct(/iP(ad|od|hone)/i),yo=ct(/chrome/i)&&ct(/android/i),Eo={capture:!1,passive:!1};function E(n,t,e){n.addEventListener(t,e,!dt&&Eo)}function y(n,t,e){n.removeEventListener(t,e,!dt&&Eo)}function Ue(n,t){if(t){if(t[0]===">"&&(t=t.substring(1)),n)try{if(n.matches)return n.matches(t);if(n.msMatchesSelector)return n.msMatchesSelector(t);if(n.webkitMatchesSelector)return n.webkitMatchesSelector(t)}catch{return!1}return!1}}function Co(n){return n.host&&n!==document&&n.host.nodeType?n.host:n.parentNode}function j(n,t,e,i){if(n){e=e||document;do{if(t!=null&&(t[0]===">"?n.parentNode===e&&Ue(n,t):Ue(n,t))||i&&n===e)return n;if(n===e)break}while(n=Co(n))}return null}var ho=/\s+/g;function B(n,t,e){if(n&&t)if(n.classList)n.classList[e?"add":"remove"](t);else{var i=(" "+n.className+" ").replace(ho," ").replace(" "+t+" "," ");n.className=(i+(e?" "+t:"")).replace(ho," ")}}function f(n,t,e){var i=n&&n.style;if(i){if(e===void 0)return document.defaultView&&document.defaultView.getComputedStyle?e=document.defaultView.getComputedStyle(n,""):n.currentStyle&&(e=n.currentStyle),t===void 0?e:e[t];!(t in i)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),i[t]=e+(typeof e=="string"?"":"px")}}function Dt(n,t){var e="";if(typeof n=="string")e=n;else do{var i=f(n,"transform");i&&i!=="none"&&(e=i+" "+e)}while(!t&&(n=n.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(e)}function xo(n,t,e){if(n){var i=n.getElementsByTagName(t),o=0,s=i.length;if(e)for(;o<s;o++)e(i[o],o);return i}return[]}function ot(){var n=document.scrollingElement;return n||document.documentElement}function $(n,t,e,i,o){if(!(!n.getBoundingClientRect&&n!==window)){var s,r,a,l,c,u,h;if(n!==window&&n.parentNode&&n!==ot()?(s=n.getBoundingClientRect(),r=s.top,a=s.left,l=s.bottom,c=s.right,u=s.height,h=s.width):(r=0,a=0,l=window.innerHeight,c=window.innerWidth,u=window.innerHeight,h=window.innerWidth),(t||e)&&n!==window&&(o=o||n.parentNode,!dt))do if(o&&o.getBoundingClientRect&&(f(o,"transform")!=="none"||e&&f(o,"position")!=="static")){var m=o.getBoundingClientRect();r-=m.top+parseInt(f(o,"border-top-width")),a-=m.left+parseInt(f(o,"border-left-width")),l=r+s.height,c=a+s.width;break}while(o=o.parentNode);if(i&&n!==window){var g=Dt(o||n),C=g&&g.a,T=g&&g.d;g&&(r/=T,a/=C,h/=C,u/=T,l=r+u,c=a+h)}return{top:r,left:a,bottom:l,right:c,width:h,height:u}}}function uo(n,t,e){for(var i=yt(n,!0),o=$(n)[t];i;){var s=$(i)[e],r=void 0;if(e==="top"||e==="left"?r=o>=s:r=o<=s,!r)return i;if(i===ot())break;i=yt(i,!1)}return!1}function Ft(n,t,e,i){for(var o=0,s=0,r=n.children;s<r.length;){if(r[s].style.display!=="none"&&r[s]!==v.ghost&&(i||r[s]!==v.dragged)&&j(r[s],e.draggable,n,!1)){if(o===t)return r[s];o++}s++}return null}function Di(n,t){for(var e=n.lastElementChild;e&&(e===v.ghost||f(e,"display")==="none"||t&&!Ue(e,t));)e=e.previousElementSibling;return e||null}function P(n,t){var e=0;if(!n||!n.parentNode)return-1;for(;n=n.previousElementSibling;)n.nodeName.toUpperCase()!=="TEMPLATE"&&n!==v.clone&&(!t||Ue(n,t))&&e++;return e}function po(n){var t=0,e=0,i=ot();if(n)do{var o=Dt(n),s=o.a,r=o.d;t+=n.scrollLeft*s,e+=n.scrollTop*r}while(n!==i&&(n=n.parentNode));return[t,e]}function Fs(n,t){for(var e in n)if(n.hasOwnProperty(e)){for(var i in t)if(t.hasOwnProperty(i)&&t[i]===n[e][i])return Number(e)}return-1}function yt(n,t){if(!n||!n.getBoundingClientRect)return ot();var e=n,i=!1;do if(e.clientWidth<e.scrollWidth||e.clientHeight<e.scrollHeight){var o=f(e);if(e.clientWidth<e.scrollWidth&&(o.overflowX=="auto"||o.overflowX=="scroll")||e.clientHeight<e.scrollHeight&&(o.overflowY=="auto"||o.overflowY=="scroll")){if(!e.getBoundingClientRect||e===document.body)return ot();if(i||t)return e;i=!0}}while(e=e.parentNode);retu
`,e.replace(i)}})}function br(n){n.parser.addNodeFilter("div",t=>{for(let e of t){let i=e.attr("id")||"",o=e.attr("class")||"";(i==="pointer"||o.includes("pointer"))&&e.remove()}})}function Ko(n){wr(n),br(n)}function Xo(n){return n.tagName.toLowerCase()==="code-block"}function Yo(n,t,e,i,o){let s=window.$components.first("code-editor"),r=n.selection.getBookmark();s.open(t,e,i,(a,l)=>{o(a,l),n.focus(),n.selection.moveToBookmark(r)},()=>{n.focus(),n.selection.moveToBookmark(r)})}function Go(n,t){let e=t.getAttribute("dir")||"";Yo(n,t.getContent(),t.getLanguage(),e,(i,o)=>{t.setContent(i,o)})}function yr(n){let t=n.getDoc(),e=t.defaultView;class i 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(h=>h.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 u=this.shadowRoot.querySelector(".CodeMirrorContainer"),h=m=>{this.editor=m.wysiwygView(u,this.shadowRoot,a,this.getLanguage()),setTimeout(()=>{this.style.height=null},12)};window.importVersioned("code").then(m=>{let g=Date.now()-r<20?20:0;setTimeout(()=>h(m),g)})}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",i)}function Er(n){n.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>'),n.ui.registry.addButton("codeeditor",{tooltip:"Insert code block",icon:"codeblock",onAction(){n.execCommand("codeeditor")}}),n.ui.registry.addButton("editcodeeditor",{tooltip:"Edit code block",icon:"edit-block",onAction(){n.execCommand("codeeditor")}}),n.addCommand("codeeditor",()=>{let t=n.selection.getNode(),e=t.ownerDocument;if(Xo(t))Go(n,t);else{let i=n.selection.getContent({format:"text"}),o=document.dir==="rtl"?"ltr":"";Yo(n,i,"",o,(s,r)=>{let a=e.createElement("pre"),l=e.createElement("code");l.classList.add(`language-${r}`),l.innerText=s,o&&a.setAttribute("dir",o),a.append(l),n.insertContent(a.outerHTML)})}}),n.on("dblclick",()=>{let t=n.selection.getNode();Xo(t)&&Go(n,t)}),n.on("PreInit",()=>{n.parser.addNodeFilter("pre",t=>{for(let e of t){let i=window.tinymce.html.Node.create("code-block",{contenteditable:"false"}),o=e.children().filter(a=>a.name==="code")[0]||null,s=e.attr("dir")||o&&o.attr("dir")||"";s&&i.attr("dir",s);let r=e.getAll("span");for(let a of r)a.unwrap();e.attr("style",null),e.wrap(i)}}),n.parser.addNodeFilter("code-block",t=>{for(let e of t)e.attr("contenteditable","false")}),n.serializer.addNodeFilter("code-block",t=>{for(let e of t){let i=e.attr("dir");i&&e.firstChild?e.firstChild.attr("dir",i):e.firstChild&&e.firstChild.attr("dir",null),e.unwrap()}})}),n.ui.registry.addContextToolbar("codeeditor",{predicate(t){return t.nodeName.toLowerCase()==="code-block"},items:"editcodeeditor",position:"node",scope:"node"}),n.on("PreInit",()=>{yr(n)})}function Jo(){return Er}function Sn(n){return new Promise((t,e)=>{n.oncomplete=n.onsuccess=()=>t(n.result),n.onabort=n.onerror=()=>e(n.error)})}function Cr(n,t){let e,i=()=>{if(e)return e;let o=indexedDB.open(n);return o.onupgradeneeded=()=>o.result.createObjectStore(t),e=Sn(o),e.then(s=>{s.onclose=()=>e=void 0},()=>{}),e};return(o,s)=>i().then(r=>s(r.transaction(t,o).objectStore(t)))}var Bi;function Pi(){return Bi||(Bi=Cr("keyval-store","keyval")),Bi}function Ri(n,t=Pi()){return t("readonly",e=>Sn(e.get(n)))}function Oi(n,t,e=Pi()){return e("readwrite",i=>(i.put(t,n),Sn(i.transaction)))}function _i(n,t=Pi()){return t("readwrite",e=>(e.delete(n),Sn(e.transaction)))}var nt=null,qi,kn,Ni,Fi="last-drawing-save";function Ui(n){nt?.contentWindow?.postMessage(JSON.stringify(n),qi)}function Lr(n){Oi(Fi,n.data),Ni&&Ni(n.data).then(()=>{_i(Fi)})}function Tr(n){Ui({action:"export",format:"xmlpng",xml:n.xml,spin:"Updating drawing"})}function Sr(){kn&&kn().then(n=>{Ui({action:"load",autosave:1,xml:n})})}function kr(){let n={};nt&&(window.$events.emitPublic(nt,"editor-drawio::configure",{config:n}),Ui({action:"configure",config:n}))}function Zo(){window.removeEventListener("message",Qo),nt&&document.body.removeChild(nt)}function Qo(n){if(!n.data||n.data.length<1||n.origin!==qi)return;let t=JSON.parse(n.data);t.event==="init"?Sr():t.event==="exit"?Zo():t.event==="save"?Tr(t):t.event==="export"?Lr(t):t.event==="configure"&&kr()}async function $r(){let n=await Ri(Fi),t=document.getElementById("unsaved-drawing-dialog");t||console.error("Missing expected un
`),e=t.findIndex(r=>r.trim()==="<!-- Start: custom user content -->"),i=t.findIndex(r=>r.trim()==="<!-- End: custom user content -->");if(e===-1||i===-1)return;let o=t.slice(e+1,i).join(`
`),s=n.createElement("div");s.innerHTML=o,n.head.append(...s.children)}function ta(n){return function(e){function i(){n.darkMode&&e.contentDocument.documentElement.classList.add("dark-mode"),window.$events.emit("editor-html-change","")}e.on("ExecCommand change input NodeChange ObjectResized",i),Fo(e),Vo(e,n),e.on("init",()=>{i(),qo(e),window.editor=e,No(e)}),e.on("PreInit",()=>{Ko(e)}),us(e),ms(e),fs(e),window.$events.emitPublic(n.containerElement,"editor-tinymce::setup",{editor:e}),e.ui.registry.addButton("inlinecode",{tooltip:"Inline code",icon:"sourcecode",onAction(){e.execCommand("mceToggleFormat",!1,"code")}})}}function ws(n){return`
html, body, html.dark-mode {
background: ${n.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 bs(n){return window.tinymce.addI18n(n.language,n.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:n.darkMode?"tinymce-5-dark":"tinymce-5",body_class:"page-content",browser_spellcheck:!0,relative_urls:!1,language:n.language,directionality:n.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:Qr(n),contextmenu:!1,toolbar:Wo(n),content_style:ws(n),style_formats:Yr,style_formats_merge:!1,media_alt_source:!1,media_poster:!1,formats:Jr,table_style_by_css:!0,table_use_colgroups:!0,file_picker_types:"file image",color_map:Zr,file_picker_callback:gs,paste_preprocess(e,i){let{content:o}=i;o.indexOf('<img src="file://')!==-1&&(i.content="")},init_instance_callback(e){vs(e.getDoc())},setup(e){zo(e),jo(e),ta(n)(e)}}}function Wt(n){window.tinymce.addI18n(n.language,n.translationMap);let t=document.querySelector('script[src*="/dist/app.js"]').getAttribute("src").split("?version=")[1];return{width:"100%",height:"185px",target:n.containerElement,cache_suffix:`?version=${t}`,content_css:[window.baseUrl("/dist/styles.css")],branding:!1,skin:n.darkMode?"tinymce-5-dark":"tinymce-5",body_class:"wysiwyg-input",browser_spellcheck:!0,relative_urls:!1,language:n.language,directionality:n.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:ws(n),file_picker_types:"file",valid_elements:"p,a[href|title|target],ol,ul,li,strong,em,br",file_picker_callback:gs,init_instance_callback(e){vs(e.getDoc()),e.contentDocument.documentElement.classList.toggle("dark-mode",n.darkMode)}}}var Mn=class extends d{constructor(){super(...arguments);this.wysiwygEditor=null}setup(){this.commentId=this.$opts.commentId,this.commentLocalId=this.$opts.commentLocalId,this.deletedText=this.$opts.deletedText,this.deletedText=this.$opts.deletedText,this.archiveText=this.$opts.archiveText,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.archiveButton=this.$refs.archiveButton,this.input=this.$refs.input,this.setupListeners()}setupListeners(){if(this.replyButton){let e={id:this.commentLocalId,element:this.container};this.replyButton.addEventListener("click",()=>this.$emit("reply",e))}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)),this.archiveButton&&this.archiveButton.addEventListener("click",this.archive.bind(this))}toggleEditMode(e){this.contentContainer.toggleAttribute("hidden",e),this.form.toggleAttribute("hidden",!e)}startEdit(){if(this.toggleEditMode(!0),this.wysiwygEditor){this.wysiwygEditor.focus();return}let e=Wt({language:this.wysiwygLanguage,containerElement:this.input,darkMode:document.documentElement.classList.contains("dark-mode"),textDirection:this.wysiwygTextDirection,drawio
/*! Bundled license information:
sortablejs/modular/sortable.esm.js:
(**!
* Sortable 1.15.6
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*)
*/
//# sourceMappingURL=app.js.map