@twreporter/react-article-components 1.6.4-rc.4 → 1.6.4

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/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.6.4](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-article-components@1.6.4-rc.5...@twreporter/react-article-components@1.6.4) (2022-09-14)
7
+
8
+ **Note:** Version bump only for package @twreporter/react-article-components
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.6.4-rc.5](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-article-components@1.6.4-rc.4...@twreporter/react-article-components@1.6.4-rc.5) (2022-09-08)
15
+
16
+ **Note:** Version bump only for package @twreporter/react-article-components
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.6.4-rc.4](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-article-components@1.6.4-rc.3...@twreporter/react-article-components@1.6.4-rc.4) (2022-09-05)
7
23
 
8
24
 
@@ -21,12 +21,14 @@ var _get = _interopRequireDefault(require("lodash/get"));
21
21
 
22
22
  var _merge = _interopRequireDefault(require("lodash/merge"));
23
23
 
24
- var _theme = _interopRequireDefault(require("../../constants/theme"));
25
-
26
24
  var _color = _interopRequireDefault(require("../../constants/color"));
27
25
 
28
26
  var _body = _interopRequireDefault(require("../../constants/prop-types/body"));
29
27
 
28
+ var _theme = _interopRequireDefault(require("../../constants/theme"));
29
+
30
+ var _positionZIndex = _interopRequireDefault(require("../../constants/position-z-index"));
31
+
30
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
33
 
32
34
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -74,11 +76,17 @@ var _ = {
74
76
  get: _get["default"],
75
77
  merge: _merge["default"]
76
78
  };
79
+ var embedNamespace = {
80
+ infogram: 'infogram',
81
+ twreporter: '__twreporterEmbeddedData'
82
+ };
77
83
 
78
84
  var Block = /*#__PURE__*/_styledComponents["default"].div.withConfig({
79
85
  displayName: "embedded-code__Block",
80
86
  componentId: "tkafgt-0"
81
- })(["position:relative;img.img-responsive{margin:0 auto;max-width:100%;height:auto;display:block;}"]);
87
+ })(["position:relative;z-index:", ";img.img-responsive{margin:0 auto;max-width:100%;height:auto;display:block;}"], function (props) {
88
+ return props.shouldEscalateZIndex ? _positionZIndex["default"].embed : 0;
89
+ });
82
90
 
83
91
  exports.Block = Block;
84
92
 
@@ -112,8 +120,6 @@ function dispatchWindowLoadEvent() {
112
120
  window.dispatchEvent(loadEvent);
113
121
  }
114
122
 
115
- var infogramEmbed = 'infogram';
116
-
117
123
  var EmbeddedCode = /*#__PURE__*/function (_React$PureComponent) {
118
124
  _inherits(EmbeddedCode, _React$PureComponent);
119
125
 
@@ -127,7 +133,8 @@ var EmbeddedCode = /*#__PURE__*/function (_React$PureComponent) {
127
133
  _this = _super.call(this, props);
128
134
 
129
135
  _defineProperty(_assertThisInitialized(_this), "state", {
130
- isLoaded: false
136
+ isLoaded: false,
137
+ shouldEscalateZIndex: false
131
138
  });
132
139
 
133
140
  _defineProperty(_assertThisInitialized(_this), "executeScript", function () {
@@ -188,23 +195,32 @@ var EmbeddedCode = /*#__PURE__*/function (_React$PureComponent) {
188
195
 
189
196
  var _$get = _.get(_this.props, ['data', 'content', 0], {}),
190
197
  caption = _$get.caption,
198
+ embeddedCode = _$get.embeddedCode,
191
199
  embeddedCodeWithoutScript = _$get.embeddedCodeWithoutScript;
192
200
 
193
201
  _this._caption = caption;
194
202
  _this._embeddedCodeWithoutScript = embeddedCodeWithoutScript;
203
+ _this._embeddedCode = embeddedCode;
195
204
  return _this;
196
205
  }
197
206
 
198
207
  _createClass(EmbeddedCode, [{
199
208
  key: "componentDidMount",
200
209
  value: function componentDidMount() {
201
- var _this$_embeddedCodeWi;
210
+ var _this$_embeddedCodeWi, _this$_embeddedCode;
202
211
 
203
212
  // Delay loading infogram in loadEmbed()
204
- if (!((_this$_embeddedCodeWi = this._embeddedCodeWithoutScript) !== null && _this$_embeddedCodeWi !== void 0 && _this$_embeddedCodeWi.includes(infogramEmbed))) {
213
+ if (!((_this$_embeddedCodeWi = this._embeddedCodeWithoutScript) !== null && _this$_embeddedCodeWi !== void 0 && _this$_embeddedCodeWi.includes(embedNamespace.infogram))) {
205
214
  this.setState({
206
215
  isLoaded: true
207
216
  }, this.executeScript);
217
+ } // Deliberately set z-index for embeded from @twreporter
218
+
219
+
220
+ if ((_this$_embeddedCode = this._embeddedCode) !== null && _this$_embeddedCode !== void 0 && _this$_embeddedCode.includes(embedNamespace.twreporter)) {
221
+ this.setState({
222
+ shouldEscalateZIndex: true
223
+ });
208
224
  }
209
225
  }
210
226
  }, {
@@ -212,6 +228,7 @@ var EmbeddedCode = /*#__PURE__*/function (_React$PureComponent) {
212
228
  value: function componentWillUnmount() {
213
229
  this._embedded = null;
214
230
  this._caption = null;
231
+ this._embeddedCode = null;
215
232
  this._embeddedCodeWithoutScript = null;
216
233
  }
217
234
  }, {
@@ -220,17 +237,19 @@ var EmbeddedCode = /*#__PURE__*/function (_React$PureComponent) {
220
237
  var _this$_embeddedCodeWi2;
221
238
 
222
239
  var className = this.props.className;
240
+ var shouldEscalateZIndex = this.state.shouldEscalateZIndex;
223
241
 
224
242
  var embed = /*#__PURE__*/_react["default"].createElement("div", {
225
243
  className: className
226
244
  }, /*#__PURE__*/_react["default"].createElement(Block, {
227
245
  ref: this._embedded,
246
+ shouldEscalateZIndex: shouldEscalateZIndex,
228
247
  dangerouslySetInnerHTML: {
229
248
  __html: this._embeddedCodeWithoutScript
230
249
  }
231
250
  }), this._caption ? /*#__PURE__*/_react["default"].createElement(Caption, null, this._caption) : null);
232
251
 
233
- if ((_this$_embeddedCodeWi2 = this._embeddedCodeWithoutScript) !== null && _this$_embeddedCodeWi2 !== void 0 && _this$_embeddedCodeWi2.includes(infogramEmbed)) {
252
+ if ((_this$_embeddedCodeWi2 = this._embeddedCodeWithoutScript) !== null && _this$_embeddedCodeWi2 !== void 0 && _this$_embeddedCodeWi2.includes(embedNamespace.infogram)) {
234
253
  return this.state.isLoaded ? embed : null;
235
254
  }
236
255
 
@@ -9,6 +9,10 @@ var _default = {
9
9
  // z-index is set for covering web-push & header.
10
10
  // Set z-index to 1002 because web-push has z-index 1001,
11
11
  // And header has z-index 1000.
12
- toc: 1002
12
+ toc: 1002,
13
+ // embeded code
14
+ // when z-index is escalated, it is above toolbar
15
+ // but under the header hamburger menu which has z-index 1000
16
+ embed: 999
13
17
  };
14
18
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twreporter/react-article-components",
3
- "version": "1.6.4-rc.4",
3
+ "version": "1.6.4",
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.6.0-rc.0",
28
- "@twreporter/react-components": "^8.13.0-rc.0",
29
- "@twreporter/redux": "^7.3.0-rc.0",
30
- "@twreporter/universal-header": "^2.2.14-rc.2",
27
+ "@twreporter/core": "^1.6.0",
28
+ "@twreporter/react-components": "^8.13.0",
29
+ "@twreporter/redux": "^7.3.0",
30
+ "@twreporter/universal-header": "^2.2.14",
31
31
  "howler": "^2.2.3",
32
32
  "lodash": "^4.17.11",
33
33
  "memoize-one": "^5.0.5",
@@ -40,5 +40,5 @@
40
40
  "files": [
41
41
  "lib"
42
42
  ],
43
- "gitHead": "a94c5e961dbe609191117cd9e67b0b5a6d883e31"
43
+ "gitHead": "26c77ca4dbdfdd65e156c41c5fb96149f820b304"
44
44
  }