@twreporter/react-article-components 2.1.0-rc.2 → 2.1.1-beta.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.
- package/lib/components/body/embedded-code.js +22 -15
- package/package.json +6 -7
- package/CHANGELOG.md +0 -2017
- package/LICENSE +0 -21
|
@@ -78,7 +78,8 @@ var _ = {
|
|
|
78
78
|
};
|
|
79
79
|
var embedNamespace = {
|
|
80
80
|
infogram: 'infogram',
|
|
81
|
-
twreporter: '__twreporterEmbeddedData'
|
|
81
|
+
twreporter: '__twreporterEmbeddedData',
|
|
82
|
+
storyTellingReporter: '@story-telling-reporter'
|
|
82
83
|
};
|
|
83
84
|
|
|
84
85
|
var Block = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
@@ -207,17 +208,23 @@ var EmbeddedCode = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
207
208
|
_createClass(EmbeddedCode, [{
|
|
208
209
|
key: "componentDidMount",
|
|
209
210
|
value: function componentDidMount() {
|
|
210
|
-
var _this$
|
|
211
|
-
|
|
212
|
-
//
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
211
|
+
var _this$_embeddedCode, _this$_embeddedCode2;
|
|
212
|
+
|
|
213
|
+
// !! WORKAROUND !!
|
|
214
|
+
// After upgrading to react v18,
|
|
215
|
+
// `EmbeddedCode` component becomes abnormal.
|
|
216
|
+
// One case is that `EmbeddedCode` will `executeScript()` twice.
|
|
217
|
+
// Therefore, the embedded code will generate duplicate contents.
|
|
218
|
+
//
|
|
219
|
+
// To avoid `executeScript()` twice,
|
|
220
|
+
// temporarily comment out the following condition.
|
|
221
|
+
//
|
|
222
|
+
// Delay loading infogram in loadEmbed()
|
|
223
|
+
// if (!this._embeddedCodeWithoutScript?.includes(embedNamespace.infogram)) {
|
|
224
|
+
// this.setState({ isLoaded: true }, this.executeScript)
|
|
225
|
+
// }
|
|
226
|
+
// Deliberately set z-index for embeded from @twreporter
|
|
227
|
+
if ((_this$_embeddedCode = this._embeddedCode) !== null && _this$_embeddedCode !== void 0 && _this$_embeddedCode.includes(embedNamespace.twreporter) || (_this$_embeddedCode2 = this._embeddedCode) !== null && _this$_embeddedCode2 !== void 0 && _this$_embeddedCode2.includes(embedNamespace.storyTellingReporter)) {
|
|
221
228
|
this.setState({
|
|
222
229
|
shouldEscalateZIndex: true
|
|
223
230
|
});
|
|
@@ -234,7 +241,7 @@ var EmbeddedCode = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
234
241
|
}, {
|
|
235
242
|
key: "render",
|
|
236
243
|
value: function render() {
|
|
237
|
-
var _this$
|
|
244
|
+
var _this$_embeddedCodeWi;
|
|
238
245
|
|
|
239
246
|
var className = this.props.className;
|
|
240
247
|
var shouldEscalateZIndex = this.state.shouldEscalateZIndex;
|
|
@@ -249,7 +256,7 @@ var EmbeddedCode = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
249
256
|
}
|
|
250
257
|
}), this._caption ? /*#__PURE__*/_react["default"].createElement(Caption, null, this._caption) : null);
|
|
251
258
|
|
|
252
|
-
if ((_this$
|
|
259
|
+
if ((_this$_embeddedCodeWi = this._embeddedCodeWithoutScript) !== null && _this$_embeddedCodeWi !== void 0 && _this$_embeddedCodeWi.includes(embedNamespace.infogram)) {
|
|
253
260
|
return this.state.isLoaded ? embed : null;
|
|
254
261
|
}
|
|
255
262
|
|
|
@@ -309,7 +316,7 @@ var WayPointWrapper = function WayPointWrapper(props) {
|
|
|
309
316
|
onEnter: onEnter,
|
|
310
317
|
onLeave: onLeave,
|
|
311
318
|
fireOnRapidScroll: false,
|
|
312
|
-
topOffset:
|
|
319
|
+
topOffset: "-150%"
|
|
313
320
|
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(EmbeddedCode, _extends({}, props, {
|
|
314
321
|
ref: embedRef
|
|
315
322
|
}))))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twreporter/react-article-components",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1-beta.0",
|
|
4
4
|
"description": "The Reporter react article components, which are used in article page",
|
|
5
5
|
"main": "lib/components/article-page.js",
|
|
6
6
|
"repository": "https://github.com/twreporter/twreporter-npm-packages.git",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"webpack-dev-server": "^3.7.2"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@twreporter/core": "^1.22.0
|
|
28
|
-
"@twreporter/react-components": "^9.0.1
|
|
29
|
-
"@twreporter/redux": "^8.0.1
|
|
30
|
-
"@twreporter/universal-header": "^3.0.1
|
|
27
|
+
"@twreporter/core": "^1.22.0",
|
|
28
|
+
"@twreporter/react-components": "^9.0.1",
|
|
29
|
+
"@twreporter/redux": "^8.0.1",
|
|
30
|
+
"@twreporter/universal-header": "^3.0.1",
|
|
31
31
|
"howler": "^2.2.3",
|
|
32
32
|
"lodash": "^4.17.11",
|
|
33
33
|
"memoize-one": "^5.0.5",
|
|
@@ -40,6 +40,5 @@
|
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
42
|
"lib"
|
|
43
|
-
]
|
|
44
|
-
"gitHead": "9c4e9f08523a0746274ea6ea14e2398bdf8101b6"
|
|
43
|
+
]
|
|
45
44
|
}
|