@seafile/sdoc-editor 0.5.59 → 0.5.60
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ObjectUtils from './object-utils';
|
|
2
|
+
import deepCopy from 'deep-copy';
|
|
2
3
|
import context from '../../context';
|
|
3
4
|
import { generateDefaultText } from '../../basic-sdk/extension/core/utils/index';
|
|
4
5
|
import { CLIPBOARD_ORIGIN_SDOC_KEY, ELEMENT_TYPE } from '../extension/constants';
|
|
@@ -14,6 +15,10 @@ export const normalizeChildren = children => {
|
|
|
14
15
|
if (ObjectUtils.hasProperty(child, 'text') && !ObjectUtils.hasProperty(child, 'children')) {
|
|
15
16
|
return child;
|
|
16
17
|
}
|
|
18
|
+
// To resolve the issue that the children is not assigned to the new object
|
|
19
|
+
if (!Object.getOwnPropertyDescriptor(child, 'children').writable) {
|
|
20
|
+
child = deepCopy(child);
|
|
21
|
+
}
|
|
17
22
|
// child is element
|
|
18
23
|
child.children = normalizeChildren(child.children);
|
|
19
24
|
return child;
|