Skip to content

Commit a43ae78

Browse files
committed
fix: check element property before clone
1 parent 623d7fa commit a43ae78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

front-end/h5/src/components/core/models/element.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class Element {
2727
* 3. 为何需要 clone,因为会有 element.clone() 以及 page.clone(),
2828
* element.pluginProps 和 elementcommonStyle 是引用类型,如果不做 deep_clone 可能会出现意外错误
2929
*/
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()
3232
this.events = []
3333
}
3434

0 commit comments

Comments
 (0)