@seafile/sdoc-editor 1.0.124 → 1.0.126

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.
@@ -42,12 +42,17 @@ const withLink = editor => {
42
42
  // Internal link, insert sdoc file link
43
43
  if ((0, _isUrl.default)(text) && !(0, _utils.isImage)(text)) {
44
44
  if ((0, _utils.isSameDomain)(text, _context.default.getSetting('serviceUrl'))) {
45
- const res = await _context.default.getLinkFilesInfo([text]);
46
- if ((0, _helpers2.isSdocFile)(res, text)) {
47
- const fileName = res.data.files_info[text].name;
48
- const fileUuid = res.data.files_info[text].file_uuid;
49
- (0, _helpers.insertSdocFileLink)(editor, fileName, fileUuid);
50
- } else {
45
+ try {
46
+ const res = await _context.default.getLinkFilesInfo([text]);
47
+ if ((0, _helpers2.isSdocFile)(res, text)) {
48
+ const fileName = res.data.files_info[text].name;
49
+ const fileUuid = res.data.files_info[text].file_uuid;
50
+ (0, _helpers.insertSdocFileLink)(editor, fileName, fileUuid);
51
+ } else {
52
+ const link = (0, _helpers2.genLinkNode)(text, text);
53
+ _slate.Transforms.insertNodes(newEditor, link);
54
+ }
55
+ } catch (err) {
51
56
  const link = (0, _helpers2.genLinkNode)(text, text);
52
57
  _slate.Transforms.insertNodes(newEditor, link);
53
58
  }
@@ -278,10 +278,12 @@ const withTable = editor => {
278
278
  }
279
279
  }
280
280
  }
281
- const [node] = (0, _core.getTopLevelBlockNode)(editor);
282
- if (_slate.Range.isRange(selection) && (node === null || node === void 0 ? void 0 : node.type) === _constants.ELEMENT_TYPE.TABLE) {
283
- newEditor.deleteBackward();
284
- return;
281
+ if (_slate.Range.isRange(selection) && (0, _helpers.isAllInTable)(editor)) {
282
+ const [node] = (0, _core.getTopLevelBlockNode)(editor);
283
+ if (_slate.Range.isRange(selection) && (node === null || node === void 0 ? void 0 : node.type) === _constants.ELEMENT_TYPE.TABLE) {
284
+ newEditor.deleteBackward();
285
+ return;
286
+ }
285
287
  }
286
288
  deleteFragment(unit);
287
289
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.124",
3
+ "version": "1.0.126",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",