@seafile/seafile-editor 0.3.77 → 0.3.78

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.
@@ -309,6 +309,21 @@ var LitsUtils = function LitsUtils(editor) {
309
309
  return false;
310
310
  };
311
311
 
312
+ this.getNormalizedListItems = function (list) {
313
+ var listItems = [];
314
+ list.children.forEach(function (listItem) {
315
+ var children = listItem.children || [];
316
+ var firstChild = children[0];
317
+
318
+ if (firstChild && firstChild.type.includes('_list')) {
319
+ listItems.push.apply(listItems, _toConsumableArray(_this.getNormalizedListItems(firstChild)));
320
+ } else {
321
+ listItems.push(listItem);
322
+ }
323
+ });
324
+ return listItems;
325
+ };
326
+
312
327
  this.pasteContentInList = function (command) {
313
328
  var data = command.data;
314
329
 
@@ -318,6 +333,8 @@ var LitsUtils = function LitsUtils(editor) {
318
333
  type = _getEventTransfer.type,
319
334
  html = _getEventTransfer.html;
320
335
 
336
+ console.log(fragment);
337
+
321
338
  if (type === 'text' && !fragment) {
322
339
  var newText = text.replace(/\r\n|\n/g, ' ');
323
340
  SfEditor.insertText(_this.editor, newText);
@@ -341,7 +358,8 @@ var LitsUtils = function LitsUtils(editor) {
341
358
  var listPath = currentItemPath.slice(0, currentItemPath.length - 1);
342
359
 
343
360
  if (firstBlockType === 'ordered_list' || firstBlockType === 'unordered_list') {
344
- var listItems = firstBlock.children;
361
+ var listItems = _this.getNormalizedListItems(firstBlock);
362
+
345
363
  listItems.forEach(function (listItem, index) {
346
364
  var itemChildren = listItem.children;
347
365
  SfEditor.insertFragment(_this.editor, [itemChildren[0]]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "0.3.77",
3
+ "version": "0.3.78",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@seafile/slate-react": "^0.54.13",