@useinsider/guido 3.27.0-beta.8ac96e3 → 3.27.0-beta.9585b71
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.
|
@@ -2,45 +2,52 @@ import { EditorStatePropertyType as M, PreviewDeviceMode as I, ModificationDescr
|
|
|
2
2
|
import { createImageMarginsControl as C, createImageSizeControl as O } from "../../../controlFactories.js";
|
|
3
3
|
import { RecommendationBlockId as c } from "../../constants/blockIds.js";
|
|
4
4
|
import { RecommendationControlId as f } from "../../constants/controlIds.js";
|
|
5
|
-
import { BLOCK_ROOT_SELECTOR as l, MOBILE_CONTAINER_SELECTOR as
|
|
6
|
-
import { hasGetStyle as a, hasGetAttribute as
|
|
7
|
-
const
|
|
5
|
+
import { BLOCK_ROOT_SELECTOR as l, MOBILE_CONTAINER_SELECTOR as R } from "../../constants/selectors.js";
|
|
6
|
+
import { hasGetStyle as a, hasGetAttribute as T } from "../../utils/tagName.js";
|
|
7
|
+
const _ = { width: "", height: "auto", "max-height": "" }, E = `${l} img.adapt-img`, b = `*${l.slice(1)}`, p = `@media only screen and (max-width: 600px) { ${E} { max-height: none !important; } }`;
|
|
8
8
|
function x(t) {
|
|
9
9
|
return { width: "auto", height: "auto", "max-height": `${t}px` };
|
|
10
10
|
}
|
|
11
11
|
function A(t) {
|
|
12
|
-
return t.querySelectorAll(
|
|
12
|
+
return t.querySelectorAll(b).some((e) => "getSelector" in e && e.getSelector() === E);
|
|
13
13
|
}
|
|
14
14
|
function B(t, e) {
|
|
15
|
-
return a(t) && Object.entries(e).some(([o,
|
|
15
|
+
return a(t) && Object.entries(e).some(([o, i]) => (t.getStyle(o) ?? "") !== i);
|
|
16
16
|
}
|
|
17
17
|
function S(t) {
|
|
18
18
|
const e = t.getDocumentRootCssNode();
|
|
19
19
|
return e && !A(e) ? e : null;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
21
|
+
function U(t, e) {
|
|
22
|
+
const i = e.querySelectorAll("img").some((r) => a(r) && !!r.getStyle("max-height")) ? S(t) : null;
|
|
23
|
+
if (!i)
|
|
24
24
|
return;
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const n = t.getDocumentModifier();
|
|
26
|
+
n.modifyCss(i).appendRule(p), n.apply(new g("Add the reco image mobile fit rule"));
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const L = `[esd-extension-block-id="${c.IMAGE}"]`, v = /^\d+px$/;
|
|
29
29
|
function y(t) {
|
|
30
|
-
return
|
|
30
|
+
return T(t) && Number(t.getAttribute("height")) || 0;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function w(t) {
|
|
33
33
|
const e = y(t), o = a(t) ? t.getStyle("max-height") ?? "" : "";
|
|
34
|
-
return
|
|
34
|
+
return v.test(o) && e > 0 && o !== `${e}px`;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const o = e.querySelectorAll(
|
|
36
|
+
function Z(t, e) {
|
|
37
|
+
const o = e.querySelectorAll(L).map((n) => n.querySelector("img")).filter(w);
|
|
38
38
|
if (!o.length)
|
|
39
39
|
return;
|
|
40
|
-
const
|
|
41
|
-
o.forEach((
|
|
40
|
+
const i = t.getDocumentModifier();
|
|
41
|
+
o.forEach((n) => i.modifyHtml(n).setStyle("max-height", `${y(n)}px`)), i.apply(new g("Sync the reco image height bound").asHidden());
|
|
42
|
+
}
|
|
43
|
+
function h(t) {
|
|
44
|
+
try {
|
|
45
|
+
return !!t.closest(R);
|
|
46
|
+
} catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
42
49
|
}
|
|
43
|
-
class
|
|
50
|
+
class D extends O(
|
|
44
51
|
f.IMAGE_SIZE,
|
|
45
52
|
c.IMAGE,
|
|
46
53
|
l
|
|
@@ -50,21 +57,17 @@ class w extends O(
|
|
|
50
57
|
const o = super.getTargetNodes(e);
|
|
51
58
|
if (!this.isMobilePreview())
|
|
52
59
|
return o;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return o.filter((i) => !!i.closest(h) === n);
|
|
56
|
-
} catch {
|
|
57
|
-
return [];
|
|
58
|
-
}
|
|
60
|
+
const i = h(e);
|
|
61
|
+
return i === null ? [] : o.filter((n) => h(n) === i);
|
|
59
62
|
}
|
|
60
63
|
getAdditionalModifications(e) {
|
|
61
64
|
if (this.isMobilePreview())
|
|
62
65
|
return;
|
|
63
|
-
const o = this.getFitStyles(),
|
|
64
|
-
if (!
|
|
66
|
+
const o = this.getFitStyles(), i = this.getTargetNodes(e).map((s) => s.querySelector("img")).filter((s) => B(s, o)), n = o["max-height"] ? S(this.api) : null;
|
|
67
|
+
if (!i.length && !n)
|
|
65
68
|
return;
|
|
66
69
|
const r = this.api.getDocumentModifier();
|
|
67
|
-
return
|
|
70
|
+
return n && r.modifyCss(n).appendRule(p), i.forEach((s) => {
|
|
68
71
|
const u = r.modifyHtml(s);
|
|
69
72
|
Object.entries(o).forEach(([d, m]) => {
|
|
70
73
|
m ? u.setStyle(d, m) : u.removeStyle(d);
|
|
@@ -76,19 +79,19 @@ class w extends O(
|
|
|
76
79
|
}
|
|
77
80
|
getFitStyles() {
|
|
78
81
|
const { size: e } = this.api.getValues();
|
|
79
|
-
return (e == null ? void 0 : e.type) === "height" && e.value ? x(e.value) :
|
|
82
|
+
return (e == null ? void 0 : e.type) === "height" && e.value ? x(e.value) : _;
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
|
-
const
|
|
85
|
+
const N = C(
|
|
83
86
|
f.IMAGE_MARGINS,
|
|
84
87
|
c.IMAGE,
|
|
85
88
|
l
|
|
86
|
-
),
|
|
87
|
-
size:
|
|
88
|
-
margins:
|
|
89
|
+
), j = {
|
|
90
|
+
size: D,
|
|
91
|
+
margins: N
|
|
89
92
|
};
|
|
90
93
|
export {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
j as ImageControls,
|
|
95
|
+
U as ensureMobileFitRule,
|
|
96
|
+
Z as syncHeightBound
|
|
94
97
|
};
|
package/dist/package.json.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const o = "3.27.0-beta.
|
|
1
|
+
const o = "3.27.0-beta.9585b71", s = { stripo: { version: "2.83.1" } }, t = {
|
|
2
2
|
version: o,
|
|
3
3
|
guido: s
|
|
4
4
|
};
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
t as default,
|
|
7
7
|
s as guido,
|
|
8
8
|
o as version
|
|
9
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.27.0-beta.
|
|
3
|
+
"version": "3.27.0-beta.9585b71",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|