@seafile/sdoc-editor 0.1.149-beta2 → 0.1.149-beta3
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.
- package/dist/api/seafile-api.js +0 -14
- package/dist/basic-sdk/editor/index.js +2 -5
- package/dist/basic-sdk/socket/socket-client.js +2 -2
- package/dist/basic-sdk/socket/socket-manager.js +2 -2
- package/dist/basic-sdk/socket/with-socket-io.js +2 -7
- package/dist/context.js +0 -13
- package/dist/pages/simple-editor.js +8 -14
- package/package.json +1 -1
package/dist/api/seafile-api.js
CHANGED
|
@@ -46,14 +46,6 @@ var SeafileAPI = /*#__PURE__*/function () {
|
|
|
46
46
|
var url = '/api/v2.1/seadoc/download-image/' + docUuid + '/' + encodeURIComponent(imageName);
|
|
47
47
|
return this.req.get(url);
|
|
48
48
|
}
|
|
49
|
-
}, {
|
|
50
|
-
key: "sdocPublishRevision",
|
|
51
|
-
value: function sdocPublishRevision(docUuid, replace) {
|
|
52
|
-
var url = '/api/v2.1/seadoc/publish-revision/' + docUuid + '/';
|
|
53
|
-
var form = new FormData();
|
|
54
|
-
form.append('replace', replace);
|
|
55
|
-
return this._sendPostRequest(url, form);
|
|
56
|
-
}
|
|
57
49
|
}, {
|
|
58
50
|
key: "startRevise",
|
|
59
51
|
value: function startRevise(repoID, fileUuid, path) {
|
|
@@ -83,12 +75,6 @@ var SeafileAPI = /*#__PURE__*/function () {
|
|
|
83
75
|
var url = 'api/v2.1/seadoc/revisions/' + docUuid + '/?page=' + page + '&per_page=' + perPage;
|
|
84
76
|
return this.req.get(url);
|
|
85
77
|
}
|
|
86
|
-
}, {
|
|
87
|
-
key: "deleteSdocRevision",
|
|
88
|
-
value: function deleteSdocRevision(docUuid) {
|
|
89
|
-
var url = 'api/v2.1/seadoc/revision/' + docUuid + '/';
|
|
90
|
-
return this.req.delete(url);
|
|
91
|
-
}
|
|
92
78
|
}, {
|
|
93
79
|
key: "updateSdocRevision",
|
|
94
80
|
value: function updateSdocRevision(docUuid) {
|
|
@@ -94,14 +94,11 @@ var Editor = forwardRef(function (_ref, ref) {
|
|
|
94
94
|
}));
|
|
95
95
|
},
|
|
96
96
|
// send message
|
|
97
|
-
publishDocument: function publishDocument(originDocUuid, originDocName, isNeedUpdateOriginDoc) {
|
|
98
|
-
editor.publishDocument(originDocUuid, originDocName, isNeedUpdateOriginDoc);
|
|
97
|
+
publishDocument: function publishDocument(originDocUuid, originDocName, isNeedUpdateOriginDoc, callback) {
|
|
98
|
+
editor.publishDocument(originDocUuid, originDocName, isNeedUpdateOriginDoc, callback);
|
|
99
99
|
},
|
|
100
100
|
replaceDocument: function replaceDocument(value, originFileVersion) {
|
|
101
101
|
editor.replaceDocument(value, originFileVersion);
|
|
102
|
-
},
|
|
103
|
-
saveDocument: function saveDocument(callback) {
|
|
104
|
-
editor.saveDocument(callback);
|
|
105
102
|
}
|
|
106
103
|
|
|
107
104
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -124,8 +124,8 @@ var SocketClient = /*#__PURE__*/_createClass(function SocketClient(config) {
|
|
|
124
124
|
origin_doc_uuid: originDocUuid,
|
|
125
125
|
origin_doc_name: originDocName,
|
|
126
126
|
update_origin_doc: isNeedUpdateOriginDoc
|
|
127
|
-
}), function (
|
|
128
|
-
callback && callback(
|
|
127
|
+
}), function (success) {
|
|
128
|
+
callback && callback(success);
|
|
129
129
|
});
|
|
130
130
|
};
|
|
131
131
|
this.receivePublishDocument = function () {
|
|
@@ -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, isNeedUpdateOriginDoc) {
|
|
31
|
-
_this.socketClient.sendPublishDocument(originDocUuid, originDocName, isNeedUpdateOriginDoc);
|
|
30
|
+
this.sendPublishDocument = function (originDocUuid, originDocName, isNeedUpdateOriginDoc, callback) {
|
|
31
|
+
_this.socketClient.sendPublishDocument(originDocUuid, originDocName, isNeedUpdateOriginDoc, callback);
|
|
32
32
|
};
|
|
33
33
|
this.receivePublishDocument = function () {
|
|
34
34
|
_this.eventBus.dispatch(EXTERNAL_EVENT.PUBLISH_DOCUMENT);
|
|
@@ -54,21 +54,16 @@ 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, isNeedUpdateOriginDoc) {
|
|
57
|
+
newEditor.publishDocument = function (originDocUuid, originDocName, isNeedUpdateOriginDoc, callback) {
|
|
58
58
|
var config = options.config;
|
|
59
59
|
var socketManager = SocketManager.getInstance(newEditor, document, config);
|
|
60
|
-
socketManager.sendPublishDocument(originDocUuid, originDocName, isNeedUpdateOriginDoc);
|
|
60
|
+
socketManager.sendPublishDocument(originDocUuid, originDocName, isNeedUpdateOriginDoc, callback);
|
|
61
61
|
};
|
|
62
62
|
newEditor.replaceDocument = function (document) {
|
|
63
63
|
var config = options.config;
|
|
64
64
|
var socketManager = SocketManager.getInstance(newEditor, document, config);
|
|
65
65
|
socketManager.sendReplaceDocument(document);
|
|
66
66
|
};
|
|
67
|
-
newEditor.saveDocument = function (callback) {
|
|
68
|
-
var config = options.config;
|
|
69
|
-
var socketManager = SocketManager.getInstance(newEditor, document, config);
|
|
70
|
-
socketManager.sendSaveDocument(callback);
|
|
71
|
-
};
|
|
72
67
|
return newEditor;
|
|
73
68
|
};
|
|
74
69
|
export default withSocketIO;
|
package/dist/context.js
CHANGED
|
@@ -163,13 +163,6 @@ var Context = /*#__PURE__*/function () {
|
|
|
163
163
|
var fileUuid = this.getSetting('docUuid');
|
|
164
164
|
return this.api.startRevise(repoID, fileUuid, filePath);
|
|
165
165
|
}
|
|
166
|
-
}, {
|
|
167
|
-
key: "publishSdocRevision",
|
|
168
|
-
value: function publishSdocRevision() {
|
|
169
|
-
var replace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
170
|
-
var docUuid = this.getSetting('docUuid');
|
|
171
|
-
return this.api.sdocPublishRevision(docUuid, replace);
|
|
172
|
-
}
|
|
173
166
|
}, {
|
|
174
167
|
key: "getSeadocOriginFileDownloadLink",
|
|
175
168
|
value: function getSeadocOriginFileDownloadLink() {
|
|
@@ -188,12 +181,6 @@ var Context = /*#__PURE__*/function () {
|
|
|
188
181
|
var docUuid = this.getSetting('docUuid');
|
|
189
182
|
return this.api.getSdocRevisions(docUuid, page, perPage);
|
|
190
183
|
}
|
|
191
|
-
}, {
|
|
192
|
-
key: "deleteSdocRevision",
|
|
193
|
-
value: function deleteSdocRevision() {
|
|
194
|
-
var docUuid = this.getSetting('docUuid');
|
|
195
|
-
return this.api.deleteSdocRevision(docUuid);
|
|
196
|
-
}
|
|
197
184
|
}, {
|
|
198
185
|
key: "updateSdocRevision",
|
|
199
186
|
value: function updateSdocRevision() {
|
|
@@ -227,15 +227,10 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
227
227
|
isNeedReplaceMaster = _getRebase.isNeedReplaceMaster,
|
|
228
228
|
value = _getRebase.value;
|
|
229
229
|
if (canMerge && isNeedReplaceMaster) {
|
|
230
|
-
editorRef.current.
|
|
231
|
-
if (
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
setTipType(TIP_TYPE.HAS_BEEN_PUBLISHED);
|
|
235
|
-
setShowTip(true);
|
|
236
|
-
}).catch(function (error) {
|
|
237
|
-
toaster.danger(t('Error'));
|
|
238
|
-
});
|
|
230
|
+
editorRef.current.publishDocument(originDocUuid, originDocName, true, function (success) {
|
|
231
|
+
if (success) {
|
|
232
|
+
setTipType(TIP_TYPE.HAS_BEEN_PUBLISHED);
|
|
233
|
+
setShowTip(true);
|
|
239
234
|
} else {
|
|
240
235
|
toaster.danger(t('Error'));
|
|
241
236
|
}
|
|
@@ -279,14 +274,13 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
279
274
|
}, [tipType]);
|
|
280
275
|
var tipSubmit = useCallback(function () {
|
|
281
276
|
if (tipType === TIP_TYPE.DELETE_NO_CHANGES_REVISION) {
|
|
282
|
-
|
|
283
|
-
if (
|
|
284
|
-
editorRef.current.publishDocument(originDocUuid, originDocName, false);
|
|
277
|
+
editorRef.current.publishDocument(originDocUuid, originDocName, false, function (success) {
|
|
278
|
+
if (success) {
|
|
285
279
|
setShowTip(false);
|
|
286
280
|
jumpToURL(originFileURL);
|
|
281
|
+
} else {
|
|
282
|
+
toaster.danger(t('Error'));
|
|
287
283
|
}
|
|
288
|
-
}).catch(function (error) {
|
|
289
|
-
toaster.danger(t('Error'));
|
|
290
284
|
});
|
|
291
285
|
return;
|
|
292
286
|
}
|