@seafile/seafile-editor 0.3.74 → 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.
@@ -78,6 +78,7 @@ var InternalLinkDialog = /*#__PURE__*/function (_React$Component) {
78
78
  className: "tip mb-1"
79
79
  }, this.props.t('internal_link_desc')), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("a", {
80
80
  target: "_blank",
81
+ rel: "noopener noreferrer",
81
82
  href: this.state.smartLink
82
83
  }, this.state.smartLink))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
83
84
  color: "secondary",
@@ -57,6 +57,7 @@ var RelatedFilesList = /*#__PURE__*/function (_React$Component) {
57
57
  key: index
58
58
  }, /*#__PURE__*/React.createElement("a", {
59
59
  href: href,
60
+ rel: "noopener noreferrer",
60
61
  target: "_blank"
61
62
  }, /*#__PURE__*/React.createElement(Card, {
62
63
  body: true,
@@ -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'
@@ -109,7 +109,8 @@ var TextLinkHoverMenu = /*#__PURE__*/function (_React$Component) {
109
109
  }
110
110
  }, /*#__PURE__*/React.createElement("a", {
111
111
  href: this.linkUrl,
112
- target: "blank",
112
+ target: "_blank",
113
+ rel: "noopener noreferrer",
113
114
  className: "seafile-ed-hovermenu-link"
114
115
  }, this.linkUrl), /*#__PURE__*/React.createElement(Button, {
115
116
  color: "",
@@ -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
 
@@ -317,6 +333,8 @@ var LitsUtils = function LitsUtils(editor) {
317
333
  type = _getEventTransfer.type,
318
334
  html = _getEventTransfer.html;
319
335
 
336
+ console.log(fragment);
337
+
320
338
  if (type === 'text' && !fragment) {
321
339
  var newText = text.replace(/\r\n|\n/g, ' ');
322
340
  SfEditor.insertText(_this.editor, newText);
@@ -340,7 +358,8 @@ var LitsUtils = function LitsUtils(editor) {
340
358
  var listPath = currentItemPath.slice(0, currentItemPath.length - 1);
341
359
 
342
360
  if (firstBlockType === 'ordered_list' || firstBlockType === 'unordered_list') {
343
- var listItems = firstBlock.children;
361
+ var listItems = _this.getNormalizedListItems(firstBlock);
362
+
344
363
  listItems.forEach(function (listItem, index) {
345
364
  var itemChildren = listItem.children;
346
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.74",
3
+ "version": "0.3.78",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@seafile/slate-react": "^0.54.13",