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