@seafile/seafile-editor 0.3.76

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.
Files changed (156) hide show
  1. package/README.md +119 -0
  2. package/TODO.md +55 -0
  3. package/dist/components/add-formula-dialog.js +135 -0
  4. package/dist/components/add-image-dialog.js +78 -0
  5. package/dist/components/add-link-dialog.js +148 -0
  6. package/dist/components/comment-dialog.js +107 -0
  7. package/dist/components/comment-panel.js +452 -0
  8. package/dist/components/context-menu.js +112 -0
  9. package/dist/components/detail-list-view.js +119 -0
  10. package/dist/components/generate-share-link.js +412 -0
  11. package/dist/components/internal-link-dialog.js +96 -0
  12. package/dist/components/loading.js +32 -0
  13. package/dist/components/markdown-lint.js +87 -0
  14. package/dist/components/modal-portal.js +46 -0
  15. package/dist/components/outline.js +130 -0
  16. package/dist/components/participants-list.js +126 -0
  17. package/dist/components/related-files-list.js +75 -0
  18. package/dist/components/shortcut-dialog.js +167 -0
  19. package/dist/components/side-panel.js +175 -0
  20. package/dist/components/toast/alert.js +150 -0
  21. package/dist/components/toast/index.js +3 -0
  22. package/dist/components/toast/toast.js +179 -0
  23. package/dist/components/toast/toastManager.js +158 -0
  24. package/dist/components/toast/toaster.js +76 -0
  25. package/dist/components/toolbar.js +235 -0
  26. package/dist/components/topbar-component/button-group.js +31 -0
  27. package/dist/components/topbar-component/editor-toolbar.js +545 -0
  28. package/dist/components/topbar-component/file-info.js +65 -0
  29. package/dist/components/topbar-component/header-list.js +128 -0
  30. package/dist/components/topbar-component/icon-button.js +99 -0
  31. package/dist/components/topbar-component/insert-file.js +67 -0
  32. package/dist/components/topbar-component/table-toolbar.js +175 -0
  33. package/dist/components/topbar-component/upload-img.js +122 -0
  34. package/dist/components/user-help.js +205 -0
  35. package/dist/css/diff-viewer.css +105 -0
  36. package/dist/css/history-viewer.css +104 -0
  37. package/dist/css/keyboard-shortcuts.css +59 -0
  38. package/dist/css/layout.css +110 -0
  39. package/dist/css/markdown-viewer-slate/file-tags-list.css +76 -0
  40. package/dist/css/markdown-viewer.css +69 -0
  41. package/dist/css/plaineditor/markdown-editor.css +12 -0
  42. package/dist/css/react-mentions-default-style.js +72 -0
  43. package/dist/css/related-files-list.css +56 -0
  44. package/dist/css/richeditor/comments-list.css +184 -0
  45. package/dist/css/richeditor/detail-list-view.css +114 -0
  46. package/dist/css/richeditor/document-info.css +57 -0
  47. package/dist/css/richeditor/formula.css +19 -0
  48. package/dist/css/richeditor/image.css +141 -0
  49. package/dist/css/richeditor/link.css +7 -0
  50. package/dist/css/richeditor/navbar-imgbutton.css +79 -0
  51. package/dist/css/richeditor/participants-list.css +22 -0
  52. package/dist/css/richeditor/rich-editor-main.css +42 -0
  53. package/dist/css/richeditor/right-panel.css +84 -0
  54. package/dist/css/richeditor/side-panel.css +190 -0
  55. package/dist/css/richeditor/table.css +57 -0
  56. package/dist/css/richeditor/textlink-hovermenu.css +47 -0
  57. package/dist/css/richeditor/tree-view.css +67 -0
  58. package/dist/css/topbar.css +400 -0
  59. package/dist/editor/code-highlight-package.js +27 -0
  60. package/dist/editor/controller/block-element-controller.js +376 -0
  61. package/dist/editor/controller/inline-element-controller.js +129 -0
  62. package/dist/editor/controller/normalize-controller.js +107 -0
  63. package/dist/editor/controller/shortcut-controller.js +394 -0
  64. package/dist/editor/controller/void-element-controller.js +12 -0
  65. package/dist/editor/custom/custom.js +17 -0
  66. package/dist/editor/custom/get-event-transfer.js +34 -0
  67. package/dist/editor/custom/getNodesByTypeAtRange.js +69 -0
  68. package/dist/editor/custom/insertNodes.js +140 -0
  69. package/dist/editor/custom/is-empty-paragraph.js +13 -0
  70. package/dist/editor/custom/set-event-transfer.js +31 -0
  71. package/dist/editor/custom/split-nodes-at-point.js +162 -0
  72. package/dist/editor/custom/unwrap-node-by-type-at-range.js +81 -0
  73. package/dist/editor/editor-component/check-list-item.js +64 -0
  74. package/dist/editor/editor-component/code-block.js +150 -0
  75. package/dist/editor/editor-component/formula.js +79 -0
  76. package/dist/editor/editor-component/image.js +215 -0
  77. package/dist/editor/editor-component/link.js +11 -0
  78. package/dist/editor/editor-component/table.js +172 -0
  79. package/dist/editor/editor-component/textlink-hovermenu.js +136 -0
  80. package/dist/editor/editor-plugin.js +249 -0
  81. package/dist/editor/editor-utils/block-element-utils/blockquote-utils.js +96 -0
  82. package/dist/editor/editor-utils/block-element-utils/code-utils.js +162 -0
  83. package/dist/editor/editor-utils/block-element-utils/formula-utils.js +58 -0
  84. package/dist/editor/editor-utils/block-element-utils/index.js +38 -0
  85. package/dist/editor/editor-utils/block-element-utils/list-utils.js +398 -0
  86. package/dist/editor/editor-utils/block-element-utils/table-utils.js +418 -0
  87. package/dist/editor/editor-utils/common-editor-utils.js +587 -0
  88. package/dist/editor/editor-utils/inline-element-utils/index.js +95 -0
  89. package/dist/editor/editor-utils/mark-utils.js +25 -0
  90. package/dist/editor/editor-utils/range-utils.js +9 -0
  91. package/dist/editor/editor-utils/selection-utils.js +33 -0
  92. package/dist/editor/editor-utils/text-utils.js +130 -0
  93. package/dist/editor/editor.js +66 -0
  94. package/dist/editor/element-model/blockquote.js +16 -0
  95. package/dist/editor/element-model/image.js +19 -0
  96. package/dist/editor/element-model/link.js +19 -0
  97. package/dist/editor/element-model/table.js +50 -0
  98. package/dist/editor/element-model/text.js +13 -0
  99. package/dist/editor/load-script.js +83 -0
  100. package/dist/editor/plain-markdown-editor.js +324 -0
  101. package/dist/editor/rich-markdown-editor.js +580 -0
  102. package/dist/editor/seafile-editor.js +326 -0
  103. package/dist/editor/simple-editor.js +245 -0
  104. package/dist/editor-api.js +261 -0
  105. package/dist/index.css +97 -0
  106. package/dist/lib/slate-hyperscript/creators.js +263 -0
  107. package/dist/lib/slate-hyperscript/hyperscript.js +92 -0
  108. package/dist/lib/slate-hyperscript/index.js +3 -0
  109. package/dist/lib/slate-hyperscript/tokens.js +102 -0
  110. package/dist/lib/unified/index.js +470 -0
  111. package/dist/lib/vfile/core.js +172 -0
  112. package/dist/lib/vfile/index.js +48 -0
  113. package/dist/seafile-editor-chooser.js +45 -0
  114. package/dist/seafile-markdown-editor.js +301 -0
  115. package/dist/seafile-markdown-viewer.js +79 -0
  116. package/dist/seafile-simple-editor.js +56 -0
  117. package/dist/utils/copy-to-clipboard.js +47 -0
  118. package/dist/utils/deserialize-html.js +282 -0
  119. package/dist/utils/diff/compare-strings.js +46 -0
  120. package/dist/utils/diff/diff.js +855 -0
  121. package/dist/utils/diff/index.js +2 -0
  122. package/dist/utils/render-slate.js +219 -0
  123. package/dist/utils/seafile-markdown2html.js +62 -0
  124. package/dist/utils/slate2markdown/deserialize.js +689 -0
  125. package/dist/utils/slate2markdown/index.js +3 -0
  126. package/dist/utils/slate2markdown/serialize.js +407 -0
  127. package/dist/utils/utils.js +28 -0
  128. package/dist/viewer/diff-viewer.js +98 -0
  129. package/dist/viewer/markdown-viewer.js +139 -0
  130. package/dist/viewer/slate-viewer.js +73 -0
  131. package/dist/viewer/viewer-formula.js +67 -0
  132. package/dist/viewer/viewer-image.js +93 -0
  133. package/dist/viewer/viewer-outline.js +118 -0
  134. package/package.json +215 -0
  135. package/public/favicon.ico +0 -0
  136. package/public/index.html +45 -0
  137. package/public/locales/cs/seafile-editor.json +169 -0
  138. package/public/locales/de/seafile-editor.json +169 -0
  139. package/public/locales/en/seafile-editor.json +222 -0
  140. package/public/locales/es/seafile-editor.json +169 -0
  141. package/public/locales/es-AR/seafile-editor.json +169 -0
  142. package/public/locales/es-MX/seafile-editor.json +169 -0
  143. package/public/locales/fr/seafile-editor.json +169 -0
  144. package/public/locales/it/seafile-editor.json +169 -0
  145. package/public/locales/ru/seafile-editor.json +169 -0
  146. package/public/locales/zh-CN/seafile-editor.json +219 -0
  147. package/public/manifest.json +15 -0
  148. package/public/media/scripts/mathjax/tex-svg.js +1 -0
  149. package/public/media/seafile-editor-font/iconfont.eot +0 -0
  150. package/public/media/seafile-editor-font/iconfont.svg +164 -0
  151. package/public/media/seafile-editor-font/iconfont.ttf +0 -0
  152. package/public/media/seafile-editor-font/iconfont.woff +0 -0
  153. package/public/media/seafile-editor-font/iconfont.woff2 +0 -0
  154. package/public/media/seafile-editor-font.css +201 -0
  155. package/public/media/seafile-logo.png +0 -0
  156. package/public/media/seafile-ui.css +11169 -0
@@ -0,0 +1,398 @@
1
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
4
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
5
+ import { Node, Range, Path } from 'slate';
6
+ import { SfEditor } from '../../custom/custom';
7
+ import getEventTransfer from '../../custom/get-event-transfer';
8
+ import { htmlDeserializer } from '../../../utils/deserialize-html';
9
+ import { normailizeSelection } from '../selection-utils';
10
+
11
+ var LitsUtils = function LitsUtils(editor) {
12
+ var _this = this;
13
+
14
+ _classCallCheck(this, LitsUtils);
15
+
16
+ this.unwrapList = function () {
17
+ normailizeSelection(_this.editor); // selected list item
18
+
19
+ var selectedListItem = _this.getCurrentListItem(); // first selected item path and node
20
+
21
+
22
+ var firstSelectedItem = selectedListItem[0];
23
+ var firstSelectedItemPath = firstSelectedItem[1]; // get selected list and the path of the list
24
+
25
+ var selectedListPath = firstSelectedItemPath.slice(0, firstSelectedItemPath.length - 1);
26
+ var selectedList = Node.get(_this.editor, selectedListPath); // get the node and path of parent of selected list
27
+
28
+ var listParent = Node.parent(_this.editor, selectedListPath);
29
+ var listParentPath = selectedListPath.slice(0, selectedListPath.length - 1); // unwrap list of selected list item
30
+ // if the type of parent of selected list is a list and it should be a list item
31
+
32
+ if (listParent.type && listParent.type.includes('list')) {
33
+ // get the path of parent of listParent
34
+ var ancesstorPath = listParentPath.slice(0, listParentPath.length - 1);
35
+ var lastSelectedListItem = selectedListItem.slice(-1)[0];
36
+ var lastSelectedListItemPath = lastSelectedListItem[1];
37
+ var lastSelectedListItemIndex = lastSelectedListItemPath.slice(-1)[0];
38
+ 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
+
40
+ if (!(lastSelectedListItemIndex === selectedList.children.length - 1)) {
41
+ SfEditor.insertNodes(_this.editor, {
42
+ type: selectedList.type,
43
+ children: []
44
+ }, {
45
+ at: [].concat(_toConsumableArray(lastSelectedListItemPath), [lastSelectedListItem[0].children.length])
46
+ });
47
+ } // move the unselected list item to the new created list
48
+
49
+
50
+ unSelectedListItem.forEach(function (item, index) {
51
+ SfEditor.moveNodes(_this.editor, {
52
+ at: [].concat(_toConsumableArray(lastSelectedListItemPath.slice(0, -1)), [lastSelectedListItemIndex + 1]),
53
+ to: [].concat(_toConsumableArray(lastSelectedListItemPath), [lastSelectedListItem[0].children.length, index])
54
+ });
55
+ });
56
+ var currentItemPath = firstSelectedItemPath;
57
+ var startIndexOfItemInNewList = listParentPath[listParentPath.length - 1] + 1; // move item to outer list by path
58
+
59
+ selectedListItem.forEach(function (item, index) {
60
+ var itemTargetPath = [].concat(_toConsumableArray(ancesstorPath), [index + startIndexOfItemInNewList]);
61
+ SfEditor.moveNodes(_this.editor, {
62
+ at: currentItemPath,
63
+ to: itemTargetPath
64
+ });
65
+ });
66
+ var currentList = Node.get(_this.editor, selectedListPath); // delete empty list
67
+
68
+ if (!currentList.children[0] || currentList.children[0].type !== 'list_item') {
69
+ SfEditor.removeNodes(_this.editor, {
70
+ at: selectedListPath
71
+ });
72
+ }
73
+ } else {
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
+ SfEditor.unwrapNodesByTypeAtRange(_this.editor, {
90
+ match: {
91
+ type: 'list_item'
92
+ },
93
+ at: [].concat(_toConsumableArray(_listParentPath), [startIndex + index])
94
+ });
95
+ });
96
+ }
97
+ };
98
+
99
+ this.wrapList = function (type) {
100
+ normailizeSelection(_this.editor);
101
+ var nodes = SfEditor.nodes(_this.editor, {
102
+ match: 'block'
103
+ });
104
+ SfEditor.wrapNodes(_this.editor, {
105
+ type: type,
106
+ children: []
107
+ }, {
108
+ split: false
109
+ }); // Get selected block node from an iterator.
110
+ // Modified according to the function *nodes from slate/src/interface/node.ts
111
+
112
+ var items = Array.from(nodes); // wrap selected nodes into list_item
113
+
114
+ for (var _i = 0, _items = items; _i < _items.length; _i++) {
115
+ var _items$_i = _slicedToArray(_items[_i], 2),
116
+ node = _items$_i[0],
117
+ path = _items$_i[1];
118
+
119
+ SfEditor.wrapNodes(_this.editor, {
120
+ type: 'list_item',
121
+ children: [node],
122
+ data: {}
123
+ }, {
124
+ at: path
125
+ });
126
+ }
127
+ };
128
+
129
+ this.getCurrentListItem = function () {
130
+ var selection = _this.editor.selection;
131
+
132
+ if (!selection) {
133
+ return [];
134
+ }
135
+
136
+ if (Range.isCollapsed(selection)) {
137
+ // get the nearest ancesstor of block, judge if the ancesstor is list item to compat the possibility that
138
+ // a code block or blockquote in a list item
139
+ var block = SfEditor.match(_this.editor, _this.editor.selection, 'block');
140
+ var blockPath = block[1];
141
+ var blockParent = Node.parent(_this.editor, blockPath);
142
+
143
+ if (blockParent.type && blockParent.type.indexOf('list') < 0) {
144
+ return [];
145
+ }
146
+
147
+ var listItemNodes = SfEditor.nodes(_this.editor, {
148
+ match: {
149
+ type: 'list_item'
150
+ }
151
+ });
152
+ var listItemNode;
153
+
154
+ var _iterator = _createForOfIteratorHelper(listItemNodes),
155
+ _step;
156
+
157
+ try {
158
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
159
+ var item = _step.value;
160
+ listItemNode = item;
161
+ }
162
+ } catch (err) {
163
+ _iterator.e(err);
164
+ } finally {
165
+ _iterator.f();
166
+ }
167
+
168
+ if (listItemNode) {
169
+ return [listItemNode];
170
+ }
171
+
172
+ return [];
173
+ }
174
+
175
+ var focusPath = selection.focus.path;
176
+ var anchorPath = selection.anchor.path;
177
+
178
+ var _SfEditor$nodes = SfEditor.nodes(_this.editor, {
179
+ match: 'block',
180
+ at: anchorPath
181
+ }),
182
+ _SfEditor$nodes2 = _slicedToArray(_SfEditor$nodes, 1),
183
+ startItem = _SfEditor$nodes2[0];
184
+
185
+ var _SfEditor$nodes3 = SfEditor.nodes(_this.editor, {
186
+ match: 'block',
187
+ at: focusPath
188
+ }),
189
+ _SfEditor$nodes4 = _slicedToArray(_SfEditor$nodes3, 1),
190
+ endItem = _SfEditor$nodes4[0];
191
+
192
+ var _startItem = _slicedToArray(startItem, 2),
193
+ startPath = _startItem[1];
194
+
195
+ var _endItem = _slicedToArray(endItem, 2),
196
+ endPath = _endItem[1];
197
+
198
+ if (Path.equals(startPath, endPath)) {
199
+ var _blockParent = Node.parent(_this.editor, startPath);
200
+
201
+ if (!_blockParent.type || _blockParent.type.indexOf('list') < 0) {
202
+ return [];
203
+ }
204
+
205
+ return [[_blockParent, startPath.slice(0, -1)]];
206
+ }
207
+
208
+ var commonPath = Path.common(focusPath, anchorPath);
209
+ var commonAncestor = Node.get(_this.editor, commonPath);
210
+ var nodeType = commonAncestor.type;
211
+
212
+ if (nodeType === 'ordered_list' || nodeType === 'unordered_list') {
213
+ var startIndex = anchorPath.slice(commonPath.length)[0];
214
+ var endIndex = focusPath.slice(commonPath.length)[0];
215
+ var selectedListItem = [];
216
+
217
+ for (var index = startIndex; index <= endIndex; index++) {
218
+ selectedListItem.push([commonAncestor.children[index], [].concat(_toConsumableArray(commonPath), [index])]);
219
+ }
220
+
221
+ return selectedListItem;
222
+ } else if (nodeType === 'list_item') {
223
+ return [[commonAncestor, commonPath]];
224
+ }
225
+
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
+ return [];
255
+ };
256
+
257
+ this.increaseListDepth = function () {
258
+ var listNodes = SfEditor.nodes(_this.editor, {
259
+ match: {
260
+ type: 'list_item'
261
+ }
262
+ });
263
+ var node; //get the nearest list_item of current selection
264
+
265
+ var _iterator3 = _createForOfIteratorHelper(listNodes),
266
+ _step3;
267
+
268
+ try {
269
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
270
+ var item = _step3.value;
271
+ node = item;
272
+ } // if current list item is the first child of the list return
273
+
274
+ } catch (err) {
275
+ _iterator3.e(err);
276
+ } finally {
277
+ _iterator3.f();
278
+ }
279
+
280
+ var listItemPath = _toConsumableArray(node[1]);
281
+
282
+ if (listItemPath[listItemPath.length - 1] === 0) return;
283
+ var listNode = Node.parent(_this.editor, listItemPath);
284
+ var listItemIndex = listItemPath.pop();
285
+ var listNodePath = listItemPath;
286
+ var previousListItem = listNode.children[listItemIndex - 1];
287
+ var previousListItemPath = [].concat(_toConsumableArray(listNodePath), [listItemIndex - 1]);
288
+ var lastIndex = previousListItem.children.length;
289
+ var newListPath = [].concat(_toConsumableArray(previousListItemPath), [lastIndex]);
290
+ SfEditor.insertNodes(_this.editor, {
291
+ type: listNode.type,
292
+ children: []
293
+ }, {
294
+ at: newListPath,
295
+ split: true
296
+ });
297
+ var newListItemPath = [].concat(_toConsumableArray(newListPath), [0]);
298
+ SfEditor.moveNodes(_this.editor, {
299
+ at: node[1],
300
+ to: newListItemPath
301
+ });
302
+ };
303
+
304
+ this.isInlist = function () {
305
+ var node = _this.getCurrentListItem();
306
+
307
+ if (node.length > 0) return true;
308
+ return false;
309
+ };
310
+
311
+ this.pasteContentInList = function (command) {
312
+ var data = command.data;
313
+
314
+ var _getEventTransfer = getEventTransfer(data),
315
+ fragment = _getEventTransfer.fragment,
316
+ text = _getEventTransfer.text,
317
+ type = _getEventTransfer.type,
318
+ html = _getEventTransfer.html;
319
+
320
+ if (type === 'text' && !fragment) {
321
+ var newText = text.replace(/\r\n|\n/g, ' ');
322
+ SfEditor.insertText(_this.editor, newText);
323
+ return;
324
+ }
325
+
326
+ if (type === 'html') {
327
+ fragment = htmlDeserializer(html);
328
+ } // insert fragment
329
+
330
+
331
+ if (text.length > 0) {
332
+ var newtext = text.replace(/\r\n|\n/g, ' ');
333
+ var firstBlock = fragment[0];
334
+ var firstBlockType = firstBlock.type;
335
+
336
+ var currentItem = _this.getCurrentListItem();
337
+
338
+ var currentItemPath = currentItem[0][1];
339
+ var currentItemIndex = currentItemPath[currentItemPath.length - 1];
340
+ var listPath = currentItemPath.slice(0, currentItemPath.length - 1);
341
+
342
+ if (firstBlockType === 'ordered_list' || firstBlockType === 'unordered_list') {
343
+ var listItems = firstBlock.children;
344
+ listItems.forEach(function (listItem, index) {
345
+ var itemChildren = listItem.children;
346
+ SfEditor.insertFragment(_this.editor, [itemChildren[0]]);
347
+
348
+ if (itemChildren.length > 1) {
349
+ SfEditor.insertNodes(_this.editor, itemChildren.slice(1));
350
+ }
351
+
352
+ if (index < listItems.length - 1) {
353
+ SfEditor.insertNodes(_this.editor, {
354
+ type: 'list_item',
355
+ data: {},
356
+ children: [{
357
+ type: 'paragraph',
358
+ children: [{
359
+ text: ''
360
+ }]
361
+ }]
362
+ }, {
363
+ at: [].concat(_toConsumableArray(listPath), [currentItemIndex + index + 1])
364
+ });
365
+ SfEditor.select(_this.editor, [].concat(_toConsumableArray(listPath), [currentItemIndex + index + 1]));
366
+ }
367
+ });
368
+
369
+ if (fragment.length > 1) {
370
+ var outestListItem = SfEditor.match(_this.editor, _this.editor.selection, {
371
+ type: 'list_item'
372
+ });
373
+ var outestListItemPath = outestListItem[1];
374
+ var outestListPath = outestListItemPath.slice(0, outestListItemPath.length - 1);
375
+ var outestListIndex = outestListPath[outestListPath.length - 1];
376
+ var nextBlockPath = [].concat(_toConsumableArray(outestListPath.slice(0, outestListPath.length - 1)), [outestListIndex + 1]);
377
+ SfEditor.insertNodes(_this.editor, fragment.slice(1), {
378
+ at: nextBlockPath
379
+ });
380
+ }
381
+ } else {
382
+ if (fragment.length === 1 && fragment[0].type === 'paragraph') {
383
+ SfEditor.insertFragment(_this.editor, fragment);
384
+ return;
385
+ } // insert text directly when the first block is not a list
386
+
387
+
388
+ SfEditor.insertText(_this.editor, newtext);
389
+ }
390
+ } else {
391
+ SfEditor.insertFragment(_this.editor, fragment);
392
+ }
393
+ };
394
+
395
+ this.editor = editor;
396
+ };
397
+
398
+ export default LitsUtils;