@fonixtree/magic-design 2.0.10 → 2.0.12

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.
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getDefaultJSON = void 0;
7
+
8
+ var _uuid = require("uuid");
9
+
10
+ var getDefaultJSON = function getDefaultJSON() {
11
+ return {
12
+ id: (0, _uuid.v4)(),
13
+ type: 'CUSTOM_CODE',
14
+ content: {
15
+ pcHtml: '',
16
+ h5Html: ''
17
+ },
18
+ spacing: {
19
+ pc: {
20
+ paddingTop: 10,
21
+ paddingBottom: 10,
22
+ marginBottom: 0
23
+ },
24
+ mobile: {
25
+ paddingTop: 10,
26
+ paddingBottom: 10,
27
+ marginBottom: 0
28
+ }
29
+ },
30
+ background: {
31
+ opacity: 100,
32
+ color: '#fff',
33
+ image: '',
34
+ bgType: 'color'
35
+ }
36
+ };
37
+ };
38
+
39
+ exports.getDefaultJSON = getDefaultJSON;
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _defaultJSON = require("./defaultJSON");
11
+
12
+ var _compositeDecorator = _interopRequireDefault(require("../../../../decorator/compositeDecorator"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+
16
+ 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); }
17
+
18
+ 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; }
19
+
20
+ 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); }
21
+
22
+ var __extends = void 0 && (void 0).__extends || function () {
23
+ var _extendStatics = function extendStatics(d, b) {
24
+ _extendStatics = Object.setPrototypeOf || {
25
+ __proto__: []
26
+ } instanceof Array && function (d, b) {
27
+ d.__proto__ = b;
28
+ } || function (d, b) {
29
+ for (var p in b) {
30
+ if (b.hasOwnProperty(p)) d[p] = b[p];
31
+ }
32
+ };
33
+
34
+ return _extendStatics(d, b);
35
+ };
36
+
37
+ return function (d, b) {
38
+ _extendStatics(d, b);
39
+
40
+ function __() {
41
+ this.constructor = d;
42
+ }
43
+
44
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45
+ };
46
+ }();
47
+
48
+ var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
49
+ var c = arguments.length,
50
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
51
+ d;
52
+ if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
53
+ if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
54
+ }
55
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
56
+ };
57
+
58
+ var CustomCode =
59
+ /** @class */
60
+ function (_super) {
61
+ __extends(CustomCode, _super);
62
+
63
+ function CustomCode() {
64
+ var _this = _super !== null && _super.apply(this, arguments) || this;
65
+
66
+ _this.htmlTemp = '';
67
+
68
+ _this.createHtml = function () {
69
+ var nodeData = _this.props.nodeData;
70
+ console.log('----nodeData', nodeData);
71
+ var htmlCode = window.magicDesign.device === 'pc' ? nodeData.content.pcHtml : nodeData.content.h5Html;
72
+ _this.htmlTemp = htmlCode;
73
+
74
+ if (document.getElementById('custom-wrap')) {
75
+ document.getElementById('custom-wrap').innerHTML = htmlCode;
76
+ }
77
+ };
78
+
79
+ return _this;
80
+ }
81
+
82
+ CustomCode.prototype.componentDidMount = function () {
83
+ this.createHtml();
84
+ };
85
+
86
+ CustomCode.prototype.componentWillReceiveProps = function (prevProps) {
87
+ console.log('111111');
88
+
89
+ if (window.magicDesign.device === 'pc') {
90
+ console.log('22222222');
91
+
92
+ if (prevProps.nodeData.content.pcHtml != this.props.nodeData.content.pcHtml) {
93
+ console.log('4444444');
94
+ this.createHtml();
95
+ }
96
+ } else {
97
+ console.log('3333333333', this.htmlTemp, this.props.nodeData.content);
98
+
99
+ if (this.htmlTemp != this.props.nodeData.content.h5Html) {
100
+ console.log('5555555');
101
+ this.createHtml();
102
+ }
103
+ }
104
+ };
105
+
106
+ CustomCode.prototype.render = function () {
107
+ // const { nodeData } = this.props;
108
+ // console.log('----nodeData', nodeData);
109
+ return (
110
+ /*#__PURE__*/
111
+ // <div dangerouslySetInnerHTML={{ __html: window.magicDesign.device === 'pc' ? nodeData.content.pcHtml : nodeData.content.h5Html }} />
112
+ _react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
113
+ id: "custom-wrap"
114
+ }), /*#__PURE__*/_react["default"].createElement("a", {
115
+ href: "https://www.baidu.com"
116
+ }, "baidu11 "))
117
+ );
118
+ };
119
+
120
+ CustomCode.defaultProps = {};
121
+ CustomCode.type = 'CUSTOM_CODE';
122
+ CustomCode.getDefaultJSON = _defaultJSON.getDefaultJSON;
123
+ CustomCode = __decorate([_compositeDecorator["default"]], CustomCode);
124
+ return CustomCode;
125
+ }(_react.Component);
126
+
127
+ var _default = CustomCode;
128
+ exports["default"] = _default;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _reactAce = _interopRequireDefault(require("react-ace"));
11
+
12
+ require("ace-builds/src-noconflict/mode-html");
13
+
14
+ require("ace-builds/src-noconflict/mode-javascript");
15
+
16
+ require("ace-builds/src-noconflict/theme-github");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
20
+ // 可选的主题样式
21
+ var MyEditor = function MyEditor(props) {
22
+ var value = props.value,
23
+ changeVal = props.changeVal,
24
+ blurArea = props.blurArea;
25
+ return /*#__PURE__*/_react["default"].createElement(_reactAce["default"], {
26
+ editorProps: {
27
+ $blockScrolling: true
28
+ },
29
+ mode: "html",
30
+ name: "editor",
31
+ onBlur: blurArea,
32
+ onChange: changeVal,
33
+ style: {
34
+ width: '100%'
35
+ },
36
+ theme: "github",
37
+ value: value
38
+ });
39
+ };
40
+
41
+ var _default = MyEditor;
42
+ exports["default"] = _default;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _MyEditor = _interopRequireDefault(require("./MyEditor"));
11
+
12
+ var _coreUtil = require("../../../../utils/coreUtil");
13
+
14
+ var _Collapse = _interopRequireDefault(require("../../../../common/Collapse"));
15
+
16
+ var _BackgroundConfig = _interopRequireDefault(require("../../../common/config-panels/BackgroundConfig"));
17
+
18
+ var _locale = require("../../../../locale");
19
+
20
+ var _BaseConfig = _interopRequireDefault(require("../../../../meta-comp/config-panels/BaseConfig"));
21
+
22
+ var _SpacingConfig = _interopRequireDefault(require("../../../common/config-panels/SpacingConfig"));
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
+
26
+ var __extends = void 0 && (void 0).__extends || function () {
27
+ var _extendStatics = function extendStatics(d, b) {
28
+ _extendStatics = Object.setPrototypeOf || {
29
+ __proto__: []
30
+ } instanceof Array && function (d, b) {
31
+ d.__proto__ = b;
32
+ } || function (d, b) {
33
+ for (var p in b) {
34
+ if (b.hasOwnProperty(p)) d[p] = b[p];
35
+ }
36
+ };
37
+
38
+ return _extendStatics(d, b);
39
+ };
40
+
41
+ return function (d, b) {
42
+ _extendStatics(d, b);
43
+
44
+ function __() {
45
+ this.constructor = d;
46
+ }
47
+
48
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
49
+ };
50
+ }();
51
+
52
+ var CustomCodeConfig =
53
+ /** @class */
54
+ function (_super) {
55
+ __extends(CustomCodeConfig, _super);
56
+
57
+ function CustomCodeConfig() {
58
+ var _this = _super !== null && _super.apply(this, arguments) || this;
59
+
60
+ _this.changeVal = function (v) {
61
+ var data = _this.props.data;
62
+
63
+ if ((0, _coreUtil.isPc)()) {
64
+ data.content.pcHtml = v;
65
+ } else {
66
+ data.content.h5Html = v;
67
+ }
68
+ };
69
+
70
+ _this.blurArea = function () {
71
+ _this.selfRender();
72
+ };
73
+
74
+ return _this;
75
+ }
76
+
77
+ CustomCodeConfig.prototype.render = function () {
78
+ var data = this.props.data;
79
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Collapse["default"], {
80
+ divider: "bold",
81
+ headerSize: "large",
82
+ source: [{
83
+ key: 'content',
84
+ name: (0, _locale.i18n)('CONTENT'),
85
+ value: /*#__PURE__*/_react["default"].createElement(_MyEditor["default"], {
86
+ blurArea: this.blurArea,
87
+ changeVal: this.changeVal,
88
+ value: (0, _coreUtil.isPc)() ? data.content.pcHtml : data.content.h5Html
89
+ })
90
+ }, {
91
+ key: 'spacing',
92
+ name: (0, _locale.i18n)('SPACING'),
93
+ value: /*#__PURE__*/_react["default"].createElement(_SpacingConfig["default"], {
94
+ data: data.spacing
95
+ })
96
+ }, {
97
+ key: 'background',
98
+ name: (0, _locale.i18n)('BACKGROUND'),
99
+ value: /*#__PURE__*/_react["default"].createElement(_BackgroundConfig["default"], {
100
+ data: data.background
101
+ })
102
+ }],
103
+ type: "triangle"
104
+ }));
105
+ };
106
+
107
+ return CustomCodeConfig;
108
+ }(_BaseConfig["default"]);
109
+
110
+ var _default = CustomCodeConfig;
111
+ exports["default"] = _default;
@@ -27,6 +27,8 @@ var _Video = _interopRequireDefault(require("../composite-comp/bol/components/Vi
27
27
 
28
28
  var _Wallet = _interopRequireDefault(require("../composite-comp/bol/components/Wallet"));
29
29
 
30
+ var _CustomCode = _interopRequireDefault(require("../composite-comp/bol/components/CustomCode"));
31
+
30
32
  var _FlashDeal = _interopRequireDefault(require("../composite-comp/dito/components/FlashDeal"));
31
33
 
32
34
  var _SearchBar = _interopRequireDefault(require("../composite-comp/dito/components/SearchBar"));
@@ -59,6 +61,8 @@ var _TagCompConfig = _interopRequireDefault(require("../composite-comp/bol/confi
59
61
 
60
62
  var _VideoConfig = _interopRequireDefault(require("../composite-comp/bol/config-panels/VideoConfig"));
61
63
 
64
+ var _CustomCodeConfig = _interopRequireDefault(require("../composite-comp/bol/config-panels/CustomCodeConfig"));
65
+
62
66
  var _WalletConfig = _interopRequireDefault(require("../composite-comp/bol/config-panels/WalletConfig"));
63
67
 
64
68
  var _FlashDealConfig = _interopRequireDefault(require("../composite-comp/dito/config-panels/FlashDealConfig"));
@@ -105,13 +109,13 @@ var _a, _b, _c; // 组件
105
109
  /**
106
110
  * 渲染组件索引
107
111
  */
108
- var componentMap = (_a = {}, _a[_Banner["default"].type] = _Banner["default"], _a[_Video["default"].type] = _Video["default"], _a[_Text["default"].type] = _Text["default"], _a[_FlashDeal["default"].type] = _FlashDeal["default"], _a[_SearchBar["default"].type] = _SearchBar["default"], _a[_SignBoard["default"].type] = _SignBoard["default"], _a[_ImageText["default"].type] = _ImageText["default"], _a[_Recommend["default"].type] = _Recommend["default"], _a[_MobileNavigation["default"].type] = _MobileNavigation["default"], _a[_PcNavigation["default"].type] = _PcNavigation["default"], _a[_Divider["default"].type] = _Divider["default"], _a[_ImageGallery["default"].type] = _ImageGallery["default"], _a[_Newsletter["default"].type] = _Newsletter["default"], _a[_Carousel["default"].type] = _Carousel["default"], _a[_Button["default"].type] = _Button["default"], _a[_Tag["default"].type] = _Tag["default"], _a[_Wallet["default"].type] = _Wallet["default"], _a);
112
+ var componentMap = (_a = {}, _a[_Banner["default"].type] = _Banner["default"], _a[_Video["default"].type] = _Video["default"], _a[_Text["default"].type] = _Text["default"], _a[_FlashDeal["default"].type] = _FlashDeal["default"], _a[_SearchBar["default"].type] = _SearchBar["default"], _a[_SignBoard["default"].type] = _SignBoard["default"], _a[_ImageText["default"].type] = _ImageText["default"], _a[_Recommend["default"].type] = _Recommend["default"], _a[_MobileNavigation["default"].type] = _MobileNavigation["default"], _a[_PcNavigation["default"].type] = _PcNavigation["default"], _a[_Divider["default"].type] = _Divider["default"], _a[_ImageGallery["default"].type] = _ImageGallery["default"], _a[_Newsletter["default"].type] = _Newsletter["default"], _a[_Carousel["default"].type] = _Carousel["default"], _a[_Button["default"].type] = _Button["default"], _a[_Tag["default"].type] = _Tag["default"], _a[_Wallet["default"].type] = _Wallet["default"], _a[_CustomCode["default"].type] = _CustomCode["default"], _a);
109
113
  /**
110
114
  * 一级配置面板索引
111
115
  */
112
116
 
113
117
  exports.componentMap = componentMap;
114
- var configPanelMap = (_b = {}, _b[_Banner["default"].type] = _BannerConfig["default"], _b[_Video["default"].type] = _VideoConfig["default"], _b[_Text["default"].type] = _TextCompConfig["default"], _b[_FlashDeal["default"].type] = _FlashDealConfig["default"], _b[_SearchBar["default"].type] = _SearchBarConfig["default"], _b[_SignBoard["default"].type] = _SignBoardConfig["default"], _b[_ImageText["default"].type] = _ImageTextConfig["default"], _b[_Recommend["default"].type] = _RecommendConfig["default"], _b[_MobileNavigation["default"].type] = _MobileNavigationConfig["default"], _b[_PcNavigation["default"].type] = _PcNavigationConfig["default"], _b[_Divider["default"].type] = _DividerConfig["default"], _b[_ImageGallery["default"].type] = _ImageGalleryConfig["default"], _b[_Newsletter["default"].type] = _NewsletterConfig["default"], _b[_Carousel["default"].type] = _CarouselConfig["default"], _b[_Button["default"].type] = _ButtonCompConfig["default"], _b[_Tag["default"].type] = _TagCompConfig["default"], _b[_Wallet["default"].type] = _WalletConfig["default"], _b);
118
+ var configPanelMap = (_b = {}, _b[_Banner["default"].type] = _BannerConfig["default"], _b[_Video["default"].type] = _VideoConfig["default"], _b[_Text["default"].type] = _TextCompConfig["default"], _b[_FlashDeal["default"].type] = _FlashDealConfig["default"], _b[_SearchBar["default"].type] = _SearchBarConfig["default"], _b[_SignBoard["default"].type] = _SignBoardConfig["default"], _b[_ImageText["default"].type] = _ImageTextConfig["default"], _b[_Recommend["default"].type] = _RecommendConfig["default"], _b[_MobileNavigation["default"].type] = _MobileNavigationConfig["default"], _b[_PcNavigation["default"].type] = _PcNavigationConfig["default"], _b[_Divider["default"].type] = _DividerConfig["default"], _b[_ImageGallery["default"].type] = _ImageGalleryConfig["default"], _b[_Newsletter["default"].type] = _NewsletterConfig["default"], _b[_Carousel["default"].type] = _CarouselConfig["default"], _b[_Button["default"].type] = _ButtonCompConfig["default"], _b[_Tag["default"].type] = _TagCompConfig["default"], _b[_Wallet["default"].type] = _WalletConfig["default"], _b[_CustomCode["default"].type] = _CustomCodeConfig["default"], _b);
115
119
  /**
116
120
  * 二级配置面板索引
117
121
  */
@@ -129,6 +129,10 @@ var compInfoMap = {
129
129
  name: 'Image and Text',
130
130
  icon: 'icon-filled-image'
131
131
  },
132
+ CUSTOM_CODE: {
133
+ name: 'Custom Code',
134
+ icon: 'icon-html'
135
+ },
132
136
  RECOMMEND: {
133
137
  name: 'Recommend',
134
138
  icon: 'icon-forms'
@@ -39,7 +39,7 @@ function History(_a) {
39
39
  var source = _a.source,
40
40
  onClick = _a.onClick,
41
41
  onChange = _a.onChange,
42
- selectIndex = _a.selectIndex;
42
+ selectKey = _a.selectKey;
43
43
 
44
44
  var _b = (0, _react.useState)(false),
45
45
  isEdit = _b[0],
@@ -65,7 +65,10 @@ function History(_a) {
65
65
  var newSource = source.filter(function (src, index) {
66
66
  return !selected.includes(index);
67
67
  });
68
- onChange(newSource.length ? newSource : []);
68
+ var newSelectIndex = source.findIndex(function (src) {
69
+ return src.key === selected;
70
+ });
71
+ onChange(newSource.length ? newSource : [], newSelectIndex);
69
72
  setIsEdit(false);
70
73
  };
71
74
 
@@ -104,7 +107,7 @@ function History(_a) {
104
107
  }, source.length > 0 && source.map(function (his, index) {
105
108
  return /*#__PURE__*/_react["default"].createElement("div", {
106
109
  className: (0, _classnames["default"])('historyNode', {
107
- active: selectIndex === index
110
+ active: selectKey === index
108
111
  }),
109
112
  onClick: function onClick() {
110
113
  return onHisItemClick(index);
@@ -68,5 +68,6 @@
68
68
  margin-top: 10px;
69
69
  color: #FF4141;
70
70
  text-align: center;
71
+ font-size: 14px;
71
72
  }
72
73
  }
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _antd = require("antd");
13
13
 
14
+ var _uuid = require("uuid");
15
+
14
16
  var _GenerateSize = _interopRequireDefault(require("./GenerateSize"));
15
17
 
16
18
  var _GenerateArtist = _interopRequireDefault(require("./GenerateArtist"));
@@ -243,12 +245,18 @@ function (_super) {
243
245
 
244
246
  _this.onHisConfigClick = function () {};
245
247
 
246
- _this.historyChange = function (newHis) {
248
+ _this.historyChange = function (newHis, newIndex) {
247
249
  (0, _storeUtil.setSessionStore)(_constants.STORAGE_KEY.FONIXTREE_AI_IMG_HIS, newHis);
248
250
 
249
251
  _this.setState({
250
252
  history: newHis
251
253
  });
254
+
255
+ if (newIndex) {
256
+ _this.setState({
257
+ hisCursor: newIndex
258
+ });
259
+ }
252
260
  };
253
261
 
254
262
  _this.getColumnNum = function (num) {
@@ -338,6 +346,7 @@ function (_super) {
338
346
  case 2:
339
347
  result = _a.sent();
340
348
  history.push({
349
+ key: (0, _uuid.v4)(),
341
350
  images: result.imageList,
342
351
  params: params
343
352
  });
@@ -370,17 +379,17 @@ function (_super) {
370
379
 
371
380
  _this.onRegenerate = function () {
372
381
  return __awaiter(_this, void 0, void 0, function () {
373
- var _a, history, hisCursor, params, result, e_2;
382
+ var _a, history, hisCursor, _b, params, key, result, e_2;
374
383
 
375
- return __generator(this, function (_b) {
376
- switch (_b.label) {
384
+ return __generator(this, function (_c) {
385
+ switch (_c.label) {
377
386
  case 0:
378
387
  _a = this.state, history = _a.history, hisCursor = _a.hisCursor;
379
- params = history[hisCursor].params;
380
- _b.label = 1;
388
+ _b = history[hisCursor], params = _b.params, key = _b.key;
389
+ _c.label = 1;
381
390
 
382
391
  case 1:
383
- _b.trys.push([1, 3,, 4]);
392
+ _c.trys.push([1, 3,, 4]);
384
393
 
385
394
  this.setState({
386
395
  loading: true
@@ -390,8 +399,9 @@ function (_super) {
390
399
  , (0, _commonUtil.commonFetch)('/designer/v1/ai/create-image', params, 'POST')];
391
400
 
392
401
  case 2:
393
- result = _b.sent();
402
+ result = _c.sent();
394
403
  history[hisCursor] = {
404
+ key: key,
395
405
  images: result.imageList,
396
406
  params: params
397
407
  };
@@ -404,7 +414,7 @@ function (_super) {
404
414
  , 4];
405
415
 
406
416
  case 3:
407
- e_2 = _b.sent();
417
+ e_2 = _c.sent();
408
418
  this.setState({
409
419
  loading: false
410
420
  });
@@ -577,14 +587,18 @@ function (_super) {
577
587
  };
578
588
 
579
589
  AiImageGenerator.prototype.render = function () {
580
- var _a;
581
-
582
- var _b = this.state,
583
- loading = _b.loading,
584
- history = _b.history,
585
- hisCursor = _b.hisCursor;
590
+ var _a = this.state,
591
+ loading = _a.loading,
592
+ history = _a.history,
593
+ hisCursor = _a.hisCursor;
586
594
  var visible = this.props.visible;
587
- var images = ((_a = history[hisCursor]) === null || _a === void 0 ? void 0 : _a.images) || [];
595
+
596
+ var _b = history[hisCursor] || {},
597
+ _c = _b.images,
598
+ images = _c === void 0 ? [] : _c,
599
+ _d = _b.key,
600
+ key = _d === void 0 ? '' : _d;
601
+
588
602
  var columnNum = this.getColumnNum(images.length || []);
589
603
  return /*#__PURE__*/_react["default"].createElement(_antd.Drawer, {
590
604
  bodyStyle: {
@@ -699,7 +713,7 @@ function (_super) {
699
713
  }))), /*#__PURE__*/_react["default"].createElement(_History["default"], {
700
714
  onChange: this.historyChange,
701
715
  onClick: this.onHistoryClick,
702
- selectIndex: hisCursor,
716
+ selectKey: key,
703
717
  source: history
704
718
  }))));
705
719
  };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getDefaultJSON = void 0;
7
+
8
+ var _uuid = require("uuid");
9
+
10
+ var getDefaultJSON = function getDefaultJSON() {
11
+ return {
12
+ id: (0, _uuid.v4)(),
13
+ type: 'CUSTOM_CODE',
14
+ content: {
15
+ pcHtml: '',
16
+ h5Html: ''
17
+ },
18
+ spacing: {
19
+ pc: {
20
+ paddingTop: 10,
21
+ paddingBottom: 10,
22
+ marginBottom: 0
23
+ },
24
+ mobile: {
25
+ paddingTop: 10,
26
+ paddingBottom: 10,
27
+ marginBottom: 0
28
+ }
29
+ },
30
+ background: {
31
+ opacity: 100,
32
+ color: '#fff',
33
+ image: '',
34
+ bgType: 'color'
35
+ }
36
+ };
37
+ };
38
+
39
+ exports.getDefaultJSON = getDefaultJSON;
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _defaultJSON = require("./defaultJSON");
11
+
12
+ var _compositeDecorator = _interopRequireDefault(require("../../../../decorator/compositeDecorator"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+
16
+ 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); }
17
+
18
+ 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; }
19
+
20
+ 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); }
21
+
22
+ var __extends = void 0 && (void 0).__extends || function () {
23
+ var _extendStatics = function extendStatics(d, b) {
24
+ _extendStatics = Object.setPrototypeOf || {
25
+ __proto__: []
26
+ } instanceof Array && function (d, b) {
27
+ d.__proto__ = b;
28
+ } || function (d, b) {
29
+ for (var p in b) {
30
+ if (b.hasOwnProperty(p)) d[p] = b[p];
31
+ }
32
+ };
33
+
34
+ return _extendStatics(d, b);
35
+ };
36
+
37
+ return function (d, b) {
38
+ _extendStatics(d, b);
39
+
40
+ function __() {
41
+ this.constructor = d;
42
+ }
43
+
44
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45
+ };
46
+ }();
47
+
48
+ var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
49
+ var c = arguments.length,
50
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
51
+ d;
52
+ if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
53
+ if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
54
+ }
55
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
56
+ };
57
+
58
+ var CustomCode =
59
+ /** @class */
60
+ function (_super) {
61
+ __extends(CustomCode, _super);
62
+
63
+ function CustomCode() {
64
+ var _this = _super !== null && _super.apply(this, arguments) || this;
65
+
66
+ _this.htmlTemp = '';
67
+
68
+ _this.createHtml = function () {
69
+ var nodeData = _this.props.nodeData;
70
+ console.log('----nodeData', nodeData);
71
+ var htmlCode = window.magicDesign.device === 'pc' ? nodeData.content.pcHtml : nodeData.content.h5Html;
72
+ _this.htmlTemp = htmlCode;
73
+
74
+ if (document.getElementById('custom-wrap')) {
75
+ document.getElementById('custom-wrap').innerHTML = htmlCode;
76
+ }
77
+ };
78
+
79
+ return _this;
80
+ }
81
+
82
+ CustomCode.prototype.componentDidMount = function () {
83
+ this.createHtml();
84
+ };
85
+
86
+ CustomCode.prototype.componentWillReceiveProps = function (prevProps) {
87
+ console.log('111111');
88
+
89
+ if (window.magicDesign.device === 'pc') {
90
+ console.log('22222222');
91
+
92
+ if (prevProps.nodeData.content.pcHtml != this.props.nodeData.content.pcHtml) {
93
+ console.log('4444444');
94
+ this.createHtml();
95
+ }
96
+ } else {
97
+ console.log('3333333333', this.htmlTemp, this.props.nodeData.content);
98
+
99
+ if (this.htmlTemp != this.props.nodeData.content.h5Html) {
100
+ console.log('5555555');
101
+ this.createHtml();
102
+ }
103
+ }
104
+ };
105
+
106
+ CustomCode.prototype.render = function () {
107
+ // const { nodeData } = this.props;
108
+ // console.log('----nodeData', nodeData);
109
+ return (
110
+ /*#__PURE__*/
111
+ // <div dangerouslySetInnerHTML={{ __html: window.magicDesign.device === 'pc' ? nodeData.content.pcHtml : nodeData.content.h5Html }} />
112
+ _react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
113
+ id: "custom-wrap"
114
+ }), /*#__PURE__*/_react["default"].createElement("a", {
115
+ href: "https://www.baidu.com"
116
+ }, "baidu11 "))
117
+ );
118
+ };
119
+
120
+ CustomCode.defaultProps = {};
121
+ CustomCode.type = 'CUSTOM_CODE';
122
+ CustomCode.getDefaultJSON = _defaultJSON.getDefaultJSON;
123
+ CustomCode = __decorate([_compositeDecorator["default"]], CustomCode);
124
+ return CustomCode;
125
+ }(_react.Component);
126
+
127
+ var _default = CustomCode;
128
+ exports["default"] = _default;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _reactAce = _interopRequireDefault(require("react-ace"));
11
+
12
+ require("ace-builds/src-noconflict/mode-html");
13
+
14
+ require("ace-builds/src-noconflict/mode-javascript");
15
+
16
+ require("ace-builds/src-noconflict/theme-github");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
20
+ // 可选的主题样式
21
+ var MyEditor = function MyEditor(props) {
22
+ var value = props.value,
23
+ changeVal = props.changeVal,
24
+ blurArea = props.blurArea;
25
+ return /*#__PURE__*/_react["default"].createElement(_reactAce["default"], {
26
+ editorProps: {
27
+ $blockScrolling: true
28
+ },
29
+ mode: "html",
30
+ name: "editor",
31
+ onBlur: blurArea,
32
+ onChange: changeVal,
33
+ style: {
34
+ width: '100%'
35
+ },
36
+ theme: "github",
37
+ value: value
38
+ });
39
+ };
40
+
41
+ var _default = MyEditor;
42
+ exports["default"] = _default;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _MyEditor = _interopRequireDefault(require("./MyEditor"));
11
+
12
+ var _coreUtil = require("../../../../utils/coreUtil");
13
+
14
+ var _Collapse = _interopRequireDefault(require("../../../../common/Collapse"));
15
+
16
+ var _BackgroundConfig = _interopRequireDefault(require("../../../common/config-panels/BackgroundConfig"));
17
+
18
+ var _locale = require("../../../../locale");
19
+
20
+ var _BaseConfig = _interopRequireDefault(require("../../../../meta-comp/config-panels/BaseConfig"));
21
+
22
+ var _SpacingConfig = _interopRequireDefault(require("../../../common/config-panels/SpacingConfig"));
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
+
26
+ var __extends = void 0 && (void 0).__extends || function () {
27
+ var _extendStatics = function extendStatics(d, b) {
28
+ _extendStatics = Object.setPrototypeOf || {
29
+ __proto__: []
30
+ } instanceof Array && function (d, b) {
31
+ d.__proto__ = b;
32
+ } || function (d, b) {
33
+ for (var p in b) {
34
+ if (b.hasOwnProperty(p)) d[p] = b[p];
35
+ }
36
+ };
37
+
38
+ return _extendStatics(d, b);
39
+ };
40
+
41
+ return function (d, b) {
42
+ _extendStatics(d, b);
43
+
44
+ function __() {
45
+ this.constructor = d;
46
+ }
47
+
48
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
49
+ };
50
+ }();
51
+
52
+ var CustomCodeConfig =
53
+ /** @class */
54
+ function (_super) {
55
+ __extends(CustomCodeConfig, _super);
56
+
57
+ function CustomCodeConfig() {
58
+ var _this = _super !== null && _super.apply(this, arguments) || this;
59
+
60
+ _this.changeVal = function (v) {
61
+ var data = _this.props.data;
62
+
63
+ if ((0, _coreUtil.isPc)()) {
64
+ data.content.pcHtml = v;
65
+ } else {
66
+ data.content.h5Html = v;
67
+ }
68
+ };
69
+
70
+ _this.blurArea = function () {
71
+ _this.selfRender();
72
+ };
73
+
74
+ return _this;
75
+ }
76
+
77
+ CustomCodeConfig.prototype.render = function () {
78
+ var data = this.props.data;
79
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Collapse["default"], {
80
+ divider: "bold",
81
+ headerSize: "large",
82
+ source: [{
83
+ key: 'content',
84
+ name: (0, _locale.i18n)('CONTENT'),
85
+ value: /*#__PURE__*/_react["default"].createElement(_MyEditor["default"], {
86
+ blurArea: this.blurArea,
87
+ changeVal: this.changeVal,
88
+ value: (0, _coreUtil.isPc)() ? data.content.pcHtml : data.content.h5Html
89
+ })
90
+ }, {
91
+ key: 'spacing',
92
+ name: (0, _locale.i18n)('SPACING'),
93
+ value: /*#__PURE__*/_react["default"].createElement(_SpacingConfig["default"], {
94
+ data: data.spacing
95
+ })
96
+ }, {
97
+ key: 'background',
98
+ name: (0, _locale.i18n)('BACKGROUND'),
99
+ value: /*#__PURE__*/_react["default"].createElement(_BackgroundConfig["default"], {
100
+ data: data.background
101
+ })
102
+ }],
103
+ type: "triangle"
104
+ }));
105
+ };
106
+
107
+ return CustomCodeConfig;
108
+ }(_BaseConfig["default"]);
109
+
110
+ var _default = CustomCodeConfig;
111
+ exports["default"] = _default;
@@ -27,6 +27,8 @@ var _Video = _interopRequireDefault(require("../composite-comp/bol/components/Vi
27
27
 
28
28
  var _Wallet = _interopRequireDefault(require("../composite-comp/bol/components/Wallet"));
29
29
 
30
+ var _CustomCode = _interopRequireDefault(require("../composite-comp/bol/components/CustomCode"));
31
+
30
32
  var _FlashDeal = _interopRequireDefault(require("../composite-comp/dito/components/FlashDeal"));
31
33
 
32
34
  var _SearchBar = _interopRequireDefault(require("../composite-comp/dito/components/SearchBar"));
@@ -59,6 +61,8 @@ var _TagCompConfig = _interopRequireDefault(require("../composite-comp/bol/confi
59
61
 
60
62
  var _VideoConfig = _interopRequireDefault(require("../composite-comp/bol/config-panels/VideoConfig"));
61
63
 
64
+ var _CustomCodeConfig = _interopRequireDefault(require("../composite-comp/bol/config-panels/CustomCodeConfig"));
65
+
62
66
  var _WalletConfig = _interopRequireDefault(require("../composite-comp/bol/config-panels/WalletConfig"));
63
67
 
64
68
  var _FlashDealConfig = _interopRequireDefault(require("../composite-comp/dito/config-panels/FlashDealConfig"));
@@ -105,13 +109,13 @@ var _a, _b, _c; // 组件
105
109
  /**
106
110
  * 渲染组件索引
107
111
  */
108
- var componentMap = (_a = {}, _a[_Banner["default"].type] = _Banner["default"], _a[_Video["default"].type] = _Video["default"], _a[_Text["default"].type] = _Text["default"], _a[_FlashDeal["default"].type] = _FlashDeal["default"], _a[_SearchBar["default"].type] = _SearchBar["default"], _a[_SignBoard["default"].type] = _SignBoard["default"], _a[_ImageText["default"].type] = _ImageText["default"], _a[_Recommend["default"].type] = _Recommend["default"], _a[_MobileNavigation["default"].type] = _MobileNavigation["default"], _a[_PcNavigation["default"].type] = _PcNavigation["default"], _a[_Divider["default"].type] = _Divider["default"], _a[_ImageGallery["default"].type] = _ImageGallery["default"], _a[_Newsletter["default"].type] = _Newsletter["default"], _a[_Carousel["default"].type] = _Carousel["default"], _a[_Button["default"].type] = _Button["default"], _a[_Tag["default"].type] = _Tag["default"], _a[_Wallet["default"].type] = _Wallet["default"], _a);
112
+ var componentMap = (_a = {}, _a[_Banner["default"].type] = _Banner["default"], _a[_Video["default"].type] = _Video["default"], _a[_Text["default"].type] = _Text["default"], _a[_FlashDeal["default"].type] = _FlashDeal["default"], _a[_SearchBar["default"].type] = _SearchBar["default"], _a[_SignBoard["default"].type] = _SignBoard["default"], _a[_ImageText["default"].type] = _ImageText["default"], _a[_Recommend["default"].type] = _Recommend["default"], _a[_MobileNavigation["default"].type] = _MobileNavigation["default"], _a[_PcNavigation["default"].type] = _PcNavigation["default"], _a[_Divider["default"].type] = _Divider["default"], _a[_ImageGallery["default"].type] = _ImageGallery["default"], _a[_Newsletter["default"].type] = _Newsletter["default"], _a[_Carousel["default"].type] = _Carousel["default"], _a[_Button["default"].type] = _Button["default"], _a[_Tag["default"].type] = _Tag["default"], _a[_Wallet["default"].type] = _Wallet["default"], _a[_CustomCode["default"].type] = _CustomCode["default"], _a);
109
113
  /**
110
114
  * 一级配置面板索引
111
115
  */
112
116
 
113
117
  exports.componentMap = componentMap;
114
- var configPanelMap = (_b = {}, _b[_Banner["default"].type] = _BannerConfig["default"], _b[_Video["default"].type] = _VideoConfig["default"], _b[_Text["default"].type] = _TextCompConfig["default"], _b[_FlashDeal["default"].type] = _FlashDealConfig["default"], _b[_SearchBar["default"].type] = _SearchBarConfig["default"], _b[_SignBoard["default"].type] = _SignBoardConfig["default"], _b[_ImageText["default"].type] = _ImageTextConfig["default"], _b[_Recommend["default"].type] = _RecommendConfig["default"], _b[_MobileNavigation["default"].type] = _MobileNavigationConfig["default"], _b[_PcNavigation["default"].type] = _PcNavigationConfig["default"], _b[_Divider["default"].type] = _DividerConfig["default"], _b[_ImageGallery["default"].type] = _ImageGalleryConfig["default"], _b[_Newsletter["default"].type] = _NewsletterConfig["default"], _b[_Carousel["default"].type] = _CarouselConfig["default"], _b[_Button["default"].type] = _ButtonCompConfig["default"], _b[_Tag["default"].type] = _TagCompConfig["default"], _b[_Wallet["default"].type] = _WalletConfig["default"], _b);
118
+ var configPanelMap = (_b = {}, _b[_Banner["default"].type] = _BannerConfig["default"], _b[_Video["default"].type] = _VideoConfig["default"], _b[_Text["default"].type] = _TextCompConfig["default"], _b[_FlashDeal["default"].type] = _FlashDealConfig["default"], _b[_SearchBar["default"].type] = _SearchBarConfig["default"], _b[_SignBoard["default"].type] = _SignBoardConfig["default"], _b[_ImageText["default"].type] = _ImageTextConfig["default"], _b[_Recommend["default"].type] = _RecommendConfig["default"], _b[_MobileNavigation["default"].type] = _MobileNavigationConfig["default"], _b[_PcNavigation["default"].type] = _PcNavigationConfig["default"], _b[_Divider["default"].type] = _DividerConfig["default"], _b[_ImageGallery["default"].type] = _ImageGalleryConfig["default"], _b[_Newsletter["default"].type] = _NewsletterConfig["default"], _b[_Carousel["default"].type] = _CarouselConfig["default"], _b[_Button["default"].type] = _ButtonCompConfig["default"], _b[_Tag["default"].type] = _TagCompConfig["default"], _b[_Wallet["default"].type] = _WalletConfig["default"], _b[_CustomCode["default"].type] = _CustomCodeConfig["default"], _b);
115
119
  /**
116
120
  * 二级配置面板索引
117
121
  */
@@ -129,6 +129,10 @@ var compInfoMap = {
129
129
  name: 'Image and Text',
130
130
  icon: 'icon-filled-image'
131
131
  },
132
+ CUSTOM_CODE: {
133
+ name: 'Custom Code',
134
+ icon: 'icon-html'
135
+ },
132
136
  RECOMMEND: {
133
137
  name: 'Recommend',
134
138
  icon: 'icon-forms'
@@ -39,7 +39,7 @@ function History(_a) {
39
39
  var source = _a.source,
40
40
  onClick = _a.onClick,
41
41
  onChange = _a.onChange,
42
- selectIndex = _a.selectIndex;
42
+ selectKey = _a.selectKey;
43
43
 
44
44
  var _b = (0, _react.useState)(false),
45
45
  isEdit = _b[0],
@@ -65,7 +65,10 @@ function History(_a) {
65
65
  var newSource = source.filter(function (src, index) {
66
66
  return !selected.includes(index);
67
67
  });
68
- onChange(newSource.length ? newSource : []);
68
+ var newSelectIndex = source.findIndex(function (src) {
69
+ return src.key === selected;
70
+ });
71
+ onChange(newSource.length ? newSource : [], newSelectIndex);
69
72
  setIsEdit(false);
70
73
  };
71
74
 
@@ -104,7 +107,7 @@ function History(_a) {
104
107
  }, source.length > 0 && source.map(function (his, index) {
105
108
  return /*#__PURE__*/_react["default"].createElement("div", {
106
109
  className: (0, _classnames["default"])('historyNode', {
107
- active: selectIndex === index
110
+ active: selectKey === index
108
111
  }),
109
112
  onClick: function onClick() {
110
113
  return onHisItemClick(index);
@@ -68,5 +68,6 @@
68
68
  margin-top: 10px;
69
69
  color: #FF4141;
70
70
  text-align: center;
71
+ font-size: 14px;
71
72
  }
72
73
  }
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _antd = require("antd");
13
13
 
14
+ var _uuid = require("uuid");
15
+
14
16
  var _GenerateSize = _interopRequireDefault(require("./GenerateSize"));
15
17
 
16
18
  var _GenerateArtist = _interopRequireDefault(require("./GenerateArtist"));
@@ -243,12 +245,18 @@ function (_super) {
243
245
 
244
246
  _this.onHisConfigClick = function () {};
245
247
 
246
- _this.historyChange = function (newHis) {
248
+ _this.historyChange = function (newHis, newIndex) {
247
249
  (0, _storeUtil.setSessionStore)(_constants.STORAGE_KEY.FONIXTREE_AI_IMG_HIS, newHis);
248
250
 
249
251
  _this.setState({
250
252
  history: newHis
251
253
  });
254
+
255
+ if (newIndex) {
256
+ _this.setState({
257
+ hisCursor: newIndex
258
+ });
259
+ }
252
260
  };
253
261
 
254
262
  _this.getColumnNum = function (num) {
@@ -338,6 +346,7 @@ function (_super) {
338
346
  case 2:
339
347
  result = _a.sent();
340
348
  history.push({
349
+ key: (0, _uuid.v4)(),
341
350
  images: result.imageList,
342
351
  params: params
343
352
  });
@@ -370,17 +379,17 @@ function (_super) {
370
379
 
371
380
  _this.onRegenerate = function () {
372
381
  return __awaiter(_this, void 0, void 0, function () {
373
- var _a, history, hisCursor, params, result, e_2;
382
+ var _a, history, hisCursor, _b, params, key, result, e_2;
374
383
 
375
- return __generator(this, function (_b) {
376
- switch (_b.label) {
384
+ return __generator(this, function (_c) {
385
+ switch (_c.label) {
377
386
  case 0:
378
387
  _a = this.state, history = _a.history, hisCursor = _a.hisCursor;
379
- params = history[hisCursor].params;
380
- _b.label = 1;
388
+ _b = history[hisCursor], params = _b.params, key = _b.key;
389
+ _c.label = 1;
381
390
 
382
391
  case 1:
383
- _b.trys.push([1, 3,, 4]);
392
+ _c.trys.push([1, 3,, 4]);
384
393
 
385
394
  this.setState({
386
395
  loading: true
@@ -390,8 +399,9 @@ function (_super) {
390
399
  , (0, _commonUtil.commonFetch)('/designer/v1/ai/create-image', params, 'POST')];
391
400
 
392
401
  case 2:
393
- result = _b.sent();
402
+ result = _c.sent();
394
403
  history[hisCursor] = {
404
+ key: key,
395
405
  images: result.imageList,
396
406
  params: params
397
407
  };
@@ -404,7 +414,7 @@ function (_super) {
404
414
  , 4];
405
415
 
406
416
  case 3:
407
- e_2 = _b.sent();
417
+ e_2 = _c.sent();
408
418
  this.setState({
409
419
  loading: false
410
420
  });
@@ -577,14 +587,18 @@ function (_super) {
577
587
  };
578
588
 
579
589
  AiImageGenerator.prototype.render = function () {
580
- var _a;
581
-
582
- var _b = this.state,
583
- loading = _b.loading,
584
- history = _b.history,
585
- hisCursor = _b.hisCursor;
590
+ var _a = this.state,
591
+ loading = _a.loading,
592
+ history = _a.history,
593
+ hisCursor = _a.hisCursor;
586
594
  var visible = this.props.visible;
587
- var images = ((_a = history[hisCursor]) === null || _a === void 0 ? void 0 : _a.images) || [];
595
+
596
+ var _b = history[hisCursor] || {},
597
+ _c = _b.images,
598
+ images = _c === void 0 ? [] : _c,
599
+ _d = _b.key,
600
+ key = _d === void 0 ? '' : _d;
601
+
588
602
  var columnNum = this.getColumnNum(images.length || []);
589
603
  return /*#__PURE__*/_react["default"].createElement(_antd.Drawer, {
590
604
  bodyStyle: {
@@ -699,7 +713,7 @@ function (_super) {
699
713
  }))), /*#__PURE__*/_react["default"].createElement(_History["default"], {
700
714
  onChange: this.historyChange,
701
715
  onClick: this.onHistoryClick,
702
- selectIndex: hisCursor,
716
+ selectKey: key,
703
717
  source: history
704
718
  }))));
705
719
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "2.0.10",
4
+ "version": "2.0.12",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",
@@ -32,6 +32,7 @@
32
32
  "moment": "2.29.3",
33
33
  "postcss-pxtorem": "^6.0.0",
34
34
  "ramda": "^0.28.0",
35
+ "react-ace": "^10.1.0",
35
36
  "react-color": "2.17.0",
36
37
  "react-router-dom": "5.3.0",
37
38
  "react-slick": "^0.29.0",