@seafile/seafile-editor 0.3.75 → 0.3.79

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.
@@ -291,9 +291,9 @@ var withMarkdownShortcut = function withMarkdownShortcut(editor) {
291
291
  _Editor$nodes8 = _slicedToArray(_Editor$nodes7, 1),
292
292
  match = _Editor$nodes8[0];
293
293
 
294
- var _block2 = match[0]; // if the header content is none set the header to paragraph when delete
294
+ var _block2 = match[0]; // set header to paragraph when delete at the start of header
295
295
 
296
- if (_block2.type.includes('header') && Node.text(_block2).length === 0) {
296
+ if (_block2.type.includes('header')) {
297
297
  editor.exec({
298
298
  type: 'set_header',
299
299
  headerType: 'paragraph'
@@ -90,6 +90,7 @@ var LitsUtils = function LitsUtils(editor) {
90
90
  match: {
91
91
  type: 'list_item'
92
92
  },
93
+ mode: 'highest',
93
94
  at: [].concat(_toConsumableArray(_listParentPath), [startIndex + index])
94
95
  });
95
96
  });
@@ -308,6 +309,21 @@ var LitsUtils = function LitsUtils(editor) {
308
309
  return false;
309
310
  };
310
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
+
311
327
  this.pasteContentInList = function (command) {
312
328
  var data = command.data;
313
329
 
@@ -340,7 +356,8 @@ var LitsUtils = function LitsUtils(editor) {
340
356
  var listPath = currentItemPath.slice(0, currentItemPath.length - 1);
341
357
 
342
358
  if (firstBlockType === 'ordered_list' || firstBlockType === 'unordered_list') {
343
- var listItems = firstBlock.children;
359
+ var listItems = _this.getNormalizedListItems(firstBlock);
360
+
344
361
  listItems.forEach(function (listItem, index) {
345
362
  var itemChildren = listItem.children;
346
363
  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.75",
3
+ "version": "0.3.79",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@seafile/slate-react": "^0.54.13",