@seafile/seafile-editor 1.0.70 → 1.0.72
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.
|
@@ -24,6 +24,7 @@ const isMenuDisabled = (editor, readonly) => {
|
|
|
24
24
|
if (type === _elementTypes.ORDERED_LIST) return true;
|
|
25
25
|
if (type === _elementTypes.CHECK_LIST_ITEM) return true;
|
|
26
26
|
if (type === _elementTypes.IMAGE) return true;
|
|
27
|
+
if (type === _elementTypes.TABLE_CELL) return true;
|
|
27
28
|
return false;
|
|
28
29
|
},
|
|
29
30
|
universal: true,
|
|
@@ -61,6 +61,7 @@ const deserializeElements = function () {
|
|
|
61
61
|
let elements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
62
62
|
let isTopLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
63
63
|
let nodes = [];
|
|
64
|
+
let isAllTextNode = false;
|
|
64
65
|
elements.filter(cruftNewline).forEach(element => {
|
|
65
66
|
const node = deserializeElement(element);
|
|
66
67
|
switch ((0, _typeOf.default)(node)) {
|
|
@@ -69,12 +70,24 @@ const deserializeElements = function () {
|
|
|
69
70
|
nodes = nodes.concat(formatNode);
|
|
70
71
|
break;
|
|
71
72
|
case 'object':
|
|
73
|
+
// keys length is 2: node is text
|
|
74
|
+
const keys = Object.keys(node);
|
|
75
|
+
isAllTextNode = keys.length === 2 ? true : false;
|
|
72
76
|
nodes.push(node);
|
|
73
77
|
break;
|
|
74
78
|
default:
|
|
75
79
|
// nothing todo
|
|
76
80
|
}
|
|
77
81
|
});
|
|
82
|
+
|
|
83
|
+
// if elements is all text node, combine the elements
|
|
84
|
+
if (isAllTextNode) {
|
|
85
|
+
const node = {
|
|
86
|
+
id: nodes[0].id,
|
|
87
|
+
text: nodes.reduce((ret, item) => ret + item.text, '')
|
|
88
|
+
};
|
|
89
|
+
nodes = [node];
|
|
90
|
+
}
|
|
78
91
|
return nodes;
|
|
79
92
|
};
|
|
80
93
|
const formatElementNodes = nodes => {
|