@seafile/sdoc-editor 2.0.122-test-0.0.1 → 2.0.123
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/LICENSE.txt
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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.
|
|
@@ -8,18 +8,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
11
|
-
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
13
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
14
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
var _reactI18next = require("react-i18next");
|
|
16
13
|
var _slate = require("@seafile/slate");
|
|
17
14
|
var _deepCopy = _interopRequireDefault(require("deep-copy"));
|
|
18
|
-
var _notificationHooks = require("../comment/hooks/notification-hooks");
|
|
19
15
|
var _fileLoading = _interopRequireDefault(require("../components/file-loading"));
|
|
20
|
-
var _toast = _interopRequireDefault(require("../components/toast"));
|
|
21
16
|
var _constants = require("../constants");
|
|
22
|
-
var
|
|
17
|
+
var _context = _interopRequireDefault(require("../context"));
|
|
23
18
|
var _extension = require("../extension");
|
|
24
19
|
var _core = require("../extension/core");
|
|
25
20
|
var _commentEditorToolbar = _interopRequireDefault(require("../extension/toolbar/comment-editor-toolbar"));
|
|
@@ -28,8 +23,6 @@ var _useScrollContext = require("../hooks/use-scroll-context");
|
|
|
28
23
|
var _layout = require("../layout");
|
|
29
24
|
var _nodeId = _interopRequireDefault(require("../node-id"));
|
|
30
25
|
var _socket = require("../socket");
|
|
31
|
-
var _commonUtils = require("../utils/common-utils");
|
|
32
|
-
var _eventBus = _interopRequireDefault(require("../utils/event-bus"));
|
|
33
26
|
var _commentArticle = _interopRequireDefault(require("./comment-article"));
|
|
34
27
|
var SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
35
28
|
var propsEditor = _ref.editor,
|
|
@@ -44,15 +37,10 @@ var SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
44
37
|
slateValue = _useState2[0],
|
|
45
38
|
_setSlateValue = _useState2[1];
|
|
46
39
|
var commentEditorContainerRef = (0, _react.useRef)(null);
|
|
47
|
-
var timeoutRef = (0, _react.useRef)(null);
|
|
48
|
-
var _useNotificationConte = (0, _notificationHooks.useNotificationContext)(),
|
|
49
|
-
notificationsInfo = _useNotificationConte.notificationsInfo;
|
|
50
|
-
var _useTranslation = (0, _reactI18next.useTranslation)('sdoc-editor'),
|
|
51
|
-
t = _useTranslation.t;
|
|
52
40
|
var validEditor = (0, _react.useMemo)(function () {
|
|
53
41
|
if (propsEditor) return propsEditor;
|
|
54
42
|
var defaultEditor = (0, _extension.createCommentEditor)();
|
|
55
|
-
var editorConfig =
|
|
43
|
+
var editorConfig = _context["default"].getEditorConfig();
|
|
56
44
|
var newEditor = (0, _nodeId["default"])((0, _socket.withSocketIO)(defaultEditor, {
|
|
57
45
|
document: document,
|
|
58
46
|
config: editorConfig
|
|
@@ -64,65 +52,6 @@ var SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
64
52
|
return newEditor;
|
|
65
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
66
54
|
}, []);
|
|
67
|
-
(0, _react.useEffect)(function () {
|
|
68
|
-
if (!(commentEditorContainerRef !== null && commentEditorContainerRef !== void 0 && commentEditorContainerRef.current)) return;
|
|
69
|
-
if (notificationsInfo.notifications_map.length === 0) return;
|
|
70
|
-
if (!commentEditorContainerRef.current.closest('.global-comment-input-wrapper')) return;
|
|
71
|
-
var clearAllNotification = /*#__PURE__*/function () {
|
|
72
|
-
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
73
|
-
var res, notifications, eventBus, errorMessage;
|
|
74
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
75
|
-
while (1) switch (_context.prev = _context.next) {
|
|
76
|
-
case 0:
|
|
77
|
-
_context.prev = 0;
|
|
78
|
-
_context.next = 3;
|
|
79
|
-
return _context2["default"].readAllNotifications();
|
|
80
|
-
case 3:
|
|
81
|
-
_context.next = 5;
|
|
82
|
-
return _context2["default"].listUnseenNotifications();
|
|
83
|
-
case 5:
|
|
84
|
-
res = _context.sent;
|
|
85
|
-
notifications = res.data.notifications;
|
|
86
|
-
eventBus = _eventBus["default"].getInstance();
|
|
87
|
-
eventBus.dispatch(_constants.INTERNAL_EVENT.UNSEEN_NOTIFICATIONS_COUNT, notifications === null || notifications === void 0 ? void 0 : notifications.length);
|
|
88
|
-
eventBus.dispatch(_constants.INTERNAL_EVENT.NEW_NOTIFICATION);
|
|
89
|
-
eventBus.dispatch(_constants.INTERNAL_EVENT.CLEAR_NOTIFICATION);
|
|
90
|
-
_context.next = 17;
|
|
91
|
-
break;
|
|
92
|
-
case 13:
|
|
93
|
-
_context.prev = 13;
|
|
94
|
-
_context.t0 = _context["catch"](0);
|
|
95
|
-
errorMessage = (0, _commonUtils.getErrorMsg)(_context.t0);
|
|
96
|
-
_toast["default"].danger(t(errorMessage));
|
|
97
|
-
case 17:
|
|
98
|
-
case "end":
|
|
99
|
-
return _context.stop();
|
|
100
|
-
}
|
|
101
|
-
}, _callee, null, [[0, 13]]);
|
|
102
|
-
}));
|
|
103
|
-
return function clearAllNotification() {
|
|
104
|
-
return _ref2.apply(this, arguments);
|
|
105
|
-
};
|
|
106
|
-
}();
|
|
107
|
-
var el = commentEditorContainerRef && commentEditorContainerRef.current;
|
|
108
|
-
|
|
109
|
-
// Mark comment read if focusing commentEditorContainerRef over 3s
|
|
110
|
-
var handleFocus = function handleFocus() {
|
|
111
|
-
timeoutRef.current = setTimeout(function () {
|
|
112
|
-
clearAllNotification();
|
|
113
|
-
}, 3000);
|
|
114
|
-
};
|
|
115
|
-
var handleBlur = function handleBlur() {
|
|
116
|
-
clearTimeout(timeoutRef.current);
|
|
117
|
-
};
|
|
118
|
-
el.addEventListener('focus', handleFocus);
|
|
119
|
-
el.addEventListener('blur', handleBlur);
|
|
120
|
-
return function () {
|
|
121
|
-
el.removeEventListener('focus', handleFocus);
|
|
122
|
-
el.removeEventListener('blur', handleBlur);
|
|
123
|
-
clearTimeout(timeoutRef.current);
|
|
124
|
-
};
|
|
125
|
-
}, [notificationsInfo.notifications_map, t]);
|
|
126
55
|
|
|
127
56
|
// useMount: focus editor
|
|
128
57
|
(0, _react.useEffect)(function () {
|
|
@@ -209,7 +209,7 @@ var queryCopyMoveProgressView = exports.queryCopyMoveProgressView = function que
|
|
|
209
209
|
};
|
|
210
210
|
var _start = /*#__PURE__*/function () {
|
|
211
211
|
var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
212
|
-
var res,
|
|
212
|
+
var res, successful, eventBus;
|
|
213
213
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
214
214
|
while (1) switch (_context.prev = _context.next) {
|
|
215
215
|
case 0:
|
|
@@ -217,8 +217,8 @@ var queryCopyMoveProgressView = exports.queryCopyMoveProgressView = function que
|
|
|
217
217
|
return _context2["default"].getCopyMoveProgressView(taskId);
|
|
218
218
|
case 2:
|
|
219
219
|
res = _context.sent;
|
|
220
|
-
|
|
221
|
-
if (
|
|
220
|
+
successful = res.data.successful;
|
|
221
|
+
if (successful) {
|
|
222
222
|
stop();
|
|
223
223
|
// Reload image
|
|
224
224
|
eventBus = _eventBus["default"].getInstance();
|
|
@@ -238,7 +238,6 @@ var Image = function Image(_ref) {
|
|
|
238
238
|
return (0, _helpers.handleBase64Image)(editor, path, data);
|
|
239
239
|
}
|
|
240
240
|
setIsShowImagePlaceholder(true);
|
|
241
|
-
console.log(data.src);
|
|
242
241
|
// External network images do not reload after failure to load
|
|
243
242
|
if (!data.src.startsWith('http')) {
|
|
244
243
|
var eventBus = _eventBus["default"].getInstance();
|
|
@@ -363,15 +363,18 @@ var QuickInsertBlockMenu = function QuickInsertBlockMenu(_ref) {
|
|
|
363
363
|
}
|
|
364
364
|
if (keyCode === Enter) {
|
|
365
365
|
e.preventDefault();
|
|
366
|
+
if (currentSelectIndex === -1) return;
|
|
366
367
|
var item = renderItems[currentSelectIndex];
|
|
367
368
|
if (item === _constants2.TABLE) {
|
|
368
369
|
tableSizeRef.current.uncontrolledPopoverRef.current.toggle();
|
|
369
370
|
return;
|
|
370
371
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
if (dropDownItems[item]) {
|
|
373
|
+
var _dropDownItems$item$p = dropDownItems[item].props,
|
|
374
|
+
disabled = _dropDownItems$item$p.disabled,
|
|
375
|
+
onClick = _dropDownItems$item$p.onClick;
|
|
376
|
+
!disabled && onClick();
|
|
377
|
+
}
|
|
375
378
|
}
|
|
376
379
|
if (keyCode === Esc) {
|
|
377
380
|
e.preventDefault();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.123",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -69,5 +69,6 @@
|
|
|
69
69
|
},
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
|
-
}
|
|
72
|
+
},
|
|
73
|
+
"gitHead": "6381a83479253e6fbdc0955a14c0ded4ca799d53"
|
|
73
74
|
}
|