@gxpl/sdk 0.0.22 → 0.0.24
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.
|
@@ -16,5 +16,13 @@ function useLayoutDeviation() {
|
|
|
16
16
|
setDeviation(articleWidth / exemplary);
|
|
17
17
|
});
|
|
18
18
|
}, [articleRectObserver, exemplary]);
|
|
19
|
+
(0, react_1.useEffect)(() => {
|
|
20
|
+
if (!articleRectObserver)
|
|
21
|
+
return;
|
|
22
|
+
return articleRectObserver.on('init', () => {
|
|
23
|
+
const articleWidth = articleRectObserver.width;
|
|
24
|
+
setDeviation(articleWidth / exemplary);
|
|
25
|
+
});
|
|
26
|
+
}, [articleRectObserver, exemplary]);
|
|
19
27
|
return { layoutDeviation: deviation };
|
|
20
28
|
}
|
|
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const TransitionMachineContext_1 = require("../../provider/TransitionMachineContext");
|
|
6
6
|
const LinkWrapper = ({ link, children }) => {
|
|
7
7
|
const actorRef = TransitionMachineContext_1.TransitionMachineContext.useActorRef();
|
|
8
|
-
const validUrl = link && 'url' in link ? buildValidUrl(link.url) : '
|
|
8
|
+
const validUrl = link && 'url' in link ? buildValidUrl(link.url) : '';
|
|
9
9
|
const targetParams = link && 'target' in link && link.target === '_blank' ? { target: link.target, rel: 'noreferrer' } : {};
|
|
10
10
|
const handleGoToScene = () => {
|
|
11
11
|
if (!actorRef || !link || !('value' in link))
|
|
@@ -72,7 +72,11 @@ class RichTextConverter {
|
|
|
72
72
|
offset = entity.end;
|
|
73
73
|
}
|
|
74
74
|
if (entity.link) {
|
|
75
|
-
kids.push((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { link: { url: entity.link, target: (_e = entity.target) !== null && _e !== void 0 ? _e : '_self'
|
|
75
|
+
kids.push((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { link: { url: entity.link, target: (_e = entity.target) !== null && _e !== void 0 ? _e : '_self' }, children: entityKids }, entity.start));
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (entity.value) {
|
|
79
|
+
kids.push((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { link: { value: entity.value, animation: (_f = entity.animation) !== null && _f !== void 0 ? _f : 'fade', direction: (_g = entity.direction) !== null && _g !== void 0 ? _g : 'north', duration: 0 }, children: entityKids }, entity.start));
|
|
76
80
|
continue;
|
|
77
81
|
}
|
|
78
82
|
kids.push(...entityKids);
|
|
@@ -147,7 +151,7 @@ class RichTextConverter {
|
|
|
147
151
|
return styleGroups;
|
|
148
152
|
}
|
|
149
153
|
groupEntities(entities, styleGroups) {
|
|
150
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
|
154
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
151
155
|
const entitiesGroups = [];
|
|
152
156
|
if (!entities.length && !styleGroups)
|
|
153
157
|
return;
|
|
@@ -166,8 +170,8 @@ class RichTextConverter {
|
|
|
166
170
|
const start = dividers[i];
|
|
167
171
|
const end = dividers[i + 1];
|
|
168
172
|
const entity = entities.find(e => e.start === start);
|
|
169
|
-
entitiesGroups.push(Object.assign({ stylesGroup: [], start,
|
|
170
|
-
end }, (entity &&
|
|
173
|
+
entitiesGroups.push(Object.assign(Object.assign({ stylesGroup: [], start,
|
|
174
|
+
end }, (entity && (((_a = entity.data) === null || _a === void 0 ? void 0 : _a.type) === 'url' || ((_b = entity.data) === null || _b === void 0 ? void 0 : _b.type) === 'anchor') && { link: entity.data.url, target: (_c = entity.data.target) !== null && _c !== void 0 ? _c : '_self' })), (entity && ((_d = entity.data) === null || _d === void 0 ? void 0 : _d.type) === 'scene' && { value: entity.data.value, animation: (_e = entity.data.animation) !== null && _e !== void 0 ? _e : 'fade', direction: (_f = entity.data.direction) !== null && _f !== void 0 ? _f : 'north', duration: (_g = entity.data.duration) !== null && _g !== void 0 ? _g : 0 })));
|
|
171
175
|
}
|
|
172
176
|
return entitiesGroups;
|
|
173
177
|
}
|
|
@@ -193,8 +197,8 @@ class RichTextConverter {
|
|
|
193
197
|
const start = entityDividers[i];
|
|
194
198
|
const end = entityDividers[i + 1];
|
|
195
199
|
const entity = entities.find(e => e.start === start);
|
|
196
|
-
entitiesGroups.push(Object.assign({ stylesGroup: styleGroups.filter(s => s.start >= start && s.end <= end), start,
|
|
197
|
-
end }, (entity &&
|
|
200
|
+
entitiesGroups.push(Object.assign(Object.assign({ stylesGroup: styleGroups.filter(s => s.start >= start && s.end <= end), start,
|
|
201
|
+
end }, (entity && ((_h = entity.data) === null || _h === void 0 ? void 0 : _h.url) && { link: entity.data.url, target: (_j = entity.data.target) !== null && _j !== void 0 ? _j : '_self' })), (entity && ((_k = entity.data) === null || _k === void 0 ? void 0 : _k.value) && { value: entity.data.value, animation: (_l = entity.data.animation) !== null && _l !== void 0 ? _l : 'fade', direction: (_m = entity.data.direction) !== null && _m !== void 0 ? _m : 'north', duration: (_o = entity.data.duration) !== null && _o !== void 0 ? _o : 0 })));
|
|
198
202
|
}
|
|
199
203
|
return entitiesGroups;
|
|
200
204
|
}
|