@seafile/comment-editor 0.0.1-alpha.56 → 0.0.1-alpha.57

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.
@@ -232,6 +232,8 @@ const CommentEditor = _ref => {
232
232
  width: "100%"
233
233
  })), /*#__PURE__*/_react.default.createElement("div", {
234
234
  className: "comment-editor-user-name"
235
- }, userInfo.name)));
235
+ }, userInfo.name)), toolMenus.includes(_constants2.IMAGE) && /*#__PURE__*/_react.default.createElement(_insertElementDialog.default, {
236
+ editor: editor
237
+ }));
236
238
  };
237
239
  var _default = exports.default = CommentEditor;
@@ -106,4 +106,4 @@ class FieldSetting extends _react.default.Component {
106
106
  }, t('Italic'))));
107
107
  }
108
108
  }
109
- var _default = exports.default = (0, _reactI18next.withTranslation)('seafile-editor')(FieldSetting);
109
+ var _default = exports.default = FieldSetting;
@@ -150,4 +150,4 @@ class HeaderMenu extends _react.default.Component {
150
150
  })));
151
151
  }
152
152
  }
153
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(HeaderMenu);
153
+ var _default = exports.default = HeaderMenu;
@@ -229,4 +229,4 @@ class TableContextMenu extends _react.default.Component {
229
229
  }, t('Fit_table_to_page_width'))));
230
230
  }
231
231
  }
232
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(TableContextMenu);
232
+ var _default = exports.default = TableContextMenu;
@@ -94,4 +94,4 @@ class InsertTableElement extends _react.Component {
94
94
  }), /*#__PURE__*/_react.default.createElement("span", null, type === _constants.TABLE_ELEMENT.ROW ? t('Row(s)') : t('Column(s)'))));
95
95
  }
96
96
  }
97
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(InsertTableElement);
97
+ var _default = exports.default = InsertTableElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/comment-editor",
3
- "version": "0.0.1-alpha.56",
3
+ "version": "0.0.1-alpha.57",
4
4
  "private": false,
5
5
  "description": "This is a comment editor",
6
6
  "main": "dist/index.js",
@@ -1,194 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _reactI18next = require("react-i18next");
11
- var _dayjs = _interopRequireDefault(require("dayjs"));
12
- var _basicSdk = require("../../basic-sdk");
13
- require("./style.css");
14
- class TipMessage extends _react.default.Component {
15
- constructor(props) {
16
- super(props);
17
- (0, _defineProperty2.default)(this, "onOperationExecuteError", () => {
18
- const {
19
- t
20
- } = this.props;
21
- const message = t('Failed_to_execute_operation_on_server');
22
- _basicSdk.toaster.warning(message, {
23
- hasCloseButton: true
24
- });
25
- });
26
- (0, _defineProperty2.default)(this, "onSyncServerOperationError", () => {
27
- const {
28
- t
29
- } = this.props;
30
- const message = t('Failed_to_sync_with_server_operations');
31
- _basicSdk.toaster.danger(message, {
32
- hasCloseButton: false,
33
- duration: null
34
- });
35
- });
36
- (0, _defineProperty2.default)(this, "onInternalServerExecError", () => {
37
- const {
38
- t
39
- } = this.props;
40
- const message = t('Internal_server_exec_operations_error');
41
- _basicSdk.toaster.danger(message, {
42
- hasCloseButton: false,
43
- duration: null
44
- });
45
- });
46
- (0, _defineProperty2.default)(this, "onTokenExpiredError", msg => {
47
- const {
48
- t
49
- } = this.props;
50
- const message = t('Token_expired_Please_refresh_the_page');
51
- _basicSdk.toaster.closeAll();
52
- _basicSdk.toaster.danger(message, {
53
- duration: null
54
- });
55
- });
56
- (0, _defineProperty2.default)(this, "onPendingOpExceedLimit", () => {
57
- const {
58
- t
59
- } = this.props;
60
- _basicSdk.toaster.closeAll();
61
- const message = t('Pending_operations_exceed_limit');
62
- _basicSdk.toaster.warning(message, {
63
- duration: 5
64
- });
65
- });
66
- (0, _defineProperty2.default)(this, "onDisconnect", () => {
67
- const {
68
- t,
69
- isEditMode
70
- } = this.props;
71
- if (!isEditMode) return;
72
- const message = t('Server_is_not_connected_Operation_will_be_sent_to_server_later');
73
- _basicSdk.toaster.warning(message, {
74
- hasCloseButton: true,
75
- duration: null
76
- });
77
- });
78
- (0, _defineProperty2.default)(this, "onReconnectError", () => {
79
- if (!this.isConnectError) {
80
- this.isConnectError = true;
81
- const {
82
- t
83
- } = this.props;
84
- const message = t('Server_is_disconnected_Reconnecting');
85
- _basicSdk.toaster.closeAll();
86
- _basicSdk.toaster.warning(message, {
87
- hasCloseButton: true,
88
- duration: null
89
- });
90
- }
91
- });
92
- (0, _defineProperty2.default)(this, "onReconnect", () => {
93
- this.isConnectError = false;
94
- const {
95
- t
96
- } = this.props;
97
- const message = t('Server_is_reconnected');
98
- _basicSdk.toaster.closeAll();
99
- _basicSdk.toaster.success(message); // close after serval seconds
100
- });
101
- (0, _defineProperty2.default)(this, "onDocumentSaving", () => {
102
- this.setState({
103
- isSaving: true,
104
- isSaved: false
105
- });
106
- });
107
- (0, _defineProperty2.default)(this, "onDocumentSaved", lastSavedAt => {
108
- if (this.saveTimer) clearTimeout(this.saveTimer);
109
- if (this.resetTimer) clearTimeout(this.resetTimer);
110
- this.saveTimer = setTimeout(() => {
111
- this.setState({
112
- lastSavedAt,
113
- isSaving: false,
114
- isSaved: true
115
- });
116
- }, 1000);
117
- this.resetTimer = setTimeout(() => {
118
- this.setState({
119
- isSaving: false,
120
- isSaved: false
121
- });
122
- }, 2000);
123
- });
124
- (0, _defineProperty2.default)(this, "render", () => {
125
- const {
126
- t
127
- } = this.props;
128
- const {
129
- isSaved,
130
- isSaving,
131
- lastSavedAt
132
- } = this.state;
133
- if (isSaving && !isSaved) {
134
- return /*#__PURE__*/_react.default.createElement("span", {
135
- className: "tip-message"
136
- }, t('Saving'));
137
- }
138
- if (!isSaving && isSaved) {
139
- return /*#__PURE__*/_react.default.createElement("span", {
140
- className: "tip-message"
141
- }, t('All_changes_saved'));
142
- }
143
- if (lastSavedAt) {
144
- return /*#__PURE__*/_react.default.createElement("span", {
145
- className: "tip-message"
146
- }, /*#__PURE__*/_react.default.createElement("span", {
147
- className: "sdocfont sdoc-save-tip mr-2"
148
- }), /*#__PURE__*/_react.default.createElement("span", {
149
- className: "save-time"
150
- }, (0, _dayjs.default)(lastSavedAt).format('HH:mm')));
151
- }
152
- return null;
153
- });
154
- this.state = {
155
- isSaved: false,
156
- isSaving: false,
157
- lastSavedAt: ''
158
- };
159
- this.saveTimer = null;
160
- }
161
- componentDidMount() {
162
- const eventBus = _basicSdk.EventBus.getInstance();
163
- this.unsubscribeSavingEvent = eventBus.subscribe('is-saving', this.onDocumentSaving);
164
- this.unsubscribeSavedEvent = eventBus.subscribe('saved', this.onDocumentSaved);
165
- // offline reconnect
166
- this.unsubscribeDisconnectEvent = eventBus.subscribe('disconnect', this.onDisconnect);
167
- this.unsubscribeReconnectErrorEvent = eventBus.subscribe('reconnect_error', this.onReconnectError);
168
- this.unsubscribeReconnectEvent = eventBus.subscribe('reconnect', this.onReconnect);
169
-
170
- // server return error
171
- this.unsubscribeOpExecError = eventBus.subscribe('execute_client_operations_error', this.onOperationExecuteError);
172
- this.unsubscribeSyncServerOpError = eventBus.subscribe('sync_server_operations_error', this.onSyncServerOperationError);
173
- this.unsubscribeDocumentLoadError = eventBus.subscribe('load_document_content_error', this.onInternalServerExecError);
174
- this.unsubscribeOperationsSaveError = eventBus.subscribe('save_operations_to_database_error', this.onInternalServerExecError);
175
- this.unsubscribeOperationsSaveError = eventBus.subscribe('token_expired', this.onTokenExpiredError);
176
-
177
- // local error
178
- this.unsubscribePendingOpExceedLimit = eventBus.subscribe('pending_operations_exceed_limit', this.onPendingOpExceedLimit);
179
- }
180
- componentWillUnmount() {
181
- this.unsubscribeSavingEvent();
182
- this.unsubscribeSavedEvent();
183
- this.unsubscribeDisconnectEvent();
184
- this.unsubscribeReconnectErrorEvent();
185
- this.unsubscribeReconnectEvent();
186
- this.unsubscribeOpExecError();
187
- this.unsubscribeSyncServerOpError();
188
- this.unsubscribePendingOpExceedLimit();
189
- this.unsubscribeDocumentLoadError();
190
- this.unsubscribeOperationsSaveError();
191
- clearTimeout(this.saveTimer);
192
- }
193
- }
194
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(TipMessage);
@@ -1,15 +0,0 @@
1
- .sdoc-editor-page-wrapper .tip-message {
2
- margin-left: 12px;
3
- font-size: 12px;
4
- opacity: 0.75;
5
- color: #999;
6
- width: max-content;
7
- height: 27px;
8
- line-height: 27px;
9
- display: inline-flex;
10
- }
11
-
12
- .sdoc-editor-page-wrapper .tip-message .sdocfont {
13
- padding-top: 1px;
14
- font-size: 14px;
15
- }