msf-editor
Advanced tools
| 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} |
@@ -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],"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],"getSectionsCount":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options); | ||
| }); | ||
@@ -20,0 +20,0 @@ }; |
@@ -26,2 +26,5 @@ 'use strict'; | ||
| } | ||
| async getSectionsCount() { | ||
| this.sendMessage("getSectionsCount", {}); | ||
| } | ||
| async test() { | ||
@@ -28,0 +31,0 @@ console.log("Only a test"); |
@@ -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],"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],"getSectionsCount":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options); | ||
| }); |
@@ -17,2 +17,5 @@ import { Component, Element, Event, h, Listen, Method, Prop, State } from '@stencil/core'; | ||
| } | ||
| async getSectionsCount() { | ||
| this.sendMessage("getSectionsCount", {}); | ||
| } | ||
| async test() { | ||
@@ -249,2 +252,18 @@ console.log("Only a test"); | ||
| }, | ||
| "getSectionsCount": { | ||
| "complexType": { | ||
| "signature": "() => Promise<void>", | ||
| "parameters": [], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| }, | ||
| "test": { | ||
@@ -251,0 +270,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],"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],"getSectionsCount":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options); | ||
| }); | ||
@@ -16,0 +16,0 @@ }; |
@@ -22,2 +22,5 @@ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-91f324f7.js'; | ||
| } | ||
| async getSectionsCount() { | ||
| this.sendMessage("getSectionsCount", {}); | ||
| } | ||
| async test() { | ||
@@ -24,0 +27,0 @@ console.log("Only a test"); |
@@ -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],"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],"getSectionsCount":[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,n={};return""!==o&&(n.resourcesUrl=new URL(".",o).href),e(n)})().then((e=>o([["p-38c1cc9f",[[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))); | ||
| 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))); |
@@ -13,2 +13,3 @@ /* eslint-disable */ | ||
| "content": string; | ||
| "getSectionsCount": () => Promise<void>; | ||
| "load": (data: any) => Promise<void>; | ||
@@ -15,0 +16,0 @@ "preview": (device: any) => Promise<void>; |
@@ -18,2 +18,3 @@ import { EventEmitter } from '../../stencil-public-runtime'; | ||
| save(opts?: any): Promise<void>; | ||
| getSectionsCount(): Promise<void>; | ||
| test(): Promise<void>; | ||
@@ -20,0 +21,0 @@ spinner(behavior: 'hide' | 'show'): Promise<void>; |
+1
-1
| { | ||
| "name": "msf-editor", | ||
| "version": "0.9.0", | ||
| "version": "1.0.0", | ||
| "description": "Stencil Component Starter", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
| 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})}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} |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
378135
0.22%6390
0.42%9
-10%