@maildeno/editor 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/dist/RowPreviewLegacyComponent-3QuwvWmT.js +402 -0
- package/dist/RowPreviewLegacyComponent-DVxrCJ14.js +402 -0
- package/dist/RowPreviewRow-0pEQLmS4.js +80 -0
- package/dist/RowPreviewRow-Eum1wh1W.js +80 -0
- package/dist/babel-DV7WPQI0.js +10043 -0
- package/dist/editor.css +1 -2809
- package/dist/element-Dq6bmt2l.js +48454 -0
- package/dist/element.js +5 -2
- package/dist/estree-DY9POgc0.js +8195 -0
- package/dist/html-wb0gSX1o.js +7273 -0
- package/dist/index.js +48019 -67941
- package/dist/init.js +133 -153
- package/dist/standalone-DHvJ30Td.js +3554 -0
- package/dist/vue.runtime.esm-bundler-CsdyQceJ.js +6118 -0
- package/package.json +6 -8
- package/dist/RowPreviewLegacyComponent-BFvLnPiK.js +0 -439
- package/dist/RowPreviewLegacyComponent-CXsY4P-R.js +0 -439
- package/dist/RowPreviewRow-CeowK6Q_.js +0 -107
- package/dist/RowPreviewRow-D-6koDUR.js +0 -107
- package/dist/element-95RHug4F.js +0 -68388
- package/dist/element-scoped-styles.css +0 -2810
- package/dist/estree-B67dfAo1.js +0 -7989
- package/dist/html-D6UnSE1C.js +0 -7353
- package/dist/standalone-Bd2oQFm3.js +0 -3639
- package/dist/typescript-C_Ru9PRN.js +0 -23184
- package/dist/vue.runtime.esm-bundler-BaHqghYy.js +0 -9097
package/dist/init.js
CHANGED
|
@@ -1,156 +1,136 @@
|
|
|
1
|
-
import { O as
|
|
2
|
-
import { a as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
stylesInjected = true;
|
|
14
|
-
for (const css of buildShadowStyles()) {
|
|
15
|
-
if (!css) continue;
|
|
16
|
-
const style = document.createElement("style");
|
|
17
|
-
style.setAttribute("data-maildeno-light-dom", "");
|
|
18
|
-
style.textContent = css;
|
|
19
|
-
document.head.appendChild(style);
|
|
20
|
-
}
|
|
1
|
+
import { O as o, at as c, i as u, st as g } from "./vue.runtime.esm-bundler-CsdyQceJ.js";
|
|
2
|
+
import { a as H, c as b, d as w, f as T, h as A, i as C, l as J, m as M, n as f, p as I, r as v, s as S, u as R } from "./element-Dq6bmt2l.js";
|
|
3
|
+
var m = !1;
|
|
4
|
+
function h() {
|
|
5
|
+
if (!(m || typeof document > "u")) {
|
|
6
|
+
m = !0;
|
|
7
|
+
for (const e of S()) {
|
|
8
|
+
if (!e) continue;
|
|
9
|
+
const l = document.createElement("style");
|
|
10
|
+
l.setAttribute("data-maildeno-light-dom", ""), l.textContent = e, document.head.appendChild(l);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
21
13
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
removeSaveHandler: (fn) => saveHandlers.delete(fn),
|
|
46
|
-
destroy: () => {
|
|
47
|
-
app.unmount();
|
|
48
|
-
mountEl.remove();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
14
|
+
function E(e, l) {
|
|
15
|
+
h();
|
|
16
|
+
const t = c({ ...l }), i = /* @__PURE__ */ new Set(), a = g(null), r = document.createElement("div");
|
|
17
|
+
r.style.height = "100%", e.appendChild(r);
|
|
18
|
+
const n = u({ setup() {
|
|
19
|
+
return () => o(v, {
|
|
20
|
+
...t,
|
|
21
|
+
ref: a,
|
|
22
|
+
onSave: (s) => i.forEach((d) => d(s))
|
|
23
|
+
});
|
|
24
|
+
} });
|
|
25
|
+
return n.mount(r), {
|
|
26
|
+
element: r,
|
|
27
|
+
exposed: () => a.value ?? null,
|
|
28
|
+
setProp: (s, d) => {
|
|
29
|
+
t[s] = d;
|
|
30
|
+
},
|
|
31
|
+
addSaveHandler: (s) => i.add(s),
|
|
32
|
+
removeSaveHandler: (s) => i.delete(s),
|
|
33
|
+
destroy: () => {
|
|
34
|
+
n.unmount(), r.remove();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
51
37
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
38
|
+
async function j(e) {
|
|
39
|
+
const l = typeof e.container == "string" ? document.querySelector(e.container) : e.container;
|
|
40
|
+
if (!l) throw new Error(`[maildeno-editor] init() couldn't find a container${typeof e.container == "string" ? ` matching "${e.container}"` : ""}.`);
|
|
41
|
+
if (e.shadowDom === !1) {
|
|
42
|
+
const a = E(l, {
|
|
43
|
+
templateId: e.templateId,
|
|
44
|
+
storageAdapter: e.storageAdapter,
|
|
45
|
+
theme: e.theme,
|
|
46
|
+
capabilities: e.capabilities,
|
|
47
|
+
onSendTestEmail: e.onSendTestEmail,
|
|
48
|
+
brandName: e.brandName,
|
|
49
|
+
versions: e.versions,
|
|
50
|
+
saveHandler: e.onSave,
|
|
51
|
+
assistant: e.assistant
|
|
52
|
+
});
|
|
53
|
+
await new Promise((n) => setTimeout(n, 0));
|
|
54
|
+
const r = (n, ...s) => {
|
|
55
|
+
const d = a.exposed()?.[n];
|
|
56
|
+
return typeof d == "function" ? d(...s) : null;
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
element: a.element,
|
|
60
|
+
on: (n, s) => a.addSaveHandler(s),
|
|
61
|
+
off: (n, s) => a.removeSaveHandler(s),
|
|
62
|
+
setTheme: (n) => a.setProp("theme", n),
|
|
63
|
+
getHtml: (n = "prune") => r("getHtml", n),
|
|
64
|
+
getMjml: (n = "prune") => r("getMjml", n),
|
|
65
|
+
getReactEmail: (n = "prune") => r("getReactEmail", n),
|
|
66
|
+
getJson: () => r("getJson"),
|
|
67
|
+
setJson: (n, s) => {
|
|
68
|
+
r("setJson", n, s);
|
|
69
|
+
},
|
|
70
|
+
getSelection: () => r("getSelection"),
|
|
71
|
+
setSelection: (n) => r("setSelection", n) ?? !1,
|
|
72
|
+
onChange: (n) => r("onChange", n) ?? (() => {
|
|
73
|
+
}),
|
|
74
|
+
destroy: () => a.destroy()
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
f();
|
|
78
|
+
const t = document.createElement("maildeno-editor");
|
|
79
|
+
e.templateId !== void 0 && (t.templateId = e.templateId), e.storageAdapter && (t.storageAdapter = e.storageAdapter), e.theme && (t.theme = e.theme), e.capabilities && (t.capabilities = e.capabilities), e.onSendTestEmail && (t.onSendTestEmail = e.onSendTestEmail), e.brandName !== void 0 && (t.brandName = e.brandName), e.versions !== void 0 && (t.versions = e.versions), e.assistant && (t.assistant = e.assistant), e.onSave && (t.saveHandler = e.onSave), l.appendChild(t), await new Promise((a) => setTimeout(a, 0));
|
|
80
|
+
const i = /* @__PURE__ */ new WeakMap();
|
|
81
|
+
return {
|
|
82
|
+
element: t,
|
|
83
|
+
on(a, r) {
|
|
84
|
+
const n = ((s) => r(Array.isArray(s.detail) ? s.detail[0] : s.detail));
|
|
85
|
+
i.set(r, n), t.addEventListener(a, n);
|
|
86
|
+
},
|
|
87
|
+
off(a, r) {
|
|
88
|
+
const n = i.get(r);
|
|
89
|
+
n && (t.removeEventListener(a, n), i.delete(r));
|
|
90
|
+
},
|
|
91
|
+
setTheme(a) {
|
|
92
|
+
t.theme = a;
|
|
93
|
+
},
|
|
94
|
+
getHtml(a = "prune") {
|
|
95
|
+
return t.getHtml ? t.getHtml(a) : null;
|
|
96
|
+
},
|
|
97
|
+
getMjml(a = "prune") {
|
|
98
|
+
return t.getMjml ? t.getMjml(a) : null;
|
|
99
|
+
},
|
|
100
|
+
getReactEmail(a = "prune") {
|
|
101
|
+
return t.getReactEmail ? t.getReactEmail(a) : null;
|
|
102
|
+
},
|
|
103
|
+
getJson() {
|
|
104
|
+
return t.getJson ? t.getJson() : null;
|
|
105
|
+
},
|
|
106
|
+
setJson(a, r) {
|
|
107
|
+
t.setJson?.(a, r);
|
|
108
|
+
},
|
|
109
|
+
getSelection() {
|
|
110
|
+
return t.getSelection ? t.getSelection() : null;
|
|
111
|
+
},
|
|
112
|
+
setSelection(a) {
|
|
113
|
+
return t.setSelection ? t.setSelection(a) : !1;
|
|
114
|
+
},
|
|
115
|
+
onChange(a) {
|
|
116
|
+
return t.onChange ? t.onChange(a) : () => {
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
destroy() {
|
|
120
|
+
t.remove();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
56
123
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
assistant: options.assistant
|
|
71
|
-
});
|
|
72
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
73
|
-
const call = (name, ...args) => {
|
|
74
|
-
const fn = mount.exposed()?.[name];
|
|
75
|
-
return typeof fn === "function" ? fn(...args) : null;
|
|
76
|
-
};
|
|
77
|
-
return {
|
|
78
|
-
element: mount.element,
|
|
79
|
-
on: (_event, handler) => mount.addSaveHandler(handler),
|
|
80
|
-
off: (_event, handler) => mount.removeSaveHandler(handler),
|
|
81
|
-
setTheme: (theme) => mount.setProp("theme", theme),
|
|
82
|
-
getHtml: (mode = "prune") => call("getHtml", mode),
|
|
83
|
-
getMjml: (mode = "prune") => call("getMjml", mode),
|
|
84
|
-
getReactEmail: (mode = "prune") => call("getReactEmail", mode),
|
|
85
|
-
getJson: () => call("getJson"),
|
|
86
|
-
setJson: (data, opts) => {
|
|
87
|
-
call("setJson", data, opts);
|
|
88
|
-
},
|
|
89
|
-
getSelection: () => call("getSelection"),
|
|
90
|
-
setSelection: (id) => call("setSelection", id) ?? false,
|
|
91
|
-
onChange: (cb) => call("onChange", cb) ?? (() => {}),
|
|
92
|
-
destroy: () => mount.destroy()
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
registerMaildenoEditorElement();
|
|
96
|
-
const el = document.createElement("maildeno-editor");
|
|
97
|
-
if (options.templateId !== void 0) el.templateId = options.templateId;
|
|
98
|
-
if (options.storageAdapter) el.storageAdapter = options.storageAdapter;
|
|
99
|
-
if (options.theme) el.theme = options.theme;
|
|
100
|
-
if (options.capabilities) el.capabilities = options.capabilities;
|
|
101
|
-
if (options.onSendTestEmail) el.onSendTestEmail = options.onSendTestEmail;
|
|
102
|
-
if (options.brandName !== void 0) el.brandName = options.brandName;
|
|
103
|
-
if (options.versions !== void 0) el.versions = options.versions;
|
|
104
|
-
if (options.assistant) el.assistant = options.assistant;
|
|
105
|
-
if (options.onSave) el.saveHandler = options.onSave;
|
|
106
|
-
container.appendChild(el);
|
|
107
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
108
|
-
const listenerWrappers = /* @__PURE__ */ new WeakMap();
|
|
109
|
-
return {
|
|
110
|
-
element: el,
|
|
111
|
-
on(event, handler) {
|
|
112
|
-
const wrapped = ((e) => handler(Array.isArray(e.detail) ? e.detail[0] : e.detail));
|
|
113
|
-
listenerWrappers.set(handler, wrapped);
|
|
114
|
-
el.addEventListener(toDomEventName(event), wrapped);
|
|
115
|
-
},
|
|
116
|
-
off(event, handler) {
|
|
117
|
-
const wrapped = listenerWrappers.get(handler);
|
|
118
|
-
if (wrapped) {
|
|
119
|
-
el.removeEventListener(toDomEventName(event), wrapped);
|
|
120
|
-
listenerWrappers.delete(handler);
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
setTheme(theme) {
|
|
124
|
-
el.theme = theme;
|
|
125
|
-
},
|
|
126
|
-
getHtml(mode = "prune") {
|
|
127
|
-
return el.getHtml ? el.getHtml(mode) : null;
|
|
128
|
-
},
|
|
129
|
-
getMjml(mode = "prune") {
|
|
130
|
-
return el.getMjml ? el.getMjml(mode) : null;
|
|
131
|
-
},
|
|
132
|
-
getReactEmail(mode = "prune") {
|
|
133
|
-
return el.getReactEmail ? el.getReactEmail(mode) : null;
|
|
134
|
-
},
|
|
135
|
-
getJson() {
|
|
136
|
-
return el.getJson ? el.getJson() : null;
|
|
137
|
-
},
|
|
138
|
-
setJson(data, opts) {
|
|
139
|
-
el.setJson?.(data, opts);
|
|
140
|
-
},
|
|
141
|
-
getSelection() {
|
|
142
|
-
return el.getSelection ? el.getSelection() : null;
|
|
143
|
-
},
|
|
144
|
-
setSelection(id) {
|
|
145
|
-
return el.setSelection ? el.setSelection(id) : false;
|
|
146
|
-
},
|
|
147
|
-
onChange(cb) {
|
|
148
|
-
return el.onChange ? el.onChange(cb) : () => {};
|
|
149
|
-
},
|
|
150
|
-
destroy() {
|
|
151
|
-
el.remove();
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
//#endregion
|
|
156
|
-
export { createLocalStorageAdapter, getAllBlocks, getBlock, getRegisteredCustomESPs, getRegisteredMergeTagIds, init, palette, registerBlock, registerESPSyntax, registerMergeTags, setEditorTheme };
|
|
124
|
+
export {
|
|
125
|
+
A as createLocalStorageAdapter,
|
|
126
|
+
T as getAllBlocks,
|
|
127
|
+
I as getBlock,
|
|
128
|
+
b as getRegisteredCustomESPs,
|
|
129
|
+
R as getRegisteredMergeTagIds,
|
|
130
|
+
j as init,
|
|
131
|
+
C as palette,
|
|
132
|
+
M as registerBlock,
|
|
133
|
+
J as registerESPSyntax,
|
|
134
|
+
w as registerMergeTags,
|
|
135
|
+
H as setEditorTheme
|
|
136
|
+
};
|