@easy-editor/react-renderer 0.0.13 → 0.0.15

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.
@@ -1759,6 +1759,15 @@ function baseRendererFactory() {
1759
1759
  * execute method in schema.lifeCycles
1760
1760
  */
1761
1761
  __executeLifeCycleMethod = (method, args) => {
1762
+ // construct 场景下,跳过判断
1763
+ if (this.context) {
1764
+ const {
1765
+ engine
1766
+ } = this.context;
1767
+ if (!engine.props.excuteLifeCycleInDesignMode) {
1768
+ return;
1769
+ }
1770
+ }
1762
1771
  executeLifeCycleMethod(this, this.props.__schema, method, args);
1763
1772
  };
1764
1773
 
@@ -1912,7 +1921,7 @@ function baseRendererFactory() {
1912
1921
  engine
1913
1922
  } = this.context;
1914
1923
  if (engine) {
1915
- engine.props.onCompGetCtx(schema, this);
1924
+ engine.props?.onCompGetCtx?.(schema, this);
1916
1925
  // 画布场景才需要每次渲染bind自定义方法
1917
1926
  if (this.__designModeIsDesign) {
1918
1927
  this.__bindCustomMethods(this.props);
@@ -1929,7 +1938,7 @@ function baseRendererFactory() {
1929
1938
  } = this.props;
1930
1939
  // ref && engine?.props?.onCompGetRef(__schema, ref)
1931
1940
  // TODO: 只在 ref 存在执行,会影响 documentInstance 的卸载
1932
- engine?.props?.onCompGetRef(__schema, ref);
1941
+ engine.props?.onCompGetRef?.(__schema, ref);
1933
1942
  this.__ref = ref;
1934
1943
  };
1935
1944
  __createDom = () => {
@@ -2026,7 +2035,7 @@ function baseRendererFactory() {
2026
2035
  componentId: schema.id,
2027
2036
  enableStrictNotFoundMode: engine.props.enableStrictNotFoundMode,
2028
2037
  ref: ref => {
2029
- ref && engine.props?.onCompGetRef(schema, ref);
2038
+ ref && engine.props?.onCompGetRef?.(schema, ref);
2030
2039
  }
2031
2040
  }, this.__getSchemaChildrenVirtualDom(schema, scope, Comp));
2032
2041
  }
@@ -2101,7 +2110,7 @@ function baseRendererFactory() {
2101
2110
  if (refProps && typeof refProps === 'string') {
2102
2111
  this[refProps] = ref;
2103
2112
  }
2104
- ref && engine.props?.onCompGetRef(schema, ref);
2113
+ ref && engine.props?.onCompGetRef?.(schema, ref);
2105
2114
  };
2106
2115
 
2107
2116
  // scope需要传入到组件上
@@ -2110,7 +2119,7 @@ function baseRendererFactory() {
2110
2119
  // }
2111
2120
  if (schema?.__ctx?.lceKey) {
2112
2121
  if (!isSchema(schema)) {
2113
- engine.props?.onCompGetCtx(schema, scope);
2122
+ engine.props?.onCompGetCtx?.(schema, scope);
2114
2123
  }
2115
2124
  props.key = props.key || `${schema.__ctx.lceKey}_${schema.__ctx.idx || 0}_${idx !== undefined ? idx : ''}`;
2116
2125
  } else if ((typeof idx === 'number' || typeof idx === 'string') && !props.key) {
@@ -2595,7 +2604,8 @@ function rendererFactory() {
2595
2604
  suspended: false,
2596
2605
  schema: {},
2597
2606
  onCompGetRef: () => {},
2598
- onCompGetCtx: () => {}
2607
+ onCompGetCtx: () => {},
2608
+ excuteLifeCycleInDesignMode: false
2599
2609
  };
2600
2610
  constructor(props) {
2601
2611
  super(props);