@useinsider/guido 3.27.0-beta.9585b71 → 3.27.0-beta.9bfcb9a
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.
|
@@ -1,97 +1,79 @@
|
|
|
1
|
-
import { EditorStatePropertyType as
|
|
2
|
-
import { createImageMarginsControl as
|
|
1
|
+
import { EditorStatePropertyType as E, PreviewDeviceMode as I, ModificationDescription as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { createImageMarginsControl as M, createImageSizeControl as C } from "../../../controlFactories.js";
|
|
3
3
|
import { RecommendationBlockId as c } from "../../constants/blockIds.js";
|
|
4
|
-
import { RecommendationControlId as
|
|
5
|
-
import { BLOCK_ROOT_SELECTOR as l
|
|
6
|
-
import { hasGetStyle as a, hasGetAttribute as
|
|
7
|
-
const
|
|
8
|
-
function
|
|
4
|
+
import { RecommendationControlId as g } from "../../constants/controlIds.js";
|
|
5
|
+
import { BLOCK_ROOT_SELECTOR as l } from "../../constants/selectors.js";
|
|
6
|
+
import { hasGetStyle as a, hasGetAttribute as O } from "../../utils/tagName.js";
|
|
7
|
+
const R = { width: "", height: "auto", "max-height": "" }, f = `${l} img.adapt-img`, x = `*${l.slice(1)}`, p = `@media only screen and (max-width: 600px) { ${f} { max-height: none !important; } }`;
|
|
8
|
+
function _(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(x).some((e) => "getSelector" in e && e.getSelector() === f);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
return a(t) && Object.entries(e).some(([o,
|
|
14
|
+
function T(t, e) {
|
|
15
|
+
return a(t) && Object.entries(e).some(([o, n]) => (t.getStyle(o) ?? "") !== n);
|
|
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 H(t, e) {
|
|
22
|
+
const n = e.querySelectorAll("img").some((r) => a(r) && !!r.getStyle("max-height")) ? S(t) : null;
|
|
23
|
+
if (!n)
|
|
24
24
|
return;
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const i = t.getDocumentModifier();
|
|
26
|
+
i.modifyCss(n).appendRule(p), i.apply(new h("Add the reco image mobile fit rule"));
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const B = `[esd-extension-block-id="${c.IMAGE}"]`, L = /^\d+px$/;
|
|
29
29
|
function y(t) {
|
|
30
|
-
return
|
|
30
|
+
return O(t) && Number(t.getAttribute("height")) || 0;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function b(t) {
|
|
33
33
|
const e = y(t), o = a(t) ? t.getStyle("max-height") ?? "" : "";
|
|
34
|
-
return
|
|
34
|
+
return L.test(o) && e > 0 && o !== `${e}px`;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const o = e.querySelectorAll(
|
|
36
|
+
function U(t, e) {
|
|
37
|
+
const o = e.querySelectorAll(B).map((i) => i.querySelector("img")).filter(b);
|
|
38
38
|
if (!o.length)
|
|
39
39
|
return;
|
|
40
|
-
const
|
|
41
|
-
o.forEach((
|
|
42
|
-
}
|
|
43
|
-
function h(t) {
|
|
44
|
-
try {
|
|
45
|
-
return !!t.closest(R);
|
|
46
|
-
} catch {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
40
|
+
const n = t.getDocumentModifier();
|
|
41
|
+
o.forEach((i) => n.modifyHtml(i).setStyle("max-height", `${y(i)}px`)), n.apply(new h("Sync the reco image height bound").asHidden());
|
|
49
42
|
}
|
|
50
|
-
class D extends
|
|
51
|
-
|
|
43
|
+
class D extends C(
|
|
44
|
+
g.IMAGE_SIZE,
|
|
52
45
|
c.IMAGE,
|
|
53
46
|
l
|
|
54
47
|
) {
|
|
55
|
-
// Stripo derives the mobile size from rendered targets, and the container hidden in mobile preview renders 0px.
|
|
56
|
-
getTargetNodes(e) {
|
|
57
|
-
const o = super.getTargetNodes(e);
|
|
58
|
-
if (!this.isMobilePreview())
|
|
59
|
-
return o;
|
|
60
|
-
const i = h(e);
|
|
61
|
-
return i === null ? [] : o.filter((n) => h(n) === i);
|
|
62
|
-
}
|
|
63
48
|
getAdditionalModifications(e) {
|
|
64
|
-
if (this.
|
|
49
|
+
if (this.api.getEditorState()[E.previewDeviceMode] === I.MOBILE)
|
|
65
50
|
return;
|
|
66
|
-
const o = this.getFitStyles(),
|
|
67
|
-
if (!
|
|
51
|
+
const o = this.getFitStyles(), n = this.getTargetNodes(e).map((s) => s.querySelector("img")).filter((s) => T(s, o)), i = o["max-height"] ? S(this.api) : null;
|
|
52
|
+
if (!n.length && !i)
|
|
68
53
|
return;
|
|
69
54
|
const r = this.api.getDocumentModifier();
|
|
70
|
-
return
|
|
71
|
-
const
|
|
72
|
-
Object.entries(o).forEach(([
|
|
73
|
-
|
|
55
|
+
return i && r.modifyCss(i).appendRule(p), n.forEach((s) => {
|
|
56
|
+
const m = r.modifyHtml(s);
|
|
57
|
+
Object.entries(o).forEach(([u, d]) => {
|
|
58
|
+
d ? m.setStyle(u, d) : m.removeStyle(u);
|
|
74
59
|
});
|
|
75
60
|
}), r;
|
|
76
61
|
}
|
|
77
|
-
isMobilePreview() {
|
|
78
|
-
return this.api.getEditorState()[M.previewDeviceMode] === I.MOBILE;
|
|
79
|
-
}
|
|
80
62
|
getFitStyles() {
|
|
81
63
|
const { size: e } = this.api.getValues();
|
|
82
|
-
return (e == null ? void 0 : e.type) === "height" && e.value ?
|
|
64
|
+
return (e == null ? void 0 : e.type) === "height" && e.value ? _(e.value) : R;
|
|
83
65
|
}
|
|
84
66
|
}
|
|
85
|
-
const
|
|
86
|
-
|
|
67
|
+
const F = M(
|
|
68
|
+
g.IMAGE_MARGINS,
|
|
87
69
|
c.IMAGE,
|
|
88
70
|
l
|
|
89
|
-
),
|
|
71
|
+
), P = {
|
|
90
72
|
size: D,
|
|
91
|
-
margins:
|
|
73
|
+
margins: F
|
|
92
74
|
};
|
|
93
75
|
export {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
76
|
+
P as ImageControls,
|
|
77
|
+
H as ensureMobileFitRule,
|
|
78
|
+
U as syncHeightBound
|
|
97
79
|
};
|
package/dist/package.json.js
CHANGED
|
@@ -25,9 +25,7 @@ declare const SizeControl_base: {
|
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
declare class SizeControl extends SizeControl_base {
|
|
28
|
-
getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
|
|
29
28
|
getAdditionalModifications(root: ImmutableHtmlNode): TemplateModifier<HtmlNodeModifier, CssNodeModifier> | undefined;
|
|
30
|
-
private isMobilePreview;
|
|
31
29
|
private getFitStyles;
|
|
32
30
|
}
|
|
33
31
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const s = "2.
|
|
1
|
+
const s = "2.86.1", n = ["UIEditor.js", "zone.js", "styles-BWH3PMR4.css", "polyfills-FF3RLU5F.js", "main-QEKXZ3YR.js", "chunk-5T7CEBI5.js", "chunk-62K3AMOD.js", "chunk-66LFOY5U.js", "chunk-AMCKJHBC.js", "chunk-BOERNIOQ.js", "chunk-BVZUBVXH.js", "chunk-I2DLD5I4.js", "chunk-IEC5XOV2.js", "chunk-ILRQX7FO.js", "chunk-LBYVYY25.js", "chunk-LC3XAPU2.js", "chunk-OZSNTS6D.js", "chunk-PBUSX63H.js", "chunk-PYISBD2D.js", "assets/css/uiEditor.css", "assets/i18n/en.json", "assets/icons/ui-editor-icons.sprite.svg", "assets/icons/ui-editor-icons.map.json", "assets/imageeditor/scripts.min.js", "assets/imageeditor/assets/icons/merged.svg"], c = {
|
|
2
2
|
version: s,
|
|
3
3
|
files: n
|
|
4
4
|
};
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
c as default,
|
|
7
7
|
n as files,
|
|
8
8
|
s 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.9bfcb9a",
|
|
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",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
},
|
|
137
137
|
"guido": {
|
|
138
138
|
"stripo": {
|
|
139
|
-
"version": "2.
|
|
139
|
+
"version": "2.86.1"
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
}
|