@fonixtree/magic-design 0.0.112 → 0.0.115

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.
Files changed (31) hide show
  1. package/es/common/Video/index.js +1 -1
  2. package/es/composite-comp/bol/components/Video/components/ShareBtn/index.js +26 -3
  3. package/es/composite-comp/bol/components/Video/components/VideoTag/index.js +7 -3
  4. package/es/composite-comp/bol/components/Video/mobile/Layout1/index.js +8 -2
  5. package/es/composite-comp/bol/components/Video/mobile/Layout2/index.js +8 -4
  6. package/es/composite-comp/bol/components/Video/mobile/Layout3/index.js +8 -2
  7. package/es/composite-comp/bol/components/Video/pc/Layout1/index.js +8 -2
  8. package/es/composite-comp/bol/components/Video/pc/Layout2/index.js +13 -4
  9. package/es/composite-comp/bol/components/Video/pc/Layout3/index.js +13 -4
  10. package/es/composite-comp/bol/components/Video/pc/Layout4/index.js +13 -4
  11. package/es/composite-comp/bol/components/Video/pc/Layout5/index.js +13 -4
  12. package/es/composite-comp/bol/config-panels/VideoConfig/VideoShareConfig/index.js +0 -1
  13. package/es/core/Renderer/index.js +21 -3
  14. package/es/utils/commonUtil.js +76 -3
  15. package/es/utils/coreUtil.js +9 -2
  16. package/lib/common/Video/index.js +1 -1
  17. package/lib/composite-comp/bol/components/Video/components/ShareBtn/index.js +26 -3
  18. package/lib/composite-comp/bol/components/Video/components/VideoTag/index.js +7 -3
  19. package/lib/composite-comp/bol/components/Video/mobile/Layout1/index.js +8 -2
  20. package/lib/composite-comp/bol/components/Video/mobile/Layout2/index.js +8 -4
  21. package/lib/composite-comp/bol/components/Video/mobile/Layout3/index.js +8 -2
  22. package/lib/composite-comp/bol/components/Video/pc/Layout1/index.js +8 -2
  23. package/lib/composite-comp/bol/components/Video/pc/Layout2/index.js +13 -4
  24. package/lib/composite-comp/bol/components/Video/pc/Layout3/index.js +13 -4
  25. package/lib/composite-comp/bol/components/Video/pc/Layout4/index.js +13 -4
  26. package/lib/composite-comp/bol/components/Video/pc/Layout5/index.js +13 -4
  27. package/lib/composite-comp/bol/config-panels/VideoConfig/VideoShareConfig/index.js +0 -1
  28. package/lib/core/Renderer/index.js +21 -3
  29. package/lib/utils/commonUtil.js +76 -3
  30. package/lib/utils/coreUtil.js +9 -2
  31. package/package.json +1 -1
@@ -311,7 +311,7 @@ function (_super) {
311
311
  shadowWrap.onclick = function () {
312
312
  var _a;
313
313
 
314
- (_a = document.querySelector("[video-id=" + videoId + "]")) === null || _a === void 0 ? void 0 : _a.remove();
314
+ (_a = document.querySelector("[video-id=\"" + videoId + "\"]")) === null || _a === void 0 ? void 0 : _a.remove();
315
315
  };
316
316
 
317
317
  var contentWrap = document.createElement('div');
@@ -7,6 +7,8 @@ exports["default"] = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+
10
12
  var _videoShare = _interopRequireDefault(require("./imgs/video-share.png"));
11
13
 
12
14
  var _facebookIcon = _interopRequireDefault(require("./imgs/facebook-icon.png"));
@@ -19,9 +21,9 @@ var _twitterIcon = _interopRequireDefault(require("./imgs/twitter-icon.png"));
19
21
 
20
22
  var _arrowRight = _interopRequireDefault(require("./imgs/arrow-right.png"));
21
23
 
22
- require("./index.less");
24
+ var _commonUtil = require("../../../../../../utils/commonUtil");
23
25
 
24
- var _classnames = _interopRequireDefault(require("classnames"));
26
+ require("./index.less");
25
27
 
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
29
 
@@ -70,7 +72,8 @@ function (_super) {
70
72
 
71
73
  var _a = this.props,
72
74
  pc = _a.pc,
73
- padding = _a.padding;
75
+ padding = _a.padding,
76
+ data = _a.data;
74
77
  var show = this.state.show;
75
78
  return /*#__PURE__*/_react["default"].createElement("div", {
76
79
  className: (0, _classnames["default"])('video-share-btn', {
@@ -96,18 +99,38 @@ function (_super) {
96
99
  }, /*#__PURE__*/_react["default"].createElement("img", {
97
100
  alt: "",
98
101
  className: "share-img",
102
+ onClick: function onClick(e) {
103
+ e.stopPropagation();
104
+ (0, _commonUtil.shareFacebook)(data);
105
+ },
99
106
  src: _facebookIcon["default"]
100
107
  }), /*#__PURE__*/_react["default"].createElement("img", {
101
108
  alt: "",
102
109
  className: "share-img",
110
+ onClick: function onClick(e) {
111
+ e.stopPropagation();
112
+ (0, _commonUtil.shareLinkedin)(data);
113
+ },
103
114
  src: _linkedInIcon["default"]
104
115
  }), /*#__PURE__*/_react["default"].createElement("img", {
105
116
  alt: "",
106
117
  className: "share-img",
118
+ onClick: function onClick(e) {
119
+ e.stopPropagation();
120
+ (0, _commonUtil.shareTwitter)(data);
121
+ },
107
122
  src: _twitterIcon["default"]
108
123
  }), /*#__PURE__*/_react["default"].createElement("img", {
109
124
  alt: "",
110
125
  className: "share-img",
126
+ onClick: function onClick(e) {
127
+ e.stopPropagation();
128
+ (0, _commonUtil.copy2ClipBoard)(data.url);
129
+
130
+ _this.setState({
131
+ show: false
132
+ });
133
+ },
111
134
  src: _linkIcon["default"]
112
135
  }), /*#__PURE__*/_react["default"].createElement("img", {
113
136
  alt: "",
@@ -63,7 +63,8 @@ function (_super) {
63
63
  _b = _a.position,
64
64
  position = _b === void 0 ? 'absolute' : _b,
65
65
  noShare = _a.noShare,
66
- padding = _a.padding;
66
+ padding = _a.padding,
67
+ share = _a.share;
67
68
  return /*#__PURE__*/_react["default"].createElement("div", {
68
69
  className: "video-tag-container",
69
70
  style: {
@@ -103,11 +104,14 @@ function (_super) {
103
104
  className: "text-text"
104
105
  }, /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
105
106
  data: data.text
106
- }), !noShare && /*#__PURE__*/_react["default"].createElement(_index["default"], null)))));
107
+ }), !noShare && /*#__PURE__*/_react["default"].createElement(_index["default"], {
108
+ data: share
109
+ })))));
107
110
  };
108
111
 
109
112
  VideoTag.defaultProps = {
110
- data: {}
113
+ data: {},
114
+ noShare: false
111
115
  };
112
116
  return VideoTag;
113
117
  }(_react["default"].Component);
@@ -131,7 +131,7 @@ function (_super) {
131
131
  }
132
132
  },
133
133
  opts: __assign(__assign({}, group.video), {
134
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
134
+ cover: (0, _coreUtil.getVideoCover)(group),
135
135
  source: group.video.sourceUrl
136
136
  }),
137
137
  videoId: group.id
@@ -141,7 +141,13 @@ function (_super) {
141
141
  alt: "",
142
142
  src: _playCircle["default"]
143
143
  })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
144
- data: group
144
+ data: group,
145
+ noShare: !data.share.open,
146
+ share: __assign({
147
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
148
+ scroll: 'node-' + data.id
149
+ })
150
+ }, data.share)
145
151
  }));
146
152
  }));
147
153
  };
@@ -13,8 +13,6 @@ var _playCircle = _interopRequireDefault(require("../../imgs/play-circle.png"));
13
13
 
14
14
  var _commonUtil = require("../../../../../../utils/commonUtil");
15
15
 
16
- var _coreUtil = require("../../../../../../utils/coreUtil");
17
-
18
16
  require("./index.less");
19
17
 
20
18
  var _VideoTag = _interopRequireDefault(require("../../components/VideoTag"));
@@ -166,7 +164,7 @@ function (_super) {
166
164
  }
167
165
  },
168
166
  opts: __assign(__assign({}, group.video), {
169
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
167
+ cover: getVideoCover(group),
170
168
  source: group.video.sourceUrl
171
169
  }),
172
170
  videoId: group.id
@@ -176,7 +174,13 @@ function (_super) {
176
174
  alt: "",
177
175
  src: _playCircle["default"]
178
176
  })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
179
- data: group
177
+ data: group,
178
+ noShare: !data.share.open,
179
+ share: __assign({
180
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
181
+ scroll: 'node-' + data.id
182
+ })
183
+ }, data.share)
180
184
  }));
181
185
  }))), /*#__PURE__*/_react["default"].createElement(_common.SwiperBan, {
182
186
  data: data.groupSource,
@@ -133,7 +133,7 @@ function (_super) {
133
133
  }
134
134
  },
135
135
  opts: __assign(__assign({}, group.video), {
136
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
136
+ cover: (0, _coreUtil.getVideoCover)(group),
137
137
  source: group.video.sourceUrl
138
138
  }),
139
139
  videoId: group.id
@@ -144,7 +144,13 @@ function (_super) {
144
144
  src: _playCircle["default"]
145
145
  }))), /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
146
146
  data: group,
147
- position: "relative"
147
+ noShare: !data.share.open,
148
+ position: "relative",
149
+ share: __assign({
150
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
151
+ scroll: 'node-' + data.id
152
+ })
153
+ }, data.share)
148
154
  }));
149
155
  }));
150
156
  };
@@ -86,6 +86,7 @@ function (_super) {
86
86
  var _this = this;
87
87
 
88
88
  var data = this.props.data;
89
+ console.log('data: ', data);
89
90
  var hasPlaying = Object.keys(this.videoRefMap).find(function (key) {
90
91
  return _this.videoRefMap[key].playing;
91
92
  });
@@ -134,7 +135,7 @@ function (_super) {
134
135
  }
135
136
  },
136
137
  opts: __assign(__assign({}, group.video), {
137
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
138
+ cover: (0, _coreUtil.getVideoCover)(group),
138
139
  source: group.video.sourceUrl
139
140
  }),
140
141
  videoId: group.id
@@ -148,7 +149,12 @@ function (_super) {
148
149
  noShare: true,
149
150
  padding: 48
150
151
  }));
151
- })), !hasPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
152
+ })), data.share.open && !hasPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
153
+ data: __assign({
154
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
155
+ scroll: 'node-' + data.id
156
+ })
157
+ }, data.share),
152
158
  pc: true
153
159
  }));
154
160
  };
@@ -160,9 +160,13 @@ function (_super) {
160
160
 
161
161
  _this.videoRefMap[group.id].el.player.pause();
162
162
  } else {
163
- _this.videoRefMap[group.id].playing = true;
163
+ if (group.video.playPosition == 'Popup') {
164
+ _this.videoRefMap[group.id].el.fullPlay('pc');
165
+ } else {
166
+ _this.videoRefMap[group.id].playing = true;
164
167
 
165
- _this.videoRefMap[group.id].el.player.play();
168
+ _this.videoRefMap[group.id].el.player.play();
169
+ }
166
170
  }
167
171
 
168
172
  _this.setState({});
@@ -180,7 +184,7 @@ function (_super) {
180
184
  }
181
185
  },
182
186
  opts: __assign(__assign({}, group.video), {
183
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
187
+ cover: (0, _coreUtil.getVideoCover)(group),
184
188
  source: group.video.sourceUrl
185
189
  }),
186
190
  videoId: group.id
@@ -189,12 +193,17 @@ function (_super) {
189
193
  }, /*#__PURE__*/_react["default"].createElement("img", {
190
194
  alt: "",
191
195
  src: _playCircle["default"]
192
- })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
196
+ })), data.share.open && !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
193
197
  data: group,
194
198
  noShare: true,
195
199
  padding: 32
196
200
  }));
197
201
  })), !hasPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
202
+ data: __assign({
203
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
204
+ scroll: 'node-' + data.id
205
+ })
206
+ }, data.share),
198
207
  pc: true
199
208
  }));
200
209
  };
@@ -95,6 +95,11 @@ function (_super) {
95
95
  height: data.pcHeight
96
96
  }
97
97
  }, !hasPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
98
+ data: __assign({
99
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
100
+ scroll: 'node-' + data.id
101
+ })
102
+ }, data.share),
98
103
  pc: true
99
104
  }), data.groupSource.map(function (group) {
100
105
  var _a;
@@ -112,9 +117,13 @@ function (_super) {
112
117
 
113
118
  _this.videoRefMap[group.id].el.player.pause();
114
119
  } else {
115
- _this.videoRefMap[group.id].playing = true;
120
+ if (group.video.playPosition == 'Popup') {
121
+ _this.videoRefMap[group.id].el.fullPlay('pc');
122
+ } else {
123
+ _this.videoRefMap[group.id].playing = true;
116
124
 
117
- _this.videoRefMap[group.id].el.player.play();
125
+ _this.videoRefMap[group.id].el.player.play();
126
+ }
118
127
  }
119
128
 
120
129
  _this.setState({});
@@ -132,7 +141,7 @@ function (_super) {
132
141
  }
133
142
  },
134
143
  opts: __assign(__assign({}, group.video), {
135
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
144
+ cover: (0, _coreUtil.getVideoCover)(group),
136
145
  source: group.video.sourceUrl
137
146
  }),
138
147
  videoId: group.id
@@ -141,7 +150,7 @@ function (_super) {
141
150
  }, /*#__PURE__*/_react["default"].createElement("img", {
142
151
  alt: "",
143
152
  src: _playCircle["default"]
144
- })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
153
+ })), data.share.open && !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
145
154
  data: group,
146
155
  noShare: true,
147
156
  padding: 20
@@ -106,9 +106,13 @@ function (_super) {
106
106
 
107
107
  _this.videoRefMap[group.id].el.player.pause();
108
108
  } else {
109
- _this.videoRefMap[group.id].playing = true;
109
+ if (group.video.playPosition == 'Popup') {
110
+ _this.videoRefMap[group.id].el.fullPlay('pc');
111
+ } else {
112
+ _this.videoRefMap[group.id].playing = true;
110
113
 
111
- _this.videoRefMap[group.id].el.player.play();
114
+ _this.videoRefMap[group.id].el.player.play();
115
+ }
112
116
  }
113
117
 
114
118
  _this.setState({});
@@ -129,7 +133,7 @@ function (_super) {
129
133
  }
130
134
  },
131
135
  opts: __assign(__assign({}, group.video), {
132
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
136
+ cover: (0, _coreUtil.getVideoCover)(group),
133
137
  source: group.video.sourceUrl
134
138
  }),
135
139
  videoId: group.id
@@ -138,7 +142,12 @@ function (_super) {
138
142
  }, /*#__PURE__*/_react["default"].createElement("img", {
139
143
  alt: "",
140
144
  src: _playCircle["default"]
141
- })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
145
+ })), data.share.open && !isPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
146
+ data: __assign({
147
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
148
+ scroll: 'node-' + data.id
149
+ })
150
+ }, data.share),
142
151
  padding: 20,
143
152
  pc: true
144
153
  })), /*#__PURE__*/_react["default"].createElement("div", {
@@ -106,9 +106,13 @@ function (_super) {
106
106
 
107
107
  _this.videoRefMap[group.id].el.player.pause();
108
108
  } else {
109
- _this.videoRefMap[group.id].playing = true;
109
+ if (group.video.playPosition == 'Popup') {
110
+ _this.videoRefMap[group.id].el.fullPlay('pc');
111
+ } else {
112
+ _this.videoRefMap[group.id].playing = true;
110
113
 
111
- _this.videoRefMap[group.id].el.player.play();
114
+ _this.videoRefMap[group.id].el.player.play();
115
+ }
112
116
  }
113
117
 
114
118
  _this.setState({});
@@ -129,7 +133,7 @@ function (_super) {
129
133
  }
130
134
  },
131
135
  opts: __assign(__assign({}, group.video), {
132
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
136
+ cover: (0, _coreUtil.getVideoCover)(group),
133
137
  source: group.video.sourceUrl
134
138
  }),
135
139
  videoId: group.id
@@ -138,7 +142,12 @@ function (_super) {
138
142
  }, /*#__PURE__*/_react["default"].createElement("img", {
139
143
  alt: "",
140
144
  src: _playCircle["default"]
141
- })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
145
+ })), data.share.open && !isPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
146
+ data: __assign({
147
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
148
+ scroll: 'node-' + data.id
149
+ })
150
+ }, data.share),
142
151
  padding: 20,
143
152
  pc: true
144
153
  })), /*#__PURE__*/_react["default"].createElement("div", {
@@ -66,7 +66,6 @@ function (_super) {
66
66
  var _this = this;
67
67
 
68
68
  var data = this.props.data;
69
- console.log('data: ', data);
70
69
 
71
70
  var ShareSetting = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_common.Field, {
72
71
  title: (0, _locale.i18n)('SOCIAL_IMAGE')
@@ -1,17 +1,23 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports["default"] = void 0;
7
9
 
8
- var _react = _interopRequireDefault(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _commonUtil = require("../../utils/commonUtil");
9
13
 
10
14
  var _componentTypes = require("../../constants/component-types");
11
15
 
12
16
  var _coreUtil = require("../../utils/coreUtil");
13
17
 
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
18
+ 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); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
21
 
16
22
  var __assign = void 0 && (void 0).__assign || function () {
17
23
  __assign = Object.assign || function (t) {
@@ -31,6 +37,7 @@ var __assign = void 0 && (void 0).__assign || function () {
31
37
  /* eslint-disable consistent-return */
32
38
 
33
39
 
40
+ // import { deviceTypeMap } from '../../constants';
34
41
  var setDesignConfig = function setDesignConfig(props) {
35
42
  var config = props.config,
36
43
  device = props.device,
@@ -67,6 +74,16 @@ var Renderer = function Renderer(props) {
67
74
  return source;
68
75
  };
69
76
 
77
+ (0, _react.useEffect)(function () {
78
+ setTimeout(function () {
79
+ var _a;
80
+
81
+ var scrollId = (0, _commonUtil.getUrlParams)('scroll');
82
+ (_a = document.querySelector("#" + scrollId)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
83
+ behavior: 'smooth'
84
+ });
85
+ }, 300);
86
+ });
70
87
  return /*#__PURE__*/_react["default"].createElement("div", {
71
88
  className: "render_wrap",
72
89
  magic_design: "",
@@ -86,7 +103,8 @@ var Renderer = function Renderer(props) {
86
103
  });
87
104
 
88
105
  return /*#__PURE__*/_react["default"].createElement("div", {
89
- key: nodeData.id
106
+ key: nodeData.id,
107
+ id: 'node-' + nodeData.id
90
108
  }, /*#__PURE__*/_react["default"].createElement(Clazz, __assign({}, newInstanceProps), null));
91
109
  }));
92
110
  };
@@ -3,14 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.addZero = void 0;
6
+ exports.addZero = exports.addUrlQuery = void 0;
7
7
  exports.asyncDataURLtoImage = asyncDataURLtoImage;
8
8
  exports.checkFileName = exports.calcLastTime = void 0;
9
9
  exports.commonFetch = commonFetch;
10
10
  exports.convertImageUrl = convertImageUrl;
11
+ exports.copy2ClipBoard = copy2ClipBoard;
11
12
  exports.dragSource = void 0;
12
13
  exports.ensure = ensure;
13
- exports.styleStringify = exports.navigateTo = exports.importAsync = exports.getUrlParams = exports.getColorRgba = void 0;
14
+ exports.navigateTo = exports.importAsync = exports.getUrlParams = exports.getColorRgba = void 0;
15
+ exports.shareFacebook = shareFacebook;
16
+ exports.shareLinkedin = shareLinkedin;
17
+ exports.shareTwitter = shareTwitter;
18
+ exports.styleStringify = void 0;
14
19
 
15
20
  var _axios = _interopRequireDefault(require("axios"));
16
21
 
@@ -115,6 +120,16 @@ var navigateTo = function navigateTo(url) {
115
120
 
116
121
  exports.navigateTo = navigateTo;
117
122
 
123
+ var addUrlQuery = function addUrlQuery(url, queryObj) {
124
+ if (/\?/.test(url)) {
125
+ return url + '&' + _qs["default"].stringify(queryObj);
126
+ } else {
127
+ return url + '?' + _qs["default"].stringify(queryObj);
128
+ }
129
+ };
130
+
131
+ exports.addUrlQuery = addUrlQuery;
132
+
118
133
  var dragSource = function dragSource(source, from, to) {
119
134
  var out = source.splice(from, 1);
120
135
 
@@ -318,4 +333,62 @@ var importAsync = function importAsync(fileUrl) {
318
333
  });
319
334
  };
320
335
 
321
- exports.importAsync = importAsync;
336
+ exports.importAsync = importAsync;
337
+
338
+ function shareFacebook(_a) {
339
+ var url = _a.url,
340
+ image = _a.image,
341
+ title = _a.title,
342
+ description = _a.description;
343
+ window.open('http://www.facebook.com/sharer.php' + _qs["default"].stringify({
344
+ u: url,
345
+ t: title
346
+ }, {
347
+ addQueryPrefix: true
348
+ }));
349
+ }
350
+
351
+ function shareTwitter(_a) {
352
+ var url = _a.url,
353
+ image = _a.image,
354
+ title = _a.title,
355
+ description = _a.description;
356
+ window.open('http://twitter.com/share' + _qs["default"].stringify({
357
+ url: url,
358
+ text: title
359
+ }, {
360
+ addQueryPrefix: true
361
+ }));
362
+ } // export function sharewhatsApp({ url, image, title, description }) {
363
+ // window.open(`https://api.whatsapp.com/send?text=${encodeURIComponent(url)}`, '_self');
364
+ // }
365
+
366
+
367
+ function shareLinkedin(_a) {
368
+ var url = _a.url,
369
+ image = _a.image,
370
+ title = _a.title,
371
+ description = _a.description;
372
+ window.open('http://www.linkedin.com/shareArticle' + _qs["default"].stringify({
373
+ mini: true,
374
+ url: url,
375
+ title: title
376
+ }, {
377
+ addQueryPrefix: true
378
+ }));
379
+ }
380
+ /**
381
+ * 复制到剪切板
382
+ * @param {*} text 复制内容
383
+ */
384
+
385
+
386
+ function copy2ClipBoard(text) {
387
+ var tag = document.createElement('input');
388
+ tag.setAttribute('id', 'cp_hgz_input');
389
+ tag.value = text;
390
+ document.getElementsByTagName('body')[0].appendChild(tag);
391
+ document.getElementById('cp_hgz_input').select();
392
+ document.execCommand('copy');
393
+ document.getElementById('cp_hgz_input').remove();
394
+ }
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setMagicDesign = exports.renderPreview = exports.isPc = exports.isDesignMode = exports.isActiveFloor = exports.copyNode = exports.clickUrl = void 0;
6
+ exports.setMagicDesign = exports.renderPreview = exports.isPc = exports.isDesignMode = exports.isActiveFloor = exports.getVideoCover = exports.copyNode = exports.clickUrl = void 0;
7
7
 
8
8
  var _uuid = require("uuid");
9
9
 
@@ -206,10 +206,17 @@ exports.isPc = isPc;
206
206
  var setMagicDesign = function setMagicDesign(magicDesignObj) {
207
207
  window.magicDesign = __assign(__assign({}, window.magicDesign), magicDesignObj);
208
208
  };
209
+
210
+ exports.setMagicDesign = setMagicDesign;
211
+
212
+ var getVideoCover = function getVideoCover(group) {
213
+ if (group.overilay.open) return isPc() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc;
214
+ return '';
215
+ };
209
216
  /** 刷新预览区域 */
210
217
 
211
218
 
212
- exports.setMagicDesign = setMagicDesign;
219
+ exports.getVideoCover = getVideoCover;
213
220
 
214
221
  var renderPreview = function renderPreview(changeHistory) {
215
222
  if (changeHistory === void 0) {
@@ -311,7 +311,7 @@ function (_super) {
311
311
  shadowWrap.onclick = function () {
312
312
  var _a;
313
313
 
314
- (_a = document.querySelector("[video-id=" + videoId + "]")) === null || _a === void 0 ? void 0 : _a.remove();
314
+ (_a = document.querySelector("[video-id=\"" + videoId + "\"]")) === null || _a === void 0 ? void 0 : _a.remove();
315
315
  };
316
316
 
317
317
  var contentWrap = document.createElement('div');
@@ -7,6 +7,8 @@ exports["default"] = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+
10
12
  var _videoShare = _interopRequireDefault(require("./imgs/video-share.png"));
11
13
 
12
14
  var _facebookIcon = _interopRequireDefault(require("./imgs/facebook-icon.png"));
@@ -19,9 +21,9 @@ var _twitterIcon = _interopRequireDefault(require("./imgs/twitter-icon.png"));
19
21
 
20
22
  var _arrowRight = _interopRequireDefault(require("./imgs/arrow-right.png"));
21
23
 
22
- require("./index.less");
24
+ var _commonUtil = require("../../../../../../utils/commonUtil");
23
25
 
24
- var _classnames = _interopRequireDefault(require("classnames"));
26
+ require("./index.less");
25
27
 
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
29
 
@@ -70,7 +72,8 @@ function (_super) {
70
72
 
71
73
  var _a = this.props,
72
74
  pc = _a.pc,
73
- padding = _a.padding;
75
+ padding = _a.padding,
76
+ data = _a.data;
74
77
  var show = this.state.show;
75
78
  return /*#__PURE__*/_react["default"].createElement("div", {
76
79
  className: (0, _classnames["default"])('video-share-btn', {
@@ -96,18 +99,38 @@ function (_super) {
96
99
  }, /*#__PURE__*/_react["default"].createElement("img", {
97
100
  alt: "",
98
101
  className: "share-img",
102
+ onClick: function onClick(e) {
103
+ e.stopPropagation();
104
+ (0, _commonUtil.shareFacebook)(data);
105
+ },
99
106
  src: _facebookIcon["default"]
100
107
  }), /*#__PURE__*/_react["default"].createElement("img", {
101
108
  alt: "",
102
109
  className: "share-img",
110
+ onClick: function onClick(e) {
111
+ e.stopPropagation();
112
+ (0, _commonUtil.shareLinkedin)(data);
113
+ },
103
114
  src: _linkedInIcon["default"]
104
115
  }), /*#__PURE__*/_react["default"].createElement("img", {
105
116
  alt: "",
106
117
  className: "share-img",
118
+ onClick: function onClick(e) {
119
+ e.stopPropagation();
120
+ (0, _commonUtil.shareTwitter)(data);
121
+ },
107
122
  src: _twitterIcon["default"]
108
123
  }), /*#__PURE__*/_react["default"].createElement("img", {
109
124
  alt: "",
110
125
  className: "share-img",
126
+ onClick: function onClick(e) {
127
+ e.stopPropagation();
128
+ (0, _commonUtil.copy2ClipBoard)(data.url);
129
+
130
+ _this.setState({
131
+ show: false
132
+ });
133
+ },
111
134
  src: _linkIcon["default"]
112
135
  }), /*#__PURE__*/_react["default"].createElement("img", {
113
136
  alt: "",
@@ -63,7 +63,8 @@ function (_super) {
63
63
  _b = _a.position,
64
64
  position = _b === void 0 ? 'absolute' : _b,
65
65
  noShare = _a.noShare,
66
- padding = _a.padding;
66
+ padding = _a.padding,
67
+ share = _a.share;
67
68
  return /*#__PURE__*/_react["default"].createElement("div", {
68
69
  className: "video-tag-container",
69
70
  style: {
@@ -103,11 +104,14 @@ function (_super) {
103
104
  className: "text-text"
104
105
  }, /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
105
106
  data: data.text
106
- }), !noShare && /*#__PURE__*/_react["default"].createElement(_index["default"], null)))));
107
+ }), !noShare && /*#__PURE__*/_react["default"].createElement(_index["default"], {
108
+ data: share
109
+ })))));
107
110
  };
108
111
 
109
112
  VideoTag.defaultProps = {
110
- data: {}
113
+ data: {},
114
+ noShare: false
111
115
  };
112
116
  return VideoTag;
113
117
  }(_react["default"].Component);
@@ -131,7 +131,7 @@ function (_super) {
131
131
  }
132
132
  },
133
133
  opts: __assign(__assign({}, group.video), {
134
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
134
+ cover: (0, _coreUtil.getVideoCover)(group),
135
135
  source: group.video.sourceUrl
136
136
  }),
137
137
  videoId: group.id
@@ -141,7 +141,13 @@ function (_super) {
141
141
  alt: "",
142
142
  src: _playCircle["default"]
143
143
  })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
144
- data: group
144
+ data: group,
145
+ noShare: !data.share.open,
146
+ share: __assign({
147
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
148
+ scroll: 'node-' + data.id
149
+ })
150
+ }, data.share)
145
151
  }));
146
152
  }));
147
153
  };
@@ -13,8 +13,6 @@ var _playCircle = _interopRequireDefault(require("../../imgs/play-circle.png"));
13
13
 
14
14
  var _commonUtil = require("../../../../../../utils/commonUtil");
15
15
 
16
- var _coreUtil = require("../../../../../../utils/coreUtil");
17
-
18
16
  require("./index.less");
19
17
 
20
18
  var _VideoTag = _interopRequireDefault(require("../../components/VideoTag"));
@@ -166,7 +164,7 @@ function (_super) {
166
164
  }
167
165
  },
168
166
  opts: __assign(__assign({}, group.video), {
169
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
167
+ cover: getVideoCover(group),
170
168
  source: group.video.sourceUrl
171
169
  }),
172
170
  videoId: group.id
@@ -176,7 +174,13 @@ function (_super) {
176
174
  alt: "",
177
175
  src: _playCircle["default"]
178
176
  })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
179
- data: group
177
+ data: group,
178
+ noShare: !data.share.open,
179
+ share: __assign({
180
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
181
+ scroll: 'node-' + data.id
182
+ })
183
+ }, data.share)
180
184
  }));
181
185
  }))), /*#__PURE__*/_react["default"].createElement(_common.SwiperBan, {
182
186
  data: data.groupSource,
@@ -133,7 +133,7 @@ function (_super) {
133
133
  }
134
134
  },
135
135
  opts: __assign(__assign({}, group.video), {
136
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
136
+ cover: (0, _coreUtil.getVideoCover)(group),
137
137
  source: group.video.sourceUrl
138
138
  }),
139
139
  videoId: group.id
@@ -144,7 +144,13 @@ function (_super) {
144
144
  src: _playCircle["default"]
145
145
  }))), /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
146
146
  data: group,
147
- position: "relative"
147
+ noShare: !data.share.open,
148
+ position: "relative",
149
+ share: __assign({
150
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
151
+ scroll: 'node-' + data.id
152
+ })
153
+ }, data.share)
148
154
  }));
149
155
  }));
150
156
  };
@@ -86,6 +86,7 @@ function (_super) {
86
86
  var _this = this;
87
87
 
88
88
  var data = this.props.data;
89
+ console.log('data: ', data);
89
90
  var hasPlaying = Object.keys(this.videoRefMap).find(function (key) {
90
91
  return _this.videoRefMap[key].playing;
91
92
  });
@@ -134,7 +135,7 @@ function (_super) {
134
135
  }
135
136
  },
136
137
  opts: __assign(__assign({}, group.video), {
137
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
138
+ cover: (0, _coreUtil.getVideoCover)(group),
138
139
  source: group.video.sourceUrl
139
140
  }),
140
141
  videoId: group.id
@@ -148,7 +149,12 @@ function (_super) {
148
149
  noShare: true,
149
150
  padding: 48
150
151
  }));
151
- })), !hasPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
152
+ })), data.share.open && !hasPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
153
+ data: __assign({
154
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
155
+ scroll: 'node-' + data.id
156
+ })
157
+ }, data.share),
152
158
  pc: true
153
159
  }));
154
160
  };
@@ -160,9 +160,13 @@ function (_super) {
160
160
 
161
161
  _this.videoRefMap[group.id].el.player.pause();
162
162
  } else {
163
- _this.videoRefMap[group.id].playing = true;
163
+ if (group.video.playPosition == 'Popup') {
164
+ _this.videoRefMap[group.id].el.fullPlay('pc');
165
+ } else {
166
+ _this.videoRefMap[group.id].playing = true;
164
167
 
165
- _this.videoRefMap[group.id].el.player.play();
168
+ _this.videoRefMap[group.id].el.player.play();
169
+ }
166
170
  }
167
171
 
168
172
  _this.setState({});
@@ -180,7 +184,7 @@ function (_super) {
180
184
  }
181
185
  },
182
186
  opts: __assign(__assign({}, group.video), {
183
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
187
+ cover: (0, _coreUtil.getVideoCover)(group),
184
188
  source: group.video.sourceUrl
185
189
  }),
186
190
  videoId: group.id
@@ -189,12 +193,17 @@ function (_super) {
189
193
  }, /*#__PURE__*/_react["default"].createElement("img", {
190
194
  alt: "",
191
195
  src: _playCircle["default"]
192
- })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
196
+ })), data.share.open && !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
193
197
  data: group,
194
198
  noShare: true,
195
199
  padding: 32
196
200
  }));
197
201
  })), !hasPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
202
+ data: __assign({
203
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
204
+ scroll: 'node-' + data.id
205
+ })
206
+ }, data.share),
198
207
  pc: true
199
208
  }));
200
209
  };
@@ -95,6 +95,11 @@ function (_super) {
95
95
  height: data.pcHeight
96
96
  }
97
97
  }, !hasPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
98
+ data: __assign({
99
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
100
+ scroll: 'node-' + data.id
101
+ })
102
+ }, data.share),
98
103
  pc: true
99
104
  }), data.groupSource.map(function (group) {
100
105
  var _a;
@@ -112,9 +117,13 @@ function (_super) {
112
117
 
113
118
  _this.videoRefMap[group.id].el.player.pause();
114
119
  } else {
115
- _this.videoRefMap[group.id].playing = true;
120
+ if (group.video.playPosition == 'Popup') {
121
+ _this.videoRefMap[group.id].el.fullPlay('pc');
122
+ } else {
123
+ _this.videoRefMap[group.id].playing = true;
116
124
 
117
- _this.videoRefMap[group.id].el.player.play();
125
+ _this.videoRefMap[group.id].el.player.play();
126
+ }
118
127
  }
119
128
 
120
129
  _this.setState({});
@@ -132,7 +141,7 @@ function (_super) {
132
141
  }
133
142
  },
134
143
  opts: __assign(__assign({}, group.video), {
135
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
144
+ cover: (0, _coreUtil.getVideoCover)(group),
136
145
  source: group.video.sourceUrl
137
146
  }),
138
147
  videoId: group.id
@@ -141,7 +150,7 @@ function (_super) {
141
150
  }, /*#__PURE__*/_react["default"].createElement("img", {
142
151
  alt: "",
143
152
  src: _playCircle["default"]
144
- })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
153
+ })), data.share.open && !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
145
154
  data: group,
146
155
  noShare: true,
147
156
  padding: 20
@@ -106,9 +106,13 @@ function (_super) {
106
106
 
107
107
  _this.videoRefMap[group.id].el.player.pause();
108
108
  } else {
109
- _this.videoRefMap[group.id].playing = true;
109
+ if (group.video.playPosition == 'Popup') {
110
+ _this.videoRefMap[group.id].el.fullPlay('pc');
111
+ } else {
112
+ _this.videoRefMap[group.id].playing = true;
110
113
 
111
- _this.videoRefMap[group.id].el.player.play();
114
+ _this.videoRefMap[group.id].el.player.play();
115
+ }
112
116
  }
113
117
 
114
118
  _this.setState({});
@@ -129,7 +133,7 @@ function (_super) {
129
133
  }
130
134
  },
131
135
  opts: __assign(__assign({}, group.video), {
132
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
136
+ cover: (0, _coreUtil.getVideoCover)(group),
133
137
  source: group.video.sourceUrl
134
138
  }),
135
139
  videoId: group.id
@@ -138,7 +142,12 @@ function (_super) {
138
142
  }, /*#__PURE__*/_react["default"].createElement("img", {
139
143
  alt: "",
140
144
  src: _playCircle["default"]
141
- })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
145
+ })), data.share.open && !isPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
146
+ data: __assign({
147
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
148
+ scroll: 'node-' + data.id
149
+ })
150
+ }, data.share),
142
151
  padding: 20,
143
152
  pc: true
144
153
  })), /*#__PURE__*/_react["default"].createElement("div", {
@@ -106,9 +106,13 @@ function (_super) {
106
106
 
107
107
  _this.videoRefMap[group.id].el.player.pause();
108
108
  } else {
109
- _this.videoRefMap[group.id].playing = true;
109
+ if (group.video.playPosition == 'Popup') {
110
+ _this.videoRefMap[group.id].el.fullPlay('pc');
111
+ } else {
112
+ _this.videoRefMap[group.id].playing = true;
110
113
 
111
- _this.videoRefMap[group.id].el.player.play();
114
+ _this.videoRefMap[group.id].el.player.play();
115
+ }
112
116
  }
113
117
 
114
118
  _this.setState({});
@@ -129,7 +133,7 @@ function (_super) {
129
133
  }
130
134
  },
131
135
  opts: __assign(__assign({}, group.video), {
132
- cover: (0, _coreUtil.isPc)() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc,
136
+ cover: (0, _coreUtil.getVideoCover)(group),
133
137
  source: group.video.sourceUrl
134
138
  }),
135
139
  videoId: group.id
@@ -138,7 +142,12 @@ function (_super) {
138
142
  }, /*#__PURE__*/_react["default"].createElement("img", {
139
143
  alt: "",
140
144
  src: _playCircle["default"]
141
- })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
145
+ })), data.share.open && !isPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
146
+ data: __assign({
147
+ url: (0, _commonUtil.addUrlQuery)(window.location.href, {
148
+ scroll: 'node-' + data.id
149
+ })
150
+ }, data.share),
142
151
  padding: 20,
143
152
  pc: true
144
153
  })), /*#__PURE__*/_react["default"].createElement("div", {
@@ -66,7 +66,6 @@ function (_super) {
66
66
  var _this = this;
67
67
 
68
68
  var data = this.props.data;
69
- console.log('data: ', data);
70
69
 
71
70
  var ShareSetting = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_common.Field, {
72
71
  title: (0, _locale.i18n)('SOCIAL_IMAGE')
@@ -1,17 +1,23 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports["default"] = void 0;
7
9
 
8
- var _react = _interopRequireDefault(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _commonUtil = require("../../utils/commonUtil");
9
13
 
10
14
  var _componentTypes = require("../../constants/component-types");
11
15
 
12
16
  var _coreUtil = require("../../utils/coreUtil");
13
17
 
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
18
+ 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); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
21
 
16
22
  var __assign = void 0 && (void 0).__assign || function () {
17
23
  __assign = Object.assign || function (t) {
@@ -31,6 +37,7 @@ var __assign = void 0 && (void 0).__assign || function () {
31
37
  /* eslint-disable consistent-return */
32
38
 
33
39
 
40
+ // import { deviceTypeMap } from '../../constants';
34
41
  var setDesignConfig = function setDesignConfig(props) {
35
42
  var config = props.config,
36
43
  device = props.device,
@@ -67,6 +74,16 @@ var Renderer = function Renderer(props) {
67
74
  return source;
68
75
  };
69
76
 
77
+ (0, _react.useEffect)(function () {
78
+ setTimeout(function () {
79
+ var _a;
80
+
81
+ var scrollId = (0, _commonUtil.getUrlParams)('scroll');
82
+ (_a = document.querySelector("#" + scrollId)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
83
+ behavior: 'smooth'
84
+ });
85
+ }, 300);
86
+ });
70
87
  return /*#__PURE__*/_react["default"].createElement("div", {
71
88
  className: "render_wrap",
72
89
  magic_design: "",
@@ -86,7 +103,8 @@ var Renderer = function Renderer(props) {
86
103
  });
87
104
 
88
105
  return /*#__PURE__*/_react["default"].createElement("div", {
89
- key: nodeData.id
106
+ key: nodeData.id,
107
+ id: 'node-' + nodeData.id
90
108
  }, /*#__PURE__*/_react["default"].createElement(Clazz, __assign({}, newInstanceProps), null));
91
109
  }));
92
110
  };
@@ -3,14 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.addZero = void 0;
6
+ exports.addZero = exports.addUrlQuery = void 0;
7
7
  exports.asyncDataURLtoImage = asyncDataURLtoImage;
8
8
  exports.checkFileName = exports.calcLastTime = void 0;
9
9
  exports.commonFetch = commonFetch;
10
10
  exports.convertImageUrl = convertImageUrl;
11
+ exports.copy2ClipBoard = copy2ClipBoard;
11
12
  exports.dragSource = void 0;
12
13
  exports.ensure = ensure;
13
- exports.styleStringify = exports.navigateTo = exports.importAsync = exports.getUrlParams = exports.getColorRgba = void 0;
14
+ exports.navigateTo = exports.importAsync = exports.getUrlParams = exports.getColorRgba = void 0;
15
+ exports.shareFacebook = shareFacebook;
16
+ exports.shareLinkedin = shareLinkedin;
17
+ exports.shareTwitter = shareTwitter;
18
+ exports.styleStringify = void 0;
14
19
 
15
20
  var _axios = _interopRequireDefault(require("axios"));
16
21
 
@@ -115,6 +120,16 @@ var navigateTo = function navigateTo(url) {
115
120
 
116
121
  exports.navigateTo = navigateTo;
117
122
 
123
+ var addUrlQuery = function addUrlQuery(url, queryObj) {
124
+ if (/\?/.test(url)) {
125
+ return url + '&' + _qs["default"].stringify(queryObj);
126
+ } else {
127
+ return url + '?' + _qs["default"].stringify(queryObj);
128
+ }
129
+ };
130
+
131
+ exports.addUrlQuery = addUrlQuery;
132
+
118
133
  var dragSource = function dragSource(source, from, to) {
119
134
  var out = source.splice(from, 1);
120
135
 
@@ -318,4 +333,62 @@ var importAsync = function importAsync(fileUrl) {
318
333
  });
319
334
  };
320
335
 
321
- exports.importAsync = importAsync;
336
+ exports.importAsync = importAsync;
337
+
338
+ function shareFacebook(_a) {
339
+ var url = _a.url,
340
+ image = _a.image,
341
+ title = _a.title,
342
+ description = _a.description;
343
+ window.open('http://www.facebook.com/sharer.php' + _qs["default"].stringify({
344
+ u: url,
345
+ t: title
346
+ }, {
347
+ addQueryPrefix: true
348
+ }));
349
+ }
350
+
351
+ function shareTwitter(_a) {
352
+ var url = _a.url,
353
+ image = _a.image,
354
+ title = _a.title,
355
+ description = _a.description;
356
+ window.open('http://twitter.com/share' + _qs["default"].stringify({
357
+ url: url,
358
+ text: title
359
+ }, {
360
+ addQueryPrefix: true
361
+ }));
362
+ } // export function sharewhatsApp({ url, image, title, description }) {
363
+ // window.open(`https://api.whatsapp.com/send?text=${encodeURIComponent(url)}`, '_self');
364
+ // }
365
+
366
+
367
+ function shareLinkedin(_a) {
368
+ var url = _a.url,
369
+ image = _a.image,
370
+ title = _a.title,
371
+ description = _a.description;
372
+ window.open('http://www.linkedin.com/shareArticle' + _qs["default"].stringify({
373
+ mini: true,
374
+ url: url,
375
+ title: title
376
+ }, {
377
+ addQueryPrefix: true
378
+ }));
379
+ }
380
+ /**
381
+ * 复制到剪切板
382
+ * @param {*} text 复制内容
383
+ */
384
+
385
+
386
+ function copy2ClipBoard(text) {
387
+ var tag = document.createElement('input');
388
+ tag.setAttribute('id', 'cp_hgz_input');
389
+ tag.value = text;
390
+ document.getElementsByTagName('body')[0].appendChild(tag);
391
+ document.getElementById('cp_hgz_input').select();
392
+ document.execCommand('copy');
393
+ document.getElementById('cp_hgz_input').remove();
394
+ }
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setMagicDesign = exports.renderPreview = exports.isPc = exports.isDesignMode = exports.isActiveFloor = exports.copyNode = exports.clickUrl = void 0;
6
+ exports.setMagicDesign = exports.renderPreview = exports.isPc = exports.isDesignMode = exports.isActiveFloor = exports.getVideoCover = exports.copyNode = exports.clickUrl = void 0;
7
7
 
8
8
  var _uuid = require("uuid");
9
9
 
@@ -206,10 +206,17 @@ exports.isPc = isPc;
206
206
  var setMagicDesign = function setMagicDesign(magicDesignObj) {
207
207
  window.magicDesign = __assign(__assign({}, window.magicDesign), magicDesignObj);
208
208
  };
209
+
210
+ exports.setMagicDesign = setMagicDesign;
211
+
212
+ var getVideoCover = function getVideoCover(group) {
213
+ if (group.overilay.open) return isPc() ? group.overilay.content.pcImgSrc : group.overilay.content.h5ImgSrc;
214
+ return '';
215
+ };
209
216
  /** 刷新预览区域 */
210
217
 
211
218
 
212
- exports.setMagicDesign = setMagicDesign;
219
+ exports.getVideoCover = getVideoCover;
213
220
 
214
221
  var renderPreview = function renderPreview(changeHistory) {
215
222
  if (changeHistory === void 0) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "0.0.112",
4
+ "version": "0.0.115",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",