@seafile/comment-editor 0.0.1-alpha.6 → 0.0.1-alpha.61

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.
Files changed (41) hide show
  1. package/dist/_i18n/index.js +37 -0
  2. package/dist/basic-sdk/context.js +8 -21
  3. package/dist/basic-sdk/editor/comment-editor.js +19 -64
  4. package/dist/basic-sdk/extension/commons/color-menu/color-item.js +4 -2
  5. package/dist/basic-sdk/extension/commons/color-menu/index.js +4 -2
  6. package/dist/basic-sdk/extension/commons/insert-element-dialog/index.js +54 -96
  7. package/dist/basic-sdk/extension/commons/select/field-setting.js +3 -2
  8. package/dist/basic-sdk/extension/commons/select-file-dialog/local-files/index.js +4 -2
  9. package/dist/basic-sdk/extension/plugins/code-block/hover-menu/index.js +5 -3
  10. package/dist/basic-sdk/extension/plugins/file-link/hover-menu/index.js +5 -3
  11. package/dist/basic-sdk/extension/plugins/header/menu/index.js +3 -2
  12. package/dist/basic-sdk/extension/plugins/image/helpers.js +1 -1
  13. package/dist/basic-sdk/extension/plugins/image/hover-menu/index.js +4 -2
  14. package/dist/basic-sdk/extension/plugins/image/render-elem.js +5 -3
  15. package/dist/basic-sdk/extension/plugins/image/use-copy-image.js +1 -1
  16. package/dist/basic-sdk/extension/plugins/image/use-upload-image.js +1 -1
  17. package/dist/basic-sdk/extension/plugins/sdoc-link/hover-menu/index.js +4 -2
  18. package/dist/basic-sdk/extension/plugins/table/menu/color-selector-popover/color-item.js +4 -2
  19. package/dist/basic-sdk/extension/plugins/table/menu/table-context-menu/index.js +3 -2
  20. package/dist/basic-sdk/extension/plugins/table/menu/table-context-menu/insert-table-element.js +3 -2
  21. package/dist/basic-sdk/extension/plugins/table/menu/table-menu/index.js +1 -2
  22. package/dist/basic-sdk/extension/plugins/text-align/menu/index.js +1 -1
  23. package/dist/basic-sdk/extension/plugins/text-style/menu/comemnt-editor-menu.js +1 -2
  24. package/dist/basic-sdk/extension/plugins/text-style/menu/index.js +4 -2
  25. package/dist/basic-sdk/extension/plugins/video/render-elem.js +1 -2
  26. package/dist/basic-sdk/extension/toolbar/comment-editor-toolbar/index.js +13 -9
  27. package/dist/basic-sdk/hooks/use-comment.js +22 -12
  28. package/dist/basic-sdk/model/index.js +1 -8
  29. package/dist/basic-sdk/socket/helpers.js +312 -0
  30. package/dist/components/error-boundary/error-page.js +4 -4
  31. package/dist/pages/seafile-comment-editor.js +35 -17
  32. package/package.json +6 -6
  33. package/dist/basic-sdk/layout/comment-layout/index.css +0 -15
  34. package/dist/basic-sdk/layout/comment-layout/index.js +0 -87
  35. package/dist/basic-sdk/layout/comment-layout/resize-width/index.css +0 -38
  36. package/dist/basic-sdk/layout/comment-layout/resize-width/index.js +0 -132
  37. package/dist/basic-sdk/layout/editor-container.js +0 -32
  38. package/dist/basic-sdk/layout/index.js +0 -13
  39. package/dist/basic-sdk/model/notification.js +0 -18
  40. package/dist/components/tip-message/index.js +0 -194
  41. package/dist/components/tip-message/style.css +0 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/comment-editor",
3
- "version": "0.0.1-alpha.6",
3
+ "version": "0.0.1-alpha.61",
4
4
  "private": false,
5
5
  "description": "This is a comment editor",
6
6
  "main": "dist/index.js",
@@ -115,10 +115,10 @@
115
115
  "fs-extra": "^10.0.0",
116
116
  "html-webpack-plugin": "^5.5.0",
117
117
  "husky": "8.0.3",
118
- "i18next": "22.4.9",
119
- "i18next-browser-languagedetector": "7.0.1",
120
- "i18next-xhr-backend": "3.2.2",
121
- "identity-obj-proxy": "3.0.0",
118
+ "i18next": "^25.2.1",
119
+ "i18next-browser-languagedetector": "^8.1.0",
120
+ "i18next-http-backend": "^3.0.2",
121
+ "identity-obj-proxy": "^3.0.0",
122
122
  "is-wsl": "^1.1.0",
123
123
  "jest": "29.7.0",
124
124
  "jest-environment-jsdom": "29.7.0",
@@ -141,7 +141,7 @@
141
141
  "react-app-polyfill": "^3.0.0",
142
142
  "react-dev-utils": "^12.0.1",
143
143
  "react-dom": "18.3.1",
144
- "react-i18next": "12.1.4",
144
+ "react-i18next": "15.5.2",
145
145
  "react-refresh": "^0.11.0",
146
146
  "react-router": "7.5.2",
147
147
  "react-router-dom": "7.1.3",
@@ -1,15 +0,0 @@
1
- .comment-layout-wrapper {
2
- display: flex;
3
- flex-direction: row;
4
- max-width: 620px;
5
- min-width: 360px;
6
- position: relative;
7
- right: 0;
8
- }
9
-
10
- .comment-layout-wrapper .sdoc-content-right-panel {
11
- width: 100%;
12
- height: 100%;
13
- overflow: hidden;
14
- border-left: 1px solid #d8d8d8;
15
- }
@@ -1,87 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _comment = _interopRequireDefault(require("../../comment"));
11
- var _constants = require("../../constants");
12
- var _useComment = require("../../hooks/use-comment");
13
- var _eventBus = _interopRequireDefault(require("../../utils/event-bus"));
14
- var _localStorageUtils = _interopRequireDefault(require("../../utils/local-storage-utils"));
15
- var _resizeWidth = _interopRequireDefault(require("./resize-width"));
16
- require("./index.css");
17
- const MIN_PANEL_WIDTH = 360;
18
- const MAX_PANEL_WIDTH = 620;
19
- const CommentLayout = _ref => {
20
- let {
21
- editor
22
- } = _ref;
23
- const {
24
- className,
25
- pluginName,
26
- pluginEventBus,
27
- pluginEvent
28
- } = (0, _useComment.useComment)();
29
- const [width, setWidth] = (0, _react.useState)(MIN_PANEL_WIDTH);
30
- const panelWrapperStyle = (0, _react.useMemo)(() => {
31
- if (!pluginName) return null;
32
- let style = {
33
- width,
34
- zIndex: 101
35
- };
36
- if (!style.width || style.width < MIN_PANEL_WIDTH) {
37
- style.width = MIN_PANEL_WIDTH;
38
- } else if (style.width > MAX_PANEL_WIDTH) {
39
- style.width = MAX_PANEL_WIDTH;
40
- }
41
- return style;
42
- }, [width, pluginName]);
43
- const resizeWidth = (0, _react.useCallback)(width => {
44
- setWidth(width);
45
- }, []);
46
- const resizeWidthEnd = (0, _react.useCallback)(width => {
47
- const settings = _localStorageUtils.default.getItem(_constants.SDOC_STORAGE) || {};
48
- _localStorageUtils.default.setItem(_constants.SDOC_STORAGE, JSON.stringify({
49
- ...settings,
50
- panelWidth: width
51
- }));
52
- const eventBus = _eventBus.default.getInstance();
53
- eventBus.dispatch(_constants.INTERNAL_EVENT.RESIZE_ARTICLE);
54
- }, []);
55
- (0, _react.useEffect)(() => {
56
- const isShowGlobalComments = pluginName === 'sdoc' ? true : false;
57
- const settings = _localStorageUtils.default.getItem(_constants.SDOC_STORAGE) || {};
58
- _localStorageUtils.default.setItem(_constants.SDOC_STORAGE, {
59
- ...settings,
60
- isShowGlobalComments
61
- });
62
- const eventBus = pluginEventBus.getInstance();
63
- eventBus.dispatch(pluginEvent.RESIZE_ARTICLE);
64
- }, [pluginEvent.RESIZE_ARTICLE, pluginEventBus, pluginName]);
65
- (0, _react.useEffect)(() => {
66
- const settings = _localStorageUtils.default.getItem(_constants.SDOC_STORAGE) || {};
67
- const {
68
- panelWidth
69
- } = settings;
70
- const width = Math.max(MIN_PANEL_WIDTH, Math.min(parseInt(panelWidth, 10) || MIN_PANEL_WIDTH, MAX_PANEL_WIDTH));
71
- setWidth(width);
72
- }, []);
73
- return /*#__PURE__*/_react.default.createElement("div", {
74
- className: `comment-layout-wrapper ${className}`,
75
- style: panelWrapperStyle
76
- }, /*#__PURE__*/_react.default.createElement(_resizeWidth.default, {
77
- minWidth: MIN_PANEL_WIDTH,
78
- maxWidth: MAX_PANEL_WIDTH,
79
- resizeWidth: resizeWidth,
80
- resizeWidthEnd: resizeWidthEnd
81
- }), /*#__PURE__*/_react.default.createElement(_comment.default, {
82
- editor: editor,
83
- type: "global",
84
- width: width
85
- }));
86
- };
87
- var _default = exports.default = CommentLayout;
@@ -1,38 +0,0 @@
1
- .comment-layout-resize-width-handler {
2
- height: 100%;
3
- position: absolute;
4
- right: 0;
5
- top: 0;
6
- width: 6px;
7
- }
8
-
9
- .comment-layout-resize-width-handler.resize-handler-placement-right {
10
- left: 0;
11
- right: auto;
12
- }
13
-
14
- .comment-layout-resize-width-handler:hover {
15
- cursor: col-resize;
16
- }
17
-
18
- .comment-layout-resize-width-handler .comment-layout-resize-width-handler-content {
19
- background-color: initial;
20
- height: 100%;
21
- position: relative;
22
- width: 2px;
23
- }
24
-
25
- .comment-layout-resize-width-handler:hover .comment-layout-resize-width-handler-content {
26
- background-color: #ccc;
27
- }
28
-
29
- .comment-layout-resize-width-handler .comment-layout-resize-width-handler-bar {
30
- background-color: #2d7ff9;
31
- border-radius: 3px;
32
- content: "";
33
- left: 50%;
34
- margin-left: -3px;
35
- position: absolute;
36
- width: 6px;
37
- }
38
-
@@ -1,132 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
9
- require("./index.css");
10
- const ResizeWidth = _ref => {
11
- let {
12
- minWidth,
13
- maxWidth,
14
- resizeWidth: resizeWidthAPI,
15
- resizeWidthEnd
16
- } = _ref;
17
- const [isShowHandlerBar, setIsShowHandlerBar] = (0, _react.useState)(false);
18
- const [drag, setDrag] = (0, _react.useState)(null);
19
- const handlerRef = (0, _react.useRef)(null);
20
- const handlerBarRef = (0, _react.useRef)(null);
21
- const setHandlerBarTop = handlerTop => {
22
- if (!handlerBarRef.current || handlerTop < 0) return;
23
- handlerBarRef.current.style.top = handlerTop + 'px';
24
- };
25
- const setHandlerBarPosition = event => {
26
- if (!handlerRef.current) return;
27
- const {
28
- top
29
- } = handlerRef.current.getBoundingClientRect();
30
- const handlerTop = event.pageY - top - 26 / 2;
31
- setHandlerBarTop(handlerTop);
32
- };
33
- const getWidthFromMouseEvent = event => {
34
- return event.pageX || event.touches && event.touches[0] && event.touches[0].pageX || event.changedTouches && event.changedTouches[event.changedTouches.length - 1].pageX;
35
- };
36
- const calculateResizedWidth = event => {
37
- const width = getWidthFromMouseEvent(event);
38
- const resizedWidth = document.body.clientWidth - width;
39
- if (minWidth && resizedWidth < minWidth || maxWidth && resizedWidth > maxWidth) return -1;
40
- return resizedWidth;
41
- };
42
- const onResizeWidth = event => {
43
- const resizedWidth = calculateResizedWidth(event);
44
- if (resizedWidth < 0) return;
45
- if (resizeWidthAPI) {
46
- resizeWidthAPI(resizedWidth);
47
- }
48
- };
49
- const onDrag = event => {
50
- onResizeWidth(event);
51
- };
52
- const onDragStart = (0, _react.useCallback)(event => {
53
- if (event && event.dataTransfer && event.dataTransfer.setData) {
54
- event.dataTransfer.setData('text/plain', 'dummy');
55
- }
56
- }, []);
57
- const onDragEnd = event => {
58
- onResizeWidth(event);
59
- };
60
- const onMouseLeave = () => {
61
- setIsShowHandlerBar(false);
62
- };
63
- const onMouseEnter = event => {
64
- setIsShowHandlerBar(true);
65
- setHandlerBarPosition(event);
66
- if (handlerRef.current) {
67
- handlerRef.current.addEventListener('mouseleave', onMouseLeave);
68
- }
69
- };
70
- const onMouseOver = event => {
71
- setHandlerBarPosition(event);
72
- };
73
- const onMouseDown = event => {
74
- event.preventDefault && event.preventDefault();
75
- const currDrag = onDragStart(event);
76
- if (currDrag === null && event.button !== 0) return;
77
- window.addEventListener('mouseup', onMouseUp);
78
- window.addEventListener('mousemove', onMouseMove);
79
- if (handlerRef.current) {
80
- handlerRef.current.removeEventListener('mouseleave', onMouseLeave);
81
- }
82
- setDrag(currDrag);
83
- };
84
- const onMouseMove = event => {
85
- event.preventDefault && event.preventDefault();
86
- if (!drag === null) return;
87
- onDrag(event);
88
- };
89
- const onMouseUp = event => {
90
- window.removeEventListener('mouseup', onMouseUp);
91
- window.removeEventListener('mousemove', onMouseMove);
92
- onDragEnd(event, drag);
93
- setHandlerBarTop(-9999);
94
- setDrag(null);
95
- setIsShowHandlerBar(false);
96
- if (resizeWidthEnd) {
97
- const resizeWidth = calculateResizedWidth(event);
98
- if (resizeWidth < 0) return;
99
- resizeWidthEnd(resizeWidth);
100
- }
101
- };
102
- (0, _react.useEffect)(() => {
103
- return () => {
104
- window.removeEventListener('mouseup', onMouseUp);
105
- window.removeEventListener('mousemove', onMouseMove);
106
- };
107
-
108
- // eslint-disable-next-line
109
- }, []);
110
- return /*#__PURE__*/_react.default.createElement("div", {
111
- className: "comment-layout-resize-width-handler resize-handler-placement-right",
112
- ref: handlerRef,
113
- onMouseDown: onMouseDown,
114
- onMouseOver: onMouseOver,
115
- onMouseEnter: onMouseEnter,
116
- onDrag: onDrag,
117
- onDragStart: onDragStart,
118
- onDragEnd: onDragEnd,
119
- style: {
120
- zIndex: 4
121
- }
122
- }, /*#__PURE__*/_react.default.createElement("div", {
123
- className: "comment-layout-resize-width-handler-content"
124
- }, isShowHandlerBar && /*#__PURE__*/_react.default.createElement("div", {
125
- className: "comment-layout-resize-width-handler-bar",
126
- ref: handlerBarRef,
127
- style: {
128
- height: 26
129
- }
130
- })));
131
- };
132
- var _default = exports.default = ResizeWidth;
@@ -1,32 +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 _react = _interopRequireDefault(require("react"));
9
- var _classnames = _interopRequireDefault(require("classnames"));
10
- var _commonUtils = require("../utils/common-utils");
11
- require("../assets/css/layout.css");
12
- require("../assets/css/default.css");
13
- require("../assets/css/sdoc-editor-article.css");
14
- require("../assets/css/sdoc-editor-plugins.css");
15
- require("../assets/css/sdoc-comment-editor-plugin.css");
16
- require("../assets/css/dropdown-menu.css");
17
- const EditorContainer = _ref => {
18
- let {
19
- children,
20
- readonly,
21
- fullscreen
22
- } = _ref;
23
- const className = (0, _classnames.default)('sdoc-editor-container', {
24
- 'mobile': _commonUtils.isMobile,
25
- 'readonly': readonly,
26
- 'fullscreen': fullscreen
27
- });
28
- return /*#__PURE__*/_react.default.createElement("div", {
29
- className: className
30
- }, children);
31
- };
32
- var _default = exports.default = EditorContainer;
@@ -1,13 +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
- Object.defineProperty(exports, "EditorContainer", {
8
- enumerable: true,
9
- get: function () {
10
- return _editorContainer.default;
11
- }
12
- });
13
- var _editorContainer = _interopRequireDefault(require("./editor-container"));
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _utils = require("../comment/utils");
8
- class Notification {
9
- constructor(options) {
10
- var _options$detail, _options$detail2, _options$detail3;
11
- this.id = options.id || '';
12
- this.comment_id = (options === null || options === void 0 ? void 0 : (_options$detail = options.detail) === null || _options$detail === void 0 ? void 0 : _options$detail.comment_id) || '';
13
- this.reply_id = (options === null || options === void 0 ? void 0 : (_options$detail2 = options.detail) === null || _options$detail2 === void 0 ? void 0 : _options$detail2.reply_id) || '';
14
- this.type = (options === null || options === void 0 ? void 0 : (_options$detail3 = options.detail) === null || _options$detail3 === void 0 ? void 0 : _options$detail3.msg_type) || '';
15
- this.key = this.type !== 'reply' ? (0, _utils.generatorNotificationKey)(this.comment_id) : (0, _utils.generatorNotificationKey)(this.comment_id, this.reply_id);
16
- }
17
- }
18
- var _default = exports.default = Notification;
@@ -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
- }