1"use strict";(self.webpackChunkkms=self.webpackChunkkms||[]).push([[3992,4729,7485],{65641(e,t,i){i.d(t,{FB:()=>l,hq:()=>a,oO:()=>o});var s=i(85804),n=i(28974),r=["/vendor/ckeditor/plugins/kmsgallery/styles/gallery.css","/static/build/css/kms_css.css"];class o{constructor(e){this.element=e,this.editorReady=!1,this.loadTasks=[],e.classList.contains("rich-text-full-uploads")?(this._mode="full",this._secure_uploads=!0):e.classList.contains("rich-text-full")?(this._mode="full",this._secure_uploads=!1):e.classList.contains("rich-text-basic")?(this._mode="form",this._secure_uploads=!1):(this._mode=this.element.dataset.editorMode||"full",this._uploads=this.element.hasAttribute("data-editor-uploads")),this._secure_uploads=this.element.hasAttribute("data-editor-secure-uploads"),(0,s.u)().then(e=>{this.csrf_token=e,this.initialise()})}initialise(){this.loadTasks.forEach(e=>e())}get uploads(){return this._uploads}get secure_uploads(){return this._secure_uploads}set secure_uploads(e){this._secure_uploads=e}get mode(){return this._mode}getData(){return this.element.value}getHTML(){return this.element.value}setContent(e,t){this.editorReady?(this.element.style.display="none",this.setEditorContent(e,t)):this.loadTasks.push(()=>{this.element.style.display="none",this.setEditorContent(e,t)})}setEditorContent(){throw new Error("Child class must implement the method setEditorContent!")}destroy(){this.element.style.display=null,this.removeEditor()}removeEditor(){throw new Error("Child class must implement the method removeEditor!")}}class l{constructor(e,t){this.element=e,this.element.style.display="none",this.editorType=t,this.is_inline=!1,this.initialise()}getStyleSheetUrls(){var e=r;return this.element.dataset.editorStylesUrl?e.push(this.element.dataset.editorStylesUrl):e.push("/app/css/editor.css"),e}initialise(){this.createWrapper(),(0,n.R)(this.wrap.id,this.getStyleSheetUrls(),this.createEditor.bind(this))}createEditor(){this.editor=new this.editorType(this.element,this),this.editor.setContent(this.element.value,()=>{this.loader.remove()}),this.element.form.addEventListener("submit",()=>{this.element.value=this.editor.getData()})}createWrapper(){this.wrap||(this.wrap=document.createElement("div"),this.wrap.classList.add("console-edit-wrap"),this.wrap.id=Date.now().toString(36)+Math.random().toString(36).substring(2),this.element.parentNode.insertBefore(this.wrap,this.element),this.wrap.appendChild(this.element),this.editor_el=document.createElement("div"),this.wrap.appendChild(this.editor_el),this.loader=document.createElement("div"),this.loader.classList.add("light-bg
1-loader"),this.wrap.appendChild(this.loader))}}class a{constructor(e,t,i){this.element=e,this.editorType=t,this.editing=!1,this.is_inline=!0,this.content_processor=i,this.initialise()}getStyleSheetUrls(){return r}initialise(){this.wrapperHoverOn=this.wrapperHoverOn.bind(this),this.wrapperHoverOff=this.wrapperHoverOff.bind(this),this.edit=this.edit.bind(this),this.save=this.save.bind(this),this.cancel=this.cancel.bind(this),this.closeEdit=this.closeEdit.bind(this),this.createWrapper(),(0,n.R)(this.wrap.id,this.getStyleSheetUrls())}wrapperHoverOn(){this.editing||(this.wrap.style.boxShadow="0px 0px 10px 0px #000000",this.editControls.style.opacity=1)}wrapperHoverOff(){this.editing||(this.wrap.style.boxShadow="none",this.editControls.style.opacity=0)}createWrapper(){this.wrap||(this.wrap=document.createElement("div"),this.wrap.id=Date.now().toString(36)+Math.random().toString(36).substring(2),this.wrap.classList.add("inline-edit-wrap"),this.element.parentNode.insertBefore(this.wrap,this.element),this.wrap.appendChild(this.element),this.wrap.insertAdjacentHTML("beforeend",'<div class=\'inline-edit-controls\'><span class="edit"><img alt="editor edit icon" src="/static/frontend/img/edit.svg"/></span><span class="save" style="display:none">Save</span> <span class="cancel" style="display:none">Cancel</span></div>'),this.editControls=this.wrap.querySelector(".inline-edit-controls"),this.wrap.querySelector(".inline-edit-controls .edit").addEventListener("click",this.edit),this.wrap.querySelector(".inline-edit-controls .save").addEventListener("click",this.save),this.wrap.querySelector(".inline-edit-controls .cancel").addEventListener("click",this.cancel),this.wrap.addEventListener("mouseenter",this.wrapperHoverOn),this.wrap.addEventListener("mouseleave",this.wrapperHoverOff))}displayEditUI(){this.wrap.style.boxShadow="0px 0px 10px 0px #000000",this.editControls.style.opacity=1,this.editControls.querySelector(".edit").style.display="none",this.editControls.querySelector(".save").style.display="inline",this.editControls.querySelector(".cancel").style.display="inline"}hideEditUI(){this.wrap.style.boxShadow="none",this.editControls.style.opacity=0,this.element.contentEditable="false",this.editControls.querySelector(".edit").style.display="inline",this.editControls.querySelector(".save").style.display="none",this.editControls.querySelector(".cancel").style.display="none"}cancel(){this.closeEdit(),this.element.innerHTML=this.element.origHTML,this.content_processor(this.element)}closeEdit(){this.wrap.querySelector(".inline-edit-save")&&this.wrap.querySelector(".inline-edit-save").remove(),this.editor.destroy(),this.hideEditUI(),this.wrap.style.boxShadow="0px 0px 10px 0px #00cc00",setTimeout(()=>{this.wrap.style.boxShadow="none"},1e3),this.editing=!1}get content_url(){return`/console/content/${this.element.dataset.content_type}/update/${this.element.dataset.id}`}edit(){this.editing=!0,this.element.origHTML=this.element.innerHTML,this.displayEditUI(),fetch(this.content_url,{method:"get",headers:{Accept:"application/json"}}).then(e=>{if(e.ok)return e.json();throw new Error("Something went wrong")}).then(e=>{let t=e.content_version.content,i=e.content_version.content_src||t;this.edit_content_loaded(t,i)}).catch(function(e){console.log(e),alert("error loading content, please try again")})}save(){let e=new FormData;e.append("content_src",this.editor.getData()),e.append("content",this.editor.getHTML()),e.append("editor",this.element.dataset.editor),fetch(this.content_url,{method:"post",body:e,headers:{Accept:"application/json","X-CSRF":this.editor.csrf_token}}).then(e=>{if(e.ok)return e.json();throw new Error("Something went wrong")}).then(e=>{this.closeEdit(),this.element.innerHTML=e.processed_content,this.element.origsrc=e.content,this.content_processor(this.element)}).catch(function(e){console.log(e),alert("error saving content, please try again")})}edit_content_loaded(e,t){this.editor=new this.editorType(this.element,this),this.editor.setContent(t),console.debug(e,t)}}},99246(e,t,i){i.d(t,{RichEditorJS:()=>f});var s=i(49601),n=i(73538),r=i.n(n),o=i(92859),l=i.n(o),a=i(59593),d=i.n(a),h=i(46321),c=i.n(h),p=i(30587),u=i.n(p),m=i(88643),y=i.n(m),w=i(32854),v=i.n(w),g=i(65641);class f extends g.oO{constructor(e){super(e),this.element.style.display="none",this.editorEl=document.createElement("div"),this.editorEl.classList.add("html-editor","editor-editorjs"),this.element.insertAdjacentElement("afterend",this.editorEl)}setEditorContent(e){var t,i;this.editor=(t={onReady:()=>{this.onEditorReady(e)}},i={holder:this.editorEl,tools:{header:r(),list:l(),image:d(),raw:c(),checklist:u(),quote:y(),embed:{class:v(),config:{services:{youtube:!0,coub:!0}}}}},new s.A(Object.assign(i,t)))}onEditorReady(e){try{var t=JSON.parse(e);this.editor.render(t)}catch(t){this.editor.blocks.renderFromHTML(e)}this.editor.on("change",()=>{this.editor.save().then(e=>{this._src=JSON.stringify(e)})})}getData(){return this._src}getHTML(){return""}removeEditor(){this.editor.destroy()}}},28974(e,t,i){function s(e,t){if(e instanceof CSSStyleRule){var i=e.selectorText.split(",").map(e=>function(e,t){var i=e.split(" ");return e.startsWith(":root")?i[0]="#"+t:i.unshift("#"+t),(i=i.filter(e=>
1!e.match(/^(html|body)$/i))).join(" ")}(e,t));return i.join(", ")+" {"+e.style.cssText+"}\r\n"}if(e instanceof CSSMediaRule){var n=[...e.cssRules].map(e=>s(e,t));return"@media "+e.media.mediaText+" {"+n.join(" ")+"}"}if(e instanceof CSSFontFaceRule)return e.cssText}i.d(t,{R:()=>o});let n=0;function r(e,t,i){var r=document.createElement("link");function o(){var t=r.sheet;if(t.cssRules){var o=[...t.cssRules].map(t=>s(t,e)).join(" ");r.remove();var l=document.createElement("style");l.innerHTML=o,l.id=e+"-"+n+"-styles",n++,document.head.appendChild(l)}document.getElementById(e).clientHeight,i&&i()}r.setAttribute("rel","stylesheet"),r.setAttribute("type","text/css"),r.setAttribute("media","(max-width: 0)"),r.setAttribute("href",t),r.setAttribute("crossorigin","anonymous"),document.head.appendChild(r),r.onload=o,r.onerror=function(){o(),alert("Error loading editor stylesheet. The editor display may not be correct."),console.error("Error loading stylesheet '"+t+"'.")}}function o(e,t,i){if(document.getElementById(e)){for(var s=i,n=t.length-1;n>0;n--)s=o(n,s);r(e,t[0],s)}else console.error("Element with ID '"+e+"' not found.");function o(i,s){return()=>{r(e,t[i],s)}}}}}]); 2//# sourceMappingURL=chunk-editing-edit-editorjs.f78d726ce708b879.build.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.