🚀 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.0
to
1.0.1
+1
dist/msf-editor/p-aa69d2b3.entry.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}
+8
-0

@@ -142,2 +142,10 @@ 'use strict';

}
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 });

@@ -144,0 +152,0 @@ }

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

}
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 });

@@ -135,0 +143,0 @@ }

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

}
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 });

@@ -140,0 +148,0 @@ }

+1
-1

@@ -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-8bfe444c",[[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,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)));
{
"name": "msf-editor",
"version": "1.0.0",
"version": "1.0.1",
"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);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}