@seafile/seafile-editor 0.3.76 → 0.3.80
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,5 +1,5 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
1
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
import { Editor } from 'slate';
|
|
5
5
|
import ListUtils from '../editor-utils/block-element-utils/list-utils';
|
|
@@ -146,6 +146,27 @@ var withBlock = function withBlock(editor) {
|
|
|
146
146
|
|
|
147
147
|
if (firstFragmentNode.type === 'paragraph') {
|
|
148
148
|
Editor.insertFragment(editor, fragment);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* if the first fragment element is a list, get normalized list items with function getNormalizedListItems and insert
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
if (firstFragmentNode.type.includes('_list')) {
|
|
157
|
+
var listItems = listUtils.getNormalizedListItems(firstFragmentNode);
|
|
158
|
+
var newFragment = fragment.slice(1);
|
|
159
|
+
Editor.insertNodes(editor, [{
|
|
160
|
+
type: firstFragmentNode.type,
|
|
161
|
+
children: listItems
|
|
162
|
+
}].concat(_toConsumableArray(newFragment)));
|
|
163
|
+
|
|
164
|
+
if (SfEditor.isEmptyParagraph(currentBlock)) {
|
|
165
|
+
Editor.delete(editor, {
|
|
166
|
+
at: path
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
149
170
|
return;
|
|
150
171
|
} // if current node is an empty paragraph, insert the fragment and
|
|
151
172
|
// delete the empty paragraph
|
|
@@ -247,15 +268,16 @@ var withBlock = function withBlock(editor) {
|
|
|
247
268
|
}
|
|
248
269
|
});
|
|
249
270
|
} else {
|
|
250
|
-
var
|
|
271
|
+
var _listItems = Editor.nodes(editor, {
|
|
251
272
|
at: editor.selection,
|
|
252
273
|
match: {
|
|
253
274
|
type: 'list_item'
|
|
254
275
|
}
|
|
255
276
|
});
|
|
277
|
+
|
|
256
278
|
var nearestItem;
|
|
257
279
|
|
|
258
|
-
var _iterator = _createForOfIteratorHelper(
|
|
280
|
+
var _iterator = _createForOfIteratorHelper(_listItems),
|
|
259
281
|
_step;
|
|
260
282
|
|
|
261
283
|
try {
|
|
@@ -327,34 +327,54 @@ var withMarkdownShortcut = function withMarkdownShortcut(editor) {
|
|
|
327
327
|
if (listUtils.isInlist()) {
|
|
328
328
|
var _Editor$nodes9 = Editor.nodes(editor, {
|
|
329
329
|
match: [{
|
|
330
|
-
type: '
|
|
331
|
-
}, {
|
|
332
|
-
type: 'unordered_list'
|
|
330
|
+
type: 'list_item'
|
|
333
331
|
}]
|
|
334
332
|
}),
|
|
335
333
|
_Editor$nodes10 = _slicedToArray(_Editor$nodes9, 1),
|
|
336
334
|
_node3 = _Editor$nodes10[0];
|
|
337
335
|
|
|
338
|
-
var
|
|
336
|
+
var listItemPath = _node3[1];
|
|
337
|
+
var listNode = Node.parent(editor, listItemPath); // Unwrap the list item when the selection is at the first list item of the first node of document
|
|
339
338
|
|
|
340
|
-
if (
|
|
339
|
+
if (anchor.path[0] === 0 && anchor.path[1] === 0) {
|
|
341
340
|
listUtils.unwrapList();
|
|
342
341
|
return;
|
|
343
|
-
} //
|
|
342
|
+
} // unwrap an empty list
|
|
344
343
|
|
|
345
344
|
|
|
346
|
-
if (
|
|
345
|
+
if (listNode.children.length === 1 && Node.text(listNode).length === 0) {
|
|
347
346
|
listUtils.unwrapList();
|
|
348
347
|
return;
|
|
348
|
+
} // list items with mutiple chidren
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
var currentChildBlockIndex = anchor.path[anchor.path.length - 2];
|
|
352
|
+
var currentListItem;
|
|
353
|
+
|
|
354
|
+
for (var i = anchor.path.length - 1; i > 0; i--) {
|
|
355
|
+
var _node4 = Node.get(editor, anchor.path.slice(0, i));
|
|
356
|
+
|
|
357
|
+
if (_node4.type === 'list_item') {
|
|
358
|
+
currentListItem = _node4;
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (currentChildBlockIndex === 0 && currentListItem.children.length > 1) {
|
|
364
|
+
Editor.withoutNormalizing(editor, function (editor) {
|
|
365
|
+
listUtils.unwrapList();
|
|
366
|
+
exec(command);
|
|
367
|
+
});
|
|
368
|
+
return;
|
|
349
369
|
}
|
|
350
370
|
}
|
|
351
371
|
|
|
352
372
|
if (codeUtils.isInCodeBlock()) {
|
|
353
|
-
var
|
|
373
|
+
var _node5 = Editor.match(editor, editor.selection, {
|
|
354
374
|
type: 'code_block'
|
|
355
375
|
});
|
|
356
376
|
|
|
357
|
-
var codeBlock =
|
|
377
|
+
var codeBlock = _node5[0];
|
|
358
378
|
var children = codeBlock.children;
|
|
359
379
|
var text = Node.text(codeBlock);
|
|
360
380
|
|
|
@@ -2,7 +2,7 @@ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIt
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
4
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
|
-
import { Node, Range, Path } from 'slate';
|
|
5
|
+
import { Node, Range, Path, Editor } from 'slate';
|
|
6
6
|
import { SfEditor } from '../../custom/custom';
|
|
7
7
|
import getEventTransfer from '../../custom/get-event-transfer';
|
|
8
8
|
import { htmlDeserializer } from '../../../utils/deserialize-html';
|
|
@@ -14,116 +14,153 @@ var LitsUtils = function LitsUtils(editor) {
|
|
|
14
14
|
_classCallCheck(this, LitsUtils);
|
|
15
15
|
|
|
16
16
|
this.unwrapList = function () {
|
|
17
|
-
|
|
17
|
+
// defer normalization util the unwrap operartions completed
|
|
18
|
+
SfEditor.withoutNormalizing(_this.editor, function () {
|
|
19
|
+
normailizeSelection(_this.editor); // selected list item
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
var selectedListItem = _this.getCurrentListItem(); // first selected item path and node
|
|
20
22
|
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
var firstSelectedItem = selectedListItem[0];
|
|
25
|
+
var firstSelectedItemPath = firstSelectedItem[1]; // get selected list and the path of the list
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
var selectedListPath = firstSelectedItemPath.slice(0, firstSelectedItemPath.length - 1);
|
|
28
|
+
var selectedList = Node.get(_this.editor, selectedListPath); // get the node and path of parent of selected list
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
var listParent = Node.parent(_this.editor, selectedListPath);
|
|
31
|
+
var listParentPath = selectedListPath.slice(0, selectedListPath.length - 1); // unwrap list of selected list item
|
|
32
|
+
// if the type of parent of selected list is a list and it should be a list item
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
if (listParent.type && listParent.type.includes('list')) {
|
|
35
|
+
// get the path of parent of listParent
|
|
36
|
+
var ancesstorPath = listParentPath.slice(0, listParentPath.length - 1);
|
|
37
|
+
var lastSelectedListItem = selectedListItem.slice(-1)[0];
|
|
38
|
+
var lastSelectedListItemPath = lastSelectedListItem[1];
|
|
39
|
+
var lastSelectedListItemIndex = lastSelectedListItemPath.slice(-1)[0];
|
|
40
|
+
var unSelectedListItem = selectedList.children.slice(selectedListItem.slice(-1)[0][1].slice(-1)[0] + 1); // insert a new list to the last selected list item
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
if (!(lastSelectedListItemIndex === selectedList.children.length - 1)) {
|
|
43
|
+
SfEditor.insertNodes(_this.editor, {
|
|
44
|
+
type: selectedList.type,
|
|
45
|
+
children: []
|
|
46
|
+
}, {
|
|
47
|
+
at: [].concat(_toConsumableArray(lastSelectedListItemPath), [lastSelectedListItem[0].children.length])
|
|
48
|
+
});
|
|
49
|
+
} // move the unselected list item to the new created list
|
|
48
50
|
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
unSelectedListItem.forEach(function (item, index) {
|
|
53
|
+
SfEditor.moveNodes(_this.editor, {
|
|
54
|
+
at: [].concat(_toConsumableArray(lastSelectedListItemPath.slice(0, -1)), [lastSelectedListItemIndex + 1]),
|
|
55
|
+
to: [].concat(_toConsumableArray(lastSelectedListItemPath), [lastSelectedListItem[0].children.length, index])
|
|
56
|
+
});
|
|
54
57
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
var currentItemPath = firstSelectedItemPath;
|
|
59
|
+
var startIndexOfItemInNewList = listParentPath[listParentPath.length - 1] + 1; // move item to outer list by path
|
|
60
|
+
|
|
61
|
+
selectedListItem.forEach(function (item, index) {
|
|
62
|
+
var itemTargetPath = [].concat(_toConsumableArray(ancesstorPath), [index + startIndexOfItemInNewList]);
|
|
63
|
+
SfEditor.moveNodes(_this.editor, {
|
|
64
|
+
at: currentItemPath,
|
|
65
|
+
to: itemTargetPath
|
|
66
|
+
});
|
|
64
67
|
});
|
|
65
|
-
|
|
66
|
-
var currentList = Node.get(_this.editor, selectedListPath); // delete empty list
|
|
68
|
+
var currentList = Node.get(_this.editor, selectedListPath); // delete empty list
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
if (!currentList.children[0] || currentList.children[0].type !== 'list_item') {
|
|
71
|
+
SfEditor.removeNodes(_this.editor, {
|
|
72
|
+
at: selectedListPath
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
// unwrap list item if the selected list is the outest of the root
|
|
77
|
+
var firstListItemIndex = firstSelectedItem[1].slice(-1)[0];
|
|
78
|
+
var restCount = 0;
|
|
79
|
+
selectedListItem.forEach(function (item) {
|
|
80
|
+
SfEditor.unwrapNodesByTypeAtRange(_this.editor, {
|
|
81
|
+
match: {
|
|
82
|
+
type: 'list_item'
|
|
83
|
+
},
|
|
84
|
+
mode: 'highest',
|
|
85
|
+
at: [].concat(_toConsumableArray(selectedListPath), [firstListItemIndex + restCount])
|
|
86
|
+
});
|
|
87
|
+
restCount += item[0].children.length;
|
|
71
88
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// unwrap list item if the selected list is the outest of the root
|
|
75
|
-
SfEditor.unwrapNodesByTypeAtRange(_this.editor, {
|
|
76
|
-
match: [{
|
|
77
|
-
type: selectedList.type
|
|
78
|
-
}],
|
|
79
|
-
split: true,
|
|
80
|
-
mode: 'highest'
|
|
81
|
-
});
|
|
82
|
-
var firstListItemIndex = firstSelectedItem[1].slice(-1)[0];
|
|
83
|
-
|
|
84
|
-
var _listParentPath = Path.parent(selectedListPath);
|
|
85
|
-
|
|
86
|
-
var selectedListIndex = selectedListPath.slice(-1)[0];
|
|
87
|
-
var startIndex = firstListItemIndex === 0 ? selectedListIndex : selectedListIndex + 1;
|
|
88
|
-
selectedListItem.forEach(function (item, index) {
|
|
89
|
+
var startItemRange = Editor.range(_this.editor, [].concat(_toConsumableArray(selectedListPath), [firstListItemIndex]));
|
|
90
|
+
var endItemRange = Editor.range(_this.editor, [].concat(_toConsumableArray(selectedListPath), [firstListItemIndex + restCount - 1]));
|
|
89
91
|
SfEditor.unwrapNodesByTypeAtRange(_this.editor, {
|
|
90
|
-
match: {
|
|
91
|
-
type:
|
|
92
|
-
},
|
|
93
|
-
|
|
92
|
+
match: [{
|
|
93
|
+
type: selectedList.type
|
|
94
|
+
}],
|
|
95
|
+
split: true,
|
|
96
|
+
mode: 'highest',
|
|
97
|
+
at: {
|
|
98
|
+
anchor: startItemRange.anchor,
|
|
99
|
+
focus: endItemRange.focus
|
|
100
|
+
}
|
|
94
101
|
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
97
104
|
};
|
|
98
105
|
|
|
99
106
|
this.wrapList = function (type) {
|
|
100
107
|
normailizeSelection(_this.editor);
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
path
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
108
|
+
var selection = _this.editor.selection;
|
|
109
|
+
var focusPath = selection.focus.path;
|
|
110
|
+
var anchorPath = selection.anchor.path;
|
|
111
|
+
|
|
112
|
+
if (Path.equals(focusPath, anchorPath)) {
|
|
113
|
+
var _SfEditor$match = SfEditor.match(_this.editor, _this.editor.selection, 'block'),
|
|
114
|
+
_SfEditor$match2 = _slicedToArray(_SfEditor$match, 2),
|
|
115
|
+
block = _SfEditor$match2[0],
|
|
116
|
+
path = _SfEditor$match2[1];
|
|
117
|
+
|
|
118
|
+
Editor.withoutNormalizing(_this.editor, function (editor) {
|
|
119
|
+
SfEditor.wrapNodes(_this.editor, {
|
|
120
|
+
type: 'list_item',
|
|
121
|
+
children: [block],
|
|
122
|
+
data: {}
|
|
123
|
+
}, {
|
|
124
|
+
at: path
|
|
125
|
+
});
|
|
126
|
+
SfEditor.wrapNodes(_this.editor, {
|
|
127
|
+
type: type,
|
|
128
|
+
children: []
|
|
129
|
+
}, {
|
|
130
|
+
split: false,
|
|
131
|
+
at: path
|
|
132
|
+
});
|
|
125
133
|
});
|
|
134
|
+
return;
|
|
126
135
|
}
|
|
136
|
+
|
|
137
|
+
var commonPath = Path.common(focusPath, anchorPath);
|
|
138
|
+
var commonAncestor = Node.get(_this.editor, commonPath);
|
|
139
|
+
var startIndex = anchorPath[commonPath.length];
|
|
140
|
+
var endIndex = focusPath[commonPath.length]; // get hightest selected commonAncestor block items
|
|
141
|
+
|
|
142
|
+
var selectedBlock = commonAncestor.children.slice(startIndex, endIndex + 1);
|
|
143
|
+
Editor.withoutNormalizing(_this.editor, function (editor) {
|
|
144
|
+
selectedBlock.forEach(function (blockItem, index) {
|
|
145
|
+
// wrap block into list
|
|
146
|
+
if (!blockItem.type.includes('list')) {
|
|
147
|
+
SfEditor.wrapNodes(_this.editor, {
|
|
148
|
+
type: 'list_item',
|
|
149
|
+
children: [blockItem],
|
|
150
|
+
data: {}
|
|
151
|
+
}, {
|
|
152
|
+
at: [].concat(_toConsumableArray(commonPath), [startIndex + index])
|
|
153
|
+
});
|
|
154
|
+
SfEditor.wrapNodes(_this.editor, {
|
|
155
|
+
type: type,
|
|
156
|
+
children: []
|
|
157
|
+
}, {
|
|
158
|
+
split: false,
|
|
159
|
+
at: [].concat(_toConsumableArray(commonPath), [startIndex + index])
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
127
164
|
};
|
|
128
165
|
|
|
129
166
|
this.getCurrentListItem = function () {
|
|
@@ -223,34 +260,6 @@ var LitsUtils = function LitsUtils(editor) {
|
|
|
223
260
|
return [[commonAncestor, commonPath]];
|
|
224
261
|
}
|
|
225
262
|
|
|
226
|
-
if (commonPath.length === 0) {
|
|
227
|
-
var listNodes = SfEditor.nodes(_this.editor, {
|
|
228
|
-
match: [{
|
|
229
|
-
type: 'list_item'
|
|
230
|
-
}, {
|
|
231
|
-
type: 'list_item'
|
|
232
|
-
}],
|
|
233
|
-
mode: 'highest'
|
|
234
|
-
});
|
|
235
|
-
var list = [];
|
|
236
|
-
|
|
237
|
-
var _iterator2 = _createForOfIteratorHelper(listNodes),
|
|
238
|
-
_step2;
|
|
239
|
-
|
|
240
|
-
try {
|
|
241
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
242
|
-
var iterator = _step2.value;
|
|
243
|
-
list.push(iterator);
|
|
244
|
-
}
|
|
245
|
-
} catch (err) {
|
|
246
|
-
_iterator2.e(err);
|
|
247
|
-
} finally {
|
|
248
|
-
_iterator2.f();
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
return list;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
263
|
return [];
|
|
255
264
|
};
|
|
256
265
|
|
|
@@ -262,19 +271,19 @@ var LitsUtils = function LitsUtils(editor) {
|
|
|
262
271
|
});
|
|
263
272
|
var node; //get the nearest list_item of current selection
|
|
264
273
|
|
|
265
|
-
var
|
|
266
|
-
|
|
274
|
+
var _iterator2 = _createForOfIteratorHelper(listNodes),
|
|
275
|
+
_step2;
|
|
267
276
|
|
|
268
277
|
try {
|
|
269
|
-
for (
|
|
270
|
-
var item =
|
|
278
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
279
|
+
var item = _step2.value;
|
|
271
280
|
node = item;
|
|
272
281
|
} // if current list item is the first child of the list return
|
|
273
282
|
|
|
274
283
|
} catch (err) {
|
|
275
|
-
|
|
284
|
+
_iterator2.e(err);
|
|
276
285
|
} finally {
|
|
277
|
-
|
|
286
|
+
_iterator2.f();
|
|
278
287
|
}
|
|
279
288
|
|
|
280
289
|
var listItemPath = _toConsumableArray(node[1]);
|
|
@@ -286,18 +295,21 @@ var LitsUtils = function LitsUtils(editor) {
|
|
|
286
295
|
var previousListItem = listNode.children[listItemIndex - 1];
|
|
287
296
|
var previousListItemPath = [].concat(_toConsumableArray(listNodePath), [listItemIndex - 1]);
|
|
288
297
|
var lastIndex = previousListItem.children.length;
|
|
289
|
-
var newListPath = [].concat(_toConsumableArray(previousListItemPath), [lastIndex]);
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
298
|
+
var newListPath = [].concat(_toConsumableArray(previousListItemPath), [lastIndex]); // Deferring normalization list untils after operations completes.
|
|
299
|
+
|
|
300
|
+
SfEditor.withoutNormalizing(_this.editor, function () {
|
|
301
|
+
SfEditor.insertNodes(_this.editor, {
|
|
302
|
+
type: listNode.type,
|
|
303
|
+
children: []
|
|
304
|
+
}, {
|
|
305
|
+
at: newListPath,
|
|
306
|
+
split: true
|
|
307
|
+
});
|
|
308
|
+
var newListItemPath = [].concat(_toConsumableArray(newListPath), [0]);
|
|
309
|
+
SfEditor.moveNodes(_this.editor, {
|
|
310
|
+
at: node[1],
|
|
311
|
+
to: newListItemPath
|
|
312
|
+
});
|
|
301
313
|
});
|
|
302
314
|
};
|
|
303
315
|
|
|
@@ -308,6 +320,21 @@ var LitsUtils = function LitsUtils(editor) {
|
|
|
308
320
|
return false;
|
|
309
321
|
};
|
|
310
322
|
|
|
323
|
+
this.getNormalizedListItems = function (list) {
|
|
324
|
+
var listItems = [];
|
|
325
|
+
list.children.forEach(function (listItem) {
|
|
326
|
+
var children = listItem.children || [];
|
|
327
|
+
var firstChild = children[0];
|
|
328
|
+
|
|
329
|
+
if (firstChild && firstChild.type.includes('_list')) {
|
|
330
|
+
listItems.push.apply(listItems, _toConsumableArray(_this.getNormalizedListItems(firstChild)));
|
|
331
|
+
} else {
|
|
332
|
+
listItems.push(listItem);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
return listItems;
|
|
336
|
+
};
|
|
337
|
+
|
|
311
338
|
this.pasteContentInList = function (command) {
|
|
312
339
|
var data = command.data;
|
|
313
340
|
|
|
@@ -340,7 +367,8 @@ var LitsUtils = function LitsUtils(editor) {
|
|
|
340
367
|
var listPath = currentItemPath.slice(0, currentItemPath.length - 1);
|
|
341
368
|
|
|
342
369
|
if (firstBlockType === 'ordered_list' || firstBlockType === 'unordered_list') {
|
|
343
|
-
var listItems = firstBlock
|
|
370
|
+
var listItems = _this.getNormalizedListItems(firstBlock);
|
|
371
|
+
|
|
344
372
|
listItems.forEach(function (listItem, index) {
|
|
345
373
|
var itemChildren = listItem.children;
|
|
346
374
|
SfEditor.insertFragment(_this.editor, [itemChildren[0]]);
|