@fonixtree/magic-design 0.0.150 → 0.0.151

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 (123) hide show
  1. package/es/assets/images/layout-icon/layout-video-h5-1.png +0 -0
  2. package/es/common/ImageModal/index.js +75 -31
  3. package/es/common/LinkModal/BundleCampaign/index.js +2 -2
  4. package/es/common/LinkModal/CatgTable/index.js +1 -1
  5. package/es/common/LinkModal/CouponTable/index.js +1 -1
  6. package/es/common/LinkModal/FilteredProductModal/index.js +5 -5
  7. package/es/common/LinkModal/FunctionTable/index.js +1 -1
  8. package/es/common/LinkModal/ProductDetailPage/index.js +3 -3
  9. package/es/common/LinkModal/index.js +2 -2
  10. package/es/common/ProductModal/index.js +4 -4
  11. package/es/common/UrlPicker/index.js +1 -1
  12. package/es/common/Video/closeImg.png +0 -0
  13. package/es/common/Video/index.js +14 -1
  14. package/es/common/Video/index.less +10 -6
  15. package/es/composite-comp/bol/components/Text/index.js +22 -8
  16. package/es/composite-comp/bol/components/Text/index.less +4 -6
  17. package/es/composite-comp/bol/components/Video/components/ShareBtn/index.less +7 -4
  18. package/es/composite-comp/bol/components/Video/components/VideoTag/index.js +9 -3
  19. package/es/composite-comp/bol/components/Video/components/VideoTag/index.less +2 -2
  20. package/es/composite-comp/bol/components/Video/defaultJSON.js +1 -1
  21. package/es/composite-comp/bol/components/Video/mobile/Layout1/index.js +7 -2
  22. package/es/composite-comp/bol/components/Video/mobile/Layout1/index.less +2 -2
  23. package/es/composite-comp/bol/components/Video/mobile/Layout2/index.js +8 -5
  24. package/es/composite-comp/bol/components/Video/mobile/Layout2/index.less +3 -3
  25. package/es/composite-comp/bol/components/Video/mobile/Layout3/index.js +17 -8
  26. package/es/composite-comp/bol/components/Video/mobile/Layout3/index.less +16 -3
  27. package/es/composite-comp/bol/components/Video/pc/Layout1/index.js +9 -11
  28. package/es/composite-comp/bol/components/Video/pc/Layout2/index.js +7 -4
  29. package/es/composite-comp/bol/components/Video/pc/Layout3/index.js +1 -0
  30. package/es/composite-comp/bol/components/Video/pc/Layout4/index.js +9 -2
  31. package/es/composite-comp/bol/components/Video/pc/Layout4/index.less +11 -4
  32. package/es/composite-comp/bol/components/Video/pc/Layout5/index.js +9 -2
  33. package/es/composite-comp/bol/components/Video/pc/Layout5/index.less +9 -2
  34. package/es/composite-comp/bol/components/Video/pc/index.js +14 -5
  35. package/es/composite-comp/common/components/ImageLabel/index.less +3 -2
  36. package/es/composite-comp/common/components/ProductItem/index.js +3 -2
  37. package/es/composite-comp/common/components/ProductItem/index.less +4 -9
  38. package/es/composite-comp/dito/components/PcNavigation/pc/index.js +1 -1
  39. package/es/composite-comp/dito/components/PcNavigation/pc/index.less +4 -2
  40. package/es/composite-comp/dito/components/Recommend/defaultJSON.js +1 -1
  41. package/es/composite-comp/dito/components/Recommend/mobile/index.js +2 -2
  42. package/es/composite-comp/dito/components/SearchBar/mobile/index.js +4 -2
  43. package/es/composite-comp/dito/components/SearchBar/mobile/index.less +5 -0
  44. package/es/composite-comp/dito/second-config-panels/RecommendSecondConfig/AIRecommendation/index.js +4 -6
  45. package/es/constants/index.js +3 -1
  46. package/es/core/Designer/ConfigPanel/index.js +12 -3
  47. package/es/core/Designer/LeftTitle/index.js +66 -0
  48. package/es/core/Designer/LeftTitle/index.less +9 -0
  49. package/es/core/Designer/QuickMenuBar/index.js +15 -5
  50. package/es/core/Designer/RenderHtml/index.js +89 -0
  51. package/es/core/Designer/RenderHtml/index.less +5 -0
  52. package/es/core/Designer/index.js +223 -4
  53. package/es/core/Renderer/index.js +5 -2
  54. package/es/decorator/compositeDecorator.js +2 -2
  55. package/es/locale/en/en.json +1 -0
  56. package/es/locale/es/es.json +1 -0
  57. package/es/locale/id/id.json +1 -0
  58. package/es/meta-comp/components/Text/index.js +55 -16
  59. package/es/utils/businessUtil.js +3 -3
  60. package/es/utils/commonUtil.js +11 -0
  61. package/es/utils/coreUtil.js +8 -4
  62. package/lib/assets/images/layout-icon/layout-video-h5-1.png +0 -0
  63. package/lib/common/ImageModal/index.js +75 -31
  64. package/lib/common/LinkModal/BundleCampaign/index.js +2 -2
  65. package/lib/common/LinkModal/CatgTable/index.js +1 -1
  66. package/lib/common/LinkModal/CouponTable/index.js +1 -1
  67. package/lib/common/LinkModal/FilteredProductModal/index.js +5 -5
  68. package/lib/common/LinkModal/FunctionTable/index.js +1 -1
  69. package/lib/common/LinkModal/ProductDetailPage/index.js +3 -3
  70. package/lib/common/LinkModal/index.js +2 -2
  71. package/lib/common/ProductModal/index.js +4 -4
  72. package/lib/common/UrlPicker/index.js +1 -1
  73. package/lib/common/Video/closeImg.png +0 -0
  74. package/lib/common/Video/index.js +14 -1
  75. package/lib/common/Video/index.less +10 -6
  76. package/lib/composite-comp/bol/components/Text/index.js +22 -8
  77. package/lib/composite-comp/bol/components/Text/index.less +4 -6
  78. package/lib/composite-comp/bol/components/Video/components/ShareBtn/index.less +7 -4
  79. package/lib/composite-comp/bol/components/Video/components/VideoTag/index.js +9 -3
  80. package/lib/composite-comp/bol/components/Video/components/VideoTag/index.less +2 -2
  81. package/lib/composite-comp/bol/components/Video/defaultJSON.js +1 -1
  82. package/lib/composite-comp/bol/components/Video/mobile/Layout1/index.js +7 -2
  83. package/lib/composite-comp/bol/components/Video/mobile/Layout1/index.less +2 -2
  84. package/lib/composite-comp/bol/components/Video/mobile/Layout2/index.js +8 -5
  85. package/lib/composite-comp/bol/components/Video/mobile/Layout2/index.less +3 -3
  86. package/lib/composite-comp/bol/components/Video/mobile/Layout3/index.js +17 -8
  87. package/lib/composite-comp/bol/components/Video/mobile/Layout3/index.less +16 -3
  88. package/lib/composite-comp/bol/components/Video/pc/Layout1/index.js +9 -11
  89. package/lib/composite-comp/bol/components/Video/pc/Layout2/index.js +7 -4
  90. package/lib/composite-comp/bol/components/Video/pc/Layout3/index.js +1 -0
  91. package/lib/composite-comp/bol/components/Video/pc/Layout4/index.js +9 -2
  92. package/lib/composite-comp/bol/components/Video/pc/Layout4/index.less +11 -4
  93. package/lib/composite-comp/bol/components/Video/pc/Layout5/index.js +9 -2
  94. package/lib/composite-comp/bol/components/Video/pc/Layout5/index.less +9 -2
  95. package/lib/composite-comp/bol/components/Video/pc/index.js +14 -5
  96. package/lib/composite-comp/common/components/ImageLabel/index.less +3 -2
  97. package/lib/composite-comp/common/components/ProductItem/index.js +3 -2
  98. package/lib/composite-comp/common/components/ProductItem/index.less +4 -9
  99. package/lib/composite-comp/dito/components/PcNavigation/pc/index.js +1 -1
  100. package/lib/composite-comp/dito/components/PcNavigation/pc/index.less +4 -2
  101. package/lib/composite-comp/dito/components/Recommend/defaultJSON.js +1 -1
  102. package/lib/composite-comp/dito/components/Recommend/mobile/index.js +2 -2
  103. package/lib/composite-comp/dito/components/SearchBar/mobile/index.js +4 -2
  104. package/lib/composite-comp/dito/components/SearchBar/mobile/index.less +5 -0
  105. package/lib/composite-comp/dito/second-config-panels/RecommendSecondConfig/AIRecommendation/index.js +4 -6
  106. package/lib/constants/index.js +3 -1
  107. package/lib/core/Designer/ConfigPanel/index.js +12 -3
  108. package/lib/core/Designer/LeftTitle/index.js +66 -0
  109. package/lib/core/Designer/LeftTitle/index.less +9 -0
  110. package/lib/core/Designer/QuickMenuBar/index.js +15 -5
  111. package/lib/core/Designer/RenderHtml/index.js +89 -0
  112. package/lib/core/Designer/RenderHtml/index.less +5 -0
  113. package/lib/core/Designer/index.js +223 -4
  114. package/lib/core/Renderer/index.js +5 -2
  115. package/lib/decorator/compositeDecorator.js +2 -2
  116. package/lib/locale/en/en.json +1 -0
  117. package/lib/locale/es/es.json +1 -0
  118. package/lib/locale/id/id.json +1 -0
  119. package/lib/meta-comp/components/Text/index.js +55 -16
  120. package/lib/utils/businessUtil.js +3 -3
  121. package/lib/utils/commonUtil.js +11 -0
  122. package/lib/utils/coreUtil.js +8 -4
  123. package/package.json +3 -2
@@ -29,6 +29,10 @@ var _History = _interopRequireDefault(require("./History"));
29
29
 
30
30
  var _AppointmentModal = _interopRequireDefault(require("./AppointmentModal"));
31
31
 
32
+ var _LeftTitle = _interopRequireDefault(require("./LeftTitle"));
33
+
34
+ var _RenderHtml = _interopRequireDefault(require("./RenderHtml"));
35
+
32
36
  var _componentTypes = require("../../constants/component-types");
33
37
 
34
38
  var _mobx = require("../../mobx");
@@ -39,6 +43,8 @@ require("./index.less");
39
43
 
40
44
  var _common = require("../../common");
41
45
 
46
+ var _storeUtil = require("../../utils/storeUtil");
47
+
42
48
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
43
49
 
44
50
  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); }
@@ -87,6 +93,149 @@ var __assign = void 0 && (void 0).__assign || function () {
87
93
  return __assign.apply(this, arguments);
88
94
  };
89
95
 
96
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
97
+ function adopt(value) {
98
+ return value instanceof P ? value : new P(function (resolve) {
99
+ resolve(value);
100
+ });
101
+ }
102
+
103
+ return new (P || (P = Promise))(function (resolve, reject) {
104
+ function fulfilled(value) {
105
+ try {
106
+ step(generator.next(value));
107
+ } catch (e) {
108
+ reject(e);
109
+ }
110
+ }
111
+
112
+ function rejected(value) {
113
+ try {
114
+ step(generator["throw"](value));
115
+ } catch (e) {
116
+ reject(e);
117
+ }
118
+ }
119
+
120
+ function step(result) {
121
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
122
+ }
123
+
124
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
125
+ });
126
+ };
127
+
128
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
129
+ var _ = {
130
+ label: 0,
131
+ sent: function sent() {
132
+ if (t[0] & 1) throw t[1];
133
+ return t[1];
134
+ },
135
+ trys: [],
136
+ ops: []
137
+ },
138
+ f,
139
+ y,
140
+ t,
141
+ g;
142
+ return g = {
143
+ next: verb(0),
144
+ "throw": verb(1),
145
+ "return": verb(2)
146
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
147
+ return this;
148
+ }), g;
149
+
150
+ function verb(n) {
151
+ return function (v) {
152
+ return step([n, v]);
153
+ };
154
+ }
155
+
156
+ function step(op) {
157
+ if (f) throw new TypeError("Generator is already executing.");
158
+
159
+ while (_) {
160
+ try {
161
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
162
+ if (y = 0, t) op = [op[0] & 2, t.value];
163
+
164
+ switch (op[0]) {
165
+ case 0:
166
+ case 1:
167
+ t = op;
168
+ break;
169
+
170
+ case 4:
171
+ _.label++;
172
+ return {
173
+ value: op[1],
174
+ done: false
175
+ };
176
+
177
+ case 5:
178
+ _.label++;
179
+ y = op[1];
180
+ op = [0];
181
+ continue;
182
+
183
+ case 7:
184
+ op = _.ops.pop();
185
+
186
+ _.trys.pop();
187
+
188
+ continue;
189
+
190
+ default:
191
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
192
+ _ = 0;
193
+ continue;
194
+ }
195
+
196
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
197
+ _.label = op[1];
198
+ break;
199
+ }
200
+
201
+ if (op[0] === 6 && _.label < t[1]) {
202
+ _.label = t[1];
203
+ t = op;
204
+ break;
205
+ }
206
+
207
+ if (t && _.label < t[2]) {
208
+ _.label = t[2];
209
+
210
+ _.ops.push(op);
211
+
212
+ break;
213
+ }
214
+
215
+ if (t[2]) _.ops.pop();
216
+
217
+ _.trys.pop();
218
+
219
+ continue;
220
+ }
221
+
222
+ op = body.call(thisArg, _);
223
+ } catch (e) {
224
+ op = [6, e];
225
+ y = 0;
226
+ } finally {
227
+ f = t = 0;
228
+ }
229
+ }
230
+
231
+ if (op[0] & 5) throw op[1];
232
+ return {
233
+ value: op[0] ? op[1] : void 0,
234
+ done: true
235
+ };
236
+ }
237
+ };
238
+
90
239
  var __spreadArrays = void 0 && (void 0).__spreadArrays || function () {
91
240
  for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
92
241
  s += arguments[i].length;
@@ -129,6 +278,8 @@ function (_super) {
129
278
  function Designer(props) {
130
279
  var _this = _super.call(this, props) || this;
131
280
 
281
+ _this.renderHtmlRef = /*#__PURE__*/_react["default"].createRef();
282
+
132
283
  _this.closeCompList = function () {
133
284
  if (_this.compListRef.current.open) {
134
285
  _this.compListRef.current.onClose();
@@ -366,11 +517,64 @@ function (_super) {
366
517
  }
367
518
  };
368
519
 
520
+ _this.onHtmlSave = function () {
521
+ return __awaiter(_this, void 0, void 0, function () {
522
+ var _a, device, MPageData, renderProps, html;
523
+
524
+ return __generator(this, function (_b) {
525
+ switch (_b.label) {
526
+ case 0:
527
+ _a = this.state, device = _a.device, MPageData = _a.MPageData;
528
+ renderProps = {
529
+ pageData: {
530
+ id: (0, _uuid.v4)(),
531
+ childNodes: MPageData
532
+ },
533
+ device: device
534
+ };
535
+ return [4
536
+ /*yield*/
537
+ , this.renderHtmlRef.current.renderHtml(renderProps)];
538
+
539
+ case 1:
540
+ html = _b.sent();
541
+ (0, _storeUtil.setStore)(_constants.STORAGE_KEY.MAGIC_RENDER_HTML, html);
542
+ (0, _storeUtil.setStore)(_constants.STORAGE_KEY.MAGIC_RENDER_PAGEDATA, renderProps.pageData);
543
+
544
+ if (this.props.onHtmlSave) {
545
+ this.props.onHtmlSave(html);
546
+ }
547
+
548
+ return [2
549
+ /*return*/
550
+ ];
551
+ }
552
+ });
553
+ });
554
+ };
555
+
556
+ _this.onHtmlBack = function () {
557
+ return __awaiter(_this, void 0, void 0, function () {
558
+ return __generator(this, function (_a) {
559
+ if (this.props.onHtmlBack) {
560
+ this.props.onHtmlBack();
561
+ }
562
+
563
+ return [2
564
+ /*return*/
565
+ ];
566
+ });
567
+ });
568
+ };
569
+
369
570
  _this.renderHeader = function () {
370
571
  return /*#__PURE__*/_react["default"].createElement(_QuickMenuBar["default"], {
371
572
  device: _this.state.device,
372
573
  language: _this.props.language,
373
574
  onBtnClick: _this.onQuickMenuClick,
575
+ onHtmlBack: _this.onHtmlBack,
576
+ onHtmlSave: _this.onHtmlSave,
577
+ outputType: _this.props.outputType,
374
578
  redoDisable: !_this.history.redoAble(),
375
579
  undoDisable: !_this.history.undoAble()
376
580
  });
@@ -398,6 +602,7 @@ function (_super) {
398
602
 
399
603
  var pageData = props.pageData,
400
604
  config = props.config,
605
+ outputType = props.outputType,
401
606
  locale = props.locale;
402
607
  var MPageData = pageData.childNodes || [];
403
608
  _this.configRef = /*#__PURE__*/_react["default"].createRef(); // this.viewAreaRef = React.createRef();
@@ -415,7 +620,9 @@ function (_super) {
415
620
  device: _constants.deviceTypeMap.PHONE,
416
621
  appointmentVisible: false
417
622
  };
418
- setDesignConfig(config);
623
+ setDesignConfig(__assign(__assign({}, config), {
624
+ outputType: outputType
625
+ }));
419
626
  return _this;
420
627
  }
421
628
 
@@ -481,7 +688,17 @@ function (_super) {
481
688
  pagesManager = _b.pagesManager,
482
689
  compSource = _b.compSource,
483
690
  pageName = _b.pageName,
484
- onCancelPublish = _b.onCancelPublish;
691
+ onCancelPublish = _b.onCancelPublish,
692
+ leftTitle = _b.leftTitle,
693
+ outputType = _b.outputType;
694
+ var renderPagesManage = pagesManager;
695
+
696
+ if (outputType == 'html') {
697
+ renderPagesManage = /*#__PURE__*/_react["default"].createElement(_LeftTitle["default"], {
698
+ title: leftTitle
699
+ });
700
+ }
701
+
485
702
  return /*#__PURE__*/_react["default"].createElement(_mobxReact.Provider, {
486
703
  store: _mobx.store
487
704
  }, /*#__PURE__*/_react["default"].createElement(_antd.ConfigProvider, {
@@ -496,7 +713,7 @@ function (_super) {
496
713
  onAdd: this.onAdd,
497
714
  pageData: MPageData,
498
715
  pageName: pageName,
499
- renderPagesManage: pagesManager,
716
+ renderPagesManage: renderPagesManage,
500
717
  setPageData: this.setPageData
501
718
  }), /*#__PURE__*/_react["default"].createElement(_CompListPanel["default"], {
502
719
  ref: this.compListRef,
@@ -525,7 +742,9 @@ function (_super) {
525
742
  },
526
743
  onConfirm: this.onAppointmentConfirm,
527
744
  visible: appointmentVisible
528
- })), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_common.SystemNotification, null))));
745
+ })), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_common.SystemNotification, null))), /*#__PURE__*/_react["default"].createElement(_RenderHtml["default"], {
746
+ ref: this.renderHtmlRef
747
+ }));
529
748
  };
530
749
 
531
750
  return Designer;
@@ -58,7 +58,8 @@ var setDesignConfig = function setDesignConfig(props) {
58
58
 
59
59
 
60
60
  var Renderer = function Renderer(props) {
61
- var pageData = props.pageData; // console.log('pageData: ', pageData);
61
+ var pageData = props.pageData,
62
+ outputType = props.outputType; // console.log('pageData: ', pageData);
62
63
 
63
64
  setDesignConfig(props);
64
65
  window.magicDesignPageData = pageData;
@@ -102,7 +103,9 @@ var Renderer = function Renderer(props) {
102
103
  }
103
104
 
104
105
  var newInstanceProps = __assign(__assign({}, nodeData), {
105
- nodeData: nodeData
106
+ nodeData: nodeData,
107
+ mode: 'renderer',
108
+ outputType: outputType
106
109
  });
107
110
 
108
111
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -130,8 +130,8 @@ function compositeDecorator(WrappedComponent) {
130
130
  wrapStyle.opacity = background.opacity ? background.opacity : 1;
131
131
  } else {
132
132
  wrapStyle.backgroundImage = "url(" + background.image + ")";
133
- wrapStyle.backgroundPosition = '0px 0px';
134
- wrapStyle.backgroundSize = 'auto 100%';
133
+ wrapStyle.backgroundPosition = 'center center';
134
+ wrapStyle.backgroundSize = 'cover';
135
135
  wrapStyle.backgroundRepeat = 'no-repeat';
136
136
  }
137
137
  } // 复合组件宽度
@@ -1,4 +1,5 @@
1
1
  {
2
+ "BACK": "Back",
2
3
  "VIDEO_HEIGHT": "Video Height",
3
4
  "HEIGHT": "Height",
4
5
  "SOCIAL_IMAGE": "Social Image",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "BACK": "Back",
2
3
  "VIDEO_HEIGHT": "Video Height",
3
4
  "HEIGHT": "Height",
4
5
  "SOCIAL_IMAGE": "Social Image",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "BACK": "Back",
2
3
  "VIDEO_HEIGHT": "Video Height",
3
4
  "HEIGHT": "Height",
4
5
  "SOCIAL_IMAGE": "Social Image",
@@ -319,7 +319,8 @@ function (_super) {
319
319
  node.appendChild(closeNode);
320
320
  };
321
321
 
322
- _this.renderText = function (data) {
322
+ _this.renderText = function (data, mode) {
323
+ var outputType = _this.props.outputType || window.magicDesign.outputType;
323
324
  if (!_this.textRef.current) return;
324
325
 
325
326
  _this.textRef.current.blur();
@@ -332,23 +333,57 @@ function (_super) {
332
333
  /** 渲染html */
333
334
 
334
335
  if (data.specialContent.length == 0) {
335
- _this.textRef.current.innerHTML = data.text;
336
+ if (outputType == 'html' && mode == 'renderer') {
337
+ if (data === null || data === void 0 ? void 0 : data.content.clickUrl) {
338
+ var a = document.createElement('a');
339
+ a.href = data.content.clickUrl;
340
+ a.target = '_blank';
341
+ a.innerHTML = data.text;
342
+ _this.textRef.current.innerHTML = '';
343
+
344
+ _this.textRef.current.appendChild(a);
345
+ } else {
346
+ _this.textRef.current.innerHTML = data.text;
347
+ }
348
+ } else {
349
+ _this.textRef.current.innerHTML = data.text;
350
+ }
336
351
  } else {
337
352
  _this.textRef.current.innerHTML = '';
338
353
  data.specialContent.forEach(function (c, index) {
339
- var _a;
354
+ var _a, _b, _c;
340
355
 
341
356
  var node = document.createElement('span');
342
357
  node.style = (0, _commonUtil.styleStringify)(contentStyle(c.content));
343
- node.innerText = (_a = data.text).slice.apply(_a, c.range);
344
358
 
345
- node.onclick = function (e) {
346
- if (c.content.clickUrl) {
347
- e.stopPropagation();
348
- }
359
+ if (c === null || c === void 0 ? void 0 : c.content.clickUrl) {
360
+ if (outputType == 'html' && mode == 'renderer') {
361
+ var a = document.createElement('a');
362
+ a.href = c.content.clickUrl;
363
+ a.target = '_blank';
364
+
365
+ if (mode == 'designer') {
366
+ a.onclick = function (e) {
367
+ e.preventDefault();
368
+ };
369
+ }
349
370
 
350
- (0, _coreUtil.clickUrl)(c.content.clickUrl);
351
- };
371
+ a.innerText = (_a = data.text).slice.apply(_a, c.range);
372
+ node.appendChild(a);
373
+ } else {
374
+ node.innerText = (_b = data.text).slice.apply(_b, c.range);
375
+
376
+ node.onclick = function (e) {
377
+ if (c.content.clickUrl) {
378
+ e.stopPropagation();
379
+ }
380
+
381
+ (0, _coreUtil.clickUrl)(c.content.clickUrl);
382
+ };
383
+ }
384
+ } else {
385
+ node.innerText = (_c = data.text).slice.apply(_c, c.range);
386
+ }
352
387
 
353
388
  _this.selectionRefMap[JSON.stringify(c.range)] = node;
354
389
 
@@ -356,7 +391,7 @@ function (_super) {
356
391
  /** 找到当前选中的区域 */
357
392
 
358
393
 
359
- if (_mobx.store.textSelection == c.content) {
394
+ if (_mobx.store.textSelection == (c === null || c === void 0 ? void 0 : c.content)) {
360
395
  /** 添加删除按钮 */
361
396
  _this.createHoverClose(node, function () {
362
397
  /** 第一步去除选中区域 */
@@ -402,14 +437,14 @@ function (_super) {
402
437
  Text.prototype.componentDidMount = function () {
403
438
  var _this = this;
404
439
 
405
- this.renderText(this.props.data);
440
+ this.renderText(this.props.data, this.props.mode);
406
441
  initSelectionEvent();
407
442
  appendSelectionTarget({
408
443
  target: this.textRef.current,
409
444
  data: this.props.data,
410
445
  selectionRefMap: this.selectionRefMap,
411
446
  refresh: function refresh() {
412
- _this.renderText(_this.props.data);
447
+ _this.renderText(_this.props.data, _this.props.mode);
413
448
  }
414
449
  });
415
450
  };
@@ -421,7 +456,7 @@ function (_super) {
421
456
  var result = should1 || should2 || should3;
422
457
 
423
458
  if (result) {
424
- this.renderText(nextProps.data);
459
+ this.renderText(nextProps.data, this.props.mode);
425
460
  }
426
461
 
427
462
  return result;
@@ -438,7 +473,8 @@ function (_super) {
438
473
  data = _a.data,
439
474
  className = _a.className,
440
475
  readonly = _a.readonly,
441
- onTextInput = _a.onTextInput;
476
+ onTextInput = _a.onTextInput,
477
+ mode = _a.mode;
442
478
  var style = contentStyle(data.content);
443
479
 
444
480
  if (data.underline) {
@@ -461,12 +497,14 @@ function (_super) {
461
497
  // textDecorationColor: data?.underline.textDecorationColor,
462
498
  // textDecorationStyle: data?.underline.textDecorationStyle,
463
499
  // };
500
+ // mode == 'designer' && !readonly
501
+ // console.log('!readonly: ', mode, readonly);
464
502
 
465
503
 
466
504
  return /*#__PURE__*/_react["default"].createElement("div", {
467
505
  ref: this.textRef,
468
506
  className: (0, _classnames["default"])('m-meta-text', className),
469
- contentEditable: (0, _coreUtil.isDesignMode)() && !readonly,
507
+ contentEditable: mode == 'designer' && !readonly,
470
508
  onClick: function onClick() {
471
509
  (0, _coreUtil.clickUrl)(data.content.clickUrl);
472
510
  },
@@ -495,6 +533,7 @@ function (_super) {
495
533
 
496
534
  Text.defaultProps = {
497
535
  readonly: false,
536
+ mode: 'designer',
498
537
  onTextInput: function onTextInput() {}
499
538
  };
500
539
  Text = __decorate([_decorator.metaDecorator], Text);
@@ -57,12 +57,12 @@ var parseUrl = function parseUrl(url) {
57
57
 
58
58
  case _constants.urlType.CUSTOMIZED:
59
59
  // 自定义页面
60
- pcLink = "/group/" + arg1;
61
- h5Link = "/group/" + arg1;
60
+ pcLink = "/poster/" + arg1;
61
+ h5Link = "/poster/" + arg1;
62
62
  params = {
63
63
  type: 'CUSTOMIZED',
64
64
  data: {
65
- url: "/group/" + arg1
65
+ url: "/poster/" + arg1
66
66
  }
67
67
  };
68
68
  break;
@@ -9,6 +9,7 @@ exports.checkFileName = exports.calcLastTime = void 0;
9
9
  exports.commonFetch = commonFetch;
10
10
  exports.convertImageUrl = convertImageUrl;
11
11
  exports.copy2ClipBoard = copy2ClipBoard;
12
+ exports.covertKey = covertKey;
12
13
  exports.dragSource = void 0;
13
14
  exports.ensure = ensure;
14
15
  exports.getColorRgba = void 0;
@@ -22,6 +23,8 @@ exports.styleStringify = void 0;
22
23
 
23
24
  var _axios = _interopRequireDefault(require("axios"));
24
25
 
26
+ var _lodash = require("lodash");
27
+
25
28
  var _qs = _interopRequireDefault(require("qs"));
26
29
 
27
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -463,4 +466,12 @@ function pushGA(data) {
463
466
  pageName_moduleName_groupName: 'pageName_moduleName_groupName' + random,
464
467
  pageName_moduleName_groupName_elementNam: 'pageName_moduleName_groupName_elementNam' + random
465
468
  }, data)); // }, 1000);
469
+ }
470
+ /** react key 计算 */
471
+
472
+
473
+ function covertKey(data, func) {
474
+ var newData = (0, _lodash.cloneDeep)(data);
475
+ func(newData);
476
+ return JSON.stringify(newData);
466
477
  }
@@ -287,9 +287,9 @@ var getCoupon = function getCoupon(couponId) {
287
287
  };
288
288
 
289
289
  var clickUrl = function clickUrl(url) {
290
- console.log('url', url);
290
+ console.log('clickUrl...', url);
291
291
 
292
- if (window.magicDesign.readOnly || window.magicDesign.mode !== 'renderer' || !url) {
292
+ if (window.magicDesign.readOnly || window.magicDesign.mode !== 'renderer' || !url || window.magicDesign.outputType == 'html') {
293
293
  return;
294
294
  }
295
295
 
@@ -310,9 +310,13 @@ var clickUrl = function clickUrl(url) {
310
310
  if (url.startsWith('/')) {
311
311
  (0, _commonUtil.navigateTo)(url);
312
312
  } else {
313
- // location.href = url;
314
313
  var newUrl = isPc() ? pcLink : h5Link;
315
- (0, _commonUtil.navigateTo)(newUrl);
314
+
315
+ if (newUrl.startsWith('/')) {
316
+ (0, _commonUtil.navigateTo)(newUrl);
317
+ } else {
318
+ window.location.href = newUrl;
319
+ }
316
320
  }
317
321
 
318
322
  return;
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.150",
4
+ "version": "0.0.151",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",
@@ -35,7 +35,8 @@
35
35
  "react-slick": "^0.29.0",
36
36
  "replace": "^1.2.1",
37
37
  "shortid": "^2.2.16",
38
- "slick-carousel": "^1.8.1"
38
+ "slick-carousel": "^1.8.1",
39
+ "styled-components": "^5.3.9"
39
40
  },
40
41
  "peerDependencies": {
41
42
  "react": ">=16.11.0",