@seafile/sdoc-editor 0.1.110 → 0.1.111-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/basic-sdk/socket/socket-manager.js +5 -1
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.css +1 -7
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.js +5 -5
- package/dist/components/tip-message/index.js +21 -3
- package/package.json +1 -1
- package/public/locales/en/sdoc-editor.json +3 -1
- package/public/locales/zh-CN/sdoc-editor.json +3 -1
|
@@ -10,6 +10,9 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
|
|
|
10
10
|
_classCallCheck(this, SocketManager);
|
|
11
11
|
this.addOperations = function (operations) {
|
|
12
12
|
_this.pendingOperationList.push(operations);
|
|
13
|
+
if (_this.pendingOperationList.length > 5) {
|
|
14
|
+
_this.dispatchConnectState('pending_operations_exceed_limit');
|
|
15
|
+
}
|
|
13
16
|
_this.sendOperations();
|
|
14
17
|
};
|
|
15
18
|
this.getDocumentVersion = function () {
|
|
@@ -36,7 +39,8 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
|
|
|
36
39
|
if (result && result.success) {
|
|
37
40
|
var serverVersion = result.version;
|
|
38
41
|
_this.document['version'] = serverVersion;
|
|
39
|
-
|
|
42
|
+
var lastSavedAt = new Date().getTime();
|
|
43
|
+
_this.dispatchConnectState('saved', lastSavedAt);
|
|
40
44
|
_this.sendNextOperations();
|
|
41
45
|
return;
|
|
42
46
|
}
|
package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.css
CHANGED
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
.revisions-dialog .revisions-body .sdoc-revision:hover {
|
|
64
|
+
cursor: pointer;
|
|
64
65
|
background-color: #f5f5f5;
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -92,13 +93,6 @@
|
|
|
92
93
|
overflow: hidden;
|
|
93
94
|
text-overflow: ellipsis;
|
|
94
95
|
white-space: nowrap;
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.revisions-dialog .sdoc-revision .sdoc-revision-name-content:hover {
|
|
99
|
-
text-decoration: underline;
|
|
100
|
-
cursor: pointer;
|
|
101
|
-
color: #ff8000;
|
|
102
96
|
}
|
|
103
97
|
|
|
104
98
|
.revisions-dialog .sdoc-revision .sdoc-revision-time {
|
package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.js
CHANGED
|
@@ -133,17 +133,17 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
133
133
|
}, revisions.map(function (revision) {
|
|
134
134
|
return /*#__PURE__*/React.createElement("div", {
|
|
135
135
|
className: "sdoc-revision",
|
|
136
|
-
key: revision.id
|
|
136
|
+
key: revision.id,
|
|
137
|
+
onClick: function onClick() {
|
|
138
|
+
return openRevision(revision.id);
|
|
139
|
+
}
|
|
137
140
|
}, /*#__PURE__*/React.createElement("div", {
|
|
138
141
|
className: "sdoc-revision-name",
|
|
139
142
|
style: {
|
|
140
143
|
width: '40%'
|
|
141
144
|
}
|
|
142
145
|
}, /*#__PURE__*/React.createElement("div", {
|
|
143
|
-
className: "sdoc-revision-name-content"
|
|
144
|
-
onClick: function onClick() {
|
|
145
|
-
return openRevision(revision.id);
|
|
146
|
-
}
|
|
146
|
+
className: "sdoc-revision-name-content"
|
|
147
147
|
}, t('Revision') + ' ' + revision.id)), /*#__PURE__*/React.createElement("div", {
|
|
148
148
|
className: "sdoc-revision-user",
|
|
149
149
|
style: {
|
|
@@ -4,6 +4,7 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { withTranslation } from 'react-i18next';
|
|
7
|
+
import dayjs from 'dayjs';
|
|
7
8
|
import { EventBus } from '../../basic-sdk';
|
|
8
9
|
import toaster from '../toast';
|
|
9
10
|
import './style.css';
|
|
@@ -22,6 +23,14 @@ var TipMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
22
23
|
duration: null
|
|
23
24
|
});
|
|
24
25
|
};
|
|
26
|
+
_this.onPendingOpExceedLimit = function () {
|
|
27
|
+
var t = _this.props.t;
|
|
28
|
+
toaster.closeAll();
|
|
29
|
+
var message = t('Pending_operations_exceed_limit');
|
|
30
|
+
toaster.warning(message, {
|
|
31
|
+
duration: 5
|
|
32
|
+
});
|
|
33
|
+
};
|
|
25
34
|
_this.onDocumentLoadError = function () {
|
|
26
35
|
var t = _this.props.t;
|
|
27
36
|
var message = t('Document_content_load_failed');
|
|
@@ -66,11 +75,12 @@ var TipMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
66
75
|
isSaved: false
|
|
67
76
|
});
|
|
68
77
|
};
|
|
69
|
-
_this.onDocumentSaved = function () {
|
|
78
|
+
_this.onDocumentSaved = function (lastSavedAt) {
|
|
70
79
|
if (_this.saveTimer) clearTimeout(_this.saveTimer);
|
|
71
80
|
if (_this.resetTimer) clearTimeout(_this.resetTimer);
|
|
72
81
|
_this.saveTimer = setTimeout(function () {
|
|
73
82
|
_this.setState({
|
|
83
|
+
lastSavedAt: lastSavedAt,
|
|
74
84
|
isSaving: false,
|
|
75
85
|
isSaved: true
|
|
76
86
|
});
|
|
@@ -86,7 +96,8 @@ var TipMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
86
96
|
var t = _this.props.t;
|
|
87
97
|
var _this$state = _this.state,
|
|
88
98
|
isSaved = _this$state.isSaved,
|
|
89
|
-
isSaving = _this$state.isSaving
|
|
99
|
+
isSaving = _this$state.isSaving,
|
|
100
|
+
lastSavedAt = _this$state.lastSavedAt;
|
|
90
101
|
if (isSaving && !isSaved) {
|
|
91
102
|
return /*#__PURE__*/React.createElement("span", {
|
|
92
103
|
className: "tip-message"
|
|
@@ -97,11 +108,17 @@ var TipMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
97
108
|
className: "tip-message"
|
|
98
109
|
}, t('All_changes_saved'));
|
|
99
110
|
}
|
|
111
|
+
if (lastSavedAt) {
|
|
112
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
113
|
+
className: "tip-message"
|
|
114
|
+
}, /*#__PURE__*/React.createElement("span", null, t('Recently_saved'), ' '), /*#__PURE__*/React.createElement("span", null, dayjs(lastSavedAt).format('HH:mm')));
|
|
115
|
+
}
|
|
100
116
|
return null;
|
|
101
117
|
};
|
|
102
118
|
_this.state = {
|
|
103
119
|
isSaved: false,
|
|
104
|
-
isSaving: false
|
|
120
|
+
isSaving: false,
|
|
121
|
+
lastSavedAt: ''
|
|
105
122
|
};
|
|
106
123
|
_this.saveTimer = null;
|
|
107
124
|
return _this;
|
|
@@ -119,6 +136,7 @@ var TipMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
119
136
|
|
|
120
137
|
// op execute error
|
|
121
138
|
this.unsubscribeOpExecError = eventBus.subscribe('operation_exec_error', this.onOperationExecuteError);
|
|
139
|
+
this.unsubscribePendingOpExceedLimit = eventBus.subscribe('pending_operations_exceed_limit', this.onPendingOpExceedLimit);
|
|
122
140
|
this.unsubscribeDocumentLoadError = eventBus.subscribe('document_content_load_failed', this.onDocumentLoadError);
|
|
123
141
|
}
|
|
124
142
|
}, {
|
package/package.json
CHANGED
|
@@ -340,5 +340,7 @@
|
|
|
340
340
|
"Font": "Font",
|
|
341
341
|
"All_fonts": "All fonts",
|
|
342
342
|
"Default_font": "Default font",
|
|
343
|
-
"Document_content_load_failed": "Document content failed to load, please refresh the page to try again"
|
|
343
|
+
"Document_content_load_failed": "Document content failed to load, please refresh the page to try again",
|
|
344
|
+
"Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
|
|
345
|
+
"Recently_saved": "Recently saved"
|
|
344
346
|
}
|
|
@@ -342,5 +342,7 @@
|
|
|
342
342
|
"Font": "字体",
|
|
343
343
|
"All_fonts": "所有字体",
|
|
344
344
|
"Default_font": "默认字体",
|
|
345
|
-
"Document_content_load_failed": "文档内容加载失败, 请刷新页面重新访问"
|
|
345
|
+
"Document_content_load_failed": "文档内容加载失败, 请刷新页面重新访问",
|
|
346
|
+
"Pending_operations_exceed_limit": "有多个操作未同步到服务器。请检查你的网络。",
|
|
347
|
+
"Recently_saved": "最近保存"
|
|
346
348
|
}
|