@seafile/sdoc-editor 1.0.124 → 1.0.125

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
  }
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.125",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",