File "textarea.min.js"

Full Path: /home/fresvfqn/waterdamagerestorationandrepairsmithtown.com/wp-content/plugins/sureforms/assets/js/minified/blocks/textarea.min.js
File size: 2.69 KB
MIME-type: text/plain
Charset: utf-8

function initializeTextarea(){var e=Array.from(document.getElementsByClassName("srfm-textarea-block"));if(e)for(let r of e){let i=r.querySelector("textarea");if(i)if(i.addEventListener("input",function(){var e,t=i.value,l=i.getAttribute("maxLength");""!==l&&(e=r.querySelector(".srfm-text-counter"))&&(t=l-t.length,e.innerText=t+"/"+l)}),"true"===i.getAttribute("data-is-richtext")){addQuillEditor(i),handleQuillEditorA11Y(i);let e=i?.parentElement?.querySelector(".quill-editor-container");var t=e?.querySelector(".ql-editor");t?.addEventListener("focus",function(){e.parentElement.classList.add("srfm-quill-editor-focused")}),t?.addEventListener("click",function(){e.parentElement.classList.add("srfm-quill-editor-focused")}),t?.addEventListener("blur",function(){e.parentElement.classList.remove("srfm-quill-editor-focused")})}}}function addQuillEditor(l){var e=l.getAttribute("id"),t=Quill.import("attributors/style/align"),i=Quill.import("attributors/style/direction"),r=Quill.import("ui/icons"),r=(r.undo='<svg viewBox="0 0 18 18"><polygon class="ql-fill ql-stroke" points="6 10 4 12 2 10 6 10" /><path class="ql-stroke" d="M8.09,13.91A4.6,4.6,0,0,0,9,14,5,5,0,1,0,4,9" /></svg>',r.redo='<svg viewBox="0 0 18 18"><polygon class="ql-fill ql-stroke" points="12 10 14 12 16 10 12 10" /><path class="ql-stroke" d="M9.91,13.91A4.6,4.6,0,0,1,9,14a5,5,0,1,1,5-5"/></svg>',Quill.register(t,!0),Quill.register(i,!0),"quill-"+e),t=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"];let o=new Quill("#"+r,{theme:"snow",modules:{toolbar:{container:[[{header:[1,2,3,4,5,6,!1]}],["bold","italic","underline","strike"],[{list:"ordered"},{list:"bullet"}],["blockquote"],[{align:[]}],[{color:t},{background:t}],["link"],["clean"],["undo","redo"]],handlers:{undo(){this.quill.history.undo()},redo(){this.quill.history.redo()}}},keyboard:{bindings:{tab:!0}},history:{delay:1e3,maxStack:100,userOnly:!0}}});window?.addGlobalSrfmObject(e,o);i=l.value;o.clipboard.dangerouslyPasteHTML(i),o.blur(),o.on("text-change",function(){var e=o.root.innerHTML,t=o.getLength();l.value=1<t?e:"",l.dispatchEvent(new Event("input"))})}function handleQuillEditorA11Y(e){var t,l,e=e.closest(".srfm-textarea-block");e&&(t=e.querySelector(".quill-editor-container"),l=e.querySelector(".ql-container"),e=e.querySelector("label")?.getAttribute("id"),l?.setAttribute("aria-labelledby",e),t?.setAttribute("aria-labelledby",e))}document.addEventListener("DOMContentLoaded",initializeTextarea);