@seafile/sdoc-editor 0.1.159-beta12 → 0.1.159-beta14

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.
@@ -99,7 +99,7 @@ var SeafileAPI = /*#__PURE__*/function () {
99
99
  }, {
100
100
  key: "getRevisionBasicVersionContent",
101
101
  value: function getRevisionBasicVersionContent(docUuid) {
102
- var url = 'api/v2.1/seadoc/revision/basic-version-content/' + docUuid + '/';
102
+ var url = 'api/v2.1/seadoc/revision/base-version-content/' + docUuid + '/';
103
103
  return this.req.get(url);
104
104
  }
105
105
 
@@ -87,18 +87,14 @@ var Editor = forwardRef(function (_ref, ref) {
87
87
  setSlateValue: function setSlateValue(document) {
88
88
  _setSlateValue(document.children);
89
89
  },
90
+ updateDocumentVersion: function updateDocumentVersion(document) {
91
+ editor.updateDocumentVersion(document);
92
+ },
90
93
  // get value
91
94
  getSlateValue: function getSlateValue() {
92
95
  return deepCopy(_objectSpread(_objectSpread({}, document), {}, {
93
96
  children: slateValue
94
97
  }));
95
- },
96
- // send message
97
- publishDocument: function publishDocument(originDocUuid, originDocName, callback) {
98
- editor.publishDocument(originDocUuid, originDocName, callback);
99
- },
100
- replaceDocument: function replaceDocument(value, callback) {
101
- editor.replaceDocument(value, callback);
102
98
  }
103
99
 
104
100
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -119,14 +119,6 @@ var SocketClient = /*#__PURE__*/_createClass(function SocketClient(config) {
119
119
  this.disconnectWithServer = function () {
120
120
  _this.socket.disconnect();
121
121
  };
122
- this.sendPublishDocument = function (originDocUuid, originDocName, callback) {
123
- _this.socket.emit('publish-document', _this.getParams({
124
- origin_doc_uuid: originDocUuid,
125
- origin_doc_name: originDocName
126
- }), function (success) {
127
- callback && callback(success);
128
- });
129
- };
130
122
  this.receivePublishDocument = function () {
131
123
  var socketManager = SocketManager.getInstance();
132
124
  socketManager.receivePublishDocument();
@@ -135,13 +127,6 @@ var SocketClient = /*#__PURE__*/_createClass(function SocketClient(config) {
135
127
  var socketManager = SocketManager.getInstance();
136
128
  socketManager.receivePublishDocumentError();
137
129
  };
138
- this.sendReplaceDocument = function (document, callback) {
139
- _this.socket.emit('replace-document', _this.getParams({
140
- document: document
141
- }), function (result) {
142
- callback && callback(result);
143
- });
144
- };
145
130
  this.receiveDocumentReplaced = function () {
146
131
  var socketManager = SocketManager.getInstance();
147
132
  socketManager.receiveDocumentReplaced();
@@ -27,8 +27,8 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, _do
27
27
  var version = _this.document.version;
28
28
  return version;
29
29
  };
30
- this.sendPublishDocument = function (originDocUuid, originDocName, callback) {
31
- _this.socketClient.sendPublishDocument(originDocUuid, originDocName, callback);
30
+ this.updateDocumentVersion = function (document) {
31
+ _this.document['version'] = document.version;
32
32
  };
33
33
  this.receivePublishDocument = function () {
34
34
  _this.eventBus.dispatch(EXTERNAL_EVENT.PUBLISH_DOCUMENT);
@@ -42,16 +42,6 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, _do
42
42
  this.receiveRemoveDocumentError = function () {
43
43
  _this.eventBus.dispatch(EXTERNAL_EVENT.REMOVE_DOCUMENT_ERROR);
44
44
  };
45
- this.sendReplaceDocument = function (document, callback) {
46
- _this.socketClient.sendReplaceDocument(document, function (result) {
47
- var serverVersion = result.version,
48
- success = result.success;
49
- if (success) {
50
- _this.document['version'] = serverVersion;
51
- }
52
- callback && callback(success);
53
- });
54
- };
55
45
  this.receiveDocumentReplaced = function () {
56
46
  _this.eventBus.dispatch(EXTERNAL_EVENT.DOCUMENT_REPLACED);
57
47
  };
@@ -54,15 +54,10 @@ var withSocketIO = function withSocketIO(editor, options) {
54
54
  var socketManager = SocketManager.getInstance(newEditor, document, config);
55
55
  socketManager.sendRebaseContent(document, originFileVersion);
56
56
  };
57
- newEditor.publishDocument = function (originDocUuid, originDocName, callback) {
57
+ newEditor.updateDocumentVersion = function (document) {
58
58
  var config = options.config;
59
59
  var socketManager = SocketManager.getInstance(newEditor, document, config);
60
- socketManager.sendPublishDocument(originDocUuid, originDocName, callback);
61
- };
62
- newEditor.replaceDocument = function (document, callback) {
63
- var config = options.config;
64
- var socketManager = SocketManager.getInstance(newEditor, document, config);
65
- socketManager.sendReplaceDocument(document, callback);
60
+ socketManager.updateDocumentVersion(document);
66
61
  };
67
62
  return newEditor;
68
63
  };
@@ -287,6 +287,7 @@ var SimpleEditor = function SimpleEditor(_ref) {
287
287
  });
288
288
  editorRef.current.setLoading(true);
289
289
  editorRef.current.setSlateValue(mergeValue);
290
+ editorRef.current.updateDocumentVersion(mergeValue);
290
291
  setMode(MODE.EDITOR);
291
292
  editorRef.current.setEditorMode(MODE.EDITOR);
292
293
  editorRef.current.setLoading(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.159beta12",
3
+ "version": "0.1.159beta14",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",