🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

msf-editor

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msf-editor - npm Package Compare versions

Comparing version
1.0.1
to
1.0.2
+15
dist/msf-editor/host.config.json
{
"hosting": {
"headers": [
{
"source": "/p-*",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=31556952, s-maxage=31556952, immutable"
}
]
}
]
}
}
<!doctype html><html dir="ltr" lang="en"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"> <title>MailStyler Plugin WebComponent Integration</title> <script type="module" src="/build/msf-editor.esm.js"></script> <script nomodule="" src="/build/msf-editor.js"></script> <style>body {
margin: 0;
}</style> </head> <body> <button id="save">Save</button> <button id="sendTest">Send Test</button> <button id="sectionsCount">Sections count</button> <ms-editor token="cbbaa5abdcd629725806c73fe05ffb1c1ae"></ms-editor> <script>
var msEditor = document.querySelector('ms-editor');
var toolbar = Promise.resolve({
label: "pippo",
fields: [
{
name: 'Unsubscribe link',
value: '<a class="emc_edd_link" href="[[unsubscribe_link]]">unsubscribe</a> '
}
]
});
msEditor.config = {
lang: 'en',
debug: false,
editorUrl: 'http://localhost:4200',
showCode: false,
toolbar: false,
rteToolbars: {
toolbar_0: toolbar
},
onSave: function (html, raw_html, json) {
console.log(html);
console.log(raw_html);
},
opts: {
preload: "https://andreadb.dev.emailchef.com/app/img/emc-load.svg",
blockResponsiveHelpers: {
active: true,
badWords: ['[[account:business]]', '[[unsubscribe_link]]']
}
},
style: {
vars: {
'base': '#fff',
'contrast': '#000',
'txt-low': '#efefef',
'txt-med': '#a4a4a4',
'txt-high': '#232323',
'bkg-low': '#6b6b6b',
'bkg-med': '#505050',
'bkg-high': '#454545',
'scroll-low': '#2c2c2c',
'scroll-med': '#454545',
'scroll-high': '#5a5a5a',
'info-low': '#e9eff2',
'info-med': '#92d2dd',
'info-high': '#00bcdd',
'primary-low': '#3399cc',
'primary-med': '#0079c1',
'primary-high': '#4b7fa0',
'element-low': '#00c5ab',
'element-med': '#00a08b',
'element-high': '#588778',
'block-low': '#f87676',
'block-med': '#f85e5e',
'block-high': '#e31c40',
'confirm-low': '#43a047',
'confirm-med': '#33691E',
'confirm-high': '#1f3f12',
'function-low': '#f48321',
'function-med': '#f47200',
'function-high': '#8e4200'
}
}
};
msEditor.content = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="format-detection" content="date=no" />
<meta name="format-detection" content="address=no" />
<meta name="format-detection" content="email=no" />
<meta name="x-apple-disable-message-reformatting" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;" />
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />
<style type="text/css">
body, .maintable { height:100% !important; width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
img, a img { border:0; outline:none; text-decoration:none;}
p, div {margin-top:0; margin-right:0; margin-left:0; padding:0;}
th {font-weight: normal}
.ReadMsgBody {width:100%;}
.ExternalClass {width:100%;}
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height:100%;}
img {-ms-interpolation-mode: bicubic;}
body, table, td, p, a, li, blockquote {-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%;}
@media only screen and (max-width: 600px) {
.rtable, .rtable__main, .rtable__social {width: 100% !important;}
.rtable tbody th {
display: block;
/*width: 100%; it could cause a bug in gmail/iphone*/
}
.contenttd {max-width: 100% !important; display: block; width: auto !important;}
.contenttd:after {content: ""; display: table; clear: both;}
.hiddentds {display: none;}
.imgtable, .imgtable table {max-width: 100% !important; height: auto; float: none; margin: 0 auto;}
.imgtable.btnset td {display: inline-block;}
.imgtable img {max-width: 100%!important; height: auto !important;display: block;}
table {float: none;}
.mobileHide {display: none !important;}
/*.rbutton {
margin: 10px auto!important;
}
.rbutton * {
margin: 10px auto!important;
}*/
}
.rtext p {
margin: 0 !important;
padding: 0 !important;
}
</style>
<!--[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
<![endif]-->
</head>
<body style="overflow: auto; padding:0; margin:0; font-size: 14px; font-family: Arial, helvetica, sans-serif; cursor:auto;">
<table cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="font-size: 0px; height: 0px; line-height: 0"></td>
</tr>
<tr>
<td>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="100%" id="primary" class="main demo" align="center" valign="top" > <div class="column"><div class="lyrow"><table cellspacing="0" cellpadding="0" width="100%" align="center" border="0" role="presentation" class="rtable" id="ivgj" style="width: 100%; margin: 0 auto;"><tbody><tr><th><table cellspacing="0" cellpadding="0" width="600" align="center" border="0" role="presentation" class="rtable__main" id="izku" style="width: 600px; margin: 0 auto;"><tbody><tr><th class="contenttd" id="ikjo" style="width: 600px; text-align: center;" width="600" align="center"><table cellspacing="0" cellpadding="0" align="center" role="presentation" id="idmsz" style="width: 100%;" width="100%"><tbody><tr><th bgcolor="#ffffff" class="contenttd rtdrop" id="int6i" style="width: 600px; word-break: break-word; background-color: #ffffff; vertical-align: top; border-top: medium none; border-right: medium none; border-bottom: medium none; border-left: medium none; text-align: left; font-weight: normal; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;" width="600" valign="top" align="left"><div class="rtdrag"><!--[if gte mso 12]>
<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td align="center">
<![endif]--><table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%"><tbody><tr><th align="left" class="rthead" id="ilf91" style="font-size: 24px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #575757; text-align: left; font-weight: normal; line-height: 34px; margin: 0; padding-top: 20px; padding-bottom: 0px; padding-left: 20px; padding-right: 20px;"><div class="rtitle" id="iw33k" style="mso-line-height-rule: exactly; margin: 0; padding: 0;">Pippo title</div></th></tr></tbody></table><!--[if gte mso 12]>
</td></tr></table>
<![endif]--></div><div class="rtdrag"><!--[if gte mso 12]>
<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td align="center">
<![endif]--><table cellspacing="0" cellpadding="0" border="0" role="presentation" width="100%"><tbody><tr><th class="rthead" id="ivw2b" style="font-weight: normal; font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #575757; text-align: left; line-height: 22px; margin: 0; padding-top: 10px; padding-bottom: 0px; padding-left: 20px; padding-right: 20px;" align="left"><div class="rtext" id="ikaff" style="mso-line-height-rule: exactly; margin: 0;">Sweet toffee topping tiramisu. Chocolate bar croissant fruitcake jelly-o apple pie. Gummies dragée tart cookie wafer muffin.</div></th></tr></tbody></table><!--[if gte mso 12]>
</td></tr></table>
<![endif]--></div><div class="rimage rtdrag"><!--[if gte mso 12]>
<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td align="center">
<![endif]--><table cellspacing="0" cellpadding="0" align="center" border="0" role="presentation" width="100%" class="imgtable"><tbody><tr><th align="center" id="igw8b" style="font-weight: normal; padding-top: 10px; padding-bottom: 10px; padding-left: 0px; padding-right: 0px;"><table cellspacing="0" cellpadding="0" border="0" role="presentation" align="center"><tbody><tr><td id="itckr" style="BORDER-TOP: medium none; BORDER-RIGHT: medium none; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none;"><img alt="Image" src="https://mailchef.s3.amazonaws.com/uploads/mailstyler/images/1B82A1B3-06FD-8FD9-FFC6-36E7D84B6C7B_Image_1_7fa55f23-aeaa-4503-96d4-79d3a5b83dc2.png" width="560" hspace="0" vspace="0" border="0" role="img" id="ieg2d" style="font-family: sans-serif; color: #333333; font-size: 18px; display: block; border-top: medium none; border-right: medium none; border-bottom: medium none; border-left: medium none; max-width: 100%; height: 196px; width: 560px;" height="196"></td></tr></tbody></table></th></tr></tbody></table><!--[if gte mso 12]>
</td></tr></table>
<![endif]--></div><div class="rbutton rtdrag"><table cellspacing="0" cellpadding="0" border="0" width="100%"><tbody><tr><th align="center" class="rthead" id="i6tgp" style="vertical-align: middle; padding-top: 0px; padding-right: 0; padding-bottom: 20px; padding-left: 0;" valign="middle"><table border="0" cellspacing="0" cellpadding="0" align="center" role="presentation"><tbody><tr><th align="center" bgcolor="#555555" id="icati" style="border-radius: 0;"><a href target="_blank" class="btn__btn" id="iywh7" style="text-align: center; font-size: 14px; font-family: Arial, Helvetica, sans-serif; color: #ffffff; text-decoration: none; border-radius: 0; padding-top: 10px; padding-right: 20px; padding-bottom: 10px; padding-left: 20px; border: 0; display: inline-block;">Click me</a></th></tr></tbody></table></th></tr></tbody></table></div></th></tr></tbody></table></th></tr></tbody></table></th></tr></tbody></table></div></div> </td> </tr></table> </td>
</tr>
</tbody>
</table>
</body>
</html>`;
msEditor.addEventListener('editorEvent', function(ev){
console.log('editorEvent', ev.detail);
});
document.getElementById("sendTest").addEventListener("click", function () {
msEditor.sendTest();
});
document.getElementById("save").addEventListener("click", function () {
msEditor.save();
});
document.getElementById("sectionsCount").addEventListener("click", function () {
msEditor.getSectionsCount();
});
</script> </body></html>
(function() {
function checkSupport() {
if (!document.body) {
setTimeout(checkSupport);
return;
}
function supportsDynamicImports() {
try {
new Function('import("")');
return true;
} catch (e) {}
return false;
}
var supportsEsModules = !!('noModule' in document.createElement('script'));
if (!supportsEsModules) {
document.body.innerHTML = '\n \n<style>\nbody {\n display: block !important;\n font-family: sans-serif;\n padding: 20px;\n line-height:22px;\n}\nh1 {\n font-size: 18px;\n}\nh2 {\n font-size: 14px;\n margin-top: 40px;\n}\n</style>\n\n\n <h1>This Stencil app is disabled for this browser.</h1>\n\n <h2>Developers:</h2>\n <ul>\n <li>ES5 builds are disabled <strong>during development</strong> to take advantage of 2x faster build times.</li>\n <li>Please see the example below or our <a href="https://stenciljs.com/docs/stencil-config" target="_blank" rel="noopener noreferrer">config docs</a> if you would like to develop on a browser that does not fully support ES2017 and custom elements.</li>\n <li>Note that as of Stencil v2, ES5 builds and polyfills are <strong>disabled</strong> during production builds. You can enable these <a href="https://stenciljs.com/docs/config#buildes5" target="_blank" rel="noopener noreferrer">in your stencil.config.ts file</a>.</li>\n <li>When testing browsers it is recommended to always test in production mode, and ES5 builds should always be enabled during production builds.</li>\n <li><em>This is only an experiment and if it slows down app development then we will revert this and enable ES5 builds during dev.</em></li>\n </ul>\n\n\n <h2>Enabling ES5 builds during development:</h2>\n <pre>\n <code>npm run dev --es5</code>\n </pre>\n <p>For stencil-component-starter, use:</p>\n <pre>\n <code>npm start --es5</code>\n </pre>\n\n\n <h2>Enabling full production builds during development:</h2>\n <pre>\n <code>npm run dev --prod</code>\n </pre>\n <p>For stencil-component-starter, use:</p>\n <pre>\n <code>npm start --prod</code>\n </pre>\n\n <h2>Current Browser\'s Support:</h2>\n <ul>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import">ES Module Imports</a>: <span id="es-modules-test"></span></li>\n <li><a href="http://2ality.com/2017/01/import-operator.html">ES Dynamic Imports</a>: <span id="es-dynamic-modules-test"></span></li>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/customElements">Custom Elements</a>: <span id="custom-elements-test"></span></li>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM">Shadow DOM</a>: <span id="shadow-dom-test"></span></li>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">fetch</a>: <span id="fetch-test"></span></li>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables">CSS Variables</a>: <span id="css-variables-test"></span></li>\n </ul>\n\n <h2>Current Browser:</h2>\n <pre>\n <code id="current-browser-output"></code>\n </pre>\n';
document.getElementById('current-browser-output').textContent = window.navigator.userAgent;
document.getElementById('es-modules-test').textContent = supportsEsModules;
document.getElementById('es-dynamic-modules-test').textContent = supportsDynamicImports();
document.getElementById('shadow-dom-test').textContent = !!(document.head.attachShadow);
document.getElementById('custom-elements-test').textContent = !!(window.customElements);
document.getElementById('css-variables-test').textContent = !!(window.CSS && window.CSS.supports && window.CSS.supports('color', 'var(--c)'));
document.getElementById('fetch-test').textContent = !!(window.fetch);
} else {
document.body.innerHTML = '\n \n<style>\nbody {\n display: block !important;\n font-family: sans-serif;\n padding: 20px;\n line-height:22px;\n}\nh1 {\n font-size: 18px;\n}\nh2 {\n font-size: 14px;\n margin-top: 40px;\n}\n</style>\n\n\n <h1>Update src/index.html</h1>\n\n <p>Stencil recently changed how scripts are loaded in order to improve performance.</p>\n\n <h2>BEFORE:</h2>\n <p>Previously, a single script was included that handled loading the correct JavaScript based on browser support.</p>\n <pre>\n <code>&lt;script src=&quot;/build/msf-editor.js&quot;&gt;&lt;/script&gt;\n</code>\n </pre>\n\n <h2 style="margin-top:0">AFTER:</h2>\n <p>The index.html should now include two scripts using the modern ES Module script pattern.\n Note that only one file will actually be requested and loaded based on the browser\'s native support for ES Modules.\n For more info, please see <a href="https://developers.google.com/web/fundamentals/primers/modules#browser" target="_blank" rel="noopener noreferrer">Using JavaScript modules on the web</a>.\n </p>\n <pre>\n <code>&lt;script <span style="background:yellow">type="module"</span> src="/build/msf-editor<span style="background:yellow">.esm</span>.js"&gt;&lt;/script&gt;\n &lt;script <span style="background:yellow">nomodule</span> src=&quot;/build/msf-editor.js&quot;&gt;&lt;/script&gt;</code>\n </pre>\n';
}
}
setTimeout(checkSupport);
})();
import{r as i,c as t,h as s,g as e}from"./p-54bac826.js";let o=class{constructor(s){i(this,s),this.editorEvent=t(this,"editorEvent",7),this.content="",this.assetsLoaded=!1,this.modalOpen=!1}sendMessage(i,t){this.editorFrame.contentWindow.postMessage({action:i,data:t},"*")}async save(i={}){this.sendMessage("save",i)}async test(){console.log("Only a test")}async spinner(i){["hide","show"].includes(i)||(i="hide"),this.sendMessage("showSpinner",{behavior:i})}async start(i){this.sendMessage("load",i)}async sendTest(i){this.sendMessage("sendTest",i)}async beforeUnload(i){this.sendMessage("beforeUnload",i)}async load(i){this.sendMessage("load",i)}async preview(i){this.sendMessage("preview",i)}async initConfig(){console.info("MailStyler Plugin: loading assets .."),this.config.rteToolbars&&this.config.rteToolbars.toolbar_0&&this.config.rteToolbars.toolbar_0 instanceof Promise&&(this.config.rteToolbars.toolbar_0=await this.config.rteToolbars.toolbar_0),this.config.lang&&this.config.lang.custom&&this.config.lang.custom instanceof Promise&&(this.config.lang.custom=await this.config.lang.custom),this.config.rteToolbars&&this.config.rteToolbars.toolbar_1&&this.config.rteToolbars.toolbar_1 instanceof Promise&&(this.config.rteToolbars.toolbar_1=await this.config.rteToolbars.toolbar_1);const i=void 0!==this.config.debug&&this.config.debug;this.editorUrl=this.config.editorUrl||"//editor.mailstyler.com",this.mscFrameworkUrl=i?"http://localhost:4200":this.editorUrl,this.assetsLoaded=!0,console.info("MailStyler Plugin: assets loaded!")}async componentWillRender(){!this.assetsLoaded&&this.config&&await this.initConfig()}render(){return s("iframe",{class:{open:this.modalOpen},src:this.mscFrameworkUrl,allow:"clipboard-read; clipboard-write"})}editorDidOpen(){this.load(this.content||"").then((()=>console.log("MailStyler Plugin: Template is loaded succesfully")))}listenMessage(i){if(i.data&&i.data.action){const{action:t,data:s}=i.data;if("appOk"===t)console.info("MailStyler Plugin: Editor is ready!"),this.editorDidOpen();else if("appReady"===t){let i=Object.assign({},this.config);Object.keys(i).filter((t=>"function"==typeof i[t])).forEach((t=>delete i[t])),this.sendMessage("init",{token:this.token,hostname:window.location.hostname,config:i})}else if("appSave"===t){const i=new RegExp('bgcolor="none"',"g");s.html=s.html.replace(i,""),s.raw_html=s.raw_html.replace(i,""),"function"==typeof this.config.onSave?this.config.onSave(s.html,s.raw_html,s.json,s.opts):console.error("MailStyler Plugin: You should provide a valid onSave callback")}else if("appAutoSave"===t){const i=new RegExp('bgcolor="none"',"g");s.html=s.html.replace(i,""),s.raw_html=s.raw_html.replace(i,""),"function"==typeof this.config.onAutoSave?this.config.onAutoSave(s.html,s.raw_html,s.json,s.opts):console.error("MailStyler Plugin: You should provide a valid onAutoSave callback")}else if("appSaveBlock"===t){const i=new RegExp('bgcolor="none"',"g");s.html=s.html.replace(i,""),s.raw_html=s.raw_html.replace(i,""),"function"==typeof this.config.onSaveBlock?this.config.onSaveBlock(s.html,s.raw_html):console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback")}else"appModal"===t&&(this.modalOpen="open"===s.env);this.editorEvent.emit({action:t,data:s})}}componentWillLoad(i){this.editorFrame=this.element.shadowRoot.querySelector("iframe"),i&&this.listenMessage(i)}get element(){return e(this)}};o.style=":host{display:block;width:100%;border:0;height:100vh}iframe{height:100%;width:100%;min-width:1024px;border:0;z-index:9999;top:0}iframe.open{position:fixed}";export{o as ms_editor}
+1
-1

@@ -17,3 +17,3 @@ 'use strict';

return patchEsm().then(() => {
return index.bootstrapLazy([["ms-editor.cjs",[[1,"ms-editor",{"token":[1],"config":[8],"content":[1],"modalOpen":[32],"save":[64],"getSectionsCount":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options);
return index.bootstrapLazy([["ms-editor.cjs",[[1,"ms-editor",{"token":[1],"config":[8],"content":[1],"modalOpen":[32],"save":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options);
});

@@ -20,0 +20,0 @@ };

@@ -26,5 +26,2 @@ 'use strict';

}
async getSectionsCount() {
this.sendMessage("getSectionsCount", {});
}
async test() {

@@ -83,3 +80,3 @@ console.log("Only a test");

render() {
return (index.h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl }));
return (index.h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl, allow: 'clipboard-read; clipboard-write' }));
}

@@ -144,10 +141,2 @@ editorDidOpen() {

}
else if (action === "appGetSectionsCount") {
if ("function" == typeof this.config.onCountSections) {
this.config.onCountSections(data.total);
}
else {
console.error("MailStyler Plugin: You should provide a valid onCountSections callback");
}
}
this.editorEvent.emit({ action, data });

@@ -154,0 +143,0 @@ }

@@ -18,3 +18,3 @@ 'use strict';

patchBrowser().then(options => {
return index.bootstrapLazy([["ms-editor.cjs",[[1,"ms-editor",{"token":[1],"config":[8],"content":[1],"modalOpen":[32],"save":[64],"getSectionsCount":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options);
return index.bootstrapLazy([["ms-editor.cjs",[[1,"ms-editor",{"token":[1],"config":[8],"content":[1],"modalOpen":[32],"save":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options);
});

@@ -17,5 +17,2 @@ import { Component, Element, Event, h, Listen, Method, Prop, State } from '@stencil/core';

}
async getSectionsCount() {
this.sendMessage("getSectionsCount", {});
}
async test() {

@@ -74,3 +71,3 @@ console.log("Only a test");

render() {
return (h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl }));
return (h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl, allow: 'clipboard-read; clipboard-write' }));
}

@@ -135,10 +132,2 @@ editorDidOpen() {

}
else if (action === "appGetSectionsCount") {
if ("function" == typeof this.config.onCountSections) {
this.config.onCountSections(data.total);
}
else {
console.error("MailStyler Plugin: You should provide a valid onCountSections callback");
}
}
this.editorEvent.emit({ action, data });

@@ -262,18 +251,2 @@ }

},
"getSectionsCount": {
"complexType": {
"signature": "() => Promise<void>",
"parameters": [],
"references": {
"Promise": {
"location": "global"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"test": {

@@ -280,0 +253,0 @@ "complexType": {

@@ -13,3 +13,3 @@ import { p as promiseResolve, b as bootstrapLazy } from './index-91f324f7.js';

return patchEsm().then(() => {
return bootstrapLazy([["ms-editor",[[1,"ms-editor",{"token":[1],"config":[8],"content":[1],"modalOpen":[32],"save":[64],"getSectionsCount":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options);
return bootstrapLazy([["ms-editor",[[1,"ms-editor",{"token":[1],"config":[8],"content":[1],"modalOpen":[32],"save":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options);
});

@@ -16,0 +16,0 @@ };

@@ -22,5 +22,2 @@ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-91f324f7.js';

}
async getSectionsCount() {
this.sendMessage("getSectionsCount", {});
}
async test() {

@@ -79,3 +76,3 @@ console.log("Only a test");

render() {
return (h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl }));
return (h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl, allow: 'clipboard-read; clipboard-write' }));
}

@@ -140,10 +137,2 @@ editorDidOpen() {

}
else if (action === "appGetSectionsCount") {
if ("function" == typeof this.config.onCountSections) {
this.config.onCountSections(data.total);
}
else {
console.error("MailStyler Plugin: You should provide a valid onCountSections callback");
}
}
this.editorEvent.emit({ action, data });

@@ -150,0 +139,0 @@ }

@@ -16,3 +16,3 @@ import { p as promiseResolve, b as bootstrapLazy } from './index-91f324f7.js';

patchBrowser().then(options => {
return bootstrapLazy([["ms-editor",[[1,"ms-editor",{"token":[1],"config":[8],"content":[1],"modalOpen":[32],"save":[64],"getSectionsCount":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options);
return bootstrapLazy([["ms-editor",[[1,"ms-editor",{"token":[1],"config":[8],"content":[1],"modalOpen":[32],"save":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options);
});

@@ -1,1 +0,1 @@

import{p as e,b as o}from"./p-54bac826.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-aa69d2b3",[[1,"ms-editor",{token:[1],config:[8],content:[1],modalOpen:[32],save:[64],getSectionsCount:[64],test:[64],spinner:[64],start:[64],sendTest:[64],beforeUnload:[64],load:[64],preview:[64]},[[8,"message","componentWillLoad"]]]]]],e)));
import{p as e,b as o}from"./p-54bac826.js";(()=>{const o=import.meta.url,n={};return""!==o&&(n.resourcesUrl=new URL(".",o).href),e(n)})().then((e=>o([["p-09c17c8f",[[1,"ms-editor",{token:[1],config:[8],content:[1],modalOpen:[32],save:[64],test:[64],spinner:[64],start:[64],sendTest:[64],beforeUnload:[64],load:[64],preview:[64]},[[8,"message","componentWillLoad"]]]]]],e)));

@@ -13,3 +13,2 @@ /* eslint-disable */

"content": string;
"getSectionsCount": () => Promise<void>;
"load": (data: any) => Promise<void>;

@@ -16,0 +15,0 @@ "preview": (device: any) => Promise<void>;

@@ -18,3 +18,2 @@ import { EventEmitter } from '../../stencil-public-runtime';

save(opts?: any): Promise<void>;
getSectionsCount(): Promise<void>;
test(): Promise<void>;

@@ -21,0 +20,0 @@ spinner(behavior: 'hide' | 'show'): Promise<void>;

{
"name": "msf-editor",
"version": "1.0.1",
"version": "1.0.2",
"description": "Stencil Component Starter",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

import{r as t,c as i,h as s,g as e}from"./p-54bac826.js";let o=class{constructor(s){t(this,s),this.editorEvent=i(this,"editorEvent",7),this.content="",this.assetsLoaded=!1,this.modalOpen=!1}sendMessage(t,i){this.editorFrame.contentWindow.postMessage({action:t,data:i},"*")}async save(t={}){this.sendMessage("save",t)}async getSectionsCount(){this.sendMessage("getSectionsCount",{})}async test(){console.log("Only a test")}async spinner(t){["hide","show"].includes(t)||(t="hide"),this.sendMessage("showSpinner",{behavior:t})}async start(t){this.sendMessage("load",t)}async sendTest(t){this.sendMessage("sendTest",t)}async beforeUnload(t){this.sendMessage("beforeUnload",t)}async load(t){this.sendMessage("load",t)}async preview(t){this.sendMessage("preview",t)}async initConfig(){console.info("MailStyler Plugin: loading assets .."),this.config.rteToolbars&&this.config.rteToolbars.toolbar_0&&this.config.rteToolbars.toolbar_0 instanceof Promise&&(this.config.rteToolbars.toolbar_0=await this.config.rteToolbars.toolbar_0),this.config.lang&&this.config.lang.custom&&this.config.lang.custom instanceof Promise&&(this.config.lang.custom=await this.config.lang.custom),this.config.rteToolbars&&this.config.rteToolbars.toolbar_1&&this.config.rteToolbars.toolbar_1 instanceof Promise&&(this.config.rteToolbars.toolbar_1=await this.config.rteToolbars.toolbar_1);const t=void 0!==this.config.debug&&this.config.debug;this.editorUrl=this.config.editorUrl||"//editor.mailstyler.com",this.mscFrameworkUrl=t?"http://localhost:4200":this.editorUrl,this.assetsLoaded=!0,console.info("MailStyler Plugin: assets loaded!")}async componentWillRender(){!this.assetsLoaded&&this.config&&await this.initConfig()}render(){return s("iframe",{class:{open:this.modalOpen},src:this.mscFrameworkUrl})}editorDidOpen(){this.load(this.content||"").then((()=>console.log("MailStyler Plugin: Template is loaded succesfully")))}listenMessage(t){if(t.data&&t.data.action){const{action:i,data:s}=t.data;if("appOk"===i)console.info("MailStyler Plugin: Editor is ready!"),this.editorDidOpen();else if("appReady"===i){let t=Object.assign({},this.config);Object.keys(t).filter((i=>"function"==typeof t[i])).forEach((i=>delete t[i])),this.sendMessage("init",{token:this.token,hostname:window.location.hostname,config:t})}else if("appSave"===i){const t=new RegExp('bgcolor="none"',"g");s.html=s.html.replace(t,""),s.raw_html=s.raw_html.replace(t,""),"function"==typeof this.config.onSave?this.config.onSave(s.html,s.raw_html,s.json,s.opts):console.error("MailStyler Plugin: You should provide a valid onSave callback")}else if("appAutoSave"===i){const t=new RegExp('bgcolor="none"',"g");s.html=s.html.replace(t,""),s.raw_html=s.raw_html.replace(t,""),"function"==typeof this.config.onAutoSave?this.config.onAutoSave(s.html,s.raw_html,s.json,s.opts):console.error("MailStyler Plugin: You should provide a valid onAutoSave callback")}else if("appSaveBlock"===i){const t=new RegExp('bgcolor="none"',"g");s.html=s.html.replace(t,""),s.raw_html=s.raw_html.replace(t,""),"function"==typeof this.config.onSaveBlock?this.config.onSaveBlock(s.html,s.raw_html):console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback")}else"appModal"===i?this.modalOpen="open"===s.env:"appGetSectionsCount"===i&&("function"==typeof this.config.onCountSections?this.config.onCountSections(s.total):console.error("MailStyler Plugin: You should provide a valid onCountSections callback"));this.editorEvent.emit({action:i,data:s})}}componentWillLoad(t){this.editorFrame=this.element.shadowRoot.querySelector("iframe"),t&&this.listenMessage(t)}get element(){return e(this)}};o.style=":host{display:block;width:100%;border:0;height:100vh}iframe{height:100%;width:100%;min-width:1024px;border:0;z-index:9999;top:0}iframe.open{position:fixed}";export{o as ms_editor}