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