@grapesjs/studio-sdk-plugins 1.0.21 → 1.0.22
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/dist/animationComponent/components/Animation.d.ts +6 -0
- package/dist/animationComponent/components/AnimationGroup.d.ts +4 -0
- package/dist/animationComponent/index.cjs.d.ts +3 -0
- package/dist/animationComponent/index.cjs.js +507 -0
- package/dist/animationComponent/index.d.ts +3 -0
- package/dist/animationComponent/index.es.d.ts +3 -0
- package/dist/animationComponent/index.es.js +1111 -0
- package/dist/animationComponent/index.umd.js +507 -0
- package/dist/animationComponent/shared.d.ts +3 -0
- package/dist/animationComponent/types.d.ts +28 -0
- package/dist/animationComponent/typesSchema.d.ts +48 -0
- package/dist/animationComponent/utils.d.ts +19 -0
- package/dist/dataSourceEjs/EjsExporter.d.ts +13 -0
- package/dist/dataSourceEjs/EjsImporter.d.ts +29 -0
- package/dist/dataSourceEjs/index.cjs.d.ts +2 -2
- package/dist/dataSourceEjs/index.cjs.js +24 -3
- package/dist/dataSourceEjs/index.d.ts +2 -2
- package/dist/dataSourceEjs/index.es.d.ts +2 -2
- package/dist/dataSourceEjs/index.es.js +697 -114
- package/dist/dataSourceEjs/index.umd.js +24 -3
- package/dist/dataSourceEjs/shared.d.ts +3 -0
- package/dist/dataSourceEjs/types.d.ts +2 -2
- package/dist/dataSourceEjs/typesSchema.d.ts +3 -0
- package/dist/dataSourceHandlebars/HandlebarsExporter.d.ts +16 -0
- package/dist/dataSourceHandlebars/HandlebarsImporter.d.ts +20 -0
- package/dist/dataSourceHandlebars/helperImplementations.d.ts +1 -0
- package/dist/dataSourceHandlebars/index.cjs.js +20 -1
- package/dist/dataSourceHandlebars/index.es.js +401 -99
- package/dist/dataSourceHandlebars/index.umd.js +20 -1
- package/dist/dataSourceHandlebars/shared.d.ts +3 -0
- package/dist/dataSourceHandlebars/types.d.ts +2 -2
- package/dist/dataSourceHandlebars/typesSchema.d.ts +3 -0
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +29 -29
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +64 -64
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.cjs.js +587 -51
- package/dist/index.d.ts +1 -0
- package/dist/index.es.d.ts +1 -0
- package/dist/index.es.js +4809 -3046
- package/dist/index.umd.js +584 -48
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +59 -59
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/presetPrintable/index.cjs.js +3 -3
- package/dist/presetPrintable/index.es.js +136 -131
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/prosemirror/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +67 -67
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +14 -14
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/utilsDataSources.d.ts +28 -0
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +26 -26
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +2 -1
- package/dist/dataSourceEjs/EjsStrategy.d.ts +0 -15
- package/dist/dataSourceHandlebars/HandlebarsStrategy.d.ts +0 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
M,
|
|
1
|
+
const U = "app.grapesjs.com", G = "app-stage.grapesjs.com", x = [
|
|
3
2
|
U,
|
|
3
|
+
G,
|
|
4
4
|
"localhost",
|
|
5
5
|
"127.0.0.1",
|
|
6
6
|
".local-credentialless.webcontainer.io",
|
|
@@ -9,21 +9,21 @@ const M = "app.grapesjs.com", U = "app-stage.grapesjs.com", x = [
|
|
|
9
9
|
// For stackblitz.com demos
|
|
10
10
|
"-sandpack.codesandbox.io"
|
|
11
11
|
// For Sandpack demos
|
|
12
|
-
],
|
|
13
|
-
const t =
|
|
12
|
+
], N = "license:check:start", z = "license:check:end", K = () => typeof window < "u", j = (e, n = {}) => {
|
|
13
|
+
const t = V(e) ? { id: e, src: e } : e;
|
|
14
14
|
return new Promise((s, a) => {
|
|
15
15
|
var p, g;
|
|
16
16
|
const o = document.querySelector(`script[src="${t.src}"]`), { id: i } = t;
|
|
17
17
|
if (o)
|
|
18
18
|
return (p = n.onScript) == null || p.call(n, o), s(i);
|
|
19
|
-
const
|
|
20
|
-
|
|
19
|
+
const r = document.createElement("script");
|
|
20
|
+
r.src = t.src, r.onload = () => s(i), r.onerror = () => a(i), document.head.appendChild(r), (g = n.onScript) == null || g.call(n, r);
|
|
21
21
|
});
|
|
22
|
-
},
|
|
23
|
-
const e =
|
|
22
|
+
}, C = ({ isDev: e, isStage: n }) => `${e ? "" : `https://${n ? G : U}`}/api`, q = () => {
|
|
23
|
+
const e = K() && window.location.hostname;
|
|
24
24
|
return !!e && (x.includes(e) || x.some((n) => e.endsWith(n)));
|
|
25
|
-
},
|
|
26
|
-
async function
|
|
25
|
+
}, V = (e) => typeof e == "string";
|
|
26
|
+
async function Y({
|
|
27
27
|
path: e,
|
|
28
28
|
baseApiUrl: n,
|
|
29
29
|
method: t = "GET",
|
|
@@ -31,7 +31,7 @@ async function V({
|
|
|
31
31
|
params: a,
|
|
32
32
|
body: o
|
|
33
33
|
}) {
|
|
34
|
-
const
|
|
34
|
+
const r = `${n || C({ isDev: !1, isStage: !1 })}${e}`, p = {
|
|
35
35
|
method: t,
|
|
36
36
|
headers: {
|
|
37
37
|
"Content-Type": "application/json",
|
|
@@ -39,24 +39,24 @@ async function V({
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
o && (p.body = JSON.stringify(o));
|
|
42
|
-
const g = a ? new URLSearchParams(a).toString() : "",
|
|
42
|
+
const g = a ? new URLSearchParams(a).toString() : "", c = g ? `?${g}` : "", u = await fetch(`${r}${c}`, p);
|
|
43
43
|
if (!u.ok)
|
|
44
44
|
throw new Error(`HTTP error! status: ${u.status}`);
|
|
45
45
|
return u.json();
|
|
46
46
|
}
|
|
47
|
-
var
|
|
47
|
+
var E = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(E || {}), O = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", e.sidebarLeftSet = "studio:sidebarLeft:set", e.sidebarLeftGet = "studio:sidebarLeft:get", e.sidebarLeftToggle = "studio:sidebarLeft:toggle", e.sidebarRightSet = "studio:sidebarRight:set", e.sidebarRightGet = "studio:sidebarRight:get", e.sidebarRightToggle = "studio:sidebarRight:toggle", e.sidebarTopSet = "studio:sidebarTop:set", e.sidebarTopGet = "studio:sidebarTop:get", e.sidebarTopToggle = "studio:sidebarTop:toggle", e.sidebarBottomSet = "studio:sidebarBottom:set", e.sidebarBottomGet = "studio:sidebarBottom:get", e.sidebarBottomToggle = "studio:sidebarBottom:toggle", e.symbolAdd = "studio:symbolAdd", e.symbolDetach = "studio:symbolDetach", e.symbolOverride = "studio:symbolOverride", e.symbolPropagateStyles = "studio:propagateStyles", e.getPagesConfig = "studio:getPagesConfig", e.setPagesConfig = "studio:setPagesConfig", e.getPageSettings = "studio:getPageSettings", e.setPageSettings = "studio:setPageSettings", e.projectFiles = "studio:projectFiles", e.canvasReload = "studio:canvasReload", e.getBlocksPanel = "studio:getBlocksPanel", e.setBlocksPanel = "studio:setBlocksPanel", e.getStateContextMenu = "studio:getStateContextMenu", e.setStateContextMenu = "studio:setStateContextMenu", e.contextMenuComponent = "studio:contextMenuComponent", e.layoutAdd = "studio:layoutAdd", e.layoutRemove = "studio:layoutRemove", e.layoutToggle = "studio:layoutToggle", e.layoutUpdate = "studio:layoutUpdate", e.layoutGet = "studio:layoutGet", e.layoutConfigGet = "studio:layoutConfigGet", e.layoutConfigSet = "studio:layoutConfigSet", e.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", e.assetProviderGet = "studio:assetProviderGet", e.assetProviderAdd = "studio:assetProviderAdd", e.assetProviderRemove = "studio:assetProviderRemove", e.fontGet = "studio:fontGet", e.fontAdd = "studio:fontAdd", e.fontRemove = "studio:fontRemove", e.fontManagerOpen = "studio:fontManagerOpen", e.menuFontLoad = "studio:menuFontLoad", e.toggleStateDataSource = "studio:toggleStateDataSource", e.getStateDataSource = "studio:getStateDataSource", e.dataSourceSetGlobalData = "studio:dataSourceSetGlobalData", e.dataSourceSetImporter = "studio:dataSourceSetImporter", e.dataSourceSetExporter = "studio:dataSourceSetExporter", e.setDragAbsolute = "studio:setDragAbsolute", e))(O || {});
|
|
48
48
|
const H = {
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
[
|
|
52
|
-
[
|
|
49
|
+
[E.free]: 0,
|
|
50
|
+
[E.startup]: 10,
|
|
51
|
+
[E.business]: 20,
|
|
52
|
+
[E.enterprise]: 30
|
|
53
53
|
};
|
|
54
|
-
function
|
|
54
|
+
function J(e) {
|
|
55
55
|
const n = e;
|
|
56
56
|
return n.init = (t) => (s) => e(s, t), n;
|
|
57
57
|
}
|
|
58
|
-
const
|
|
59
|
-
async function
|
|
58
|
+
const X = (e) => /* @__PURE__ */ J(e);
|
|
59
|
+
async function Z({
|
|
60
60
|
editor: e,
|
|
61
61
|
plan: n,
|
|
62
62
|
pluginName: t,
|
|
@@ -64,37 +64,37 @@ async function X({
|
|
|
64
64
|
cleanup: a
|
|
65
65
|
}) {
|
|
66
66
|
let o = "", i = !1;
|
|
67
|
-
const
|
|
68
|
-
console.warn("Cleanup plugin:", t, "Reason:",
|
|
69
|
-
}, g = (
|
|
70
|
-
var
|
|
71
|
-
const { error: u, sdkLicense: d } =
|
|
72
|
-
if (!(d ||
|
|
67
|
+
const r = q(), p = (c) => {
|
|
68
|
+
console.warn("Cleanup plugin:", t, "Reason:", c), a();
|
|
69
|
+
}, g = (c = {}) => {
|
|
70
|
+
var l;
|
|
71
|
+
const { error: u, sdkLicense: d } = c, f = (l = c.plan) == null ? void 0 : l.category;
|
|
72
|
+
if (!(d || c.license) || u)
|
|
73
73
|
p(u || "Invalid license");
|
|
74
74
|
else if (f) {
|
|
75
|
-
const
|
|
76
|
-
|
|
75
|
+
const v = H[n], A = H[f];
|
|
76
|
+
v > A && p({ pluginRequiredPlan: n, licensePlan: f });
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
|
-
e.on(
|
|
80
|
-
o =
|
|
81
|
-
}), e.on(
|
|
82
|
-
g(
|
|
79
|
+
e.on(N, (c) => {
|
|
80
|
+
o = c == null ? void 0 : c.baseApiUrl, i = !0;
|
|
81
|
+
}), e.on(z, (c) => {
|
|
82
|
+
g(c);
|
|
83
83
|
}), setTimeout(async () => {
|
|
84
84
|
if (!i) {
|
|
85
|
-
if (
|
|
85
|
+
if (r) return;
|
|
86
86
|
if (s) {
|
|
87
|
-
const
|
|
88
|
-
|
|
87
|
+
const c = await Q({ licenseKey: s, pluginName: t, baseApiUrl: o });
|
|
88
|
+
c && g(c);
|
|
89
89
|
} else
|
|
90
90
|
p("The `licenseKey` option not provided");
|
|
91
91
|
}
|
|
92
92
|
}, 2e3);
|
|
93
93
|
}
|
|
94
|
-
async function
|
|
94
|
+
async function Q(e) {
|
|
95
95
|
const { licenseKey: n, pluginName: t, baseApiUrl: s } = e;
|
|
96
96
|
try {
|
|
97
|
-
return (await
|
|
97
|
+
return (await Y({
|
|
98
98
|
baseApiUrl: s,
|
|
99
99
|
path: `/sdk/${n || "na"}`,
|
|
100
100
|
method: "POST",
|
|
@@ -107,31 +107,31 @@ async function Z(e) {
|
|
|
107
107
|
return console.error("Error during SDK license check:", a), !1;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
const
|
|
110
|
+
const ee = (e) => (n) => {
|
|
111
111
|
var t;
|
|
112
|
-
return ((t = n.getAttribute) == null ? void 0 : t.call(n,
|
|
113
|
-
},
|
|
112
|
+
return ((t = n.getAttribute) == null ? void 0 : t.call(n, W)) === e;
|
|
113
|
+
}, te = (...e) => (n, t) => e.some((s) => t.is(s)), F = (e, n, t) => {
|
|
114
114
|
const { doc: s = document } = t, a = t.target || s.head, o = a.querySelector(`style[${e}]`) || s.createElement("style");
|
|
115
115
|
o.setAttribute(e, "true"), o.innerHTML = n, !a.contains(o) && a.appendChild(o);
|
|
116
|
-
},
|
|
117
|
-
function
|
|
118
|
-
let s, a, o, i,
|
|
119
|
-
const p = n;
|
|
116
|
+
}, se = "gjs-plg-", I = "data-gs-plg-", W = "data-type-role";
|
|
117
|
+
function _(e, n, t) {
|
|
118
|
+
let s, a, o, i, r;
|
|
119
|
+
const p = n === void 0 ? 100 : n;
|
|
120
120
|
function g() {
|
|
121
121
|
const u = Date.now() - i;
|
|
122
|
-
u < p && u >= 0 ? s = setTimeout(g, p - u) : (s = null,
|
|
122
|
+
u < p && u >= 0 ? s = setTimeout(g, p - u) : (s = null, r = e.apply(o, a), o = a = null);
|
|
123
123
|
}
|
|
124
|
-
const
|
|
125
|
-
return o = this, a = arguments, i = Date.now(), s || (s = setTimeout(g, p)),
|
|
124
|
+
const c = function() {
|
|
125
|
+
return o = this, a = arguments, i = Date.now(), s || (s = setTimeout(g, p)), r;
|
|
126
126
|
};
|
|
127
|
-
return
|
|
127
|
+
return c.clear = function() {
|
|
128
128
|
s && (clearTimeout(s), s = null);
|
|
129
|
-
},
|
|
130
|
-
s && (
|
|
131
|
-
},
|
|
129
|
+
}, c.flush = function() {
|
|
130
|
+
s && (r = e.apply(o, a), o = a = null, clearTimeout(s), s = null);
|
|
131
|
+
}, c;
|
|
132
132
|
}
|
|
133
133
|
const P = "page-break";
|
|
134
|
-
function
|
|
134
|
+
function L(e, n) {
|
|
135
135
|
const s = {
|
|
136
136
|
mm: 3.7795275590551185,
|
|
137
137
|
// 1mm ≈ 3.78px
|
|
@@ -147,7 +147,7 @@ function $(e, n) {
|
|
|
147
147
|
return s[n] ? e * s[n] : null;
|
|
148
148
|
}
|
|
149
149
|
const ne = (e, n) => {
|
|
150
|
-
const { name: t, id: s, width: a, height: o, unit: i } = e, { fixedHeight:
|
|
150
|
+
const { name: t, id: s, width: a, height: o, unit: i } = e, { fixedHeight: r } = n, p = `${a}${i}`, g = `${o}${i}`;
|
|
151
151
|
return {
|
|
152
152
|
id: s || t.toLowerCase().replace(/\s/g, "-"),
|
|
153
153
|
name: `${t} (${p} x ${g})`,
|
|
@@ -156,18 +156,18 @@ const ne = (e, n) => {
|
|
|
156
156
|
sizeUnit: i,
|
|
157
157
|
widthMedia: "",
|
|
158
158
|
width: p,
|
|
159
|
-
minHeight:
|
|
160
|
-
height:
|
|
159
|
+
minHeight: r ? "0" : `${L(o, i)}px`,
|
|
160
|
+
height: r ? g : void 0
|
|
161
161
|
};
|
|
162
|
-
},
|
|
162
|
+
}, $ = "page-breaks", R = "gjs-page-breaks-spot", S = (e) => e.type === $;
|
|
163
163
|
function oe(e) {
|
|
164
|
-
const { Devices: n } = e, { height: t, minHeight: s } = n.getSelected().attributes, o = parseFloat(`${t && t !== "auto" ? t : s}`), i = e.getWrapper(),
|
|
165
|
-
if (!i || !
|
|
164
|
+
const { Devices: n } = e, { height: t, minHeight: s } = n.getSelected().attributes, o = parseFloat(`${t && t !== "auto" ? t : s}`), i = e.getWrapper(), r = i == null ? void 0 : i.getEl(), p = [];
|
|
165
|
+
if (!i || !r)
|
|
166
166
|
return p;
|
|
167
|
-
const g =
|
|
167
|
+
const g = r.getBoundingClientRect().height, u = i.findType(P).map((f) => f.getEl()).filter(Boolean).map((f) => ({ top: f.offsetTop, height: f.offsetHeight }));
|
|
168
168
|
let d = 0;
|
|
169
169
|
for (; d < g; ) {
|
|
170
|
-
const f = u.find((
|
|
170
|
+
const f = u.find((m) => m.top > d && m.top < d + o);
|
|
171
171
|
f ? (d = f.top + f.height, p.push(f.top)) : (d += o, d < g && p.push(d));
|
|
172
172
|
}
|
|
173
173
|
return p;
|
|
@@ -177,7 +177,7 @@ function ae(e, n) {
|
|
|
177
177
|
let o;
|
|
178
178
|
const i = () => {
|
|
179
179
|
F(
|
|
180
|
-
`${
|
|
180
|
+
`${I}preset-printable-spots`,
|
|
181
181
|
`.${R} {
|
|
182
182
|
position: absolute;
|
|
183
183
|
left: 0;
|
|
@@ -198,61 +198,66 @@ function ae(e, n) {
|
|
|
198
198
|
`,
|
|
199
199
|
{ target: window.document.head }
|
|
200
200
|
);
|
|
201
|
-
},
|
|
201
|
+
}, r = () => {
|
|
202
202
|
if (n.enablePageBreaksSpot === !1) return;
|
|
203
|
-
const
|
|
204
|
-
return t.getSpots(
|
|
205
|
-
}, p = ({ spot:
|
|
206
|
-
const { spotEl:
|
|
207
|
-
!
|
|
208
|
-
}, g = ({ spot:
|
|
209
|
-
if (!
|
|
210
|
-
let { spotEl:
|
|
211
|
-
|
|
212
|
-
},
|
|
213
|
-
const { spotEl:
|
|
214
|
-
!
|
|
215
|
-
const
|
|
216
|
-
|
|
203
|
+
const l = { id: $, type: $, component: e.getWrapper() };
|
|
204
|
+
return t.getSpots(l).pop() || t.addSpot(l);
|
|
205
|
+
}, p = ({ spot: l }) => {
|
|
206
|
+
const { spotEl: v } = l.attributes;
|
|
207
|
+
!S(l) || !v || !o || o.removeChild(v);
|
|
208
|
+
}, g = ({ spot: l }) => {
|
|
209
|
+
if (!S(l) || !o) return;
|
|
210
|
+
let { spotEl: v } = l.attributes;
|
|
211
|
+
v || (v = document.createElement("div"), v.className = `${R}__items`, l.set({ spotEl: v })), o.appendChild(v);
|
|
212
|
+
}, c = ({ spot: l }) => {
|
|
213
|
+
const { spotEl: v, pageBreaks: A = [] } = l.attributes;
|
|
214
|
+
!S(l) || !v || !o || (Object.entries(l.getStyle()).forEach(([T, b]) => v.style.setProperty(T, b)), v.innerHTML = "", A.forEach((T, b) => {
|
|
215
|
+
const h = document.createElement("div");
|
|
216
|
+
h.setAttribute("data-page-number", `${b + 2}`), h.className = R, h.style.top = `${T}px`, v.appendChild(h);
|
|
217
217
|
}));
|
|
218
|
-
}, u =
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
218
|
+
}, u = _(() => {
|
|
219
|
+
if (e.em.destroyed) return;
|
|
220
|
+
const l = r();
|
|
221
|
+
l && l.set({ pageBreaks: oe(e), up: (l.attributes.up || 0) + 1 });
|
|
222
|
+
}, 150), d = _(u, 200), f = () => {
|
|
223
|
+
o = t.getSpotsEl(), r();
|
|
224
|
+
}, m = [
|
|
224
225
|
["component:input", u],
|
|
225
226
|
[a.update, u],
|
|
226
227
|
[s.spotAdd, g],
|
|
227
|
-
[s.spotUpdate,
|
|
228
|
+
[s.spotUpdate, c],
|
|
228
229
|
[s.spotRemove, p],
|
|
229
|
-
[s.frameLoadBody,
|
|
230
|
+
[s.frameLoadBody, f]
|
|
230
231
|
];
|
|
231
|
-
return
|
|
232
|
-
i();
|
|
232
|
+
return m.forEach(([l, v]) => e.on(l, v)), e.onReady(() => {
|
|
233
|
+
i(), new ResizeObserver(d).observe(t.getElement().parentElement);
|
|
233
234
|
}), () => {
|
|
234
|
-
|
|
235
|
+
m.forEach(([l, v]) => e.off(l, v)), u.clear(), d.clear();
|
|
235
236
|
};
|
|
236
237
|
}
|
|
237
|
-
var
|
|
238
|
-
const
|
|
238
|
+
var D = /* @__PURE__ */ ((e) => (e.print = "presetPrintable:print", e))(D || {});
|
|
239
|
+
const M = (e) => new Promise((n) => {
|
|
239
240
|
const t = document.createElement("iframe");
|
|
240
241
|
t.style.cssText = "position: absolute; width: 0; height: 0; border: 0; opacity: 0; pointer-events: none;", t.srcdoc = e.content, t.onload = () => n(t), document.body.appendChild(t);
|
|
241
242
|
});
|
|
242
243
|
function ie(e, n) {
|
|
243
244
|
const { Commands: t, Pages: s } = e;
|
|
244
245
|
return t.add(
|
|
245
|
-
|
|
246
|
+
D.print,
|
|
246
247
|
async (a, o, i = {}) => {
|
|
247
|
-
const
|
|
248
|
+
const r = {
|
|
248
249
|
page: i.allPages ? void 0 : s.getSelected(),
|
|
249
|
-
styles: "inline"
|
|
250
|
-
|
|
250
|
+
styles: "inline",
|
|
251
|
+
optionsHtml: {
|
|
252
|
+
// Avoid DataSource exporter
|
|
253
|
+
exporter: null
|
|
254
|
+
}
|
|
255
|
+
}, g = (await t.run(O.projectFiles, r)).filter((d) => d.filename.endsWith(".html")), c = g.map((d) => d.content).join('<div style="break-before: page;"></div>'), u = [];
|
|
251
256
|
if (i.separatePrints)
|
|
252
257
|
for (const d of g)
|
|
253
|
-
u.push(await
|
|
258
|
+
u.push(await M(d));
|
|
254
259
|
else
|
|
255
|
-
u.push(await
|
|
260
|
+
u.push(await M({ content: c, filename: "", mimeType: "" }));
|
|
256
261
|
for (const d of u) {
|
|
257
262
|
const f = d.contentWindow;
|
|
258
263
|
f.focus(), f.print();
|
|
@@ -261,14 +266,14 @@ function ie(e, n) {
|
|
|
261
266
|
}
|
|
262
267
|
), t.add("presetPrintable:exp", async (a) => {
|
|
263
268
|
await j("https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"), await j("https://cdn.jsdelivr.net/npm/jspdf@3.0.0/dist/jspdf.umd.min.js");
|
|
264
|
-
const { Devices: o, Canvas: i } = a, { sizeW:
|
|
265
|
-
f.html(
|
|
269
|
+
const { Devices: o, Canvas: i } = a, { sizeW: r, sizeH: p, sizeUnit: g } = o.getSelected().attributes, c = i.getFrameEl().contentDocument, u = "px", d = [L(r, g), L(p, g)], f = new window.jspdf.jsPDF({ unit: u, format: d }), m = c.body;
|
|
270
|
+
f.html(m, { callback: (l) => l.save() });
|
|
266
271
|
}), () => {
|
|
267
|
-
delete e.Commands.commands[
|
|
272
|
+
delete e.Commands.commands[D.print];
|
|
268
273
|
};
|
|
269
274
|
}
|
|
270
275
|
function re(e, n) {
|
|
271
|
-
const { blockPageBreak: t = {} } = n, { Components: s, Blocks: a } = e, o = "Page Break", i = `${
|
|
276
|
+
const { blockPageBreak: t = {} } = n, { Components: s, Blocks: a } = e, o = "Page Break", i = `${se}${P}`;
|
|
272
277
|
return s.addType(P, {
|
|
273
278
|
block: t && {
|
|
274
279
|
label: o,
|
|
@@ -277,16 +282,16 @@ function re(e, n) {
|
|
|
277
282
|
select: !0,
|
|
278
283
|
...t
|
|
279
284
|
},
|
|
280
|
-
isComponent:
|
|
285
|
+
isComponent: ee(P),
|
|
281
286
|
model: {
|
|
282
287
|
defaults: {
|
|
283
288
|
name: o,
|
|
284
289
|
classes: i,
|
|
285
|
-
attributes: { [
|
|
290
|
+
attributes: { [W]: P },
|
|
286
291
|
emptyState: !0,
|
|
287
292
|
stylable: !1,
|
|
288
293
|
droppable: !1,
|
|
289
|
-
draggable:
|
|
294
|
+
draggable: te("wrapper"),
|
|
290
295
|
styles: `.${i} { break-before: page; }`,
|
|
291
296
|
traits: []
|
|
292
297
|
}
|
|
@@ -299,7 +304,7 @@ const ce = "presetPrintable", le = function(e, n = {}) {
|
|
|
299
304
|
const t = {
|
|
300
305
|
selectedDevice: "a4",
|
|
301
306
|
...n
|
|
302
|
-
}, { Canvas: s, Devices: a } = e, o = s.events, i = e.events,
|
|
307
|
+
}, { Canvas: s, Devices: a } = e, o = s.events, i = e.events, r = t.selectedDevice || a.getConfig().default, g = [
|
|
303
308
|
{ name: "A5", width: 148, height: 210, unit: "mm" },
|
|
304
309
|
{ name: "A5 Portrait", width: 210, height: 148, unit: "mm" },
|
|
305
310
|
{ name: "A4", width: 210, height: 297, unit: "mm" },
|
|
@@ -309,15 +314,15 @@ const ce = "presetPrintable", le = function(e, n = {}) {
|
|
|
309
314
|
{ name: "Letter", width: 8.5, height: 11, unit: "in" },
|
|
310
315
|
{ name: "Legal", width: 8.5, height: 14, unit: "in" },
|
|
311
316
|
{ name: "Ledger", width: 11, height: 17, unit: "in" }
|
|
312
|
-
].map((
|
|
317
|
+
].map((b) => ne(b, t));
|
|
313
318
|
a.devices.reset(g);
|
|
314
|
-
const
|
|
315
|
-
a.select(
|
|
319
|
+
const c = r && a.get(r) || a.getAll().at(0);
|
|
320
|
+
a.select(c);
|
|
316
321
|
const u = () => {
|
|
317
|
-
const
|
|
318
|
-
(
|
|
322
|
+
const b = "page-rule", { rules: h } = e.Css, { width: w, height: y, minHeight: k } = a.getSelected().attributes, B = y && y !== "auto" ? y : k;
|
|
323
|
+
(h.where({ id: b }).pop() || h.add(
|
|
319
324
|
{
|
|
320
|
-
id:
|
|
325
|
+
id: b,
|
|
321
326
|
selectors: [],
|
|
322
327
|
selectorsAdd: "@page"
|
|
323
328
|
},
|
|
@@ -326,8 +331,8 @@ const ce = "presetPrintable", le = function(e, n = {}) {
|
|
|
326
331
|
size: `${w} ${B}`,
|
|
327
332
|
margin: "0"
|
|
328
333
|
});
|
|
329
|
-
}, d = (
|
|
330
|
-
const
|
|
334
|
+
}, d = (b) => {
|
|
335
|
+
const h = b.document, { minHeight: w } = a.getSelected().attributes, k = `
|
|
331
336
|
${!!parseFloat(`${w}`) ? `
|
|
332
337
|
[data-gjs-type="wrapper"] { min-height: ${w}; }
|
|
333
338
|
` : `
|
|
@@ -341,48 +346,48 @@ const ce = "presetPrintable", le = function(e, n = {}) {
|
|
|
341
346
|
}
|
|
342
347
|
`}
|
|
343
348
|
`;
|
|
344
|
-
F(`${
|
|
349
|
+
F(`${I}preset-printable`, k, { doc: h, target: h.head }), u();
|
|
345
350
|
};
|
|
346
|
-
e.on(o.frameLoadBody, (
|
|
347
|
-
const
|
|
348
|
-
if (d(
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
+
e.on(o.frameLoadBody, (b) => {
|
|
352
|
+
const h = b.window;
|
|
353
|
+
if (d(h), t.fixedHeight) {
|
|
354
|
+
const y = b.model.getComponent().getEl();
|
|
355
|
+
y == null || y.addEventListener("scroll", (k) => {
|
|
351
356
|
const B = k.target;
|
|
352
357
|
B.scrollTop > 0 && B.scrollTo(0, 0);
|
|
353
358
|
});
|
|
354
359
|
}
|
|
355
360
|
}), e.on(a.events.select, () => {
|
|
356
|
-
var
|
|
357
|
-
const
|
|
358
|
-
|
|
361
|
+
var h;
|
|
362
|
+
const b = (h = s.getFrameEl().contentDocument) == null ? void 0 : h.defaultView;
|
|
363
|
+
b && d(b);
|
|
359
364
|
});
|
|
360
365
|
const f = () => {
|
|
361
|
-
const
|
|
362
|
-
|
|
366
|
+
const h = e.Css.getRules().filter((w) => w.selectorsToString() === "body").pop();
|
|
367
|
+
h == null || h.addStyle({
|
|
363
368
|
"margin-top": "",
|
|
364
369
|
"margin-right": "",
|
|
365
370
|
"margin-bottom": "",
|
|
366
371
|
"margin-left": "",
|
|
367
372
|
margin: "0"
|
|
368
373
|
});
|
|
369
|
-
},
|
|
370
|
-
|
|
371
|
-
const
|
|
374
|
+
}, m = [[i.projectLoad, f]];
|
|
375
|
+
m.forEach(([b, h]) => e.on(b, h));
|
|
376
|
+
const l = ae(e, t), v = ie(e), A = re(e, t);
|
|
372
377
|
e.onReady(() => {
|
|
373
378
|
e.UndoManager.clear();
|
|
374
379
|
});
|
|
375
|
-
const
|
|
376
|
-
|
|
380
|
+
const T = () => {
|
|
381
|
+
m.forEach(([b, h]) => e.off(b, h)), l(), v(), A();
|
|
377
382
|
};
|
|
378
|
-
|
|
383
|
+
e.on(i.destroy, T), Z({
|
|
379
384
|
editor: e,
|
|
380
385
|
licenseKey: t.licenseKey,
|
|
381
|
-
plan:
|
|
386
|
+
plan: E.startup,
|
|
382
387
|
pluginName: ce,
|
|
383
|
-
cleanup:
|
|
388
|
+
cleanup: T
|
|
384
389
|
});
|
|
385
|
-
}, ge =
|
|
390
|
+
}, ge = X(le);
|
|
386
391
|
export {
|
|
387
392
|
ge as default
|
|
388
393
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(T,E){typeof exports=="object"&&typeof module<"u"?module.exports=E():typeof define=="function"&&define.amd?define(E):(T=typeof globalThis<"u"?globalThis:T||self,T.StudioSdkPlugins_presetPrintable=E())})(this,function(){"use strict";const T="app.grapesjs.com",E="app-stage.grapesjs.com",
|
|
1
|
+
(function(T,E){typeof exports=="object"&&typeof module<"u"?module.exports=E():typeof define=="function"&&define.amd?define(E):(T=typeof globalThis<"u"?globalThis:T||self,T.StudioSdkPlugins_presetPrintable=E())})(this,function(){"use strict";const T="app.grapesjs.com",E="app-stage.grapesjs.com",H=[T,E,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],N="license:check:start",z="license:check:end",K=()=>typeof window<"u",_=(e,n={})=>{const t=V(e)?{id:e,src:e}:e;return new Promise((s,a)=>{var p,d;const o=document.querySelector(`script[src="${t.src}"]`),{id:i}=t;if(o)return(p=n.onScript)==null||p.call(n,o),s(i);const r=document.createElement("script");r.src=t.src,r.onload=()=>s(i),r.onerror=()=>a(i),document.head.appendChild(r),(d=n.onScript)==null||d.call(n,r)})},C=({isDev:e,isStage:n})=>`${e?"":`https://${n?E:T}`}/api`,q=()=>{const e=K()&&window.location.hostname;return!!e&&(H.includes(e)||H.some(n=>e.endsWith(n)))},V=e=>typeof e=="string";async function Y({path:e,baseApiUrl:n,method:t="GET",headers:s={},params:a,body:o}){const r=`${n||C({isDev:!1,isStage:!1})}${e}`,p={method:t,headers:{"Content-Type":"application/json",...s}};o&&(p.body=JSON.stringify(o));const d=a?new URLSearchParams(a).toString():"",c=d?`?${d}`:"",u=await fetch(`${r}${c}`,p);if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);return u.json()}var k=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(k||{}),M=(e=>(e.toastAdd="studio:toastAdd",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.projectFiles="studio:projectFiles",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(M||{});const U={[k.free]:0,[k.startup]:10,[k.business]:20,[k.enterprise]:30};function J(e){const n=e;return n.init=t=>s=>e(s,t),n}const X=e=>J(e);async function Z({editor:e,plan:n,pluginName:t,licenseKey:s,cleanup:a}){let o="",i=!1;const r=q(),p=c=>{console.warn("Cleanup plugin:",t,"Reason:",c),a()},d=(c={})=>{var l;const{error:u,sdkLicense:g}=c,f=(l=c.plan)==null?void 0:l.category;if(!(g||c.license)||u)p(u||"Invalid license");else if(f){const b=U[n],B=U[f];b>B&&p({pluginRequiredPlan:n,licensePlan:f})}};e.on(N,c=>{o=c==null?void 0:c.baseApiUrl,i=!0}),e.on(z,c=>{d(c)}),setTimeout(async()=>{if(!i){if(r)return;if(s){const c=await Q({licenseKey:s,pluginName:t,baseApiUrl:o});c&&d(c)}else p("The `licenseKey` option not provided")}},2e3)}async function Q(e){const{licenseKey:n,pluginName:t,baseApiUrl:s}=e;try{return(await Y({baseApiUrl:s,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const ee=e=>n=>{var t;return((t=n.getAttribute)==null?void 0:t.call(n,F))===e},te=(...e)=>(n,t)=>e.some(s=>t.is(s)),G=(e,n,t)=>{const{doc:s=document}=t,a=t.target||s.head,o=a.querySelector(`style[${e}]`)||s.createElement("style");o.setAttribute(e,"true"),o.innerHTML=n,!a.contains(o)&&a.appendChild(o)},se="gjs-plg-",O="data-gs-plg-",F="data-type-role";function I(e,n,t){let s,a,o,i,r;const p=n===void 0?100:n;function d(){const u=Date.now()-i;u<p&&u>=0?s=setTimeout(d,p-u):(s=null,r=e.apply(o,a),o=a=null)}const c=function(){return o=this,a=arguments,i=Date.now(),s||(s=setTimeout(d,p)),r};return c.clear=function(){s&&(clearTimeout(s),s=null)},c.flush=function(){s&&(r=e.apply(o,a),o=a=null,clearTimeout(s),s=null)},c}const P="page-break";function $(e,n){const s={mm:3.7795275590551185,cm:37.79527559055118,in:96,pt:1.3333333333333333,pc:16};return s[n]?e*s[n]:null}const ne=(e,n)=>{const{name:t,id:s,width:a,height:o,unit:i}=e,{fixedHeight:r}=n,p=`${a}${i}`,d=`${o}${i}`;return{id:s||t.toLowerCase().replace(/\s/g,"-"),name:`${t} (${p} x ${d})`,sizeH:o,sizeW:a,sizeUnit:i,widthMedia:"",width:p,minHeight:r?"0":`${$(o,i)}px`,height:r?d:void 0}},D="page-breaks",R="gjs-page-breaks-spot",x=e=>e.type===D;function oe(e){const{Devices:n}=e,{height:t,minHeight:s}=n.getSelected().attributes,o=parseFloat(`${t&&t!=="auto"?t:s}`),i=e.getWrapper(),r=i==null?void 0:i.getEl(),p=[];if(!i||!r)return p;const d=r.getBoundingClientRect().height,u=i.findType(P).map(f=>f.getEl()).filter(Boolean).map(f=>({top:f.offsetTop,height:f.offsetHeight}));let g=0;for(;g<d;){const f=u.find(m=>m.top>g&&m.top<g+o);f?(g=f.top+f.height,p.push(f.top)):(g+=o,g<d&&p.push(g))}return p}function ae(e,n){const{Canvas:t}=e,s=t.events,a=e.events;let o;const i=()=>{G(`${O}preset-printable-spots`,`.${R} {
|
|
2
2
|
position: absolute;
|
|
3
3
|
left: 0;
|
|
4
4
|
width: 100%;
|
|
5
5
|
border-top: 1px dashed var(--gs-theme-cl-cmp-bg2, var(--gjs-color-blue));
|
|
6
6
|
}
|
|
7
|
-
.${
|
|
7
|
+
.${R}::after {
|
|
8
8
|
background-color: var(--gs-theme-cl-cmp-bg1, var(--gjs-color-highlight));
|
|
9
9
|
content: attr(data-page-number);
|
|
10
10
|
display: block;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
right: 0;
|
|
16
16
|
transform: translate(100%, -50%);
|
|
17
17
|
}
|
|
18
|
-
`,{target:window.document.head})},
|
|
18
|
+
`,{target:window.document.head})},r=()=>{if(n.enablePageBreaksSpot===!1)return;const l={id:D,type:D,component:e.getWrapper()};return t.getSpots(l).pop()||t.addSpot(l)},p=({spot:l})=>{const{spotEl:b}=l.attributes;!x(l)||!b||!o||o.removeChild(b)},d=({spot:l})=>{if(!x(l)||!o)return;let{spotEl:b}=l.attributes;b||(b=document.createElement("div"),b.className=`${R}__items`,l.set({spotEl:b})),o.appendChild(b)},c=({spot:l})=>{const{spotEl:b,pageBreaks:B=[]}=l.attributes;!x(l)||!b||!o||(Object.entries(l.getStyle()).forEach(([A,v])=>b.style.setProperty(A,v)),b.innerHTML="",B.forEach((A,v)=>{const h=document.createElement("div");h.setAttribute("data-page-number",`${v+2}`),h.className=R,h.style.top=`${A}px`,b.appendChild(h)}))},u=I(()=>{if(e.em.destroyed)return;const l=r();l&&l.set({pageBreaks:oe(e),up:(l.attributes.up||0)+1})},150),g=I(u,200),f=()=>{o=t.getSpotsEl(),r()},m=[["component:input",u],[a.update,u],[s.spotAdd,d],[s.spotUpdate,c],[s.spotRemove,p],[s.frameLoadBody,f]];return m.forEach(([l,b])=>e.on(l,b)),e.onReady(()=>{i(),new ResizeObserver(g).observe(t.getElement().parentElement)}),()=>{m.forEach(([l,b])=>e.off(l,b)),u.clear(),g.clear()}}var j=(e=>(e.print="presetPrintable:print",e))(j||{});const W=e=>new Promise(n=>{const t=document.createElement("iframe");t.style.cssText="position: absolute; width: 0; height: 0; border: 0; opacity: 0; pointer-events: none;",t.srcdoc=e.content,t.onload=()=>n(t),document.body.appendChild(t)});function ie(e,n){const{Commands:t,Pages:s}=e;return t.add(j.print,async(a,o,i={})=>{const r={page:i.allPages?void 0:s.getSelected(),styles:"inline",optionsHtml:{exporter:null}},d=(await t.run(M.projectFiles,r)).filter(g=>g.filename.endsWith(".html")),c=d.map(g=>g.content).join('<div style="break-before: page;"></div>'),u=[];if(i.separatePrints)for(const g of d)u.push(await W(g));else u.push(await W({content:c,filename:"",mimeType:""}));for(const g of u){const f=g.contentWindow;f.focus(),f.print()}setTimeout(()=>u.forEach(g=>g.remove()),1e3)}),t.add("presetPrintable:exp",async a=>{await _("https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"),await _("https://cdn.jsdelivr.net/npm/jspdf@3.0.0/dist/jspdf.umd.min.js");const{Devices:o,Canvas:i}=a,{sizeW:r,sizeH:p,sizeUnit:d}=o.getSelected().attributes,c=i.getFrameEl().contentDocument,u="px",g=[$(r,d),$(p,d)],f=new window.jspdf.jsPDF({unit:u,format:g}),m=c.body;f.html(m,{callback:l=>l.save()})}),()=>{delete e.Commands.commands[j.print]}}function re(e,n){const{blockPageBreak:t={}}=n,{Components:s,Blocks:a}=e,o="Page Break",i=`${se}${P}`;return s.addType(P,{block:t&&{label:o,media:'<svg viewBox="0 0 24 24"><path d="M18 20H6v-2H4v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2h-2v2M14 2H6a2 2 0 0 0-2 2v8h2V4h8v4h4v4h2V8l-6-6m-3 14H8v-2h3v2m5 0h-3v-2h3v2M3 14h3v2H3v-2m18 2h-3v-2h3v2Z"/></svg>',category:"Extra",select:!0,...t},isComponent:ee(P),model:{defaults:{name:o,classes:i,attributes:{[F]:P},emptyState:!0,stylable:!1,droppable:!1,draggable:te("wrapper"),styles:`.${i} { break-before: page; }`,traits:[]}}}),()=>{s.removeType(P),a.remove(P)}}const ce="presetPrintable";return X(function(e,n={}){const t={selectedDevice:"a4",...n},{Canvas:s,Devices:a}=e,o=s.events,i=e.events,r=t.selectedDevice||a.getConfig().default,d=[{name:"A5",width:148,height:210,unit:"mm"},{name:"A5 Portrait",width:210,height:148,unit:"mm"},{name:"A4",width:210,height:297,unit:"mm"},{name:"A3",width:297,height:420,unit:"mm"},{name:"B5",width:176,height:250,unit:"mm"},{name:"B4",width:250,height:353,unit:"mm"},{name:"Letter",width:8.5,height:11,unit:"in"},{name:"Legal",width:8.5,height:14,unit:"in"},{name:"Ledger",width:11,height:17,unit:"in"}].map(v=>ne(v,t));a.devices.reset(d);const c=r&&a.get(r)||a.getAll().at(0);a.select(c);const u=()=>{const v="page-rule",{rules:h}=e.Css,{width:w,height:y,minHeight:S}=a.getSelected().attributes,L=y&&y!=="auto"?y:S;(h.where({id:v}).pop()||h.add({id:v,selectors:[],selectorsAdd:"@page"},{at:0})).setStyle({size:`${w} ${L}`,margin:"0"})},g=v=>{const h=v.document,{minHeight:w}=a.getSelected().attributes,S=`
|
|
19
19
|
${!!parseFloat(`${w}`)?`
|
|
20
20
|
[data-gjs-type="wrapper"] { min-height: ${w}; }
|
|
21
21
|
`:`
|
|
@@ -28,4 +28,4 @@
|
|
|
28
28
|
height: 100dvh;
|
|
29
29
|
}
|
|
30
30
|
`}
|
|
31
|
-
`;G(`${
|
|
31
|
+
`;G(`${O}preset-printable`,S,{doc:h,target:h.head}),u()};e.on(o.frameLoadBody,v=>{const h=v.window;if(g(h),t.fixedHeight){const y=v.model.getComponent().getEl();y==null||y.addEventListener("scroll",S=>{const L=S.target;L.scrollTop>0&&L.scrollTo(0,0)})}}),e.on(a.events.select,()=>{var h;const v=(h=s.getFrameEl().contentDocument)==null?void 0:h.defaultView;v&&g(v)});const f=()=>{const h=e.Css.getRules().filter(w=>w.selectorsToString()==="body").pop();h==null||h.addStyle({"margin-top":"","margin-right":"","margin-bottom":"","margin-left":"",margin:"0"})},m=[[i.projectLoad,f]];m.forEach(([v,h])=>e.on(v,h));const l=ae(e,t),b=ie(e),B=re(e,t);e.onReady(()=>{e.UndoManager.clear()});const A=()=>{m.forEach(([v,h])=>e.off(v,h)),l(),b(),B()};e.on(i.destroy,A),Z({editor:e,licenseKey:t.licenseKey,plan:k.startup,pluginName:ce,cleanup:A})})});
|