@seafile/sdoc-editor 2.0.210 → 2.0.212
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.
|
@@ -37,7 +37,7 @@ var LinkHover = function LinkHover(_ref) {
|
|
|
37
37
|
var onMouseDown = (0, _react.useCallback)(function (event) {
|
|
38
38
|
if (!(0, _isUrl["default"])(element.href)) {
|
|
39
39
|
event.preventDefault();
|
|
40
|
-
_toast["default"].danger('The_link_is_invalid');
|
|
40
|
+
_toast["default"].danger(t('The_link_is_invalid'));
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
event.stopPropagation();
|
|
@@ -12,6 +12,7 @@ var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/cal
|
|
|
12
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _reactI18next = require("react-i18next");
|
|
15
16
|
var _slate = require("@seafile/slate");
|
|
16
17
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
18
|
var _isUrl = _interopRequireDefault(require("is-url"));
|
|
@@ -94,10 +95,12 @@ var Link = /*#__PURE__*/function (_React$Component) {
|
|
|
94
95
|
(0, _helpers.unWrapLinkNode)(editor);
|
|
95
96
|
});
|
|
96
97
|
(0, _defineProperty2["default"])(_this, "onOpenLink", function (event) {
|
|
97
|
-
var
|
|
98
|
+
var _this$props = _this.props,
|
|
99
|
+
element = _this$props.element,
|
|
100
|
+
t = _this$props.t;
|
|
98
101
|
if (!(0, _isUrl["default"])(element.href)) {
|
|
99
102
|
event.preventDefault();
|
|
100
|
-
_toast["default"].danger('The_link_is_invalid');
|
|
103
|
+
_toast["default"].danger(t('The_link_is_invalid'));
|
|
101
104
|
return;
|
|
102
105
|
}
|
|
103
106
|
if (!(0, _helpers.isWeChat)()) {
|
|
@@ -134,12 +137,12 @@ var Link = /*#__PURE__*/function (_React$Component) {
|
|
|
134
137
|
key: "render",
|
|
135
138
|
value: function render() {
|
|
136
139
|
var _element$children$2;
|
|
137
|
-
var _this$
|
|
138
|
-
attributes = _this$
|
|
139
|
-
children = _this$
|
|
140
|
-
element = _this$
|
|
141
|
-
editor = _this$
|
|
142
|
-
readonly = _this$
|
|
140
|
+
var _this$props2 = this.props,
|
|
141
|
+
attributes = _this$props2.attributes,
|
|
142
|
+
children = _this$props2.children,
|
|
143
|
+
element = _this$props2.element,
|
|
144
|
+
editor = _this$props2.editor,
|
|
145
|
+
readonly = _this$props2.readonly;
|
|
143
146
|
var _this$state = this.state,
|
|
144
147
|
isShowLinkMenu = _this$state.isShowLinkMenu,
|
|
145
148
|
menuPosition = _this$state.menuPosition;
|
|
@@ -175,8 +178,9 @@ var Link = /*#__PURE__*/function (_React$Component) {
|
|
|
175
178
|
}]);
|
|
176
179
|
}(_react["default"].Component);
|
|
177
180
|
(0, _defineProperty2["default"])(Link, "contextType", _useScrollContext.ScrollContext);
|
|
181
|
+
var SdocLink = (0, _reactI18next.withTranslation)('sdoc-editor')(Link);
|
|
178
182
|
var renderLink = function renderLink(props, editor, readonly) {
|
|
179
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
183
|
+
return /*#__PURE__*/_react["default"].createElement(SdocLink, Object.assign({}, props, {
|
|
180
184
|
editor: editor,
|
|
181
185
|
readonly: readonly
|
|
182
186
|
}));
|
|
@@ -21,6 +21,10 @@ var SocketClient = /*#__PURE__*/(0, _createClass2["default"])(function SocketCli
|
|
|
21
21
|
_this.socket.on('connect', _this.onConnected);
|
|
22
22
|
_this.socket.on('disconnect', _this.onDisconnected);
|
|
23
23
|
_this.socket.on('connect_error', _this.onConnectError);
|
|
24
|
+
_this.socket.on('token-expired', function () {
|
|
25
|
+
var socketManager = _socketManager3["default"].getInstance();
|
|
26
|
+
socketManager.dispatchConnectState('token_expired');
|
|
27
|
+
});
|
|
24
28
|
_this.socket.on('join-room', _this.onJoinRoom);
|
|
25
29
|
_this.socket.on('leave-room', _this.onLeaveRoom);
|
|
26
30
|
_this.socket.on('user-updated', _this.onUserUpdated);
|
|
@@ -114,10 +118,11 @@ var SocketClient = /*#__PURE__*/(0, _createClass2["default"])(function SocketCli
|
|
|
114
118
|
socketManager.dispatchConnectState('disconnect');
|
|
115
119
|
});
|
|
116
120
|
(0, _defineProperty2["default"])(this, "onConnectError", function (error) {
|
|
121
|
+
var _error$data;
|
|
117
122
|
(0, _debug.clientDebug)('connect_error. %s', error.message);
|
|
118
123
|
(0, _debug.clientDebug)('connect_error. %s', error.type);
|
|
119
124
|
(0, _debug.clientDebug)('connect_error. %O', error.context);
|
|
120
|
-
if (error.message === 'jwt expired') {
|
|
125
|
+
if (((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) === 'token_expired' || error.message === 'jwt expired') {
|
|
121
126
|
var _socketManager2 = _socketManager3["default"].getInstance();
|
|
122
127
|
_socketManager2.dispatchConnectState('token_expired');
|
|
123
128
|
return;
|
|
@@ -233,6 +238,9 @@ var SocketClient = /*#__PURE__*/(0, _createClass2["default"])(function SocketCli
|
|
|
233
238
|
}, function (result) {
|
|
234
239
|
if (result.success) {
|
|
235
240
|
socketManager.onGetRecentOperations(result);
|
|
241
|
+
} else {
|
|
242
|
+
var errorType = result.error_type === 'token_expired' ? 'token_expired' : 'sync_server_operations_error';
|
|
243
|
+
socketManager.dispatchConnectState(errorType);
|
|
236
244
|
}
|
|
237
245
|
});
|
|
238
246
|
});
|
|
@@ -112,7 +112,8 @@ var SocketManager = /*#__PURE__*/(0, _createClass2["default"])(function SocketMa
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
// Operations are execute failure
|
|
115
|
-
var
|
|
115
|
+
var _ref = result || {},
|
|
116
|
+
error_type = _ref.error_type;
|
|
116
117
|
if (error_type === 'load_document_content_error' || error_type === 'save_operations_to_database_error' || error_type === 'token_expired') {
|
|
117
118
|
// load_document_content_error: After a short-term reconnection, the content of the document fails to load
|
|
118
119
|
// save_operation_to_database_error: Save operation to database error
|
|
@@ -147,6 +148,10 @@ var SocketManager = /*#__PURE__*/(0, _createClass2["default"])(function SocketMa
|
|
|
147
148
|
_this._sendingOperations = null;
|
|
148
149
|
_this.sendNextOperations();
|
|
149
150
|
});
|
|
151
|
+
} else {
|
|
152
|
+
_this.state = STATE.NEED_RELOAD;
|
|
153
|
+
_this._sendingOperations = null;
|
|
154
|
+
_this.dispatchConnectState('sync_server_operations_error');
|
|
150
155
|
}
|
|
151
156
|
});
|
|
152
157
|
(0, _defineProperty2["default"])(this, "onReceiveRemoteOperations", function (params) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.212",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -70,6 +70,5 @@
|
|
|
70
70
|
},
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
|
-
}
|
|
74
|
-
"gitHead": "1fdc5b006605911437afc3a52800ee04d5fd0133"
|
|
73
|
+
}
|
|
75
74
|
}
|
package/LICENSE.txt
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2025 Seafile Ltd.
|
|
2
|
-
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License at
|
|
6
|
-
|
|
7
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
|
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
See the License for the specific language governing permissions and
|
|
13
|
-
limitations under the License.
|