@seafile/seafile-editor 2.0.50 → 2.0.51-beta
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.
|
@@ -17,6 +17,7 @@ const renderCheckListItem = (_ref, editor) => {
|
|
|
17
17
|
children,
|
|
18
18
|
element
|
|
19
19
|
} = _ref;
|
|
20
|
+
const isReadonly = (0, _slateReact.useReadOnly)();
|
|
20
21
|
const {
|
|
21
22
|
id,
|
|
22
23
|
checked = false
|
|
@@ -43,7 +44,8 @@ const renderCheckListItem = (_ref, editor) => {
|
|
|
43
44
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
44
45
|
type: "checkbox",
|
|
45
46
|
onChange: onChange,
|
|
46
|
-
checked: checked
|
|
47
|
+
checked: checked,
|
|
48
|
+
disabled: isReadonly
|
|
47
49
|
})), children);
|
|
48
50
|
};
|
|
49
51
|
var _default = exports.default = renderCheckListItem;
|
|
@@ -30,22 +30,49 @@ const listRule = (element, parseChild) => {
|
|
|
30
30
|
children: parseChild(childNodes)
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
if (nodeName === 'LI'
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
if (nodeName === 'LI') {
|
|
34
|
+
const parsedChildren = parseChild(childNodes);
|
|
35
|
+
const normalizedChildren = Array.isArray(parsedChildren) ? parsedChildren : parsedChildren ? [parsedChildren] : [];
|
|
36
|
+
const listItemChildren = [];
|
|
37
|
+
let inlineChildren = [];
|
|
38
|
+
const appendInlineParagraph = () => {
|
|
39
|
+
if (inlineChildren.length === 0) return;
|
|
40
|
+
listItemChildren.push({
|
|
41
|
+
id: _slugid.default.nice(),
|
|
42
|
+
type: _constants.PARAGRAPH,
|
|
43
|
+
children: inlineChildren
|
|
44
|
+
});
|
|
45
|
+
inlineChildren = [];
|
|
38
46
|
};
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
normalizedChildren.forEach(child => {
|
|
48
|
+
if (!child) return;
|
|
49
|
+
const isInlineNode = !child.type || _constants.INLINE_LEVEL_TYPES.includes(child.type);
|
|
50
|
+
if (isInlineNode) {
|
|
51
|
+
inlineChildren.push(child);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
appendInlineParagraph();
|
|
55
|
+
listItemChildren.push(child);
|
|
56
|
+
});
|
|
57
|
+
appendInlineParagraph();
|
|
58
|
+
if (listItemChildren.length === 0) {
|
|
59
|
+
listItemChildren.push({
|
|
60
|
+
id: _slugid.default.nice(),
|
|
61
|
+
type: _constants.PARAGRAPH,
|
|
62
|
+
children: [(0, _core.generateDefaultText)()]
|
|
63
|
+
});
|
|
64
|
+
} else if ([_constants.UNORDERED_LIST, _constants.ORDERED_LIST].includes(listItemChildren[0].type)) {
|
|
65
|
+
// Ensure nested list item content starts with a paragraph.
|
|
66
|
+
listItemChildren.unshift({
|
|
67
|
+
id: _slugid.default.nice(),
|
|
68
|
+
type: _constants.PARAGRAPH,
|
|
69
|
+
children: [(0, _core.generateDefaultText)()]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
41
72
|
return {
|
|
42
73
|
id: _slugid.default.nice(),
|
|
43
74
|
type: _constants.LIST_ITEM,
|
|
44
|
-
children:
|
|
45
|
-
id: _slugid.default.nice(),
|
|
46
|
-
type: _constants.PARAGRAPH,
|
|
47
|
-
children: parseChild(childNodes)
|
|
48
|
-
}]
|
|
75
|
+
children: listItemChildren
|
|
49
76
|
};
|
|
50
77
|
}
|
|
51
78
|
if (PARAGRAPH_TAGS.includes(nodeName) && parentElement && parentElement.nodeName === 'LI') {
|