@seafile/sdoc-editor 0.1.140 → 0.1.142-beta
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/sdoc-server-api.js +15 -0
- package/dist/api/seafile-api.js +27 -5
- package/dist/basic-sdk/assets/css/default.css +1 -1
- package/dist/basic-sdk/assets/css/dropdown-menu.css +5 -1
- package/dist/basic-sdk/constants/index.js +14 -1
- package/dist/basic-sdk/editor/common-editor.js +45 -0
- package/dist/basic-sdk/editor/index.js +135 -0
- package/dist/basic-sdk/editor/rebase-editor/index.css +29 -0
- package/dist/basic-sdk/editor/rebase-editor/index.js +276 -0
- package/dist/basic-sdk/{slate-editor.js → editor/slate-editor.js} +21 -16
- package/dist/basic-sdk/extension/constants/index.js +1 -1
- package/dist/basic-sdk/extension/core/transforms/replace-node-children.js +26 -0
- package/dist/basic-sdk/extension/plugins/link/plugin.js +15 -3
- package/dist/basic-sdk/extension/toolbar/header-toolbar/index.js +5 -1
- package/dist/basic-sdk/extension/toolbar/header-toolbar/insert-toolbar/index.css +7 -2
- package/dist/basic-sdk/socket/helpers.js +1 -0
- package/dist/basic-sdk/socket/socket-client.js +5 -0
- package/dist/basic-sdk/socket/socket-manager.js +8 -2
- package/dist/basic-sdk/socket/with-socket-io.js +20 -12
- package/dist/basic-sdk/utils/diff.js +2 -2
- package/dist/basic-sdk/utils/rebase.js +193 -0
- package/dist/basic-sdk/views/diff-viewer.js +3 -1
- package/dist/basic-sdk/views/viewer.js +8 -11
- package/dist/components/doc-operations/index.js +8 -2
- package/dist/components/doc-operations/revision-operations/index.js +11 -3
- package/dist/components/doc-operations/revision-operations/publish-button.js +16 -13
- package/dist/components/tip-dialog/index.css +0 -0
- package/dist/components/tip-dialog/index.js +45 -0
- package/dist/constants/index.js +8 -1
- package/dist/context.js +30 -4
- package/dist/pages/simple-editor.js +221 -71
- package/package.json +2 -2
- package/public/locales/cs/sdoc-editor.json +2 -2
- package/public/locales/de/sdoc-editor.json +2 -2
- package/public/locales/en/sdoc-editor.json +8 -2
- package/public/locales/es/sdoc-editor.json +2 -2
- package/public/locales/fr/sdoc-editor.json +2 -2
- package/public/locales/ru/sdoc-editor.json +2 -2
- package/public/locales/zh_CN/sdoc-editor.json +8 -2
- package/dist/basic-sdk/editor.js +0 -105
package/dist/constants/index.js
CHANGED
|
@@ -2,5 +2,12 @@ export var EXTERNAL_EVENT = {
|
|
|
2
2
|
INTERNAL_LINK_CLICK: 'internal_link_click',
|
|
3
3
|
TOGGLE_STAR: 'toggle_star',
|
|
4
4
|
UNMARK_AS_DRAFT: 'unmark_as_draft',
|
|
5
|
-
SHARE_SDOC: 'share_sdoc'
|
|
5
|
+
SHARE_SDOC: 'share_sdoc',
|
|
6
|
+
REBASE_DOCUMENT: 'rebase_document'
|
|
7
|
+
};
|
|
8
|
+
export var MODE = {
|
|
9
|
+
DIFF_VIEWER: 'diff-viewer',
|
|
10
|
+
VIEWER: 'viewer',
|
|
11
|
+
EDITOR: 'editor',
|
|
12
|
+
REBASE: 'rebase'
|
|
6
13
|
};
|
package/dist/context.js
CHANGED
|
@@ -89,6 +89,11 @@ var Context = /*#__PURE__*/function () {
|
|
|
89
89
|
value: function saveContent(content) {
|
|
90
90
|
return this.sdocServerApi.saveDocContent(content);
|
|
91
91
|
}
|
|
92
|
+
}, {
|
|
93
|
+
key: "saveDocContentByRebase",
|
|
94
|
+
value: function saveDocContentByRebase(content) {
|
|
95
|
+
return this.sdocServerApi.saveDocContentByRebase(content);
|
|
96
|
+
}
|
|
92
97
|
}, {
|
|
93
98
|
key: "getCollaborators",
|
|
94
99
|
value: function getCollaborators() {
|
|
@@ -156,14 +161,15 @@ var Context = /*#__PURE__*/function () {
|
|
|
156
161
|
}, {
|
|
157
162
|
key: "publishSdocRevision",
|
|
158
163
|
value: function publishSdocRevision() {
|
|
164
|
+
var replace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
159
165
|
var docUuid = this.getSetting('docUuid');
|
|
160
|
-
return this.api.sdocPublishRevision(docUuid);
|
|
166
|
+
return this.api.sdocPublishRevision(docUuid, replace);
|
|
161
167
|
}
|
|
162
168
|
}, {
|
|
163
|
-
key: "
|
|
164
|
-
value: function
|
|
169
|
+
key: "getSeadocOriginFileDownloadLink",
|
|
170
|
+
value: function getSeadocOriginFileDownloadLink() {
|
|
165
171
|
var docUuid = this.getSetting('docUuid');
|
|
166
|
-
return this.api.
|
|
172
|
+
return this.api.getSeadocOriginFileDownloadLink(docUuid);
|
|
167
173
|
}
|
|
168
174
|
}, {
|
|
169
175
|
key: "getSdocRevisionsCount",
|
|
@@ -177,6 +183,26 @@ var Context = /*#__PURE__*/function () {
|
|
|
177
183
|
var docUuid = this.getSetting('docUuid');
|
|
178
184
|
return this.api.getSdocRevisions(docUuid, page, perPage);
|
|
179
185
|
}
|
|
186
|
+
}, {
|
|
187
|
+
key: "deleteSdocRevision",
|
|
188
|
+
value: function deleteSdocRevision() {
|
|
189
|
+
var docUuid = this.getSetting('docUuid');
|
|
190
|
+
return this.api.deleteSdocRevision(docUuid);
|
|
191
|
+
}
|
|
192
|
+
}, {
|
|
193
|
+
key: "rebaseSdocRevision",
|
|
194
|
+
value: function rebaseSdocRevision() {
|
|
195
|
+
var docUuid = this.getSetting('docUuid');
|
|
196
|
+
return this.api.rebaseSdocRevision(docUuid);
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
key: "getFileHistoryVersion",
|
|
200
|
+
value: function getFileHistoryVersion(fileVersion, filePath) {
|
|
201
|
+
var docUuid = this.getSetting('docUuid');
|
|
202
|
+
return this.api.getFileHistoryVersion(docUuid, fileVersion, filePath);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// local files
|
|
180
206
|
}, {
|
|
181
207
|
key: "getSdocLocalFiles",
|
|
182
208
|
value: function getSdocLocalFiles(p) {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
2
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
3
|
import { withTranslation } from 'react-i18next';
|
|
5
|
-
import deepCopy from 'deep-copy';
|
|
6
|
-
import { SDocEditor, DiffViewer } from '../basic-sdk';
|
|
7
4
|
import Loading from '../components/loading';
|
|
8
5
|
import DocInfo from '../components/doc-info';
|
|
9
6
|
import DocOperations from '../components/doc-operations';
|
|
@@ -11,6 +8,11 @@ import Layout, { Header, Content } from '../layout';
|
|
|
11
8
|
import { generateDefaultDocContent } from '../utils';
|
|
12
9
|
import context from '../context';
|
|
13
10
|
import ErrorBoundary from './error-boundary';
|
|
11
|
+
import TipDialog from '../components/tip-dialog';
|
|
12
|
+
import { EXTERNAL_EVENT, MODE } from '../constants';
|
|
13
|
+
import { getRebase } from '../basic-sdk/utils/rebase';
|
|
14
|
+
import toaster from '../components/toast';
|
|
15
|
+
import { EventBus, SDocEditor } from '../basic-sdk';
|
|
14
16
|
import '../assets/css/simple-editor.css';
|
|
15
17
|
var SimpleEditor = function SimpleEditor(_ref) {
|
|
16
18
|
var isStarred = _ref.isStarred,
|
|
@@ -19,39 +21,74 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
19
21
|
var editorRef = useRef(null);
|
|
20
22
|
var _useState = useState(true),
|
|
21
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var _useState3 = useState(
|
|
24
|
+
isLoadingSdoc = _useState2[0],
|
|
25
|
+
setLoadingSdoc = _useState2[1];
|
|
26
|
+
var _useState3 = useState(''),
|
|
25
27
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var _useState5 = useState(
|
|
28
|
+
errorMessage = _useState4[0],
|
|
29
|
+
setErrorMessage = _useState4[1];
|
|
30
|
+
var _useState5 = useState(false),
|
|
29
31
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var _useState7 = useState(
|
|
32
|
+
isShowChanges = _useState6[0],
|
|
33
|
+
setShowChanges = _useState6[1];
|
|
34
|
+
var _useState7 = useState(null),
|
|
33
35
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var _useState9 = useState(
|
|
36
|
+
document = _useState8[0],
|
|
37
|
+
setDocument = _useState8[1];
|
|
38
|
+
var _useState9 = useState(MODE.EDITOR),
|
|
37
39
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var _useState11 = useState(
|
|
40
|
+
mode = _useState10[0],
|
|
41
|
+
setMode = _useState10[1];
|
|
42
|
+
var _useState11 = useState([]),
|
|
41
43
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var _useState13 = useState(
|
|
44
|
+
changes = _useState12[0],
|
|
45
|
+
setChanges = _useState12[1];
|
|
46
|
+
var _useState13 = useState(false),
|
|
45
47
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
showTip = _useState14[0],
|
|
49
|
+
setShowTip = _useState14[1];
|
|
48
50
|
useEffect(function () {
|
|
49
51
|
context.initApi();
|
|
50
|
-
initDocumentData(
|
|
52
|
+
initDocumentData();
|
|
51
53
|
|
|
52
54
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
55
|
}, []);
|
|
54
|
-
var
|
|
56
|
+
var rebaseDocument = useCallback(function (document) {
|
|
57
|
+
toaster.warning(t('Document_has_rebased'));
|
|
58
|
+
editorRef.current.setLoading(true);
|
|
59
|
+
setShowChanges(false);
|
|
60
|
+
setMode(MODE.EDITOR);
|
|
61
|
+
editorRef.current.setEditorMode(MODE.EDITOR);
|
|
62
|
+
|
|
63
|
+
//
|
|
64
|
+
console.log('document: ', document);
|
|
65
|
+
setDocument(document);
|
|
66
|
+
editorRef.current.setSlateValue(document);
|
|
67
|
+
editorRef.current.setLoading(false);
|
|
68
|
+
|
|
69
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
70
|
+
}, [editorRef]);
|
|
71
|
+
useEffect(function () {
|
|
72
|
+
var eventBus = EventBus.getInstance();
|
|
73
|
+
var rebaseDocumentSubscribe = eventBus.subscribe(EXTERNAL_EVENT.REBASE_DOCUMENT, rebaseDocument);
|
|
74
|
+
return function () {
|
|
75
|
+
rebaseDocumentSubscribe();
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
|
+
}, []);
|
|
80
|
+
|
|
81
|
+
// useMount: reset title
|
|
82
|
+
useEffect(function () {
|
|
83
|
+
var isSdocRevision = context.getSetting('isSdocRevision');
|
|
84
|
+
var originFilename = context.getSetting('originFilename');
|
|
85
|
+
if (isSdocRevision) {
|
|
86
|
+
window.document.getElementsByTagName('title')[0].innerText = "".concat(t('Revision'), " - ").concat(originFilename);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
90
|
+
}, []);
|
|
91
|
+
var initDocumentData = useCallback(function () {
|
|
55
92
|
setShowChanges(false);
|
|
56
93
|
setLoadingSdoc(true);
|
|
57
94
|
context.getFileContent().then(function (res) {
|
|
@@ -65,7 +102,6 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
65
102
|
}
|
|
66
103
|
setDocument(result);
|
|
67
104
|
setLoadingSdoc(false);
|
|
68
|
-
isFirstLoad && setFirstLoad(false);
|
|
69
105
|
}).catch(function (error) {
|
|
70
106
|
// eslint-disable-next-line
|
|
71
107
|
console.log(error);
|
|
@@ -83,54 +119,172 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
83
119
|
|
|
84
120
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
85
121
|
}, []);
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
122
|
+
var setFileContent = useCallback(function () {
|
|
123
|
+
context.getFileContent().then(function (res) {
|
|
124
|
+
var result = res.data || generateDefaultDocContent();
|
|
125
|
+
if (result && !result.children) {
|
|
126
|
+
result = {
|
|
127
|
+
version: 0,
|
|
128
|
+
children: result.content,
|
|
129
|
+
cursors: result.cursors || {}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
setDocument(result);
|
|
133
|
+
editorRef.current.setSlateValue(result);
|
|
134
|
+
editorRef.current.setLoading(false);
|
|
135
|
+
}).catch(function (error) {
|
|
136
|
+
// eslint-disable-next-line
|
|
137
|
+
console.log(error);
|
|
138
|
+
setErrorMessage('Load_doc_content_error');
|
|
139
|
+
editorRef.current.setLoading(false);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// eslint-disable-next-line no-trailing-spaces
|
|
143
|
+
}, []);
|
|
144
|
+
var setDiffContent = useCallback(function () {
|
|
145
|
+
context.getSeadocOriginFileDownloadLink().then(function (res) {
|
|
90
146
|
var originFileDownloadLink = res.data.origin_file_download_link;
|
|
91
147
|
return fetch(originFileDownloadLink);
|
|
92
148
|
}).then(function (res) {
|
|
93
149
|
return res.json();
|
|
94
150
|
}).then(function (originContent) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
setLoadingSdoc(false);
|
|
151
|
+
editorRef.current.setDiffContent(originContent);
|
|
152
|
+
editorRef.current.setLoading(false);
|
|
98
153
|
}).catch(function (error) {
|
|
99
|
-
|
|
100
|
-
setLoadingSdoc(false);
|
|
154
|
+
console.log('error');
|
|
101
155
|
});
|
|
102
|
-
|
|
103
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
104
|
-
}, [document]);
|
|
156
|
+
}, []);
|
|
105
157
|
var toggleViewChanges = useCallback(function (isShowChanges) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
158
|
+
var needFetchNewContent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
159
|
+
editorRef.current.setLoading(true);
|
|
160
|
+
setShowChanges(isShowChanges);
|
|
161
|
+
var mode = isShowChanges ? MODE.DIFF_VIEWER : MODE.EDITOR;
|
|
162
|
+
setMode(mode);
|
|
163
|
+
editorRef.current.setEditorMode(mode);
|
|
164
|
+
if (!isShowChanges) {
|
|
165
|
+
setFileContent();
|
|
166
|
+
return;
|
|
111
167
|
}
|
|
112
|
-
if (
|
|
113
|
-
|
|
168
|
+
if (!needFetchNewContent) {
|
|
169
|
+
setDiffContent();
|
|
114
170
|
return;
|
|
115
171
|
}
|
|
116
|
-
|
|
117
|
-
|
|
172
|
+
context.getFileContent().then(function (res) {
|
|
173
|
+
var result = res.data || generateDefaultDocContent();
|
|
174
|
+
if (result && !result.children) {
|
|
175
|
+
result = {
|
|
176
|
+
version: 0,
|
|
177
|
+
children: result.content,
|
|
178
|
+
cursors: result.cursors || {}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
setDocument(result);
|
|
182
|
+
editorRef.current.setSlateValue(result);
|
|
183
|
+
}).then(function () {
|
|
184
|
+
setDiffContent();
|
|
185
|
+
}).catch(function (error) {
|
|
186
|
+
// eslint-disable-next-line
|
|
187
|
+
console.log(error);
|
|
188
|
+
setErrorMessage('Load_doc_content_error');
|
|
189
|
+
editorRef.current.setLoading(false);
|
|
190
|
+
});
|
|
118
191
|
|
|
119
192
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
120
193
|
}, [document]);
|
|
121
|
-
var
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
194
|
+
var publishRevision = useCallback(function () {
|
|
195
|
+
var repoID = context.getSetting('repoID');
|
|
196
|
+
var siteRoot = context.getSetting('siteRoot');
|
|
197
|
+
var originFileVersion = context.getSetting('originFileVersion');
|
|
198
|
+
var originFilePath = context.getSetting('originFilePath');
|
|
199
|
+
var revisionCurrentContent;
|
|
200
|
+
var revisionMasterContent;
|
|
201
|
+
var masterContent;
|
|
202
|
+
context.getFileHistoryVersion(originFileVersion, originFilePath).then(function (res) {
|
|
203
|
+
var fileHistoryRevisionContent = res.data.content; // commit content
|
|
204
|
+
revisionMasterContent = JSON.parse(fileHistoryRevisionContent);
|
|
205
|
+
return context.getSeadocOriginFileDownloadLink();
|
|
206
|
+
}).then(function (res) {
|
|
207
|
+
var originFileDownloadLink = res.data.origin_file_download_link;
|
|
208
|
+
return fetch(originFileDownloadLink);
|
|
209
|
+
}).then(function (res) {
|
|
210
|
+
return res.json();
|
|
211
|
+
}).then(function (content) {
|
|
212
|
+
masterContent = content;
|
|
213
|
+
return context.getFileContent();
|
|
214
|
+
}).then(function (res) {
|
|
215
|
+
var result = res.data || generateDefaultDocContent();
|
|
216
|
+
if (result && !result.children) {
|
|
217
|
+
result = {
|
|
218
|
+
version: 0,
|
|
219
|
+
children: result.content,
|
|
220
|
+
cursors: result.cursors || {}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
revisionCurrentContent = result;
|
|
224
|
+
var _getRebase = getRebase(masterContent, revisionMasterContent, revisionCurrentContent),
|
|
225
|
+
canMerge = _getRebase.canMerge,
|
|
226
|
+
isNeedReplaceMaster = _getRebase.isNeedReplaceMaster,
|
|
227
|
+
value = _getRebase.value;
|
|
228
|
+
if (canMerge && isNeedReplaceMaster) {
|
|
229
|
+
context.publishSdocRevision().then(function (res) {
|
|
230
|
+
var origin_file_path = res.data.origin_file_path;
|
|
231
|
+
window.location.href = "".concat(siteRoot, "lib/").concat(repoID, "/file/").concat(origin_file_path);
|
|
232
|
+
}).catch(function (error) {
|
|
233
|
+
toaster.danger(t('Error'));
|
|
234
|
+
});
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (canMerge && !isNeedReplaceMaster) {
|
|
238
|
+
setShowTip(true);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
toaster.warning(t('Need_rebase'));
|
|
242
|
+
editorRef.current.setLoading(true);
|
|
243
|
+
editorRef.current.setSlateValue(value);
|
|
244
|
+
setMode(MODE.REBASE);
|
|
245
|
+
editorRef.current.setEditorMode(MODE.REBASE);
|
|
246
|
+
editorRef.current.setLoading(false);
|
|
247
|
+
}).catch(function (error) {
|
|
248
|
+
toaster.danger(t('Error'));
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
252
|
+
}, [document, isShowChanges, mode]);
|
|
253
|
+
var abortRebase = useCallback(function () {
|
|
254
|
+
toggleViewChanges(isShowChanges, true);
|
|
255
|
+
|
|
256
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
257
|
+
}, [isShowChanges, document]);
|
|
125
258
|
var setDiffChanges = useCallback(function (diff) {
|
|
126
259
|
setChanges(diff.changes);
|
|
127
260
|
|
|
128
261
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
129
262
|
}, [isShowChanges]);
|
|
130
|
-
|
|
263
|
+
var closeTipDialog = useCallback(function () {
|
|
264
|
+
setShowTip(false);
|
|
265
|
+
|
|
266
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
267
|
+
}, []);
|
|
268
|
+
var deleteRevision = useCallback(function () {
|
|
269
|
+
context.deleteRevision().then(function (res) {
|
|
270
|
+
if (res.data.success) {
|
|
271
|
+
var repoID = context.getSetting('repoID');
|
|
272
|
+
var siteRoot = context.getSetting('siteRoot');
|
|
273
|
+
var originFilePath = context.getSetting('originFilePath');
|
|
274
|
+
window.location.href = "".concat(siteRoot, "lib/").concat(repoID, "/file/").concat(originFilePath);
|
|
275
|
+
setShowTip(false);
|
|
276
|
+
}
|
|
277
|
+
}).catch(function (error) {
|
|
278
|
+
toaster.danger(t('Error'));
|
|
279
|
+
setShowTip(false);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
283
|
+
}, []);
|
|
284
|
+
if (isLoadingSdoc) {
|
|
131
285
|
return /*#__PURE__*/React.createElement(Loading, null);
|
|
132
286
|
}
|
|
133
|
-
if (
|
|
287
|
+
if (errorMessage) {
|
|
134
288
|
return /*#__PURE__*/React.createElement("div", {
|
|
135
289
|
className: "error-page"
|
|
136
290
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -143,25 +297,21 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
143
297
|
isEditMode: !isShowChanges
|
|
144
298
|
}), /*#__PURE__*/React.createElement(DocOperations, {
|
|
145
299
|
isShowChanges: isShowChanges,
|
|
300
|
+
mode: mode,
|
|
146
301
|
changes: changes,
|
|
147
|
-
toggleViewChanges: toggleViewChanges
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}, /*#__PURE__*/React.createElement(
|
|
151
|
-
className: "error-page"
|
|
152
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
153
|
-
className: "error-tip"
|
|
154
|
-
}, t(errorMessage))), !isLoadingSdoc && !errorMessage && /*#__PURE__*/React.createElement(React.Fragment, null, isShowChanges ? /*#__PURE__*/React.createElement(DiffViewer, {
|
|
155
|
-
showToolbar: true,
|
|
156
|
-
showOutline: true,
|
|
157
|
-
currentContent: currentContent,
|
|
158
|
-
lastContent: lastContent,
|
|
159
|
-
didMountCallback: setDiffChanges
|
|
160
|
-
}) : /*#__PURE__*/React.createElement(SDocEditor, {
|
|
161
|
-
config: context.getEditorConfig(),
|
|
162
|
-
document: document,
|
|
302
|
+
toggleViewChanges: toggleViewChanges,
|
|
303
|
+
publishRevision: publishRevision,
|
|
304
|
+
abortRebase: abortRebase
|
|
305
|
+
})), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(SDocEditor, {
|
|
163
306
|
ref: editorRef,
|
|
164
|
-
|
|
165
|
-
|
|
307
|
+
document: document,
|
|
308
|
+
mode: mode,
|
|
309
|
+
setDiffChanges: setDiffChanges,
|
|
310
|
+
toggleViewChanges: toggleViewChanges
|
|
311
|
+
}))), showTip && /*#__PURE__*/React.createElement(TipDialog, {
|
|
312
|
+
toggle: closeTipDialog,
|
|
313
|
+
submit: deleteRevision,
|
|
314
|
+
title: t('Rebase_tip')
|
|
315
|
+
}, t('Rebase_delete_no_change_revision_tip')));
|
|
166
316
|
};
|
|
167
317
|
export default withTranslation('sdoc-editor')(SimpleEditor);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.142beta",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This is a sdoc editor",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"build": "node scripts/build.js",
|
|
37
37
|
"pub:dist": "export BABEL_ENV=production && ./node_modules/.bin/babel src --out-dir dist --copy-files",
|
|
38
38
|
"push-translate": "tx push -s",
|
|
39
|
-
"pull-translate": "tx pull -
|
|
39
|
+
"pull-translate": "tx pull -f",
|
|
40
40
|
"pub:optimized": "rm dist/config.js",
|
|
41
41
|
"prepublishOnly": "npm run clean && npm run pub:dist",
|
|
42
42
|
"test": "node scripts/test.js"
|
|
@@ -343,7 +343,6 @@
|
|
|
343
343
|
"Default_font": "Default font",
|
|
344
344
|
"Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
|
|
345
345
|
"Recently_saved": "Recently saved",
|
|
346
|
-
"Sdoc_document" : "Sdoc document",
|
|
347
346
|
"Text_Link": "Text Link",
|
|
348
347
|
"Icon_and_text_Link": "Icon and text Link",
|
|
349
348
|
"Card": "Card",
|
|
@@ -362,5 +361,6 @@
|
|
|
362
361
|
"Changes": "Změny",
|
|
363
362
|
"No_changes": "No changes",
|
|
364
363
|
"Title": "Název",
|
|
365
|
-
"
|
|
364
|
+
"Subtitle": "Subtitle",
|
|
365
|
+
"Link_sdoc": "Link sdoc"
|
|
366
366
|
}
|
|
@@ -343,7 +343,6 @@
|
|
|
343
343
|
"Default_font": "Default font",
|
|
344
344
|
"Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
|
|
345
345
|
"Recently_saved": "Recently saved",
|
|
346
|
-
"Sdoc_document" : "Sdoc document",
|
|
347
346
|
"Text_Link": "Text Link",
|
|
348
347
|
"Icon_and_text_Link": "Icon and text Link",
|
|
349
348
|
"Card": "Card",
|
|
@@ -362,5 +361,6 @@
|
|
|
362
361
|
"Changes": "Änderungen",
|
|
363
362
|
"No_changes": "No changes",
|
|
364
363
|
"Title": "Titel",
|
|
365
|
-
"
|
|
364
|
+
"Subtitle": "Subtitle",
|
|
365
|
+
"Link_sdoc": "Link sdoc"
|
|
366
366
|
}
|
|
@@ -343,7 +343,6 @@
|
|
|
343
343
|
"Default_font": "Default font",
|
|
344
344
|
"Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
|
|
345
345
|
"Recently_saved": "Recently saved",
|
|
346
|
-
"Sdoc_document" : "Sdoc document",
|
|
347
346
|
"Text_Link": "Text Link",
|
|
348
347
|
"Icon_and_text_Link": "Icon and text Link",
|
|
349
348
|
"Card": "Card",
|
|
@@ -362,5 +361,12 @@
|
|
|
362
361
|
"Changes": "Changes",
|
|
363
362
|
"No_changes": "No changes",
|
|
364
363
|
"Title": "Title",
|
|
365
|
-
"Subtitle": "Subtitle"
|
|
364
|
+
"Subtitle": "Subtitle",
|
|
365
|
+
"Link_sdoc": "Link sdoc",
|
|
366
|
+
"Keep_my_modification": "Keep my modification",
|
|
367
|
+
"Keep_other_modification": "Keep other's modification",
|
|
368
|
+
"Keep_both_modification": "Keep my modification",
|
|
369
|
+
"Need_rebase": "Need rebase",
|
|
370
|
+
"Abort": "Abort",
|
|
371
|
+
"Rebase_delete_no_change_revision_tip": "No changes have been made in the revision, should the revision be deleted directly ?"
|
|
366
372
|
}
|
|
@@ -343,7 +343,6 @@
|
|
|
343
343
|
"Default_font": "Default font",
|
|
344
344
|
"Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
|
|
345
345
|
"Recently_saved": "Recently saved",
|
|
346
|
-
"Sdoc_document" : "Sdoc document",
|
|
347
346
|
"Text_Link": "Text Link",
|
|
348
347
|
"Icon_and_text_Link": "Icon and text Link",
|
|
349
348
|
"Card": "Card",
|
|
@@ -362,5 +361,6 @@
|
|
|
362
361
|
"Changes": "Cambios",
|
|
363
362
|
"No_changes": "No changes",
|
|
364
363
|
"Title": "Título",
|
|
365
|
-
"
|
|
364
|
+
"Subtitle": "Subtitle",
|
|
365
|
+
"Link_sdoc": "Link sdoc"
|
|
366
366
|
}
|
|
@@ -343,7 +343,6 @@
|
|
|
343
343
|
"Default_font": "Default font",
|
|
344
344
|
"Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
|
|
345
345
|
"Recently_saved": "Recently saved",
|
|
346
|
-
"Sdoc_document" : "Sdoc document",
|
|
347
346
|
"Text_Link": "Text Link",
|
|
348
347
|
"Icon_and_text_Link": "Icon and text Link",
|
|
349
348
|
"Card": "Card",
|
|
@@ -362,5 +361,6 @@
|
|
|
362
361
|
"Changes": "Modifications",
|
|
363
362
|
"No_changes": "No changes",
|
|
364
363
|
"Title": "Titre",
|
|
365
|
-
"
|
|
364
|
+
"Subtitle": "Subtitle",
|
|
365
|
+
"Link_sdoc": "Link sdoc"
|
|
366
366
|
}
|
|
@@ -343,7 +343,6 @@
|
|
|
343
343
|
"Default_font": "Шрифт по умолчанию",
|
|
344
344
|
"Pending_operations_exceed_limit": "Несколько операций не синхронизированы с сервером. Проверьте вашу сеть.",
|
|
345
345
|
"Recently_saved": "Недавно сохранено",
|
|
346
|
-
"Sdoc_document" : "Документ Sdoc",
|
|
347
346
|
"Text_Link": "Текстовая ссылка",
|
|
348
347
|
"Icon_and_text_Link": "Значок и текстовая ссылка",
|
|
349
348
|
"Card": "Карта",
|
|
@@ -362,5 +361,6 @@
|
|
|
362
361
|
"Changes": "Изменения",
|
|
363
362
|
"No_changes": "Без изменений",
|
|
364
363
|
"Title": "Название",
|
|
365
|
-
"
|
|
364
|
+
"Subtitle": "Подзаголовок",
|
|
365
|
+
"Link_sdoc": "Ссылка на sdoc"
|
|
366
366
|
}
|
|
@@ -343,7 +343,6 @@
|
|
|
343
343
|
"Default_font": "默认字体",
|
|
344
344
|
"Pending_operations_exceed_limit": "有多个操作未同步到服务器。请检查你的网络。",
|
|
345
345
|
"Recently_saved": "最近保存",
|
|
346
|
-
"Sdoc_document" : "sdoc 文档",
|
|
347
346
|
"Text_Link": "文字链",
|
|
348
347
|
"Icon_and_text_Link": "图标+文字链",
|
|
349
348
|
"Card": "卡片",
|
|
@@ -362,5 +361,12 @@
|
|
|
362
361
|
"Changes": "改动",
|
|
363
362
|
"No_changes": "没有变化",
|
|
364
363
|
"Title": "标题",
|
|
365
|
-
"Subtitle": "副标题"
|
|
364
|
+
"Subtitle": "副标题",
|
|
365
|
+
"Link_sdoc": "链接 sdoc",
|
|
366
|
+
"Keep_my_modification": "保留我的更改",
|
|
367
|
+
"Keep_other_modification": "保留其他的更改",
|
|
368
|
+
"Keep_both_modification": "保留两个更改",
|
|
369
|
+
"Need_rebase": "需要变基",
|
|
370
|
+
"Abort": "中止",
|
|
371
|
+
"Rebase_delete_no_change_revision_tip": "No changes have been made in the revision, should the revision be deleted directly ?"
|
|
366
372
|
}
|