@gravity-ui/page-constructor 5.31.0 → 5.31.2-alpha.0
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.
|
@@ -87,7 +87,7 @@ const Media = (props) => {
|
|
|
87
87
|
var _a;
|
|
88
88
|
const { name, description } = videoMicrodata || {};
|
|
89
89
|
const json = JSON.stringify(Object.assign(Object.assign({ '@context': 'http://schema.org/', '@type': 'VideoObject', uploadDate: microdata === null || microdata === void 0 ? void 0 : microdata.contentUpdatedDate, contentUrl: ((_a = video === null || video === void 0 ? void 0 : video.src) === null || _a === void 0 ? void 0 : _a[0]) || videoIframe || youtube, thumbnailUrl: previewImg }, (videoMicrodata || {})), { name: name ? (0, microdata_1.sanitizeMicrodata)(name) : name, description: description ? (0, microdata_1.sanitizeMicrodata)(description) : description }));
|
|
90
|
-
return video || youtube || videoIframe ? (react_1.default.createElement("script", { type: "application/ld+json" }
|
|
90
|
+
return video || youtube || videoIframe ? (react_1.default.createElement("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: json } })) : null;
|
|
91
91
|
}, [microdata === null || microdata === void 0 ? void 0 : microdata.contentUpdatedDate, previewImg, video, videoIframe, videoMicrodata, youtube]);
|
|
92
92
|
return (react_1.default.createElement("div", { className: b(null, className), style: { backgroundColor: color }, "data-qa": qa },
|
|
93
93
|
videoMicrodataScript,
|
|
@@ -53,9 +53,22 @@ const VideoBlock = (props) => {
|
|
|
53
53
|
const fullId = (0, react_1.useMemo)(() => id || (0, uuid_1.v4)(), [id]);
|
|
54
54
|
const buttonId = (0, uikit_1.useUniqId)();
|
|
55
55
|
const [isPlaying, setIsPlaying] = (0, react_1.useState)(!previewImg);
|
|
56
|
-
const iframeSrc =
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
const iframeSrc = (0, react_1.useMemo)(() => {
|
|
57
|
+
if (src && isPlaying) {
|
|
58
|
+
try {
|
|
59
|
+
const url = new URL(src);
|
|
60
|
+
const searchParams = (0, utils_1.getPageSearchParams)(Object.assign(Object.assign({}, (attributes || {})), (previewImg || autoplay ? exports.AUTOPLAY_ATTRIBUTES : NO_AUTOPLAY_ATTRIBUTES)));
|
|
61
|
+
searchParams.forEach((value, key) => {
|
|
62
|
+
url.searchParams.set(key, value);
|
|
63
|
+
});
|
|
64
|
+
return url.href;
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
return src;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}, [attributes, autoplay, isPlaying, previewImg, src]);
|
|
59
72
|
const onPreviewClick = (0, react_1.useCallback)(() => {
|
|
60
73
|
handleAnalytics(analyticsEvents);
|
|
61
74
|
setIsPlaying(true);
|
|
@@ -84,7 +84,7 @@ export const Media = (props) => {
|
|
|
84
84
|
var _a;
|
|
85
85
|
const { name, description } = videoMicrodata || {};
|
|
86
86
|
const json = JSON.stringify(Object.assign(Object.assign({ '@context': 'http://schema.org/', '@type': 'VideoObject', uploadDate: microdata === null || microdata === void 0 ? void 0 : microdata.contentUpdatedDate, contentUrl: ((_a = video === null || video === void 0 ? void 0 : video.src) === null || _a === void 0 ? void 0 : _a[0]) || videoIframe || youtube, thumbnailUrl: previewImg }, (videoMicrodata || {})), { name: name ? sanitizeMicrodata(name) : name, description: description ? sanitizeMicrodata(description) : description }));
|
|
87
|
-
return video || youtube || videoIframe ? (React.createElement("script", { type: "application/ld+json" }
|
|
87
|
+
return video || youtube || videoIframe ? (React.createElement("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: json } })) : null;
|
|
88
88
|
}, [microdata === null || microdata === void 0 ? void 0 : microdata.contentUpdatedDate, previewImg, video, videoIframe, videoMicrodata, youtube]);
|
|
89
89
|
return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color }, "data-qa": qa },
|
|
90
90
|
videoMicrodataScript,
|
|
@@ -49,9 +49,22 @@ const VideoBlock = (props) => {
|
|
|
49
49
|
const fullId = useMemo(() => id || uuidv4(), [id]);
|
|
50
50
|
const buttonId = useUniqId();
|
|
51
51
|
const [isPlaying, setIsPlaying] = useState(!previewImg);
|
|
52
|
-
const iframeSrc =
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
const iframeSrc = useMemo(() => {
|
|
53
|
+
if (src && isPlaying) {
|
|
54
|
+
try {
|
|
55
|
+
const url = new URL(src);
|
|
56
|
+
const searchParams = getPageSearchParams(Object.assign(Object.assign({}, (attributes || {})), (previewImg || autoplay ? AUTOPLAY_ATTRIBUTES : NO_AUTOPLAY_ATTRIBUTES)));
|
|
57
|
+
searchParams.forEach((value, key) => {
|
|
58
|
+
url.searchParams.set(key, value);
|
|
59
|
+
});
|
|
60
|
+
return url.href;
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
return src;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return undefined;
|
|
67
|
+
}, [attributes, autoplay, isPlaying, previewImg, src]);
|
|
55
68
|
const onPreviewClick = useCallback(() => {
|
|
56
69
|
handleAnalytics(analyticsEvents);
|
|
57
70
|
setIsPlaying(true);
|