diff --git a/dist/bundle.js b/dist/bundle.js index 7e85afe..4257a26 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -4,4 +4,4 @@ * * @author Vishal Telangre * @license MIT - */n(2).toString();var f=function(){function e(t){var n=t.data,r=t.config,o=t.api;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.api=o,this.defaultType=r.defaultType||e.DEFAULT_TYPE,this.messagePlaceholder=r.messagePlaceholder||e.DEFAULT_MESSAGE_PLACEHOLDER,this.data={type:e.ALERT_TYPES.includes(n.type)?n.type:this.defaultType,message:n.message||""},this.container=void 0}return d(e,[{key:"CSS",get:function(){return{settingsButton:this.api.styles.settingsButton,settingsButtonActive:this.api.styles.settingsButtonActive,wrapper:"cdx-alert",wrapperForType:function(e){return"cdx-alert-".concat(e)},message:"cdx-alert__message"}}}],[{key:"toolbox",get:function(){return{icon:o.a,title:"Alert"}}},{key:"enableLineBreaks",get:function(){return!0}},{key:"DEFAULT_TYPE",get:function(){return"info"}},{key:"DEFAULT_MESSAGE_PLACEHOLDER",get:function(){return"Type here..."}},{key:"ALERT_TYPES",get:function(){return["primary","secondary","info","success","warning","danger","light","dark"]}}]),d(e,[{key:"render",value:function(){var e=[this.CSS.wrapper,this.CSS.wrapperForType(this.data.type)];this.container=this._make("div",e);var t=this._make("div",[this.CSS.message],{contentEditable:!0,innerHTML:this.data.message});return t.dataset.placeholder=this.messagePlaceholder,this.container.appendChild(t),this.container}},{key:"renderSettings",value:function(){var t=this,n=this._make("div");return e.ALERT_TYPES.forEach((function(e){var r=t._make("div",[t.CSS.settingsButton,t.CSS.wrapper,t.CSS.wrapperForType(e)],{innerHTML:"A"});t.data.type===e&&r.classList.add(t.CSS.settingsButtonActive),r.addEventListener("click",(function(){t._changeAlertType(e),n.querySelectorAll(".".concat(t.CSS.settingsButton)).forEach((function(e){return e.classList.remove(t.CSS.settingsButtonActive)})),r.classList.add(t.CSS.settingsButtonActive)})),n.appendChild(r)})),n}},{key:"_changeAlertType",value:function(t){var n=this;this.data.type=t,e.ALERT_TYPES.forEach((function(e){var r=n.CSS.wrapperForType(e);n.container.classList.remove(r),t===e&&n.container.classList.add(r)}))}},{key:"save",value:function(e){var t=e.querySelector(".".concat(this.CSS.message));return s(s({},this.data),{},{message:t.innerHTML})}},{key:"_make",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(e);Array.isArray(n)?(t=o.classList).add.apply(t,a(n)):n&&o.classList.add(n);for(var i in r)o[i]=r[i];return o}},{key:"onPaste",value:function(e){var t=e.detail.data;this.data={type:this.defaultType,message:t.innerHTML||""}}}],[{key:"conversionConfig",get:function(){var e=this;return{export:function(e){return e.message},import:function(t){return{message:t,type:e.DEFAULT_TYPE}}}}},{key:"sanitize",get:function(){return{type:!1,message:!0}}}]),e}()},function(e,t,n){var r=n(3),o=n(4);"string"==typeof(o=o.__esModule?o.default:o)&&(o=[[e.i,o,""]]);var a={insert:"head",singleton:!1};r(o,a);e.exports=o.locals||{}},function(e,t,n){"use strict";var r,o=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},a=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),i=[];function c(e){for(var t=-1,n=0;n1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(e);Array.isArray(n)?(t=o.classList).add.apply(t,a(n)):n&&o.classList.add(n);for(var i in r)o[i]=r[i];return o}},{key:"onPaste",value:function(e){var t=e.detail.data;this.data={type:this.defaultType,message:t.innerHTML||""}}}],[{key:"isReadOnlySupported",get:function(){return!0}},{key:"conversionConfig",get:function(){var e=this;return{export:function(e){return e.message},import:function(t){return{message:t,type:e.DEFAULT_TYPE}}}}},{key:"sanitize",get:function(){return{type:!1,message:!0}}}]),e}()},function(e,t,n){var r=n(3),o=n(4);"string"==typeof(o=o.__esModule?o.default:o)&&(o=[[e.i,o,""]]);var a={insert:"head",singleton:!1};r(o,a);e.exports=o.locals||{}},function(e,t,n){"use strict";var r,o=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},a=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),i=[];function c(e){for(var t=-1,n=0;n - + - +