opnform-host-nginx/public/vendor/mailcoach-editor/assets/editor.e48a8a0e.js

11 lines
13 KiB
JavaScript
Raw Normal View History

2022-09-20 21:59:52 +02:00
import{E as e,H as t,L as a,I as n,Q as o,D as i,R as s,T as d,a as r}from"./vendor.871f4f88.js";function l(e,t=document){return t.querySelector(e)}function c(e,t=document){return Array.from(t.querySelectorAll(e))}!function(e=".",t="__import__"){try{self[t]=new Function("u","return import(u)")}catch(a){const n=new URL(e,location),o=e=>{URL.revokeObjectURL(e.src),e.remove()};self[t]=e=>new Promise(((a,i)=>{const s=new URL(e,n);if(self[t].moduleMap[s])return a(self[t].moduleMap[s]);const d=new Blob([`import * as m from '${s}';`,`${t}.moduleMap['${s}']=m;`],{type:"text/javascript"}),r=Object.assign(document.createElement("script"),{type:"module",src:URL.createObjectURL(d),onerror(){i(new Error(`Failed to import: ${e}`)),o(r)},onload(){a(self[t].moduleMap[s]),o(r)}});document.head.appendChild(r)})),self[t].moduleMap={}}}("/build/assets/");const u=['a[href]:not([disabled]):not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','input:not([type="hidden"]):not([disabled]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])'];function m(e,t,a){document.addEventListener(e,(e=>{const n=e.target.closest(t);n&&a({event:e,target:n})}))}function h(){}async function g(e,t){e.classList.add(`${t}-leave`),e.classList.add(`${t}-leave-start`),await v(),e.classList.remove(`${t}-leave-start`),e.classList.add(`${t}-leave-end`),await p(e),e.classList.remove(`${t}-leave-end`),e.classList.remove(`${t}-leave`),e.classList.add("hidden"),await v()}function p(e){return new Promise((t=>{const a=1e3*Number(getComputedStyle(e).transitionDuration.replace("s",""));setTimeout((()=>{t()}),a)}))}function v(){return new Promise((e=>{requestAnimationFrame((()=>{requestAnimationFrame(e)}))}))}async function f(e,t){return(await fetch(e,{method:"POST",body:t,credentials:"same-origin",headers:{"X-CSRF-Token":l('[name="_token"]').value}})).json()}async function w(e,t){const a=await fetch(e,{method:"POST",body:JSON.stringify({data:t}),credentials:"same-origin",headers:{"Content-Type":"application/json","X-CSRF-Token":l('[name="_token"]').value}});return(await a.json()).html}function b(e,{onConfirm:t=h,onDismiss:a=h}={}){const n=l(`[data-modal="${e}"]`);!async function(e,t){e.classList.remove("hidden"),e.classList.add(`${t}-enter`),e.classList.add(`${t}-enter-start`),await v(),e.classList.remove(`${t}-enter-start`),e.classList.add(`${t}-enter-end`),await p(e),e.classList.remove(`${t}-enter-end`),e.classList.remove(`${t}-enter`),await v()}(n,"fade");E(n,{onConfirm:t,onDismiss:a,onClose:function(e){const t=c(u.join(", "),e),a=t[0],n=t[t.length-1];function o(e){"Tab"===e.key&&(e.shiftKey?document.activeElement===a&&(e.preventDefault(),n.focus()):document.activeElement===n&&(e.preventDefault(),a.focus()))}return a&&a.focus(),window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o)}}(n)}),y(!0)}function y(e){window.history.replaceState({},"",window.location.pathname+window.location.search+(e?"#modal":""))}function E(e,{onConfirm:t,onDismiss:a,onClose:n}){function o(t){"Escape"===t.key&&e.dispatchEvent(new Event("dismiss"))}function i(){t(),d(),g(e,"fade")}function s(){a(),d(),g(e,"fade")}function d(){n(),window.removeEventListener("keydown",o),e.removeEventListener("confirm",i),e.removeEventListener("dismiss",s),y(!1)}window.addEventListener("keydown",o),e.addEventListener("confirm",i),e.addEventListener("dismiss",s)}if(m("click","[data-modal-trigger]",(({target:e})=>{b(e.dataset.modalTrigger)})),m("click","[data-modal-confirm]",(({target:e})=>{e.closest("[data-modal]").dispatchEvent(new Event("confirm"))})),m("click","[data-modal-dismiss]",(({target:e})=>{e.closest("[data-modal]").dispatchEvent(new Event("dismiss"))})),m("click","[data-modal-backdrop]",(({event:e,target:t})=>{if(e.target===t){t.closest("[data-modal]").dispatchEvent(new Event("dismiss"))}})),document.addEventListener("turbolinks:load",(()=>{c("[data-modal]").filter((e=>!e.classList.contains("hidden"))).forEach((e=>{E(e,{onConfirm:h,onDismiss:h,onClose:h})}))})),window.location.hash.includes("#modal")){con
/**
* CodeTool for Editor.js
*
* @author CodeX (team@ifmo.su)
* @copyright CodeX 2018
* @license MIT
* @version 2.0.0
*/
class L{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}constructor({data:e,config:t,api:a,readOnly:n}){this.api=a,this.readOnly=n,this.placeholder=this.api.i18n.t(t.placeholder||L.DEFAULT_PLACEHOLDER),this.CSS={baseClass:this.api.styles.block,input:this.api.styles.input,wrapper:"ce-code",textarea:"ce-code__textarea"},this.nodes={holder:null,textarea:null,language:null,theme:null},this.data={code:e.code||"",language:e.language||"",theme:e.theme||"default"},this.nodes.holder=this.drawView()}drawView(){const e=document.createElement("div"),t=document.createElement("textarea"),a=document.createElement("input"),n=document.createElement("select");e.classList.add(this.CSS.baseClass,this.CSS.wrapper),t.classList.add(this.CSS.textarea,this.CSS.input),t.placeholder=this.placeholder,t.textContent=this.data.code,a.classList.add(this.CSS.input),a.value=this.data.language,a.placeholder="Language",n.classList.add(this.CSS.input,"theme-selector"),this.readOnly&&(t.disabled=!0,a.disabled=!0);const o=document.createElement("div");o.appendChild(a),o.appendChild(n),o.classList.add("grid","grid-cols-2","gap-4","mt-4"),e.appendChild(o),e.appendChild(t),t.addEventListener("keydown",(e=>{switch(e.code){case"Tab":this.tabHandler(e)}}));const i=document.createElement("option");i.setAttribute("disabled",!0),i.setAttribute("selected",!0),i.textContent="Select a theme",n.appendChild(i);const s=["a11y-dark","a11y-light","agate","an-old-hope","androidstudio","arduino-light","arta","ascetic","atelier-cave-dark","atelier-cave-light","atelier-dune-dark","atelier-dune-light","atelier-estuary-dark","atelier-estuary-light","atelier-forest-dark","atelier-forest-light","atelier-heath-dark","atelier-heath-light","atelier-lakeside-dark","atelier-lakeside-light","atelier-plateau-dark","atelier-plateau-light","atelier-savanna-dark","atelier-savanna-light","atelier-seaside-dark","atelier-seaside-light","atelier-sulphurpool-dark","atelier-sulphurpool-light","atom-one-dark","atom-one-dark-reasonable","atom-one-light","brown-paper","codepen-embed","color-brewer","darcula","dark","darkula","default","docco","dracula","far","foundation","github","github-gist","gml","googlecode","gradient-dark","grayscale","gruvbox-dark","gruvbox-light","hopscotch","hybrid","idea","ir-black","isbl-editor-dark","isbl-editor-light","kimbie.dark","kimbie.light","lightfair","magula","mono-blue","monokai","monokai-sublime","night-owl","nord","obsidian","ocean","paraiso-dark","paraiso-light","pojoaque","pojoaque.jpg","purebasic","qtcreator_dark","qtcreator_light","railscasts","rainbow","routeros","school-book","shades-of-purple","solarized-dark","solarized-light","sunburst","tomorrow","tomorrow-night","tomorrow-night-blue","tomorrow-night-bright","tomorrow-night-eighties","vs","vs2015","xcode","xt256","zenburn"];for(let d=0;d<s.length;d++){const e=document.createElement("option"),t=s[d];"string"==typeof t?(e.setAttribute("value",t),e.textContent=t):(e.setAttribute("value",t.value),e.textContent=t.label),n.appendChild(e)}return""!==this.data.theme&&(n.value=this.data.theme),n.addEventListener("change",(e=>{document.querySelectorAll(".theme-selector").forEach((t=>{t.value=e.target.value}))})),this.nodes.textarea=t,this.nodes.language=a,this.nodes.theme=n,e}render(){return this.nodes.holder}save(e){return{code:e.querySelector("textarea").value,language:e.querySelector("input").value,theme:document.querySelector(".theme-selector").value}}onPaste(e){const t=e.detail.data;this.data={code:t.textContent}}get data(){return this._data}set data(e){this._data=e,this.nodes.textarea&&(this.nodes.textarea.textContent=e.code),this.nodes.language&&(this.nodes.language.value=e.language),this.nodes.theme&&(this.nodes.theme.value=e.theme)}static get toolbox(){return{icon:'<svg width="14" height="14" viewBox="0 -1 14 14" xmlns="http://www.w3.org/2000/svg" > <path d="M3.177 6.852c.205.253.347.572.427.954.078.372.117.844.117 1.417 0 .418.01.725.03.92.02.18.057.314.107.396.046.075.093.117.14.134.075.027.218.056.42.083a.855.855 0 0 1 .56.297c.145.167.215.38.215.636 0 .612-.432.934-1