@grapesjs/studio-sdk-plugins 1.0.35 → 1.0.36
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/accordionComponent/index.cjs.js +7 -7
- package/dist/accordionComponent/index.es.js +175 -162
- package/dist/accordionComponent/index.umd.js +7 -7
- package/dist/aiChat/index.cjs.js +64 -64
- package/dist/aiChat/index.es.js +5785 -5757
- package/dist/aiChat/index.js +64 -64
- package/dist/aiChat/index.umd.js +63 -63
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +204 -191
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +183 -170
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +134 -121
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +165 -152
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +5 -5
- package/dist/canvasGridMode/index.es.js +245 -232
- package/dist/canvasGridMode/index.umd.js +4 -4
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +155 -142
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +9 -9
- package/dist/dataSourceEjs/index.es.js +257 -244
- package/dist/dataSourceEjs/index.umd.js +9 -9
- package/dist/dataSourceHandlebars/index.cjs.js +8 -8
- package/dist/dataSourceHandlebars/index.es.js +216 -203
- package/dist/dataSourceHandlebars/index.umd.js +7 -7
- package/dist/dialogComponent/index.cjs.js +14 -14
- package/dist/dialogComponent/index.es.js +141 -128
- package/dist/dialogComponent/index.umd.js +14 -14
- package/dist/flexComponent/index.cjs.js +13 -13
- package/dist/flexComponent/index.es.js +484 -471
- package/dist/flexComponent/index.umd.js +13 -13
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +173 -160
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +160 -147
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +196 -183
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +25 -25
- package/dist/index.es.js +121 -108
- package/dist/index.umd.js +18 -18
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +157 -144
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +245 -232
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +106 -93
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +157 -144
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +3 -3
- package/dist/presetPrintable/index.es.js +181 -168
- package/dist/presetPrintable/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +7 -7
- package/dist/prosemirror/index.es.js +385 -372
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +200 -187
- package/dist/rendererReact/index.js +1 -1
- package/dist/rendererReact/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +118 -105
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +4 -4
- package/dist/shapeDividerComponent/index.es.js +129 -116
- package/dist/shapeDividerComponent/index.umd.js +4 -4
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +203 -190
- package/dist/swiperComponent/index.umd.js +7 -7
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +257 -244
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +121 -108
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const C = "app.grapesjs.com", z = "app-stage.grapesjs.com", X = "app2.grapesjs.com", Z = "app-stage2.grapesjs.com", O = [
|
|
2
|
+
C,
|
|
3
3
|
X,
|
|
4
4
|
z,
|
|
5
5
|
Z,
|
|
@@ -11,110 +11,123 @@ const W = "app.grapesjs.com", z = "app-stage.grapesjs.com", X = "app2.grapesjs.c
|
|
|
11
11
|
// For stackblitz.com demos
|
|
12
12
|
"-sandpack.codesandbox.io"
|
|
13
13
|
// For Sandpack demos
|
|
14
|
-
], Q = "license:check:
|
|
15
|
-
const t =
|
|
16
|
-
return new Promise((o,
|
|
17
|
-
var
|
|
18
|
-
const { loadedScripts: r } = s, { id:
|
|
19
|
-
if (
|
|
20
|
-
if ((
|
|
21
|
-
|
|
14
|
+
], Q = "license:check:end", ee = () => typeof window < "u", I = (e, s = {}) => {
|
|
15
|
+
const t = se(e) ? { id: e, src: e } : e;
|
|
16
|
+
return new Promise((o, a) => {
|
|
17
|
+
var d, u;
|
|
18
|
+
const { loadedScripts: r } = s, { id: c, src: i } = t, l = document.querySelector(`script[src="${i}"]`);
|
|
19
|
+
if (l) {
|
|
20
|
+
if ((d = s.onScript) == null || d.call(s, l), r && !r.get(i)) {
|
|
21
|
+
l.addEventListener("load", () => o(c)), l.addEventListener("error", () => a(c));
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
return o(
|
|
24
|
+
return o(c);
|
|
25
25
|
}
|
|
26
26
|
const g = window.define;
|
|
27
27
|
window.define = void 0;
|
|
28
28
|
const f = () => {
|
|
29
|
-
r == null || r.set(
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
o(
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
}, document.head.appendChild(
|
|
29
|
+
r == null || r.set(i, !0), window.define = g;
|
|
30
|
+
}, n = document.createElement("script");
|
|
31
|
+
n.src = i, n.onload = () => {
|
|
32
|
+
o(c), f();
|
|
33
|
+
}, n.onerror = () => {
|
|
34
|
+
a(c), f();
|
|
35
|
+
}, document.head.appendChild(n), (u = s.onScript) == null || u.call(s, n);
|
|
36
36
|
});
|
|
37
|
-
},
|
|
37
|
+
}, te = ({
|
|
38
38
|
isDev: e,
|
|
39
39
|
isStage: s,
|
|
40
40
|
isPlatform: t
|
|
41
|
-
}) => `${e ? "" : `https://${s ? z :
|
|
42
|
-
const e =
|
|
43
|
-
return !!e && (
|
|
44
|
-
},
|
|
45
|
-
async function
|
|
41
|
+
}) => `${e ? "" : `https://${s ? z : C}`}/${t ? "platform-api" : "api"}`, oe = () => {
|
|
42
|
+
const e = ee() && window.location.hostname;
|
|
43
|
+
return !!e && (O.includes(e) || O.some((s) => e.endsWith(s)));
|
|
44
|
+
}, se = (e) => typeof e == "string";
|
|
45
|
+
async function ne({
|
|
46
46
|
path: e,
|
|
47
47
|
baseApiUrl: s,
|
|
48
48
|
method: t = "GET",
|
|
49
49
|
headers: o = {},
|
|
50
|
-
params:
|
|
50
|
+
params: a,
|
|
51
51
|
body: r
|
|
52
52
|
}) {
|
|
53
|
-
const
|
|
53
|
+
const i = `${s || te({ isDev: !1, isStage: !1 })}${e}`, l = {
|
|
54
54
|
method: t,
|
|
55
55
|
headers: {
|
|
56
56
|
"Content-Type": "application/json",
|
|
57
57
|
...o
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
r && (
|
|
61
|
-
const g =
|
|
62
|
-
if (!
|
|
63
|
-
throw new Error(`HTTP error! status: ${
|
|
64
|
-
return
|
|
60
|
+
r && (l.body = JSON.stringify(r));
|
|
61
|
+
const g = a ? new URLSearchParams(a).toString() : "", f = g ? `?${g}` : "", n = await fetch(`${i}${f}`, l);
|
|
62
|
+
if (!n.ok)
|
|
63
|
+
throw new Error(`HTTP error! status: ${n.status}`);
|
|
64
|
+
return n.json();
|
|
65
65
|
}
|
|
66
|
-
var
|
|
67
|
-
const
|
|
68
|
-
[
|
|
69
|
-
[
|
|
70
|
-
[
|
|
71
|
-
[
|
|
66
|
+
var k = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(k || {}), j = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.toastRemove = "studio:toastRemove", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", e.dialogExportCode = "studio:dialogExportCode", e.dialogImportCode = "studio:dialogImportCode", 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.clearPage = "studio:clearPage", e.projectFiles = "studio:projectFiles", e.validateCode = "studio:validateCode", 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.layoutComponentAdd = "studio:layoutComponentAdd", e.layoutComponentGet = "studio:layoutComponentGet", e.layoutComponentRemove = "studio:layoutComponentRemove", e.layoutComponentRender = "studio:layoutComponentRender", e.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", e.settings = "studio:settings", 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))(j || {});
|
|
67
|
+
const F = {
|
|
68
|
+
[k.free]: 0,
|
|
69
|
+
[k.startup]: 10,
|
|
70
|
+
[k.business]: 20,
|
|
71
|
+
[k.enterprise]: 30
|
|
72
72
|
};
|
|
73
|
-
function
|
|
73
|
+
function ae(e) {
|
|
74
74
|
const s = e;
|
|
75
75
|
return s.init = (t) => (o) => e(o, t), s;
|
|
76
76
|
}
|
|
77
|
-
const
|
|
78
|
-
async function
|
|
77
|
+
const re = (e) => /* @__PURE__ */ ae(e);
|
|
78
|
+
async function ie({
|
|
79
79
|
editor: e,
|
|
80
80
|
plan: s,
|
|
81
81
|
pluginName: t,
|
|
82
82
|
licenseKey: o,
|
|
83
|
-
onLicenseCheckResponse:
|
|
83
|
+
onLicenseCheckResponse: a,
|
|
84
84
|
cleanup: r
|
|
85
85
|
}) {
|
|
86
|
-
let
|
|
87
|
-
const
|
|
88
|
-
console.warn("Cleanup plugin:", t, "Reason:",
|
|
89
|
-
},
|
|
90
|
-
var
|
|
91
|
-
const { error:
|
|
92
|
-
if (!(u ||
|
|
93
|
-
|
|
86
|
+
let c = "", i;
|
|
87
|
+
const l = (n) => {
|
|
88
|
+
console.warn("Cleanup plugin:", t, "Reason:", n), r();
|
|
89
|
+
}, g = (n = {}) => {
|
|
90
|
+
var p;
|
|
91
|
+
const { error: d, sdkLicense: u } = n, m = (p = n.plan) == null ? void 0 : p.category;
|
|
92
|
+
if (!(u || n.license) || d)
|
|
93
|
+
l(d || "Invalid license");
|
|
94
94
|
else if (m) {
|
|
95
|
-
const h =
|
|
96
|
-
h >
|
|
95
|
+
const h = F[s], L = F[m];
|
|
96
|
+
h > L && l({ pluginRequiredPlan: s, licensePlan: m });
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
e.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
99
|
+
e.Commands.has(j.settings) && (i = e.runCommand(j.settings), c = (i == null ? void 0 : i.baseUrl) || "");
|
|
100
|
+
const f = (n) => {
|
|
101
|
+
a == null || a(n), n && g(n);
|
|
102
|
+
};
|
|
103
|
+
if (!i) {
|
|
104
|
+
e.onReady(async () => {
|
|
105
|
+
if (!oe())
|
|
106
|
+
if (o) {
|
|
107
|
+
const n = await le({ licenseKey: o, pluginName: t, baseApiUrl: c });
|
|
108
|
+
f(n);
|
|
109
|
+
} else
|
|
110
|
+
l("The `licenseKey` option not provided");
|
|
111
|
+
});
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (i.licensePlan || i.licenseError) {
|
|
115
|
+
const n = ce(i);
|
|
116
|
+
f(n);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
e.on(Q, (n) => f(n));
|
|
113
120
|
}
|
|
121
|
+
const ce = (e) => ({
|
|
122
|
+
sdkLicense: e.license,
|
|
123
|
+
license: e.license,
|
|
124
|
+
error: e.licenseError,
|
|
125
|
+
plan: e.licensePlan
|
|
126
|
+
});
|
|
114
127
|
async function le(e) {
|
|
115
128
|
const { licenseKey: s, pluginName: t, baseApiUrl: o } = e;
|
|
116
129
|
try {
|
|
117
|
-
return (await
|
|
130
|
+
return (await ne({
|
|
118
131
|
baseApiUrl: o,
|
|
119
132
|
path: `/sdk/${s || "na"}`,
|
|
120
133
|
method: "POST",
|
|
@@ -123,31 +136,31 @@ async function le(e) {
|
|
|
123
136
|
pn: t
|
|
124
137
|
}
|
|
125
138
|
})).result || {};
|
|
126
|
-
} catch (
|
|
127
|
-
return console.error("Error during SDK license check:",
|
|
139
|
+
} catch (a) {
|
|
140
|
+
return console.error("Error during SDK license check:", a), !1;
|
|
128
141
|
}
|
|
129
142
|
}
|
|
130
|
-
const
|
|
143
|
+
const pe = (e) => (s) => {
|
|
131
144
|
var t;
|
|
132
145
|
return ((t = s.getAttribute) == null ? void 0 : t.call(s, V)) === e;
|
|
133
|
-
},
|
|
134
|
-
const { doc: o = document } = t,
|
|
135
|
-
r.setAttribute(e, "true"), r.innerHTML = s, !
|
|
146
|
+
}, de = (...e) => (s, t) => e.some((o) => t.is(o)), K = (e, s, t) => {
|
|
147
|
+
const { doc: o = document } = t, a = t.target || o.head, r = a.querySelector(`style[${e}]`) || o.createElement("style");
|
|
148
|
+
r.setAttribute(e, "true"), r.innerHTML = s, !a.contains(r) && a.appendChild(r);
|
|
136
149
|
}, ge = "gjs-plg-", q = "data-gs-plg-", V = "data-type-role";
|
|
137
150
|
function N(e, s, t) {
|
|
138
|
-
let o,
|
|
139
|
-
const
|
|
151
|
+
let o, a, r, c, i;
|
|
152
|
+
const l = s === void 0 ? 100 : s;
|
|
140
153
|
function g() {
|
|
141
|
-
const
|
|
142
|
-
|
|
154
|
+
const n = Date.now() - c;
|
|
155
|
+
n < l && n >= 0 ? o = setTimeout(g, l - n) : (o = null, i = e.apply(r, a), r = a = null);
|
|
143
156
|
}
|
|
144
157
|
const f = function() {
|
|
145
|
-
return r = this,
|
|
158
|
+
return r = this, a = arguments, c = Date.now(), o || (o = setTimeout(g, l)), i;
|
|
146
159
|
};
|
|
147
160
|
return f.clear = function() {
|
|
148
161
|
o && (clearTimeout(o), o = null);
|
|
149
162
|
}, f.flush = function() {
|
|
150
|
-
o && (
|
|
163
|
+
o && (i = e.apply(r, a), r = a = null, clearTimeout(o), o = null);
|
|
151
164
|
}, f;
|
|
152
165
|
}
|
|
153
166
|
const A = "page-break";
|
|
@@ -168,36 +181,36 @@ function _(e, s) {
|
|
|
168
181
|
return o[s] ? e * o[s] : null;
|
|
169
182
|
}
|
|
170
183
|
const ue = (e, s) => {
|
|
171
|
-
const { name: t, id: o, width:
|
|
184
|
+
const { name: t, id: o, width: a, height: r, unit: c } = e, { fixedHeight: i } = s, l = `${a}${c}`, g = `${r}${c}`;
|
|
172
185
|
return {
|
|
173
186
|
id: o || t.toLowerCase().replace(/\s/g, "-"),
|
|
174
|
-
name: `${t} (${
|
|
187
|
+
name: `${t} (${l} x ${g})`,
|
|
175
188
|
sizeH: r,
|
|
176
|
-
sizeW:
|
|
177
|
-
sizeUnit:
|
|
189
|
+
sizeW: a,
|
|
190
|
+
sizeUnit: c,
|
|
178
191
|
widthMedia: "",
|
|
179
|
-
width:
|
|
180
|
-
minHeight:
|
|
181
|
-
height:
|
|
192
|
+
width: l,
|
|
193
|
+
minHeight: i ? "0" : `${_(r, c)}px`,
|
|
194
|
+
height: i ? g : void 0
|
|
182
195
|
};
|
|
183
|
-
},
|
|
196
|
+
}, H = "page-breaks", D = "gjs-page-breaks-spot", S = (e) => e.type === H;
|
|
184
197
|
function he(e) {
|
|
185
|
-
const { Devices: s } = e, { height: t, minHeight: o } = s.getSelected().attributes, r = parseFloat(`${t && t !== "auto" ? t : o}`),
|
|
186
|
-
if (!
|
|
187
|
-
return
|
|
188
|
-
const g =
|
|
189
|
-
let
|
|
190
|
-
for (;
|
|
191
|
-
const u =
|
|
192
|
-
u ? (
|
|
198
|
+
const { Devices: s } = e, { height: t, minHeight: o } = s.getSelected().attributes, r = parseFloat(`${t && t !== "auto" ? t : o}`), c = e.getWrapper(), i = c == null ? void 0 : c.getEl(), l = [];
|
|
199
|
+
if (!c || !i)
|
|
200
|
+
return l;
|
|
201
|
+
const g = i.getBoundingClientRect().height, n = c.findType(A).map((u) => u.getEl()).filter(Boolean).map((u) => ({ top: u.offsetTop, height: u.offsetHeight }));
|
|
202
|
+
let d = 0;
|
|
203
|
+
for (; d < g; ) {
|
|
204
|
+
const u = n.find((m) => m.top > d && m.top < d + r);
|
|
205
|
+
u ? (d = u.top + u.height, l.push(u.top)) : (d += r, d < g && l.push(d));
|
|
193
206
|
}
|
|
194
|
-
return
|
|
207
|
+
return l;
|
|
195
208
|
}
|
|
196
209
|
function fe(e, s) {
|
|
197
|
-
const { Canvas: t } = e, o = t.events,
|
|
210
|
+
const { Canvas: t } = e, o = t.events, a = e.events;
|
|
198
211
|
let r;
|
|
199
|
-
const
|
|
200
|
-
|
|
212
|
+
const c = () => {
|
|
213
|
+
K(
|
|
201
214
|
`${q}preset-printable-spots`,
|
|
202
215
|
`.${D} {
|
|
203
216
|
position: absolute;
|
|
@@ -220,86 +233,86 @@ function fe(e, s) {
|
|
|
220
233
|
`,
|
|
221
234
|
{ target: window.document.head }
|
|
222
235
|
);
|
|
223
|
-
},
|
|
236
|
+
}, i = () => {
|
|
224
237
|
if (s.enablePageBreaksSpot === !1) return;
|
|
225
|
-
const
|
|
226
|
-
return t.getSpots(
|
|
227
|
-
},
|
|
228
|
-
const { spotEl: h } =
|
|
229
|
-
!
|
|
230
|
-
}, g = ({ spot:
|
|
231
|
-
if (!
|
|
232
|
-
let { spotEl: h } =
|
|
233
|
-
h || (h = document.createElement("div"), h.className = `${D}__items`,
|
|
234
|
-
}, f = ({ spot:
|
|
235
|
-
const { spotEl: h, pageBreaks:
|
|
236
|
-
!
|
|
238
|
+
const p = { id: H, type: H, component: e.getWrapper() };
|
|
239
|
+
return t.getSpots(p).pop() || t.addSpot(p);
|
|
240
|
+
}, l = ({ spot: p }) => {
|
|
241
|
+
const { spotEl: h } = p.attributes;
|
|
242
|
+
!S(p) || !h || !r || r.removeChild(h);
|
|
243
|
+
}, g = ({ spot: p }) => {
|
|
244
|
+
if (!S(p) || !r) return;
|
|
245
|
+
let { spotEl: h } = p.attributes;
|
|
246
|
+
h || (h = document.createElement("div"), h.className = `${D}__items`, p.set({ spotEl: h })), r.appendChild(h);
|
|
247
|
+
}, f = ({ spot: p }) => {
|
|
248
|
+
const { spotEl: h, pageBreaks: L = [] } = p.attributes;
|
|
249
|
+
!S(p) || !h || !r || (Object.entries(p.getStyle()).forEach(([$, x]) => h.style.setProperty($, x)), h.innerHTML = "", L.forEach(($, x) => {
|
|
237
250
|
const E = document.createElement("div");
|
|
238
|
-
E.setAttribute("data-page-number", `${
|
|
251
|
+
E.setAttribute("data-page-number", `${x + 2}`), E.className = D, E.style.top = `${$}px`, h.appendChild(E);
|
|
239
252
|
}));
|
|
240
|
-
},
|
|
253
|
+
}, n = N(() => {
|
|
241
254
|
if (e.em.destroyed) return;
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
}, 150),
|
|
245
|
-
r = t.getSpotsEl(),
|
|
255
|
+
const p = i();
|
|
256
|
+
p && p.set({ pageBreaks: he(e), up: (p.attributes.up || 0) + 1 });
|
|
257
|
+
}, 150), d = N(n, 200), u = () => {
|
|
258
|
+
r = t.getSpotsEl(), i();
|
|
246
259
|
}, m = () => {
|
|
247
|
-
const
|
|
248
|
-
|
|
260
|
+
const p = i();
|
|
261
|
+
p && p.set({ up: (p.attributes.up || 0) + 1 });
|
|
249
262
|
}, w = [
|
|
250
|
-
["component:input",
|
|
263
|
+
["component:input", n],
|
|
251
264
|
["frame:scroll", m],
|
|
252
|
-
[
|
|
265
|
+
[a.update, n],
|
|
253
266
|
[o.spotAdd, g],
|
|
254
267
|
[o.spotUpdate, f],
|
|
255
|
-
[o.spotRemove,
|
|
268
|
+
[o.spotRemove, l],
|
|
256
269
|
[o.frameLoadBody, u]
|
|
257
270
|
];
|
|
258
|
-
return w.forEach(([
|
|
259
|
-
|
|
271
|
+
return w.forEach(([p, h]) => e.on(p, h)), e.onReady(() => {
|
|
272
|
+
c(), new ResizeObserver(m).observe(t.getElement().parentElement);
|
|
260
273
|
}), () => {
|
|
261
|
-
w.forEach(([
|
|
274
|
+
w.forEach(([p, h]) => e.off(p, h)), n.clear(), d.clear();
|
|
262
275
|
};
|
|
263
276
|
}
|
|
264
|
-
var
|
|
265
|
-
const
|
|
277
|
+
var M = /* @__PURE__ */ ((e) => (e.print = "presetPrintable:print", e))(M || {});
|
|
278
|
+
const W = (e) => new Promise((s) => {
|
|
266
279
|
const t = document.createElement("iframe");
|
|
267
280
|
t.style.cssText = "position: absolute; width: 0; height: 0; border: 0; opacity: 0; pointer-events: none;", t.srcdoc = e.content, t.onload = () => s(t), document.body.appendChild(t);
|
|
268
281
|
});
|
|
269
282
|
function ve(e, s) {
|
|
270
283
|
const { Commands: t, Pages: o } = e;
|
|
271
284
|
return t.add(
|
|
272
|
-
|
|
273
|
-
async (
|
|
274
|
-
const
|
|
275
|
-
page:
|
|
285
|
+
M.print,
|
|
286
|
+
async (a, r, c = {}) => {
|
|
287
|
+
const i = {
|
|
288
|
+
page: c.allPages ? void 0 : o.getSelected(),
|
|
276
289
|
styles: "inline",
|
|
277
290
|
optionsHtml: {
|
|
278
291
|
// Avoid DataSource exporter
|
|
279
292
|
exporter: null
|
|
280
293
|
}
|
|
281
|
-
}, g = (await t.run(
|
|
282
|
-
if (
|
|
283
|
-
for (const
|
|
284
|
-
|
|
294
|
+
}, g = (await t.run(j.projectFiles, i)).filter((d) => d.filename.endsWith(".html")), f = g.map((d) => d.content).join('<div style="break-before: page;"></div>'), n = [];
|
|
295
|
+
if (c.separatePrints)
|
|
296
|
+
for (const d of g)
|
|
297
|
+
n.push(await W(d));
|
|
285
298
|
else
|
|
286
|
-
|
|
287
|
-
for (const
|
|
288
|
-
const u =
|
|
299
|
+
n.push(await W({ content: f, filename: "", mimeType: "" }));
|
|
300
|
+
for (const d of n) {
|
|
301
|
+
const u = d.contentWindow;
|
|
289
302
|
u.focus(), u.print();
|
|
290
303
|
}
|
|
291
|
-
setTimeout(() =>
|
|
304
|
+
setTimeout(() => n.forEach((d) => d.remove()), 1e3);
|
|
292
305
|
}
|
|
293
|
-
), t.add("presetPrintable:exp", async (
|
|
306
|
+
), t.add("presetPrintable:exp", async (a) => {
|
|
294
307
|
await I("https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"), await I("https://cdn.jsdelivr.net/npm/jspdf@3.0.0/dist/jspdf.umd.min.js");
|
|
295
|
-
const { Devices: r, Canvas:
|
|
308
|
+
const { Devices: r, Canvas: c } = a, { sizeW: i, sizeH: l, sizeUnit: g } = r.getSelected().attributes, f = c.getFrameEl().contentDocument, n = "px", d = [_(i, g), _(l, g)], u = new window.jspdf.jsPDF({ unit: n, format: d }), m = f.body;
|
|
296
309
|
u.html(m, { callback: (w) => w.save() });
|
|
297
310
|
}), () => {
|
|
298
|
-
delete e.Commands.commands[
|
|
311
|
+
delete e.Commands.commands[M.print];
|
|
299
312
|
};
|
|
300
313
|
}
|
|
301
314
|
function be(e, s) {
|
|
302
|
-
const { blockPageBreak: t = {} } = s, { Components: o, Blocks:
|
|
315
|
+
const { blockPageBreak: t = {} } = s, { Components: o, Blocks: a } = e, r = "Page Break", c = `${ge}${A}`;
|
|
303
316
|
return o.addType(A, {
|
|
304
317
|
block: t && {
|
|
305
318
|
label: r,
|
|
@@ -308,30 +321,30 @@ function be(e, s) {
|
|
|
308
321
|
select: !0,
|
|
309
322
|
...t
|
|
310
323
|
},
|
|
311
|
-
isComponent:
|
|
324
|
+
isComponent: pe(A),
|
|
312
325
|
model: {
|
|
313
326
|
defaults: {
|
|
314
327
|
name: r,
|
|
315
|
-
classes:
|
|
328
|
+
classes: c,
|
|
316
329
|
attributes: { [V]: A },
|
|
317
330
|
emptyState: !0,
|
|
318
331
|
stylable: !1,
|
|
319
332
|
droppable: !1,
|
|
320
|
-
draggable:
|
|
321
|
-
styles: `.${
|
|
333
|
+
draggable: de("wrapper"),
|
|
334
|
+
styles: `.${c} { break-before: page; }`,
|
|
322
335
|
traits: []
|
|
323
336
|
}
|
|
324
337
|
}
|
|
325
338
|
}), () => {
|
|
326
|
-
o.removeType(A),
|
|
339
|
+
o.removeType(A), a.remove(A);
|
|
327
340
|
};
|
|
328
341
|
}
|
|
329
|
-
const me = "presetPrintable", ye =
|
|
330
|
-
var
|
|
342
|
+
const me = "presetPrintable", ye = k.free, we = function(e, s = {}) {
|
|
343
|
+
var U;
|
|
331
344
|
const t = {
|
|
332
345
|
selectedDevice: y.A4,
|
|
333
346
|
...s
|
|
334
|
-
}, { Canvas: o, Devices:
|
|
347
|
+
}, { Canvas: o, Devices: a, Blocks: r } = e, c = o.events, i = e.events, l = t.selectedDevice || a.getConfig().default, g = [
|
|
335
348
|
{ id: y.A5, name: "A5", width: 148, height: 210, unit: "mm" },
|
|
336
349
|
{ id: y.A5Portrait, name: "A5 Portrait", width: 210, height: 148, unit: "mm" },
|
|
337
350
|
{ id: y.A4, name: "A4", width: 210, height: 297, unit: "mm" },
|
|
@@ -341,12 +354,12 @@ const me = "presetPrintable", ye = $.free, we = function(e, s = {}) {
|
|
|
341
354
|
{ id: y.letter, name: "Letter", width: 8.5, height: 11, unit: "in" },
|
|
342
355
|
{ id: y.legal, name: "Legal", width: 8.5, height: 14, unit: "in" },
|
|
343
356
|
{ id: y.ledger, name: "Ledger", width: 11, height: 17, unit: "in" }
|
|
344
|
-
],
|
|
345
|
-
|
|
346
|
-
const
|
|
347
|
-
|
|
357
|
+
], n = (((U = t.devices) == null ? void 0 : U.call(t, { items: g })) || g).map((v) => ue(v, t));
|
|
358
|
+
a.devices.reset(n);
|
|
359
|
+
const d = l && a.get(l) || a.getAll().at(0);
|
|
360
|
+
a.select(d), ["map", "video"].forEach((v) => r.remove(v));
|
|
348
361
|
const m = (v = {}) => {
|
|
349
|
-
const b = "page-rule", { rules: P } = e.Css, { width: T, height: B, minHeight: R } =
|
|
362
|
+
const b = "page-rule", { rules: P } = e.Css, { width: T, height: B, minHeight: R } = a.getSelected().attributes, Y = B && B !== "auto" ? B : R, G = P.where({ id: b }).pop(), J = G || P.add(
|
|
350
363
|
{
|
|
351
364
|
id: b,
|
|
352
365
|
selectors: [],
|
|
@@ -354,12 +367,12 @@ const me = "presetPrintable", ye = $.free, we = function(e, s = {}) {
|
|
|
354
367
|
},
|
|
355
368
|
{ at: 0 }
|
|
356
369
|
);
|
|
357
|
-
(v.fromDeviceChange || !
|
|
370
|
+
(v.fromDeviceChange || !G) && J.addStyle({
|
|
358
371
|
size: `${T} ${Y}`,
|
|
359
|
-
...!
|
|
372
|
+
...!G && { margin: "0" }
|
|
360
373
|
});
|
|
361
374
|
}, w = (v, b = {}) => {
|
|
362
|
-
const P = v.document, { minHeight: T } =
|
|
375
|
+
const P = v.document, { minHeight: T } = a.getSelected().attributes, R = `
|
|
363
376
|
${!!parseFloat(`${T}`) ? `
|
|
364
377
|
[data-gjs-type="wrapper"] { min-height: ${T}; }
|
|
365
378
|
` : `
|
|
@@ -373,9 +386,9 @@ const me = "presetPrintable", ye = $.free, we = function(e, s = {}) {
|
|
|
373
386
|
}
|
|
374
387
|
`}
|
|
375
388
|
`;
|
|
376
|
-
|
|
389
|
+
K(`${q}preset-printable`, R, { doc: P, target: P.head }), m(b);
|
|
377
390
|
};
|
|
378
|
-
e.on(
|
|
391
|
+
e.on(c.frameLoadBody, (v) => {
|
|
379
392
|
const b = v.window;
|
|
380
393
|
if (w(b), t.fixedHeight) {
|
|
381
394
|
const T = v.model.getComponent().getEl();
|
|
@@ -384,12 +397,12 @@ const me = "presetPrintable", ye = $.free, we = function(e, s = {}) {
|
|
|
384
397
|
R.scrollTop > 0 && R.scrollTo(0, 0);
|
|
385
398
|
});
|
|
386
399
|
}
|
|
387
|
-
}), e.on(
|
|
400
|
+
}), e.on(a.events.select, () => {
|
|
388
401
|
var b;
|
|
389
402
|
const v = (b = o.getFrameEl().contentDocument) == null ? void 0 : b.defaultView;
|
|
390
403
|
v && w(v, { fromDeviceChange: !0 });
|
|
391
404
|
});
|
|
392
|
-
const
|
|
405
|
+
const p = () => {
|
|
393
406
|
const b = e.Css.getRules().filter((P) => P.selectorsToString() === "body").pop();
|
|
394
407
|
b == null || b.addStyle({
|
|
395
408
|
"margin-top": "",
|
|
@@ -398,23 +411,23 @@ const me = "presetPrintable", ye = $.free, we = function(e, s = {}) {
|
|
|
398
411
|
"margin-left": "",
|
|
399
412
|
margin: "0"
|
|
400
413
|
});
|
|
401
|
-
}, h = [[
|
|
414
|
+
}, h = [[i.projectLoad, p]];
|
|
402
415
|
h.forEach(([v, b]) => e.on(v, b));
|
|
403
|
-
const
|
|
416
|
+
const L = fe(e, t), $ = ve(e), x = be(e, t);
|
|
404
417
|
e.onReady(() => {
|
|
405
418
|
e.UndoManager.clear();
|
|
406
419
|
});
|
|
407
420
|
const E = () => {
|
|
408
|
-
h.forEach(([v, b]) => e.off(v, b)),
|
|
421
|
+
h.forEach(([v, b]) => e.off(v, b)), L(), $(), x();
|
|
409
422
|
};
|
|
410
|
-
e.on(
|
|
423
|
+
e.on(i.destroy, E), ie({
|
|
411
424
|
editor: e,
|
|
412
425
|
licenseKey: t.licenseKey,
|
|
413
426
|
plan: ye,
|
|
414
427
|
pluginName: me,
|
|
415
428
|
cleanup: E
|
|
416
429
|
});
|
|
417
|
-
}, Pe =
|
|
430
|
+
}, Pe = re(we);
|
|
418
431
|
export {
|
|
419
432
|
Pe as default
|
|
420
433
|
};
|