@fonixtree/magic-design 0.0.177 → 0.0.179

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.
@@ -83,8 +83,7 @@ function (_super) {
83
83
  var _this = this;
84
84
 
85
85
  var data = this.props.data; // const { ready } = this.state;
86
-
87
- console.log('----nav mobile', data); // if (data.background.bgType === 'color') {
86
+ // if (data.background.bgType === 'color') {
88
87
  // wrapStyle.backgroundColor = data.background.color;
89
88
  // wrapStyle.opacity = data.background.opacity ? data.background.opacity : 1;
90
89
  // } else {
@@ -1,8 +1,8 @@
1
1
  .config_wrap {
2
2
  width: 354px;
3
3
  background: #ffffff;
4
- height: 100vh;
5
- overflow: scroll;
4
+ max-height: 100vh;
5
+ // overflow: scroll;
6
6
  transition-property: transform;
7
7
  transition-duration: .3s;
8
8
  transition-timing-function: ease;
@@ -20,6 +20,8 @@
20
20
  .first_config_wrap {
21
21
  height: 100%;
22
22
  padding: 24px;
23
+ height: 100vh;
24
+ overflow: auto;
23
25
 
24
26
  .config_header {
25
27
  font-size: 26px;
@@ -48,7 +50,10 @@
48
50
 
49
51
  .sec_config_wrap {
50
52
  position: absolute;
53
+ height: 100vh;
54
+ overflow: auto;
51
55
  width: 354px;
56
+ z-index: 201;
52
57
  left: -354px;
53
58
  bottom: 0;
54
59
  top: 0;
@@ -78,6 +78,7 @@ function (_super) {
78
78
  return /*#__PURE__*/_react["default"].createElement("div", {
79
79
  id: "render-html-wrap"
80
80
  }, /*#__PURE__*/_react["default"].createElement(_Renderer["default"], _extends({}, renderProps, {
81
+ noSetWindow: true,
81
82
  outputType: "html"
82
83
  })));
83
84
  };
@@ -174,7 +174,8 @@ function (_super) {
174
174
  }
175
175
 
176
176
  var newInstanceProps = {
177
- nodeData: nodeData
177
+ nodeData: nodeData,
178
+ mode: 'designer'
178
179
  };
179
180
  return /*#__PURE__*/_react["default"].createElement("div", {
180
181
  key: nodeData.id,
@@ -59,9 +59,13 @@ var setDesignConfig = function setDesignConfig(props) {
59
59
 
60
60
  var Renderer = function Renderer(props) {
61
61
  var pageData = props.pageData,
62
- outputType = props.outputType; // console.log('pageData: ', pageData);
62
+ outputType = props.outputType,
63
+ noSetWindow = props.noSetWindow; // console.log('pageData: ', pageData);
64
+
65
+ if (!noSetWindow) {
66
+ setDesignConfig(props);
67
+ }
63
68
 
64
- setDesignConfig(props);
65
69
  window.magicDesignPageData = pageData;
66
70
  var pageBackground = window.magicDesign.pageBackground; // 根据楼层展示设备进行过滤
67
71
 
@@ -322,9 +322,11 @@ function (_super) {
322
322
  node.appendChild(closeNode);
323
323
  };
324
324
 
325
- _this.renderText = function (data) {
326
- var mode = window.magicDesign.mode;
325
+ _this.renderText = function (data, mode) {
327
326
  var outputType = _this.props.outputType || window.magicDesign.outputType;
327
+
328
+ var _mode = mode || window.magicDesign.mode;
329
+
328
330
  if (!_this.textRef.current) return;
329
331
 
330
332
  _this.textRef.current.blur();
@@ -337,7 +339,7 @@ function (_super) {
337
339
  /** 渲染html */
338
340
 
339
341
  if (data.specialContent.length == 0) {
340
- if (outputType == 'html' && mode == 'renderer') {
342
+ if (outputType == 'html' && _mode == 'renderer') {
341
343
  if (data === null || data === void 0 ? void 0 : data.content.clickUrl) {
342
344
  var a = document.createElement('a');
343
345
  a.href = data.content.clickUrl;
@@ -361,12 +363,12 @@ function (_super) {
361
363
  node.style = (0, _commonUtil.styleStringify)(contentStyle(c.content));
362
364
 
363
365
  if (c === null || c === void 0 ? void 0 : c.content.clickUrl) {
364
- if (outputType == 'html' && mode == 'renderer') {
366
+ if (outputType == 'html' && _mode == 'renderer') {
365
367
  var a = document.createElement('a');
366
368
  a.href = c.content.clickUrl;
367
369
  a.target = '_blank';
368
370
 
369
- if (mode == 'designer') {
371
+ if (_mode == 'designer') {
370
372
  a.onclick = function (e) {
371
373
  e.preventDefault();
372
374
  };
@@ -441,14 +443,14 @@ function (_super) {
441
443
  Text.prototype.componentDidMount = function () {
442
444
  var _this = this;
443
445
 
444
- this.renderText(this.props.data);
446
+ this.renderText(this.props.data, this.props.mode);
445
447
  initSelectionEvent();
446
448
  appendSelectionTarget({
447
449
  target: this.textRef.current,
448
450
  data: this.props.data,
449
451
  selectionRefMap: this.selectionRefMap,
450
452
  refresh: function refresh() {
451
- _this.renderText(_this.props.data);
453
+ _this.renderText(_this.props.data, _this.props.mode);
452
454
  }
453
455
  });
454
456
  };
@@ -460,7 +462,7 @@ function (_super) {
460
462
  var result = should1 || should2 || should3;
461
463
 
462
464
  if (result) {
463
- this.renderText(nextProps.data);
465
+ this.renderText(nextProps.data, nextProps.mode);
464
466
  }
465
467
 
466
468
  return result;
@@ -477,8 +479,11 @@ function (_super) {
477
479
  data = _a.data,
478
480
  className = _a.className,
479
481
  readonly = _a.readonly,
480
- onTextInput = _a.onTextInput;
481
- var mode = window.magicDesign.mode;
482
+ onTextInput = _a.onTextInput,
483
+ mode = _a.mode;
484
+
485
+ var _mode = mode || window.magicDesign.mode;
486
+
482
487
  var style = contentStyle(data.content);
483
488
 
484
489
  if (data.underline) {
@@ -507,7 +512,7 @@ function (_super) {
507
512
  return /*#__PURE__*/_react["default"].createElement("div", {
508
513
  ref: this.textRef,
509
514
  className: (0, _classnames["default"])('m-meta-text', className),
510
- contentEditable: mode == 'designer' && !readonly,
515
+ contentEditable: _mode == 'designer' && !readonly,
511
516
  onClick: function onClick() {
512
517
  (0, _coreUtil.clickUrl)(data.content.clickUrl);
513
518
  },
@@ -367,7 +367,7 @@ var copyNode = function copyNode(value, parentId) {
367
367
  if (name === 'parentId') {
368
368
  newNode.parentId = parentId;
369
369
  } else {
370
- newNode[name] = copyNode(value[name], newNode.id);
370
+ newNode[name] = copyNode(value[name], newNode.id || parentId);
371
371
  }
372
372
  });
373
373
  return newNode;
@@ -83,8 +83,7 @@ function (_super) {
83
83
  var _this = this;
84
84
 
85
85
  var data = this.props.data; // const { ready } = this.state;
86
-
87
- console.log('----nav mobile', data); // if (data.background.bgType === 'color') {
86
+ // if (data.background.bgType === 'color') {
88
87
  // wrapStyle.backgroundColor = data.background.color;
89
88
  // wrapStyle.opacity = data.background.opacity ? data.background.opacity : 1;
90
89
  // } else {
@@ -1,8 +1,8 @@
1
1
  .config_wrap {
2
2
  width: 354px;
3
3
  background: #ffffff;
4
- height: 100vh;
5
- overflow: scroll;
4
+ max-height: 100vh;
5
+ // overflow: scroll;
6
6
  transition-property: transform;
7
7
  transition-duration: .3s;
8
8
  transition-timing-function: ease;
@@ -20,6 +20,8 @@
20
20
  .first_config_wrap {
21
21
  height: 100%;
22
22
  padding: 24px;
23
+ height: 100vh;
24
+ overflow: auto;
23
25
 
24
26
  .config_header {
25
27
  font-size: 26px;
@@ -48,7 +50,10 @@
48
50
 
49
51
  .sec_config_wrap {
50
52
  position: absolute;
53
+ height: 100vh;
54
+ overflow: auto;
51
55
  width: 354px;
56
+ z-index: 201;
52
57
  left: -354px;
53
58
  bottom: 0;
54
59
  top: 0;
@@ -78,6 +78,7 @@ function (_super) {
78
78
  return /*#__PURE__*/_react["default"].createElement("div", {
79
79
  id: "render-html-wrap"
80
80
  }, /*#__PURE__*/_react["default"].createElement(_Renderer["default"], _extends({}, renderProps, {
81
+ noSetWindow: true,
81
82
  outputType: "html"
82
83
  })));
83
84
  };
@@ -174,7 +174,8 @@ function (_super) {
174
174
  }
175
175
 
176
176
  var newInstanceProps = {
177
- nodeData: nodeData
177
+ nodeData: nodeData,
178
+ mode: 'designer'
178
179
  };
179
180
  return /*#__PURE__*/_react["default"].createElement("div", {
180
181
  key: nodeData.id,
@@ -59,9 +59,13 @@ var setDesignConfig = function setDesignConfig(props) {
59
59
 
60
60
  var Renderer = function Renderer(props) {
61
61
  var pageData = props.pageData,
62
- outputType = props.outputType; // console.log('pageData: ', pageData);
62
+ outputType = props.outputType,
63
+ noSetWindow = props.noSetWindow; // console.log('pageData: ', pageData);
64
+
65
+ if (!noSetWindow) {
66
+ setDesignConfig(props);
67
+ }
63
68
 
64
- setDesignConfig(props);
65
69
  window.magicDesignPageData = pageData;
66
70
  var pageBackground = window.magicDesign.pageBackground; // 根据楼层展示设备进行过滤
67
71
 
@@ -322,9 +322,11 @@ function (_super) {
322
322
  node.appendChild(closeNode);
323
323
  };
324
324
 
325
- _this.renderText = function (data) {
326
- var mode = window.magicDesign.mode;
325
+ _this.renderText = function (data, mode) {
327
326
  var outputType = _this.props.outputType || window.magicDesign.outputType;
327
+
328
+ var _mode = mode || window.magicDesign.mode;
329
+
328
330
  if (!_this.textRef.current) return;
329
331
 
330
332
  _this.textRef.current.blur();
@@ -337,7 +339,7 @@ function (_super) {
337
339
  /** 渲染html */
338
340
 
339
341
  if (data.specialContent.length == 0) {
340
- if (outputType == 'html' && mode == 'renderer') {
342
+ if (outputType == 'html' && _mode == 'renderer') {
341
343
  if (data === null || data === void 0 ? void 0 : data.content.clickUrl) {
342
344
  var a = document.createElement('a');
343
345
  a.href = data.content.clickUrl;
@@ -361,12 +363,12 @@ function (_super) {
361
363
  node.style = (0, _commonUtil.styleStringify)(contentStyle(c.content));
362
364
 
363
365
  if (c === null || c === void 0 ? void 0 : c.content.clickUrl) {
364
- if (outputType == 'html' && mode == 'renderer') {
366
+ if (outputType == 'html' && _mode == 'renderer') {
365
367
  var a = document.createElement('a');
366
368
  a.href = c.content.clickUrl;
367
369
  a.target = '_blank';
368
370
 
369
- if (mode == 'designer') {
371
+ if (_mode == 'designer') {
370
372
  a.onclick = function (e) {
371
373
  e.preventDefault();
372
374
  };
@@ -441,14 +443,14 @@ function (_super) {
441
443
  Text.prototype.componentDidMount = function () {
442
444
  var _this = this;
443
445
 
444
- this.renderText(this.props.data);
446
+ this.renderText(this.props.data, this.props.mode);
445
447
  initSelectionEvent();
446
448
  appendSelectionTarget({
447
449
  target: this.textRef.current,
448
450
  data: this.props.data,
449
451
  selectionRefMap: this.selectionRefMap,
450
452
  refresh: function refresh() {
451
- _this.renderText(_this.props.data);
453
+ _this.renderText(_this.props.data, _this.props.mode);
452
454
  }
453
455
  });
454
456
  };
@@ -460,7 +462,7 @@ function (_super) {
460
462
  var result = should1 || should2 || should3;
461
463
 
462
464
  if (result) {
463
- this.renderText(nextProps.data);
465
+ this.renderText(nextProps.data, nextProps.mode);
464
466
  }
465
467
 
466
468
  return result;
@@ -477,8 +479,11 @@ function (_super) {
477
479
  data = _a.data,
478
480
  className = _a.className,
479
481
  readonly = _a.readonly,
480
- onTextInput = _a.onTextInput;
481
- var mode = window.magicDesign.mode;
482
+ onTextInput = _a.onTextInput,
483
+ mode = _a.mode;
484
+
485
+ var _mode = mode || window.magicDesign.mode;
486
+
482
487
  var style = contentStyle(data.content);
483
488
 
484
489
  if (data.underline) {
@@ -507,7 +512,7 @@ function (_super) {
507
512
  return /*#__PURE__*/_react["default"].createElement("div", {
508
513
  ref: this.textRef,
509
514
  className: (0, _classnames["default"])('m-meta-text', className),
510
- contentEditable: mode == 'designer' && !readonly,
515
+ contentEditable: _mode == 'designer' && !readonly,
511
516
  onClick: function onClick() {
512
517
  (0, _coreUtil.clickUrl)(data.content.clickUrl);
513
518
  },
@@ -367,7 +367,7 @@ var copyNode = function copyNode(value, parentId) {
367
367
  if (name === 'parentId') {
368
368
  newNode.parentId = parentId;
369
369
  } else {
370
- newNode[name] = copyNode(value[name], newNode.id);
370
+ newNode[name] = copyNode(value[name], newNode.id || parentId);
371
371
  }
372
372
  });
373
373
  return newNode;
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.177",
4
+ "version": "0.0.179",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",