@seafile/sdoc-editor 2.0.139 → 2.0.141
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/comment/components/comment-item-collapse-wrapper.js +20 -22
- package/dist/comment/components/comment-item-content.js +33 -17
- package/dist/comment/components/comment-item-reply.js +35 -18
- package/dist/comment/components/comment-item-wrapper.js +56 -62
- package/dist/comment/components/comment-list.js +63 -23
- package/dist/comment/components/global-comment/global-comment-editor.js +29 -10
- package/dist/comment/components/global-comment/global-comment-header.js +18 -19
- package/dist/comment/components/global-comment/index.js +9 -10
- package/dist/comment/hooks/comment-hooks/use-comment-mount.js +33 -35
- package/dist/comment/hooks/notification-hooks/use-notification-mount.js +17 -18
- package/dist/context.js +4 -3
- package/dist/extension/commons/file-insert-dialog/index.js +26 -27
- package/dist/extension/commons/select-file-dialog/local-files/index.js +12 -13
- package/dist/extension/plugins/ai/ai-module/index.js +9 -10
- package/dist/extension/plugins/image/helpers.js +9 -10
- package/dist/extension/plugins/image/use-copy-image.js +35 -37
- package/dist/extension/plugins/image/use-upload-image.js +25 -27
- package/dist/extension/plugins/link/plugin.js +24 -25
- package/dist/extension/plugins/whiteboard/helper.js +17 -18
- package/package.json +3 -2
- package/dist/comment/components/comment-editor.js +0 -162
- package/dist/editor/sdoc-comment-editor.js +0 -209
|
@@ -1,162 +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 _reactI18next = require("react-i18next");
|
|
11
|
-
var _slate = require("@seafile/slate");
|
|
12
|
-
var _slateReact = require("@seafile/slate-react");
|
|
13
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
-
var _constants = require("../../constants");
|
|
15
|
-
var _context = _interopRequireDefault(require("../../context"));
|
|
16
|
-
var _sdocCommentEditor = _interopRequireDefault(require("../../editor/sdoc-comment-editor"));
|
|
17
|
-
var _extension = require("../../extension");
|
|
18
|
-
var _constants2 = require("../../extension/constants");
|
|
19
|
-
var _core = require("../../extension/core");
|
|
20
|
-
var _nodeId = _interopRequireDefault(require("../../node-id"));
|
|
21
|
-
var _mdToSlate = _interopRequireDefault(require("../../slate-convert/md-to-slate"));
|
|
22
|
-
var _slateToMd = _interopRequireDefault(require("../../slate-convert/slate-to-md"));
|
|
23
|
-
var _eventBus = _interopRequireDefault(require("../../utils/event-bus"));
|
|
24
|
-
var _useParticipants = require("../hooks/use-participants");
|
|
25
|
-
var getSubmitTip = function getSubmitTip(type, content) {
|
|
26
|
-
if (content) return 'Save';
|
|
27
|
-
return type === 'comment' ? 'Comment' : 'Reply';
|
|
28
|
-
};
|
|
29
|
-
var DEFAULT_PLACEHOLDER = 'Enter_comment_shift_enter_for_new_line_Enter_to_send';
|
|
30
|
-
var CommentEditor = function CommentEditor(_ref) {
|
|
31
|
-
var type = _ref.type,
|
|
32
|
-
className = _ref.className,
|
|
33
|
-
content = _ref.content,
|
|
34
|
-
commentContent = _ref.commentContent,
|
|
35
|
-
_ref$placeholder = _ref.placeholder,
|
|
36
|
-
placeholder = _ref$placeholder === void 0 ? DEFAULT_PLACEHOLDER : _ref$placeholder,
|
|
37
|
-
insertContent = _ref.insertContent,
|
|
38
|
-
updateContent = _ref.updateContent,
|
|
39
|
-
setIsEditing = _ref.setIsEditing,
|
|
40
|
-
hiddenComment = _ref.hiddenComment,
|
|
41
|
-
hiddenUserInfo = _ref.hiddenUserInfo,
|
|
42
|
-
onContentChange = _ref.onContentChange,
|
|
43
|
-
isContextComment = _ref.isContextComment,
|
|
44
|
-
closeComment = _ref.closeComment;
|
|
45
|
-
var commentWrapperRef = (0, _react.useRef)();
|
|
46
|
-
var _useTranslation = (0, _reactI18next.useTranslation)('sdoc-editor'),
|
|
47
|
-
t = _useTranslation.t;
|
|
48
|
-
var _useParticipantsConte = (0, _useParticipants.useParticipantsContext)(),
|
|
49
|
-
addParticipants = _useParticipantsConte.addParticipants;
|
|
50
|
-
var submitTip = (0, _react.useMemo)(function () {
|
|
51
|
-
return getSubmitTip(type, content);
|
|
52
|
-
}, [content, type]);
|
|
53
|
-
var userInfo = _context["default"].getUserInfo();
|
|
54
|
-
var document = (0, _react.useMemo)(function () {
|
|
55
|
-
var cursor = {};
|
|
56
|
-
var elements = null;
|
|
57
|
-
elements = [(0, _core.generateEmptyElement)(_constants2.PARAGRAPH, {
|
|
58
|
-
placeholder: placeholder
|
|
59
|
-
})];
|
|
60
|
-
return {
|
|
61
|
-
elements: elements,
|
|
62
|
-
cursor: cursor
|
|
63
|
-
};
|
|
64
|
-
}, [placeholder]);
|
|
65
|
-
var editor = (0, _react.useMemo)(function () {
|
|
66
|
-
var defaultEditor = (0, _extension.createCommentEditor)();
|
|
67
|
-
var newEditor = (0, _nodeId["default"])(defaultEditor);
|
|
68
|
-
var cursors = document.cursors;
|
|
69
|
-
newEditor.cursors = cursors || {};
|
|
70
|
-
newEditor.width = _constants.COMMENT_EDITOR_EDIT_AREA_WIDTH; // default width
|
|
71
|
-
newEditor.editorType = _constants.COMMENT_EDITOR;
|
|
72
|
-
return newEditor;
|
|
73
|
-
}, [document]);
|
|
74
|
-
var updateValue = (0, _react.useCallback)(function (value) {
|
|
75
|
-
if (!value || value.trim() === '') return;
|
|
76
|
-
if (!content) return insertContent(value);
|
|
77
|
-
updateContent && updateContent(value);
|
|
78
|
-
}, [content, insertContent, updateContent]);
|
|
79
|
-
var onSubmit = (0, _react.useCallback)(function (event) {
|
|
80
|
-
event && event.stopPropagation();
|
|
81
|
-
var mdString = (0, _slateToMd["default"])(editor.children);
|
|
82
|
-
updateValue(mdString);
|
|
83
|
-
addParticipants(userInfo.username);
|
|
84
|
-
editor.children = [(0, _core.generateEmptyElement)(_constants2.PARAGRAPH, {
|
|
85
|
-
placeholder: placeholder
|
|
86
|
-
})];
|
|
87
|
-
_slate.Transforms.select(editor, _slate.Editor.start(editor, []));
|
|
88
|
-
onContentChange && onContentChange(null);
|
|
89
|
-
closeComment && closeComment();
|
|
90
|
-
}, [editor, updateValue, addParticipants, userInfo.username, placeholder, onContentChange, closeComment]);
|
|
91
|
-
var onSubmitByEnterKey = (0, _react.useCallback)(function (event) {
|
|
92
|
-
if (!_slateReact.ReactEditor.isFocused(editor)) return;
|
|
93
|
-
onSubmit(event);
|
|
94
|
-
}, [editor, onSubmit]);
|
|
95
|
-
(0, _react.useEffect)(function () {
|
|
96
|
-
var eventBus = _eventBus["default"].getInstance();
|
|
97
|
-
var unsubscribePostComment = eventBus.subscribe(_constants.INTERNAL_EVENT.COMMENT_EDITOR_POST_COMMENT, onSubmitByEnterKey);
|
|
98
|
-
return function () {
|
|
99
|
-
unsubscribePostComment();
|
|
100
|
-
};
|
|
101
|
-
}, [onSubmitByEnterKey]);
|
|
102
|
-
var onCancel = (0, _react.useCallback)(function (event) {
|
|
103
|
-
event.stopPropagation();
|
|
104
|
-
var eventType = event.type,
|
|
105
|
-
keyCode = event.keyCode,
|
|
106
|
-
target = event.target;
|
|
107
|
-
if (eventType === 'keydown' && keyCode !== _constants.KeyCodes.Esc) return;
|
|
108
|
-
if (eventType === 'click') {
|
|
109
|
-
var isSdocContentWrapper = target.classList.contains('sdoc-content-wrapper');
|
|
110
|
-
var listContainer = window.document.querySelector('#global-comment-list-container');
|
|
111
|
-
var resizeContainer = window.document.querySelector('.sdoc-comment-resize-handler');
|
|
112
|
-
var isClickOnListContainer = listContainer && listContainer.contains(target);
|
|
113
|
-
var isClickOnCommentEditorContainer = commentWrapperRef.current.contains(target);
|
|
114
|
-
var isClickResizeContainer = resizeContainer && resizeContainer.contains(target);
|
|
115
|
-
var isPreventCancel = isClickOnListContainer || isClickOnCommentEditorContainer || isClickResizeContainer || isSdocContentWrapper;
|
|
116
|
-
if (isPreventCancel) return;
|
|
117
|
-
}
|
|
118
|
-
setIsEditing && setIsEditing(false);
|
|
119
|
-
hiddenComment && hiddenComment(false);
|
|
120
|
-
if (onContentChange) {
|
|
121
|
-
if (editor.children.find(function (n) {
|
|
122
|
-
return _slate.Node.string(n).trim();
|
|
123
|
-
})) {
|
|
124
|
-
onContentChange((0, _slateToMd["default"])(editor.children));
|
|
125
|
-
} else {
|
|
126
|
-
onContentChange(null);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
130
|
-
}, [setIsEditing]);
|
|
131
|
-
(0, _react.useEffect)(function () {
|
|
132
|
-
var children = (0, _mdToSlate["default"])(content);
|
|
133
|
-
if (commentContent) {
|
|
134
|
-
children = (0, _mdToSlate["default"])(commentContent);
|
|
135
|
-
}
|
|
136
|
-
editor.children = children;
|
|
137
|
-
_slate.Transforms.select(editor, _slate.Editor.end(editor, []));
|
|
138
|
-
}, [editor, content, commentContent]);
|
|
139
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
140
|
-
className: (0, _classnames["default"])('comment-editor-wrapper', className),
|
|
141
|
-
ref: commentWrapperRef
|
|
142
|
-
}, type === 'comment' && !hiddenUserInfo && /*#__PURE__*/_react["default"].createElement("div", {
|
|
143
|
-
className: "comment-editor-user-info"
|
|
144
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
145
|
-
className: "comment-editor-user-img"
|
|
146
|
-
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
147
|
-
src: userInfo.avatar_url,
|
|
148
|
-
alt: "",
|
|
149
|
-
height: "100%",
|
|
150
|
-
width: "100%"
|
|
151
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
152
|
-
className: "comment-editor-user-name"
|
|
153
|
-
}, userInfo.name)), /*#__PURE__*/_react["default"].createElement(_sdocCommentEditor["default"], {
|
|
154
|
-
editor: editor,
|
|
155
|
-
type: type,
|
|
156
|
-
document: document,
|
|
157
|
-
onSubmit: onSubmit,
|
|
158
|
-
submitBtnText: t(submitTip),
|
|
159
|
-
onCancel: onCancel
|
|
160
|
-
}));
|
|
161
|
-
};
|
|
162
|
-
var _default = exports["default"] = CommentEditor;
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
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
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
14
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
var _reactI18next = require("react-i18next");
|
|
16
|
-
var _slate = require("@seafile/slate");
|
|
17
|
-
var _deepCopy = _interopRequireDefault(require("deep-copy"));
|
|
18
|
-
var _notificationHooks = require("../comment/hooks/notification-hooks");
|
|
19
|
-
var _fileLoading = _interopRequireDefault(require("../components/file-loading"));
|
|
20
|
-
var _toast = _interopRequireDefault(require("../components/toast"));
|
|
21
|
-
var _constants = require("../constants");
|
|
22
|
-
var _context2 = _interopRequireDefault(require("../context"));
|
|
23
|
-
var _extension = require("../extension");
|
|
24
|
-
var _core = require("../extension/core");
|
|
25
|
-
var _commentEditorToolbar = _interopRequireDefault(require("../extension/toolbar/comment-editor-toolbar"));
|
|
26
|
-
var _useCollaborators = require("../hooks/use-collaborators");
|
|
27
|
-
var _useScrollContext = require("../hooks/use-scroll-context");
|
|
28
|
-
var _layout = require("../layout");
|
|
29
|
-
var _nodeId = _interopRequireDefault(require("../node-id"));
|
|
30
|
-
var _socket = require("../socket");
|
|
31
|
-
var _commonUtils = require("../utils/common-utils");
|
|
32
|
-
var _eventBus = _interopRequireDefault(require("../utils/event-bus"));
|
|
33
|
-
var _commentArticle = _interopRequireDefault(require("./comment-article"));
|
|
34
|
-
var SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
35
|
-
var propsEditor = _ref.editor,
|
|
36
|
-
document = _ref.document,
|
|
37
|
-
isReloading = _ref.isReloading,
|
|
38
|
-
type = _ref.type,
|
|
39
|
-
onSubmit = _ref.onSubmit,
|
|
40
|
-
submitBtnText = _ref.submitBtnText,
|
|
41
|
-
onCancel = _ref.onCancel;
|
|
42
|
-
var _useState = (0, _react.useState)(document.elements),
|
|
43
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
44
|
-
slateValue = _useState2[0],
|
|
45
|
-
_setSlateValue = _useState2[1];
|
|
46
|
-
var commentEditorContainerRef = (0, _react.useRef)(null);
|
|
47
|
-
var commentTimeoutRef = (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
|
-
var validEditor = (0, _react.useMemo)(function () {
|
|
53
|
-
if (propsEditor) return propsEditor;
|
|
54
|
-
var defaultEditor = (0, _extension.createCommentEditor)();
|
|
55
|
-
var editorConfig = _context2["default"].getEditorConfig();
|
|
56
|
-
var newEditor = (0, _nodeId["default"])((0, _socket.withSocketIO)(defaultEditor, {
|
|
57
|
-
document: document,
|
|
58
|
-
config: editorConfig
|
|
59
|
-
}));
|
|
60
|
-
var cursors = document.cursors;
|
|
61
|
-
newEditor.cursors = cursors || {};
|
|
62
|
-
newEditor.width = _constants.COMMENT_EDITOR_EDIT_AREA_WIDTH; // default width
|
|
63
|
-
|
|
64
|
-
return newEditor;
|
|
65
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
66
|
-
}, []);
|
|
67
|
-
(0, _react.useEffect)(function () {
|
|
68
|
-
if (!(commentEditorContainerRef !== null && commentEditorContainerRef !== void 0 && commentEditorContainerRef.current)) return;
|
|
69
|
-
if (Object.keys(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 as read if focusing commentEditorContainerRef over 3s
|
|
110
|
-
var handleFocusIn = function handleFocusIn(e) {
|
|
111
|
-
commentTimeoutRef.current = setTimeout(function () {
|
|
112
|
-
clearAllNotification();
|
|
113
|
-
commentTimeoutRef.current = null;
|
|
114
|
-
}, 3000);
|
|
115
|
-
};
|
|
116
|
-
var handleBlur = function handleBlur() {
|
|
117
|
-
clearTimeout(commentTimeoutRef.current);
|
|
118
|
-
commentTimeoutRef.current = null;
|
|
119
|
-
};
|
|
120
|
-
el.addEventListener('focusin', handleFocusIn);
|
|
121
|
-
el.addEventListener('focusout', handleBlur);
|
|
122
|
-
return function () {
|
|
123
|
-
el.removeEventListener('focusin', handleFocusIn);
|
|
124
|
-
el.removeEventListener('focusout', handleBlur);
|
|
125
|
-
if (commentTimeoutRef.current) {
|
|
126
|
-
clearTimeout(commentTimeoutRef.current);
|
|
127
|
-
commentTimeoutRef.current = null;
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
}, [notificationsInfo]);
|
|
131
|
-
|
|
132
|
-
// useMount: focus editor
|
|
133
|
-
(0, _react.useEffect)(function () {
|
|
134
|
-
var _validEditor$children = (0, _slicedToArray2["default"])(validEditor.children, 1),
|
|
135
|
-
firstNode = _validEditor$children[0];
|
|
136
|
-
if (firstNode) {
|
|
137
|
-
var _firstNode$children = (0, _slicedToArray2["default"])(firstNode.children, 1),
|
|
138
|
-
firstNodeFirstChild = _firstNode$children[0];
|
|
139
|
-
if (firstNodeFirstChild) {
|
|
140
|
-
var endOfFirstNode = _slate.Editor.end(validEditor, [0, 0]);
|
|
141
|
-
var range = {
|
|
142
|
-
anchor: endOfFirstNode,
|
|
143
|
-
focus: endOfFirstNode
|
|
144
|
-
};
|
|
145
|
-
(0, _core.focusEditor)(validEditor, range);
|
|
146
|
-
}
|
|
147
|
-
// Force refresh to fix comment list
|
|
148
|
-
_setSlateValue((0, _toConsumableArray2["default"])(validEditor.children));
|
|
149
|
-
}
|
|
150
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
151
|
-
}, []);
|
|
152
|
-
|
|
153
|
-
// The parent component can call the method of this component through ref
|
|
154
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
|
155
|
-
return {
|
|
156
|
-
setSlateValue: function setSlateValue(document) {
|
|
157
|
-
// Force update of editor's child elements
|
|
158
|
-
validEditor.children = document.elements;
|
|
159
|
-
_setSlateValue((0, _toConsumableArray2["default"])(document.elements));
|
|
160
|
-
},
|
|
161
|
-
updateDocumentVersion: function updateDocumentVersion(document) {
|
|
162
|
-
validEditor.updateDocumentVersion(document);
|
|
163
|
-
},
|
|
164
|
-
// get value
|
|
165
|
-
getSlateValue: function getSlateValue() {
|
|
166
|
-
return (0, _deepCopy["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, document), {}, {
|
|
167
|
-
elements: slateValue
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
172
|
-
};
|
|
173
|
-
}, [document, validEditor, slateValue]);
|
|
174
|
-
if (isReloading) {
|
|
175
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
176
|
-
className: "h-100 w-100 d-flex align-items-center justify-content-center"
|
|
177
|
-
}, /*#__PURE__*/_react["default"].createElement(_fileLoading["default"], null));
|
|
178
|
-
}
|
|
179
|
-
var handleFocusEditor = function handleFocusEditor(e) {
|
|
180
|
-
if (e.target === commentEditorContainerRef.current) {
|
|
181
|
-
var focusPoint = _slate.Editor.end(validEditor, []);
|
|
182
|
-
(0, _core.focusEditor)(validEditor, focusPoint);
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
return /*#__PURE__*/_react["default"].createElement(_layout.EditorContainer, {
|
|
186
|
-
editor: validEditor
|
|
187
|
-
}, /*#__PURE__*/_react["default"].createElement(_useCollaborators.CollaboratorsProvider, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
188
|
-
className: "sdoc-comment-editor-wrapper"
|
|
189
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
190
|
-
ref: commentEditorContainerRef,
|
|
191
|
-
className: "article sdoc-comment-editor",
|
|
192
|
-
onClick: handleFocusEditor
|
|
193
|
-
}, /*#__PURE__*/_react["default"].createElement(_useScrollContext.ScrollContext.Provider, {
|
|
194
|
-
value: {
|
|
195
|
-
scrollRef: commentEditorContainerRef
|
|
196
|
-
}
|
|
197
|
-
}, /*#__PURE__*/_react["default"].createElement(_commentArticle["default"], {
|
|
198
|
-
type: type,
|
|
199
|
-
editor: validEditor,
|
|
200
|
-
slateValue: slateValue,
|
|
201
|
-
updateSlateValue: _setSlateValue
|
|
202
|
-
}))), /*#__PURE__*/_react["default"].createElement(_commentEditorToolbar["default"], {
|
|
203
|
-
editor: validEditor,
|
|
204
|
-
onSubmit: onSubmit,
|
|
205
|
-
submitBtnText: submitBtnText,
|
|
206
|
-
onCancel: onCancel
|
|
207
|
-
}))));
|
|
208
|
-
});
|
|
209
|
-
var _default = exports["default"] = SdocCommentEditor;
|