芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media.2/com_mails/js/admin-email-template-edit.min.js
((t,e)=>{class i{constructor(t,e){this.form=t,this.inputSubject=this.form.querySelector("#jform_subject"),this.inputBody=this.form.querySelector("#jform_body"),this.inputHtmlBody=this.form.querySelector("#jform_htmlbody"),this.templateData=e&&e.templateData?e.templateData:{},this.form.EmailTemplateEdit=this}setBodyValue(t){e.editors.instances[this.inputBody.id]?e.editors.instances[this.inputBody.id].setValue(t):this.inputBody.value=t}setHtmlBodyValue(t){e.editors.instances[this.inputHtmlBody.id]?e.editors.instances[this.inputHtmlBody.id].setValue(t):this.inputHtmlBody.value=t}insertTag(t,i){if(!t)return!1;let s;switch(i){case"body":s=this.inputBody;break;case"htmlbody":s=this.inputHtmlBody;break;default:return!1}return e.editors.instances[s.id]?e.editors.instances[s.id].replaceSelection(t):s.value+=` ${t}`,!0}bindListeners(){t.querySelector("#btnResetSubject").addEventListener("click",(t=>{t.preventDefault(),this.inputSubject.value=this.templateData.subject?this.templateData.subject:""}));const e=t.querySelector("#btnResetBody");e&&e.addEventListener("click",(t=>{t.preventDefault(),this.setBodyValue(this.templateData.body?this.templateData.body:"")}));const i=t.querySelector("#btnResetHtmlBody");i&&i.addEventListener("click",(t=>{t.preventDefault(),this.setHtmlBodyValue(this.templateData.htmlbody?this.templateData.htmlbody:"")})),this.form.querySelectorAll(".edit-action-add-tag").forEach((t=>{t.addEventListener("click",(t=>{t.preventDefault();const e=t.target;this.insertTag(e.dataset.tag,e.dataset.target)}))}))}}t.addEventListener("DOMContentLoaded",(()=>{new i(t.getElementById("item-form"),e.getOptions("com_mails")).bindListeners()}))})(document,Joomla);