@seafile/sdoc-editor 1.0.162-alpha.1 → 1.0.162-alpha.2
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
CHANGED
|
@@ -117,11 +117,13 @@ class SeafileAPI {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
// local files
|
|
120
|
-
getSdocFiles(docUuid, p, type) {
|
|
120
|
+
getSdocFiles(docUuid, p, type, server) {
|
|
121
121
|
const url = 'api/v2.1/seadoc/dir/' + docUuid + '/?p=' + p + '&type=' + type + '&doc_uuid=' + docUuid;
|
|
122
|
-
const url2 = 'api/v2.1/seadoc/dir/' + docUuid;
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
const url2 = 'api/v2.1/seadoc/dir/' + docUuid + '/?p=' + p + '&doc_uuid=' + docUuid;
|
|
123
|
+
// const repoID = this.getSetting('repoID');
|
|
124
|
+
// console.log(99, url, repoID);
|
|
125
|
+
const url3 = 'api/v2.1/repos/';
|
|
126
|
+
return this.req.get(url3);
|
|
125
127
|
}
|
|
126
128
|
getSdocFileId(docUuid, p) {
|
|
127
129
|
const url = 'api/v2.1/seadoc/file-uuid/' + docUuid + '/?p=' + p;
|
|
@@ -46,6 +46,7 @@ const LocalFiles = _ref => {
|
|
|
46
46
|
item.indexId = _slugid.default.nice();
|
|
47
47
|
});
|
|
48
48
|
// Open folder
|
|
49
|
+
console.log(3, res.data);
|
|
49
50
|
if (indexId && treeData.length > 0) {
|
|
50
51
|
const newFileListData = (0, _helpers.addDataToTree)(treeData, indexId, res.data, p);
|
|
51
52
|
setTreeData([...newFileListData]);
|
|
@@ -89,6 +90,7 @@ const LocalFiles = _ref => {
|
|
|
89
90
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
90
91
|
}, []);
|
|
91
92
|
const renderFileTree = (0, _react.useCallback)(data => {
|
|
93
|
+
// console.log(2, data);
|
|
92
94
|
if (!Array.isArray(data) || data.length === 0) return null;
|
|
93
95
|
return data.map(item => {
|
|
94
96
|
var _item$children, _item$children2;
|
package/dist/context.js
CHANGED
|
@@ -14,6 +14,7 @@ class Context {
|
|
|
14
14
|
constructor() {
|
|
15
15
|
(0, _defineProperty2.default)(this, "initSettings", () => {
|
|
16
16
|
this.settings = window.seafile ? window.seafile : window.seafileConfig;
|
|
17
|
+
console.log(1, this.settings);
|
|
17
18
|
const {
|
|
18
19
|
name,
|
|
19
20
|
username,
|
|
@@ -26,6 +27,7 @@ class Context {
|
|
|
26
27
|
};
|
|
27
28
|
this.user = new _model.User(userInfo);
|
|
28
29
|
if (this.settings['isSdocRevision']) {
|
|
30
|
+
console.log(2);
|
|
29
31
|
const repoID = this.getSetting('repoID');
|
|
30
32
|
const siteRoot = this.getSetting('siteRoot');
|
|
31
33
|
const originFilePath = this.getSetting('originFilePath');
|
|
@@ -60,6 +62,7 @@ class Context {
|
|
|
60
62
|
this.initSettings(); // lazy init context class
|
|
61
63
|
const server = this.getSetting('serviceUrl');
|
|
62
64
|
const token = this.getSetting('accessToken');
|
|
65
|
+
// console.log(2, server, token)
|
|
63
66
|
this.api = new _seafileApi.default(server, token);
|
|
64
67
|
const isOpenSocket = this.getSetting('isOpenSocket');
|
|
65
68
|
if (isOpenSocket) {
|
|
@@ -197,12 +200,41 @@ class Context {
|
|
|
197
200
|
// local files
|
|
198
201
|
getSdocLocalFiles(p, type) {
|
|
199
202
|
const docUuid = this.getSetting('docUuid');
|
|
203
|
+
const repoID = this.getSetting('repoID');
|
|
204
|
+
console.log(100, docUuid, repoID);
|
|
200
205
|
console.log(100, p, type, docUuid);
|
|
201
|
-
return this.api.getSdocFiles(docUuid, p, type);
|
|
206
|
+
return this.api.getSdocFiles(docUuid, p, type, this.server);
|
|
207
|
+
}
|
|
208
|
+
listRepos(options) {
|
|
209
|
+
/*
|
|
210
|
+
* options: `{type: 'shared'}`, `{type: ['mine', 'shared', ...]}`
|
|
211
|
+
*/
|
|
212
|
+
let url = this.server + '/api/v2.1/repos/';
|
|
213
|
+
if (!options) {
|
|
214
|
+
// fetch all types of repos
|
|
215
|
+
return this.req.get(url);
|
|
216
|
+
}
|
|
217
|
+
return this.req.get(url, {
|
|
218
|
+
params: options,
|
|
219
|
+
paramsSerializer: {
|
|
220
|
+
serialize: function (params) {
|
|
221
|
+
let list = [];
|
|
222
|
+
for (let key in params) {
|
|
223
|
+
if (Array.isArray(params[key])) {
|
|
224
|
+
for (let i = 0, len = params[key].length; i < len; i++) {
|
|
225
|
+
list.push(key + '=' + encodeURIComponent(params[key][i]));
|
|
226
|
+
}
|
|
227
|
+
} else {
|
|
228
|
+
list.push(key + '=' + encodeURIComponent(params[key]));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return list.join('&');
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
202
235
|
}
|
|
203
236
|
getSdocLocalFileId(p) {
|
|
204
237
|
const docUuid = this.getSetting('docUuid');
|
|
205
|
-
console.log(100, docUuid);
|
|
206
238
|
return this.api.getSdocFileId(docUuid, p);
|
|
207
239
|
}
|
|
208
240
|
getSdocLocalFileUrl(docUuid) {
|