@seafile/sdoc-editor 0.1.119 → 0.1.121
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/extension/commons/tooltip/index.css +12 -1
- package/dist/basic-sdk/extension/plugins/font/helpers.js +4 -3
- package/dist/basic-sdk/extension/plugins/header/menu/index.js +40 -28
- package/dist/basic-sdk/extension/plugins/header/menu/style.css +32 -0
- package/dist/basic-sdk/extension/plugins/header/plugin.js +9 -0
- package/dist/basic-sdk/extension/plugins/text-style/render-elem.js +1 -1
- package/dist/basic-sdk/socket/socket-manager.js +28 -17
- package/dist/basic-sdk/utils/event-handler.js +11 -1
- package/dist/components/tip-message/index.js +28 -19
- package/package.json +1 -1
- package/public/locales/en/sdoc-editor.json +3 -3
- package/public/locales/zh-CN/sdoc-editor.json +3 -3
|
@@ -4,7 +4,18 @@
|
|
|
4
4
|
background-color: #303133;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.bs-tooltip-bottom.sdoc-tooltip .arrow::before,
|
|
8
7
|
.sdoc-tooltip.bs-tooltip-auto[x-placement^="bottom"] .arrow::before {
|
|
9
8
|
border-bottom-color: #303133;
|
|
10
9
|
}
|
|
10
|
+
|
|
11
|
+
.sdoc-tooltip.bs-tooltip-auto[x-placement^="top"] .arrow::before {
|
|
12
|
+
border-top-color: #303133;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.sdoc-tooltip.bs-tooltip-auto[x-placement^="right"] .arrow::before {
|
|
16
|
+
border-right-color: #303133;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.sdoc-tooltip.bs-tooltip-auto[x-placement^="left"] .arrow::before {
|
|
20
|
+
border-left-color: #303133;
|
|
21
|
+
}
|
|
@@ -130,10 +130,11 @@ export var loadFont = function loadFont() {
|
|
|
130
130
|
fontLink.className = GOOGLE_FONT_CLASS;
|
|
131
131
|
document.body.appendChild(fontLink);
|
|
132
132
|
};
|
|
133
|
-
export var generatorFontFamily = function generatorFontFamily(fontName, fontWeight) {
|
|
133
|
+
export var generatorFontFamily = function generatorFontFamily(fontName, fontWeight, leaf) {
|
|
134
|
+
var isCodeBlock = leaf && Object.keys(leaf).includes('token');
|
|
134
135
|
var lang = context.getSetting('lang') || 'zh-cn';
|
|
135
136
|
if (fontName === DEFAULT_FONT) {
|
|
136
|
-
return "'Arial', ".concat(lang === 'zh-cn' ? "\u5B8B\u4F53" : 'Arial', ", 'sans-serif'");
|
|
137
|
+
return "".concat(isCodeBlock ? 'monospace' : 'Arial', ", ").concat(lang === 'zh-cn' ? "\u5B8B\u4F53" : 'Arial', ", 'sans-serif'");
|
|
137
138
|
}
|
|
138
139
|
var fontObject = FONT.find(function (item) {
|
|
139
140
|
return item.name === fontName;
|
|
@@ -142,5 +143,5 @@ export var generatorFontFamily = function generatorFontFamily(fontName, fontWeig
|
|
|
142
143
|
fontFamilyName = fontObject.fontFamilyName;
|
|
143
144
|
loadFont(fontObject, fontWeight);
|
|
144
145
|
var validFontName = fontFamilyName && isMac() ? fontFamilyName['mac'] : fontName;
|
|
145
|
-
return "".concat(validFontName, ", ").concat(lang === 'zh-cn' ? "\u5B8B\u4F53" : 'Arial', ", ").concat(usuallyFontFamilyName || 'sans-serif');
|
|
146
|
+
return "".concat(isCodeBlock ? 'monospace' : validFontName, ", ").concat(lang === 'zh-cn' ? "\u5B8B\u4F53" : 'Arial', ", ").concat(usuallyFontFamilyName || 'sans-serif');
|
|
146
147
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
4
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
5
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
-
import React from 'react';
|
|
6
|
+
import React, { Fragment } from 'react';
|
|
6
7
|
import { withTranslation } from 'react-i18next';
|
|
7
8
|
import classnames from 'classnames';
|
|
8
9
|
import { getHeaderType, isMenuDisabled, setHeaderType } from '../helpers';
|
|
9
|
-
import {
|
|
10
|
+
import { HEADERS, HEADER_TITLE_MAP, PARAGRAPH } from '../../../constants';
|
|
11
|
+
import Tooltip from '../../../commons/tooltip';
|
|
10
12
|
import './style.css';
|
|
11
13
|
var HeaderMenu = /*#__PURE__*/function (_React$Component) {
|
|
12
14
|
_inherits(HeaderMenu, _React$Component);
|
|
@@ -78,6 +80,11 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
78
80
|
_this.setMenuRef = function (ref) {
|
|
79
81
|
_this.menu = ref;
|
|
80
82
|
};
|
|
83
|
+
_this.getToolTip = function (index) {
|
|
84
|
+
//chrome in Mac: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
|
|
85
|
+
var isMac = window.navigator.userAgent.indexOf('Macintosh') != -1;
|
|
86
|
+
return isMac ? "\u2318 +\u2325 +".concat(index) : "ctrl+alt+".concat(index);
|
|
87
|
+
};
|
|
81
88
|
_this.state = {
|
|
82
89
|
isShowHeaderPopover: false
|
|
83
90
|
};
|
|
@@ -86,11 +93,13 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
86
93
|
_createClass(HeaderMenu, [{
|
|
87
94
|
key: "render",
|
|
88
95
|
value: function render() {
|
|
96
|
+
var _this2 = this;
|
|
89
97
|
var t = this.props.t;
|
|
90
98
|
var isShowHeaderPopover = this.state.isShowHeaderPopover;
|
|
91
99
|
var headerIconClass = "sdocfont sdoc-".concat(isShowHeaderPopover ? 'caret-up' : 'drop-down');
|
|
92
|
-
var
|
|
100
|
+
var currentType = this.getValue();
|
|
93
101
|
var disabled = this.isDisabled();
|
|
102
|
+
var itemList = [PARAGRAPH, 'divider'].concat(_toConsumableArray(HEADERS));
|
|
94
103
|
return /*#__PURE__*/React.createElement("div", {
|
|
95
104
|
className: "header-menu"
|
|
96
105
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -100,35 +109,38 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
100
109
|
onClick: disabled ? function () {} : this.onToggleClick
|
|
101
110
|
}, /*#__PURE__*/React.createElement("span", {
|
|
102
111
|
className: "active"
|
|
103
|
-
}, t(HEADER_TITLE_MAP[
|
|
112
|
+
}, t(HEADER_TITLE_MAP[currentType])), !disabled && /*#__PURE__*/React.createElement("span", {
|
|
104
113
|
className: headerIconClass
|
|
105
114
|
})), isShowHeaderPopover && /*#__PURE__*/React.createElement("div", {
|
|
106
115
|
ref: this.setMenuRef,
|
|
107
116
|
className: "header-popover sdoc-dropdown-menu"
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
117
|
+
}, itemList.map(function (item, index) {
|
|
118
|
+
if (item == 'divider') {
|
|
119
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
120
|
+
key: index,
|
|
121
|
+
className: "sdoc-dropdown-menu-divider"
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
var isSelected = currentType == item;
|
|
125
|
+
var titleIndex = index == 0 ? 0 : index - 1;
|
|
126
|
+
var id = "".concat(item, "-").concat(titleIndex);
|
|
127
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
128
|
+
key: index
|
|
129
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
130
|
+
id: id,
|
|
131
|
+
className: classnames('sdoc-dropdown-menu-item', {
|
|
132
|
+
'position-relative': isSelected
|
|
133
|
+
}),
|
|
134
|
+
onClick: _this2.onMouseDown(item)
|
|
135
|
+
}, isSelected && /*#__PURE__*/React.createElement("i", {
|
|
136
|
+
className: "sdocfont sdoc-check-mark"
|
|
137
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
138
|
+
className: item
|
|
139
|
+
}, t(HEADER_TITLE_MAP[item]))), /*#__PURE__*/React.createElement(Tooltip, {
|
|
140
|
+
target: id,
|
|
141
|
+
placement: "right"
|
|
142
|
+
}, _this2.getToolTip(titleIndex)));
|
|
143
|
+
})));
|
|
132
144
|
}
|
|
133
145
|
}]);
|
|
134
146
|
return HeaderMenu;
|
|
@@ -62,3 +62,35 @@
|
|
|
62
62
|
.header-menu .header-popover .sdoc-dropdown-menu-item {
|
|
63
63
|
font-size: 14px;
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
.header-menu .header-popover .sdoc-dropdown-menu-item .sdoc-check-mark {
|
|
67
|
+
position: absolute;
|
|
68
|
+
left: 8px;
|
|
69
|
+
transform: scale(.8);
|
|
70
|
+
color: #798d99;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.header-menu .header-popover .header1 {
|
|
74
|
+
font-size: 18px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.header-menu .header-popover .header2 {
|
|
78
|
+
font-size: 16px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.header-menu .header-popover .header3 {
|
|
82
|
+
font-size: 14px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.header-menu .header-popover .header4 {
|
|
86
|
+
font-size: 12px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.header-menu .header-popover .header5 {
|
|
90
|
+
font-size: 11px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.header-menu .header-popover .header6 {
|
|
94
|
+
font-size: 11px;
|
|
95
|
+
}
|
|
96
|
+
|
|
@@ -2,6 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import { Editor, Element, Transforms, Node } from '@seafile/slate';
|
|
3
3
|
import { PARAGRAPH, HEADER_TYPE_ARRAY, LIST_TYPE_ARRAY } from '../../constants';
|
|
4
4
|
import { generateEmptyElement, getSelectedNodeByTypes } from '../../core';
|
|
5
|
+
import { isMenuDisabled, setHeaderType } from './helpers';
|
|
5
6
|
var isSelectionAtLineEnd = function isSelectionAtLineEnd(editor, path) {
|
|
6
7
|
var selection = editor.selection;
|
|
7
8
|
if (!selection) return false;
|
|
@@ -68,6 +69,14 @@ var withHeader = function withHeader(editor) {
|
|
|
68
69
|
}
|
|
69
70
|
return insertFragment(data);
|
|
70
71
|
};
|
|
72
|
+
|
|
73
|
+
// for hotkey
|
|
74
|
+
newEditor.setParagraphHeadingType = function (type) {
|
|
75
|
+
if (isMenuDisabled(newEditor)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
setHeaderType(newEditor, type);
|
|
79
|
+
};
|
|
71
80
|
return newEditor;
|
|
72
81
|
};
|
|
73
82
|
export default withHeader;
|
|
@@ -51,7 +51,7 @@ var renderText = function renderText(props, editor) {
|
|
|
51
51
|
}
|
|
52
52
|
var font = leaf['font'] || DEFAULT_FONT;
|
|
53
53
|
var fontWeight = leaf.BOLD ? 600 : 400;
|
|
54
|
-
style['fontFamily'] = generatorFontFamily(font, fontWeight);
|
|
54
|
+
style['fontFamily'] = generatorFontFamily(font, fontWeight, leaf);
|
|
55
55
|
if (leaf.BOLD) {
|
|
56
56
|
markedChildren = /*#__PURE__*/React.createElement("strong", null, markedChildren);
|
|
57
57
|
}
|
|
@@ -65,30 +65,29 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
|
|
|
65
65
|
|
|
66
66
|
// Operations are execute failure
|
|
67
67
|
var error_type = result.error_type;
|
|
68
|
-
if (error_type === '
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
_this.state = STATE.CONFLICT;
|
|
72
|
-
var lose_operations = result.lose_operations;
|
|
73
|
-
_this.resolveConflicting(lose_operations);
|
|
74
|
-
} else if (error_type === 'document_content_load_failed') {
|
|
75
|
-
// After a short-term reconnection, the content of the document fails to load
|
|
76
|
-
_this.dispatchConnectState(error_type);
|
|
77
|
-
|
|
78
|
-
// reset sending control
|
|
79
|
-
_this.state = STATE.NEED_RELOAD;
|
|
80
|
-
_this._sendingOperations = null;
|
|
81
|
-
} else if (error_type === 'Internal_server_error') {
|
|
68
|
+
if (error_type === 'load_document_content_error' || error_type === 'save_operations_to_database_error') {
|
|
69
|
+
// load_document_content_error: After a short-term reconnection, the content of the document fails to load
|
|
70
|
+
// save_operation_to_database_error: Save operation to database error
|
|
82
71
|
_this.dispatchConnectState(error_type);
|
|
83
72
|
|
|
84
73
|
// reset sending control
|
|
85
74
|
_this.state = STATE.NEED_RELOAD;
|
|
86
75
|
_this._sendingOperations = null;
|
|
87
|
-
} else if (error_type === '
|
|
76
|
+
} else if (error_type === 'version_behind_server') {
|
|
77
|
+
// Put the failed operation into the pending list and re-execute it
|
|
78
|
+
_this.pendingOperationList.unshift(_toConsumableArray(_this._sendingOperations));
|
|
79
|
+
_this.state = STATE.CONFLICT;
|
|
80
|
+
var lose_operations = result.lose_operations;
|
|
81
|
+
_this.resolveConflicting(lose_operations);
|
|
82
|
+
} else if (error_type === 'execute_client_operations_error') {
|
|
88
83
|
_this.editor.isRemote = true;
|
|
89
84
|
var dupSendingOperations = _toConsumableArray(_this._sendingOperations);
|
|
90
85
|
revertOperationList(_this.editor, [dupSendingOperations]);
|
|
91
86
|
|
|
87
|
+
// Update the save time after revert
|
|
88
|
+
var _lastSavedAt = new Date().getTime();
|
|
89
|
+
_this.dispatchConnectState('saved', _lastSavedAt);
|
|
90
|
+
|
|
92
91
|
// Set isRemote to false must be in Promise.resolve function, make sure the modification of isRemote is later than the onChange event
|
|
93
92
|
Promise.resolve().then(function (_) {
|
|
94
93
|
_this.editor.isRemote = false;
|
|
@@ -112,7 +111,13 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
|
|
|
112
111
|
var operations = params.operations;
|
|
113
112
|
// Update content & version
|
|
114
113
|
debug('execute remote operations: %O', operations);
|
|
115
|
-
|
|
114
|
+
try {
|
|
115
|
+
syncRemoteOperations(_this.editor, operations);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
_this.state = STATE.CONFLICT;
|
|
118
|
+
_this.dispatchConnectState('sync_server_operations_error');
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
116
121
|
|
|
117
122
|
// Update document
|
|
118
123
|
_this.document.version = serverVersion;
|
|
@@ -197,7 +202,13 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
|
|
|
197
202
|
serverVersion = operationParams.version;
|
|
198
203
|
// 2.1 Update content & version
|
|
199
204
|
debug('execute lose operations: %O', operations);
|
|
200
|
-
|
|
205
|
+
try {
|
|
206
|
+
syncRemoteOperations(_this.editor, operations);
|
|
207
|
+
} catch (error) {
|
|
208
|
+
_this.state = STATE.CONFLICT;
|
|
209
|
+
_this.dispatchConnectState('sync_server_operations_error');
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
201
212
|
|
|
202
213
|
// 2.2 Update document
|
|
203
214
|
_this.document.version = serverVersion;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
4
|
import isHotkey from 'is-hotkey';
|
|
4
5
|
import EventBus from '../utils/event-bus';
|
|
5
6
|
import { getSelectedNodeByType } from '../extension/core/queries/';
|
|
6
|
-
import { ELEMENT_TYPE } from '../extension/constants';
|
|
7
|
+
import { ELEMENT_TYPE, PARAGRAPH, HEADERS } from '../extension/constants';
|
|
7
8
|
import { INTERNAL_EVENT } from '../constants';
|
|
8
9
|
var EventProxy = /*#__PURE__*/_createClass(function EventProxy(_editor) {
|
|
9
10
|
var _this = this;
|
|
@@ -11,6 +12,15 @@ var EventProxy = /*#__PURE__*/_createClass(function EventProxy(_editor) {
|
|
|
11
12
|
this.onKeyDown = function (event) {
|
|
12
13
|
var editor = _this.editor;
|
|
13
14
|
|
|
15
|
+
// paragrah, headings
|
|
16
|
+
var paragraphHeadingList = [PARAGRAPH].concat(_toConsumableArray(HEADERS));
|
|
17
|
+
paragraphHeadingList.forEach(function (item, index) {
|
|
18
|
+
if (isHotkey("cmd+opt+".concat(index), event) || isHotkey("ctrl+alt+".concat(index), event)) {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
editor.setParagraphHeadingType(item);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
14
24
|
// bold
|
|
15
25
|
if (isHotkey('mod+b', event)) {
|
|
16
26
|
event.preventDefault();
|
|
@@ -18,35 +18,34 @@ var TipMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
18
18
|
_this.onOperationExecuteError = function () {
|
|
19
19
|
var t = _this.props.t;
|
|
20
20
|
var message = t('Failed_to_execute_operation_on_server');
|
|
21
|
-
toaster.danger(message, {
|
|
22
|
-
hasCloseButton: true,
|
|
23
|
-
duration: null
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
_this.onPendingOpExceedLimit = function () {
|
|
27
|
-
var t = _this.props.t;
|
|
28
|
-
toaster.closeAll();
|
|
29
|
-
var message = t('Pending_operations_exceed_limit');
|
|
30
21
|
toaster.warning(message, {
|
|
31
|
-
|
|
22
|
+
hasCloseButton: true
|
|
32
23
|
});
|
|
33
24
|
};
|
|
34
|
-
_this.
|
|
25
|
+
_this.onSyncServerOperationError = function () {
|
|
35
26
|
var t = _this.props.t;
|
|
36
|
-
var message = t('
|
|
27
|
+
var message = t('Failed_to_sync_with_server_operations');
|
|
37
28
|
toaster.danger(message, {
|
|
38
|
-
hasCloseButton:
|
|
29
|
+
hasCloseButton: false,
|
|
39
30
|
duration: null
|
|
40
31
|
});
|
|
41
32
|
};
|
|
42
|
-
_this.
|
|
33
|
+
_this.onInternalServerExecError = function () {
|
|
43
34
|
var t = _this.props.t;
|
|
44
|
-
var message = t('
|
|
35
|
+
var message = t('Internal_server_exec_operations_error');
|
|
45
36
|
toaster.danger(message, {
|
|
46
37
|
hasCloseButton: false,
|
|
47
38
|
duration: null
|
|
48
39
|
});
|
|
49
40
|
};
|
|
41
|
+
_this.onPendingOpExceedLimit = function () {
|
|
42
|
+
var t = _this.props.t;
|
|
43
|
+
toaster.closeAll();
|
|
44
|
+
var message = t('Pending_operations_exceed_limit');
|
|
45
|
+
toaster.warning(message, {
|
|
46
|
+
duration: 5
|
|
47
|
+
});
|
|
48
|
+
};
|
|
50
49
|
_this.onDisconnect = function () {
|
|
51
50
|
var _this$props = _this.props,
|
|
52
51
|
t = _this$props.t,
|
|
@@ -142,18 +141,28 @@ var TipMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
142
141
|
this.unsubscribeReconnectErrorEvent = eventBus.subscribe('reconnect_error', this.onReconnectError);
|
|
143
142
|
this.unsubscribeReconnectEvent = eventBus.subscribe('reconnect', this.onReconnect);
|
|
144
143
|
|
|
145
|
-
//
|
|
146
|
-
this.unsubscribeOpExecError = eventBus.subscribe('
|
|
144
|
+
// server return error
|
|
145
|
+
this.unsubscribeOpExecError = eventBus.subscribe('execute_client_operations_error', this.onOperationExecuteError);
|
|
146
|
+
this.unsubscribeSyncServerOpError = eventBus.subscribe('sync_server_operations_error', this.onSyncServerOperationError);
|
|
147
|
+
this.unsubscribeDocumentLoadError = eventBus.subscribe('load_document_content_error', this.onInternalServerExecError);
|
|
148
|
+
this.unsubscribeOperationsSaveError = eventBus.subscribe('save_operations_to_database_error', this.onInternalServerExecError);
|
|
149
|
+
|
|
150
|
+
// local error
|
|
147
151
|
this.unsubscribePendingOpExceedLimit = eventBus.subscribe('pending_operations_exceed_limit', this.onPendingOpExceedLimit);
|
|
148
|
-
this.unsubscribeDocumentLoadError = eventBus.subscribe('document_content_load_failed', this.onDocumentLoadError);
|
|
149
|
-
this.unsubscribeOperationsSaveError = eventBus.subscribe('Internal_server_error', this.onOperationsSaveError);
|
|
150
152
|
}
|
|
151
153
|
}, {
|
|
152
154
|
key: "componentWillUnmount",
|
|
153
155
|
value: function componentWillUnmount() {
|
|
154
156
|
this.unsubscribeSavingEvent();
|
|
155
157
|
this.unsubscribeSavedEvent();
|
|
158
|
+
this.unsubscribeDisconnectEvent();
|
|
159
|
+
this.unsubscribeReconnectErrorEvent();
|
|
160
|
+
this.unsubscribeReconnectEvent();
|
|
161
|
+
this.unsubscribeOpExecError();
|
|
162
|
+
this.unsubscribeSyncServerOpError();
|
|
163
|
+
this.unsubscribePendingOpExceedLimit();
|
|
156
164
|
this.unsubscribeDocumentLoadError();
|
|
165
|
+
this.unsubscribeOperationsSaveError();
|
|
157
166
|
clearTimeout(this.saveTimer);
|
|
158
167
|
}
|
|
159
168
|
}]);
|
package/package.json
CHANGED
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
"Revision": "Revision",
|
|
274
274
|
"Error": "Error",
|
|
275
275
|
"Start_revise": "Start revise",
|
|
276
|
-
"Failed_to_execute_operation_on_server": "Failed to execute operation on server",
|
|
276
|
+
"Failed_to_execute_operation_on_server": "Failed to execute operation on server, the current operation has been withdrawn",
|
|
277
277
|
"Start_revise_tip": "Create a temporary document and modify on it, merge it back after reviewing changes",
|
|
278
278
|
"Load_doc_content_error": "Load doc content error",
|
|
279
279
|
"Sdoc_format_invalid": "The content of the document does not conform to the sdoc specification",
|
|
@@ -341,7 +341,6 @@
|
|
|
341
341
|
"Font": "Font",
|
|
342
342
|
"All_fonts": "All fonts",
|
|
343
343
|
"Default_font": "Default font",
|
|
344
|
-
"Document_content_load_failed": "Document content failed to load, please refresh the page to try again",
|
|
345
344
|
"Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
|
|
346
345
|
"Recently_saved": "Recently saved",
|
|
347
346
|
"Sdoc_document" : "Sdoc document",
|
|
@@ -350,5 +349,6 @@
|
|
|
350
349
|
"Card": "Card",
|
|
351
350
|
"Select_sdoc_document": "Select sdoc document",
|
|
352
351
|
"Local_file": "Local file",
|
|
353
|
-
"
|
|
352
|
+
"Internal_server_exec_operations_error": "An exception occurred on the server, please refresh the page and try again",
|
|
353
|
+
"Failed_to_sync_with_server_operations": "Synchronization with the server failed, please refresh the page"
|
|
354
354
|
}
|
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
"Revision": "修订稿",
|
|
274
274
|
"Error": "错误",
|
|
275
275
|
"Start_revise": "开始修订",
|
|
276
|
-
"Failed_to_execute_operation_on_server": "
|
|
276
|
+
"Failed_to_execute_operation_on_server": "无法在服务器上执行操作,当前操作已经撤回",
|
|
277
277
|
"Start_revise_tip": "创建一个临时文档并对其进行修订,检查更改后将其合并回来",
|
|
278
278
|
"Load_doc_content_error": "加载文档内容错误",
|
|
279
279
|
"Sdoc_format_invalid": "文档内容不符合 sdoc 规范",
|
|
@@ -343,7 +343,6 @@
|
|
|
343
343
|
"Font": "字体",
|
|
344
344
|
"All_fonts": "所有字体",
|
|
345
345
|
"Default_font": "默认字体",
|
|
346
|
-
"Document_content_load_failed": "文档内容加载失败, 请刷新页面重新访问",
|
|
347
346
|
"Pending_operations_exceed_limit": "有多个操作未同步到服务器。请检查你的网络。",
|
|
348
347
|
"Recently_saved": "最近保存",
|
|
349
348
|
"Sdoc_document" : "sdoc 文档",
|
|
@@ -352,5 +351,6 @@
|
|
|
352
351
|
"Card": "卡片",
|
|
353
352
|
"Select_sdoc_document": "选择sdoc文档",
|
|
354
353
|
"Local_file": "本地文件",
|
|
355
|
-
"
|
|
354
|
+
"Internal_server_exec_operations_error": "在服务器执行操作异常,请刷新页面后重试",
|
|
355
|
+
"Failed_to_sync_with_server_operations": "与服务器同步操作失败,请刷新页面"
|
|
356
356
|
}
|