vue-email-editor
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -8,3 +8,6 @@ import { EmailEditorProps } from './types'; | ||
}; | ||
options: () => EmailEditorProps["options"]; | ||
options: { | ||
type: () => EmailEditorProps["options"]; | ||
default: () => {}; | ||
}; | ||
scriptUrl: () => EmailEditorProps["scriptUrl"]; | ||
@@ -28,3 +31,94 @@ /** | ||
}, { | ||
editor: import("vue").ShallowRef<import("embed/Editor").Editor | null>; | ||
editor: import("vue").Ref<{ | ||
frame: { | ||
id: number; | ||
ready: boolean; | ||
iframe: HTMLIFrameElement | undefined; | ||
messages: any[]; | ||
callbackId: number; | ||
callbacks: { | ||
[key: number]: Function | undefined; | ||
}; | ||
createIframe: (src: string) => HTMLIFrameElement; | ||
destroy: () => void; | ||
appendTo: (el: Element) => void; | ||
onWindowMessage: (event: MessageEvent<any>) => void; | ||
postMessage: (action: string, message: import("embed/Frame").Message) => void; | ||
withMessage: (action: string, message: import("embed/Frame").Message | undefined, callback?: Function) => void; | ||
_preprocessMessageFunctions: (message: import("embed/Frame").Message) => import("embed/Frame").Message; | ||
preprocessMessage: (message: import("embed/Frame").Message) => import("embed/Frame").Message; | ||
scheduleMessage: (message: import("embed/Frame").Message) => void; | ||
flushMessages: () => void; | ||
handleMessage: ({ action, callbackId, doneId, result: _result, resultArgs: _resultArgs, }: import("embed/Frame").MessageData) => void; | ||
receiveMessage: (event: any) => void; | ||
} | null; | ||
init: (config?: import("embed/Config").Config) => void; | ||
destroy: () => void; | ||
version: string | undefined; | ||
loadEditor: (config: import("embed/Config").Config) => void; | ||
renderEditor: (config: import("embed/Config").Config) => void; | ||
initEditor: (config: import("embed/Config").Config) => void; | ||
registerColumns: (cells: number[]) => void; | ||
registerCallback: (type: string, callback: Function) => void; | ||
unregisterCallback: (type: string) => void; | ||
registerProvider: (type: string, callback: Function) => void; | ||
unregisterProvider: (type: string) => void; | ||
reloadProvider: (type: string) => void; | ||
addEventListener: (type: string, callback: Function) => void; | ||
removeEventListener: (type: string) => void; | ||
setDesignId: (id: string | null) => void; | ||
setDesignMode: (designMode: string) => void; | ||
setDisplayMode: (displayMode: import("state/types/types").DisplayMode) => void; | ||
loadProject: (projectId: number) => void; | ||
loadUser: (user: import("state/types/types").User) => void; | ||
loadTemplate: (templateId: number) => void; | ||
loadStockTemplate: (stockTemplateId: string) => void; | ||
setLinkTypes: (linkTypes: import("state/types/types").LinkTypes) => void; | ||
setLinkTypesSharedConfig: (linkTypesSharedConfig: import("state/types/types").LinkTypesSharedConfig | null) => void; | ||
setMergeTags: (mergeTags: import("state/types/types").MergeTags) => void; | ||
setSpecialLinks: (specialLinks: import("state/types/types").SpecialLink[]) => void; | ||
setDisplayConditions: (displayConditions: import("state/types/types").DisplayConditions) => void; | ||
setLocale: (locale: import("engine/config/intl").Locale | null) => void; | ||
setTextDirection: (textDirection: import("engine/config/intl").TextDirection | null) => void; | ||
setTranslations: (translations: import("state/types/types").Translations) => void; | ||
loadBlank: (bodyValues?: object) => void; | ||
loadDesign: (design: import("state/types/types").JSONTemplate) => void; | ||
saveDesign: (callback: Function, options?: import("embed/Config").SaveDesignOptions) => void; | ||
exportHtml: (callback: (data: import("embed/Config").ExportHtmlResult) => void, options?: import("embed/Config").ExportHtmlOptions) => void; | ||
exportLiveHtml: (callback: (data: import("embed/Config").ExportLiveHtmlResult) => void, options?: import("embed/Config").ExportLiveHtmlOptions) => void; | ||
exportPlainText: (callback: (data: import("embed/Config").ExportPlainTextResult) => void, options?: import("embed/Config").ExportPlainTextOptions) => void; | ||
exportImage: (callback: (data: import("embed/Config").ExportFromApiResult) => void, options?: import("embed/Config").ExportImageFromApiOptions) => void; | ||
exportPdf: (callback: (data: import("embed/Config").ExportFromApiResult) => void, options?: import("embed/Config").ExportPdfFromApiOptions) => void; | ||
exportZip: (callback: (data: import("embed/Config").ExportFromApiResult) => void, options?: import("embed/Config").ExportZipFromApiOptions) => void; | ||
setAppearance: (appearance: import("editor/components/editors/types").DeepPartial<import("state/types/types").AppearanceConfig>) => void; | ||
setBodyValues: (bodyValues: Partial<import("engine/options/bodies").BodyValues>, bodyId?: number) => void; | ||
setStyleGuide: (styleGuide: object) => void; | ||
setDesignTagsConfig: (designTagsConfig: import("state/types/types").DesignTagsConfig) => void; | ||
setMergeTagsConfig: (mergeTagsConfig: import("state/types/types").MergeTagsConfig) => void; | ||
showPreview: (payload: { | ||
device?: import("state/types/types").Device; | ||
resolution?: number; | ||
}) => void; | ||
hidePreview: () => void; | ||
canUndo: (callback: (result: boolean) => void) => void; | ||
canRedo: (callback: (result: boolean) => void) => void; | ||
undo: () => void; | ||
redo: () => void; | ||
audit: (callback: (data: { | ||
status: "FAIL" | "PASS"; | ||
errors: import("state/types/types").Audit[]; | ||
}) => void) => void; | ||
setValidator: (validator: import("state/types/types").Validator | null) => void; | ||
setToolValidator: (tool: string, validator: import("state/types/types").Validator | null) => void; | ||
updateTabs: (tabs: import("state/types/types").Tabs) => void; | ||
clearValidators: () => void; | ||
registerContainerExporter: () => void; | ||
registerItemExporter: () => void; | ||
registerTool: () => void; | ||
registerPropertyEditor: () => void; | ||
registerTab: () => void; | ||
createPanel: () => void; | ||
createViewer: () => void; | ||
createWidget: () => void; | ||
} | null>; | ||
}, unknown, { | ||
@@ -52,3 +146,6 @@ id(): string | undefined; | ||
}; | ||
options: () => EmailEditorProps["options"]; | ||
options: { | ||
type: () => EmailEditorProps["options"]; | ||
default: () => {}; | ||
}; | ||
scriptUrl: () => EmailEditorProps["scriptUrl"]; | ||
@@ -73,3 +170,4 @@ /** | ||
minHeight: string | number | undefined; | ||
options: import("embed/Config").Config | undefined; | ||
}, {}>; | ||
export default _default; |
@@ -5,2 +5,16 @@ import { EmailEditor } from '../vue-email-editor'; | ||
emailEditor: EmailEditorInstance | null; | ||
options: { | ||
projectId: number; | ||
appearance: { | ||
theme: string; | ||
panels: { | ||
tools: { | ||
dock: string; | ||
}; | ||
}; | ||
loader: { | ||
url: string; | ||
}; | ||
}; | ||
}; | ||
}, {}, { | ||
@@ -7,0 +21,0 @@ editorLoaded(): void; |
@@ -1,3 +0,3 @@ | ||
import { defineComponent as l, shallowRef as a, openBlock as p, createElementBlock as u, normalizeStyle as m } from "vue"; | ||
const v = "vue-email-editor", h = "2.1.1", y = "dist/vue-email-editor.es", b = "dist/vue-email-editor.d.ts", f = { | ||
import { defineComponent as a, ref as p, toRaw as n, openBlock as u, createElementBlock as m, normalizeStyle as v } from "vue"; | ||
const h = "vue-email-editor", y = "2.1.2", b = "dist/vue-email-editor.es", f = "dist/vue-email-editor.d.ts", g = { | ||
serve: "vue-cli-service serve", | ||
@@ -10,6 +10,6 @@ build: "vue-cli-service build", | ||
release: "npm run build-bundle && npm publish" | ||
}, g = { | ||
}, j = { | ||
"unlayer-types": "latest", | ||
vue: "^3.2.13" | ||
}, j = { | ||
}, E = { | ||
"@babel/types": "^7.24.7", | ||
@@ -26,16 +26,16 @@ "@vitejs/plugin-vue": "^5.0.5", | ||
"vue-tsc": "^2.0.22" | ||
}, E = [ | ||
}, _ = [ | ||
"dist" | ||
], o = { | ||
name: v, | ||
version: h, | ||
main: y, | ||
types: b, | ||
scripts: f, | ||
dependencies: g, | ||
devDependencies: j, | ||
files: E | ||
}, _ = "https://editor.unlayer.com/embed.js?2", c = []; | ||
let d = !1; | ||
const S = (e) => { | ||
], r = { | ||
name: h, | ||
version: y, | ||
main: b, | ||
types: f, | ||
scripts: g, | ||
dependencies: j, | ||
devDependencies: E, | ||
files: _ | ||
}, S = "https://editor.unlayer.com/embed.js?2", d = []; | ||
let l = !1; | ||
const I = (e) => { | ||
const t = document.querySelectorAll("script"); | ||
@@ -46,22 +46,22 @@ let i = !1; | ||
}), i; | ||
}, I = (e) => { | ||
c.push(e); | ||
}, r = () => { | ||
if (d) { | ||
}, k = (e) => { | ||
d.push(e); | ||
}, c = () => { | ||
if (l) { | ||
let e; | ||
for (; e = c.shift(); ) | ||
for (; e = d.shift(); ) | ||
e(); | ||
} | ||
}, k = (e, t = _) => { | ||
if (I(e), S(t)) | ||
r(); | ||
}, D = (e, t = S) => { | ||
if (k(e), I(t)) | ||
c(); | ||
else { | ||
const i = document.createElement("script"); | ||
i.setAttribute("src", t), i.onload = () => { | ||
d = !0, r(); | ||
l = !0, c(); | ||
}, document.head.appendChild(i); | ||
} | ||
}; | ||
let D = 0; | ||
const $ = l({ | ||
let $ = 0; | ||
const H = a({ | ||
name: "EmailEditor", | ||
@@ -74,3 +74,6 @@ props: { | ||
}, | ||
options: Object, | ||
options: { | ||
type: Object, | ||
default: () => ({}) | ||
}, | ||
scriptUrl: String, | ||
@@ -96,3 +99,3 @@ /** | ||
id() { | ||
return this.editorId || `editor-${++D}`; | ||
return this.editorId || `editor-${++$}`; | ||
} | ||
@@ -102,3 +105,3 @@ }, | ||
return { | ||
editor: a(null) | ||
editor: p(null) | ||
// Makes editor available to the template | ||
@@ -108,13 +111,13 @@ }; | ||
mounted() { | ||
k(this.loadEditor.bind(this), this.scriptUrl); | ||
D(this.loadEditor.bind(this), this.scriptUrl); | ||
}, | ||
methods: { | ||
loadEditor() { | ||
const e = this.options || {}; | ||
this.appearance && (e.appearance = this.appearance), this.locale && (e.locale = this.locale), this.projectId && (e.projectId = this.projectId), this.tools && (e.tools = this.tools), this.editor = unlayer.createEditor({ | ||
const e = n(this.options) || {}, t = n(this.appearance) || null, i = n(this.tools) || null; | ||
t && (e.appearance = t), this.locale && (e.locale = this.locale), this.projectId && (e.projectId = this.projectId), i && (e.tools = i), this.editor = unlayer.createEditor({ | ||
...e, | ||
id: this.id, | ||
source: { | ||
name: o.name, | ||
version: o.version | ||
name: r.name, | ||
version: r.version | ||
} | ||
@@ -147,18 +150,18 @@ }), this.$emit("load"), this.editor.addEventListener("editor:ready", () => { | ||
} | ||
}), H = (e, t) => { | ||
}), O = (e, t) => { | ||
const i = e.__vccOpts || e; | ||
for (const [s, n] of t) | ||
i[s] = n; | ||
for (const [s, o] of t) | ||
i[s] = o; | ||
return i; | ||
}, O = ["id"]; | ||
function x(e, t, i, s, n, C) { | ||
return p(), u("div", { | ||
}, x = ["id"]; | ||
function C(e, t, i, s, o, w) { | ||
return u(), m("div", { | ||
id: e.id, | ||
class: "unlayer-editor", | ||
style: m({ minHeight: e.minHeight }) | ||
}, null, 12, O); | ||
style: v({ minHeight: e.minHeight }) | ||
}, null, 12, x); | ||
} | ||
const A = /* @__PURE__ */ H($, [["render", x], ["__scopeId", "data-v-9374aae9"]]); | ||
const B = /* @__PURE__ */ O(H, [["render", C], ["__scopeId", "data-v-53c2c3eb"]]); | ||
export { | ||
A as EmailEditor | ||
B as EmailEditor | ||
}; |
@@ -1,1 +0,1 @@ | ||
(function(n,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(n=typeof globalThis<"u"?globalThis:n||self,s(n["vue-email-editor"]={},n.Vue))})(this,function(n,s){"use strict";const r={name:"vue-email-editor",version:"2.1.1",main:"dist/vue-email-editor.es",types:"dist/vue-email-editor.d.ts",scripts:{serve:"vue-cli-service serve",build:"vue-cli-service build",lint:"vue-cli-service lint","adjust-types":`sed -i '' '1s/^/\\/\\/\\/ <reference types=\\"unlayer-types\\/embed.d.ts\\" \\/>\\n/' ./dist/components/types.d.ts`,"build-types":"vue-tsc --emitDeclarationOnly && npm run adjust-types","build-bundle":"vite build && cd ./src/components && npm run build-types",release:"npm run build-bundle && npm publish"},dependencies:{"unlayer-types":"latest",vue:"^3.2.13"},devDependencies:{"@babel/types":"^7.24.7","@vitejs/plugin-vue":"^5.0.5","@vue/cli-service":"~5.0.0","@vue/cli-plugin-typescript":"~5.0.0",typescript:"^5.2.2",vite:"^5.3.1","vue-dts-gen":"^0.3.0","vue-loader":"^17.4.2","vue-router":"^4.4.0","vue-template-compiler":"^2.7.16","vue-tsc":"^2.0.22"},files:["dist"]},p="https://editor.unlayer.com/embed.js?2",d=[];let c=!1;const u=e=>{const t=document.querySelectorAll("script");let i=!1;return t.forEach(o=>{o.src.includes(e)&&(i=!0)}),i},m=e=>{d.push(e)},l=()=>{if(c){let e;for(;e=d.shift();)e()}},v=(e,t=p)=>{if(m(e),u(t))l();else{const i=document.createElement("script");i.setAttribute("src",t),i.onload=()=>{c=!0,l()},document.head.appendChild(i)}};let h=0;const f=s.defineComponent({name:"EmailEditor",props:{editorId:String,minHeight:{type:String,default:"500px"},options:Object,scriptUrl:String,appearance:Object,locale:String,projectId:Number,tools:Object},computed:{id(){return this.editorId||`editor-${++h}`}},setup(){return{editor:s.shallowRef(null)}},mounted(){v(this.loadEditor.bind(this),this.scriptUrl)},methods:{loadEditor(){const e=this.options||{};this.appearance&&(e.appearance=this.appearance),this.locale&&(e.locale=this.locale),this.projectId&&(e.projectId=this.projectId),this.tools&&(e.tools=this.tools),this.editor=unlayer.createEditor({...e,id:this.id,source:{name:r.name,version:r.version}}),this.$emit("load"),this.editor.addEventListener("editor:ready",()=>{this.$emit("ready")})},exportHtml(e){var t;(t=this.editor)==null||t.exportHtml(e)},loadDesign(e){var t;(t=this.editor)==null||t.loadDesign(e)},saveDesign(e){var t;(t=this.editor)==null||t.saveDesign(e)}}}),y=(e,t)=>{const i=e.__vccOpts||e;for(const[o,a]of t)i[o]=a;return i},b=["id"];function g(e,t,i,o,a,x){return s.openBlock(),s.createElementBlock("div",{id:e.id,class:"unlayer-editor",style:s.normalizeStyle({minHeight:e.minHeight})},null,12,b)}const j=y(f,[["render",g],["__scopeId","data-v-9374aae9"]]);n.EmailEditor=j,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}); | ||
(function(n,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(n=typeof globalThis<"u"?globalThis:n||self,s(n["vue-email-editor"]={},n.Vue))})(this,function(n,s){"use strict";const r={name:"vue-email-editor",version:"2.1.2",main:"dist/vue-email-editor.es",types:"dist/vue-email-editor.d.ts",scripts:{serve:"vue-cli-service serve",build:"vue-cli-service build",lint:"vue-cli-service lint","adjust-types":`sed -i '' '1s/^/\\/\\/\\/ <reference types=\\"unlayer-types\\/embed.d.ts\\" \\/>\\n/' ./dist/components/types.d.ts`,"build-types":"vue-tsc --emitDeclarationOnly && npm run adjust-types","build-bundle":"vite build && cd ./src/components && npm run build-types",release:"npm run build-bundle && npm publish"},dependencies:{"unlayer-types":"latest",vue:"^3.2.13"},devDependencies:{"@babel/types":"^7.24.7","@vitejs/plugin-vue":"^5.0.5","@vue/cli-service":"~5.0.0","@vue/cli-plugin-typescript":"~5.0.0",typescript:"^5.2.2",vite:"^5.3.1","vue-dts-gen":"^0.3.0","vue-loader":"^17.4.2","vue-router":"^4.4.0","vue-template-compiler":"^2.7.16","vue-tsc":"^2.0.22"},files:["dist"]},p="https://editor.unlayer.com/embed.js?2",d=[];let c=!1;const u=e=>{const t=document.querySelectorAll("script");let i=!1;return t.forEach(o=>{o.src.includes(e)&&(i=!0)}),i},m=e=>{d.push(e)},l=()=>{if(c){let e;for(;e=d.shift();)e()}},f=(e,t=p)=>{if(m(e),u(t))l();else{const i=document.createElement("script");i.setAttribute("src",t),i.onload=()=>{c=!0,l()},document.head.appendChild(i)}};let v=0;const h=s.defineComponent({name:"EmailEditor",props:{editorId:String,minHeight:{type:String,default:"500px"},options:{type:Object,default:()=>({})},scriptUrl:String,appearance:Object,locale:String,projectId:Number,tools:Object},computed:{id(){return this.editorId||`editor-${++v}`}},setup(){return{editor:s.ref(null)}},mounted(){f(this.loadEditor.bind(this),this.scriptUrl)},methods:{loadEditor(){const e=s.toRaw(this.options)||{},t=s.toRaw(this.appearance)||null,i=s.toRaw(this.tools)||null;t&&(e.appearance=t),this.locale&&(e.locale=this.locale),this.projectId&&(e.projectId=this.projectId),i&&(e.tools=i),this.editor=unlayer.createEditor({...e,id:this.id,source:{name:r.name,version:r.version}}),this.$emit("load"),this.editor.addEventListener("editor:ready",()=>{this.$emit("ready")})},exportHtml(e){var t;(t=this.editor)==null||t.exportHtml(e)},loadDesign(e){var t;(t=this.editor)==null||t.loadDesign(e)},saveDesign(e){var t;(t=this.editor)==null||t.saveDesign(e)}}}),y=(e,t)=>{const i=e.__vccOpts||e;for(const[o,a]of t)i[o]=a;return i},b=["id"];function g(e,t,i,o,a,x){return s.openBlock(),s.createElementBlock("div",{id:e.id,class:"unlayer-editor",style:s.normalizeStyle({minHeight:e.minHeight})},null,12,b)}const j=y(h,[["render",g],["__scopeId","data-v-53c2c3eb"]]);n.EmailEditor=j,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}); |
{ | ||
"name": "vue-email-editor", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"main": "dist/vue-email-editor.es", | ||
@@ -5,0 +5,0 @@ "types": "dist/vue-email-editor.d.ts", |
Sorry, the diff of this file is not supported yet
27191
407