@seafile/sdoc-editor 0.1.154-beta4 → 0.1.154-beta6

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.
@@ -62,9 +62,9 @@ var SeafileAPI = /*#__PURE__*/function () {
62
62
  return this._sendPostRequest(url, form);
63
63
  }
64
64
  }, {
65
- key: "getSeadocOriginFileContentDownloadLink",
66
- value: function getSeadocOriginFileContentDownloadLink(docUuid) {
67
- var url = '/api/v2.1/seadoc/revision/origin-file-download-link/' + docUuid + '/';
65
+ key: "getSeadocOriginFileContent",
66
+ value: function getSeadocOriginFileContent(docUuid) {
67
+ var url = '/api/v2.1/seadoc/revision/origin-file-content/' + docUuid + '/';
68
68
  return this.req.get(url);
69
69
  }
70
70
  }, {
package/dist/context.js CHANGED
@@ -168,10 +168,10 @@ var Context = /*#__PURE__*/function () {
168
168
  return this.api.startRevise(repoID, fileUuid, filePath);
169
169
  }
170
170
  }, {
171
- key: "getSeadocOriginFileContentDownloadLink",
172
- value: function getSeadocOriginFileContentDownloadLink() {
171
+ key: "getSeadocOriginFileContent",
172
+ value: function getSeadocOriginFileContent() {
173
173
  var docUuid = this.getSetting('docUuid');
174
- return this.api.getSeadocOriginFileContentDownloadLink(docUuid);
174
+ return this.api.getSeadocOriginFileContent(docUuid);
175
175
  }
176
176
  }, {
177
177
  key: "getSdocRevisionsCount",
@@ -114,7 +114,7 @@ var SimpleEditor = function SimpleEditor(_ref) {
114
114
  var unsubscribeMergeDocumentError = eventBus.subscribe(EXTERNAL_EVENT.DOCUMENT_REPLACED_ERROR, onError);
115
115
  var unsubscribePublishDocumentError = eventBus.subscribe(EXTERNAL_EVENT.PUBLISH_DOCUMENT_ERROR, onError);
116
116
  var unsubscribeRemoveDocument = eventBus.subscribe(EXTERNAL_EVENT.REMOVE_DOCUMENT, onDocumentRemoved);
117
- var unsubscribeRemoveDocumentError = eventBus.subscribe(EXTERNAL_EVENT.REMOVE_DOCUMENT, onError);
117
+ var unsubscribeRemoveDocumentError = eventBus.subscribe(EXTERNAL_EVENT.REMOVE_DOCUMENT_ERROR, onError);
118
118
  return function () {
119
119
  unsubscribeMergeDocument();
120
120
  unsubscribePublishDocument();
@@ -153,12 +153,9 @@ var SimpleEditor = function SimpleEditor(_ref) {
153
153
  });
154
154
  }, []);
155
155
  var setDiffContent = useCallback(function () {
156
- context.getSeadocOriginFileContentDownloadLink().then(function (res) {
157
- var originFileDownloadLink = res.data.download_link;
158
- return fetch(originFileDownloadLink);
159
- }).then(function (res) {
160
- return res.json();
161
- }).then(function (originContent) {
156
+ context.getSeadocOriginFileContent().then(function (res) {
157
+ var originContentString = res.data.content;
158
+ var originContent = JSON.parse(originContentString);
162
159
  editorRef.current.setDiffContent(originContent);
163
160
  editorRef.current.setLoading(false);
164
161
  }).catch(function (error) {
@@ -210,14 +207,10 @@ var SimpleEditor = function SimpleEditor(_ref) {
210
207
  context.getRevisionBasicVersionContent().then(function (res) {
211
208
  var basicVersionContentString = res.data.content; // commit content
212
209
  basicContent = JSON.parse(basicVersionContentString);
213
- return context.getSeadocOriginFileContentDownloadLink();
210
+ return context.getSeadocOriginFileContent();
214
211
  }).then(function (res) {
215
- var originFileDownloadLink = res.data.download_link;
216
- return fetch(originFileDownloadLink);
217
- }).then(function (res) {
218
- return res.json();
219
- }).then(function (content) {
220
- masterContent = content;
212
+ var masterContentString = res.data.content;
213
+ masterContent = JSON.parse(masterContentString);
221
214
  var _getRebase = getRebase(masterContent, basicContent, revisionContent),
222
215
  canMerge = _getRebase.canMerge,
223
216
  isNeedReplaceMaster = _getRebase.isNeedReplaceMaster,
@@ -275,7 +268,6 @@ var SimpleEditor = function SimpleEditor(_ref) {
275
268
  var originFileURL = context.getSetting('originFileURL');
276
269
  jumpToURL(originFileURL);
277
270
  }).catch(function (error) {
278
- console.log(error);
279
271
  toaster.danger(t('Error'));
280
272
  });
281
273
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.154beta4",
3
+ "version": "0.1.154beta6",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -374,5 +374,6 @@
374
374
  "Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
375
375
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
376
376
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
377
- "Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!"
377
+ "Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
378
+ "Has_been_removed_tip": "Document has been removed, please view other documents."
378
379
  }