@seafile/comment-editor 0.0.3 → 0.0.4

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.
@@ -31,6 +31,10 @@ class Context {
31
31
  return relative_path;
32
32
  });
33
33
  });
34
+ (0, _defineProperty2.default)(this, "getFileUrlByUuid", docUuid => {
35
+ const sdocServer = this.getSetting('serviceUrl');
36
+ return sdocServer + '/api/v2.1/seadoc/file/' + docUuid + '/?doc_uuid=' + docUuid;
37
+ });
34
38
  this.settings = null;
35
39
  this.api = null;
36
40
  this.config = null;
@@ -34,6 +34,16 @@ exports.normalizeChildren = normalizeChildren;
34
34
  const normalizeCopyNodes = (editor, elements) => {
35
35
  if (!Array.isArray(elements) || elements.length === 0) return [];
36
36
  return elements.map(element => {
37
+ element.children.forEach(child => {
38
+ const {
39
+ type,
40
+ doc_uuid
41
+ } = child;
42
+ if (['sdoc_link', 'file_link'].includes(type)) {
43
+ child['type'] = _constants.LINK;
44
+ child['href'] = _context.default.getFileUrlByUuid(doc_uuid);
45
+ }
46
+ });
37
47
  return element;
38
48
  });
39
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/comment-editor",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "private": false,
5
5
  "description": "This is a comment editor",
6
6
  "main": "dist/index.js",