Commit a43ae78771188f4eaf1ce58593988d5827a4c056
1 parent
623d7fa1
fix: check element property before clone
Showing
1 changed file
with
2 additions
and
2 deletions
front-end/h5/src/components/core/models/element.js
| @@ -27,8 +27,8 @@ class Element { | @@ -27,8 +27,8 @@ class Element { | ||
| 27 | * 3. 为何需要 clone,因为会有 element.clone() 以及 page.clone(), | 27 | * 3. 为何需要 clone,因为会有 element.clone() 以及 page.clone(), |
| 28 | * element.pluginProps 和 elementcommonStyle 是引用类型,如果不做 deep_clone 可能会出现意外错误 | 28 | * element.pluginProps 和 elementcommonStyle 是引用类型,如果不做 deep_clone 可能会出现意外错误 |
| 29 | */ | 29 | */ |
| 30 | - this.pluginProps = clone(ele.pluginProps) || this.getDefaultPluginProps(ele.editorConfig || {}) | ||
| 31 | - this.commonStyle = clone(ele.commonStyle) || this.getDefaultCommonStyle() | 30 | + this.pluginProps = (typeof ele.pluginProps === 'object' && clone(ele.pluginProps)) || this.getDefaultPluginProps(ele.editorConfig || {}) |
| 31 | + this.commonStyle = (typeof ele.commonStyle === 'object' && clone(ele.commonStyle)) || this.getDefaultCommonStyle() | ||
| 32 | this.events = [] | 32 | this.events = [] |
| 33 | } | 33 | } |
| 34 | 34 |