@seafile/sdoc-editor 1.0.115 → 1.0.117
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.
|
@@ -91,7 +91,6 @@ const CommentEditor = _ref => {
|
|
|
91
91
|
updateContent && updateContent(value);
|
|
92
92
|
}, [content, insertContent, updateContent]);
|
|
93
93
|
const onSubmit = (0, _react.useCallback)(event => {
|
|
94
|
-
if (!_slateReact.ReactEditor.isFocused(editor)) return;
|
|
95
94
|
event && event.stopPropagation();
|
|
96
95
|
const mdString = (0, _slateToMd.default)(editor.children);
|
|
97
96
|
updateValue(mdString);
|
|
@@ -102,13 +101,17 @@ const CommentEditor = _ref => {
|
|
|
102
101
|
_slate.Transforms.select(editor, _slate.Editor.start(editor, []));
|
|
103
102
|
updateGlobalCommentContent && updateGlobalCommentContent(null);
|
|
104
103
|
}, [editor, updateValue, addParticipants, userInfo.username, placeholder, updateGlobalCommentContent]);
|
|
104
|
+
const onSubmitByEnterKey = (0, _react.useCallback)(event => {
|
|
105
|
+
if (!_slateReact.ReactEditor.isFocused(editor)) return;
|
|
106
|
+
onSubmit(event);
|
|
107
|
+
}, [editor, onSubmit]);
|
|
105
108
|
(0, _react.useEffect)(() => {
|
|
106
109
|
const eventBus = _eventBus.default.getInstance();
|
|
107
|
-
const unsubscribePostComment = eventBus.subscribe(_constants2.INTERNAL_EVENT.COMMENT_EDITOR_POST_COMMENT,
|
|
110
|
+
const unsubscribePostComment = eventBus.subscribe(_constants2.INTERNAL_EVENT.COMMENT_EDITOR_POST_COMMENT, onSubmitByEnterKey);
|
|
108
111
|
return () => {
|
|
109
112
|
unsubscribePostComment();
|
|
110
113
|
};
|
|
111
|
-
}, [
|
|
114
|
+
}, [onSubmitByEnterKey]);
|
|
112
115
|
const onCancel = (0, _react.useCallback)(event => {
|
|
113
116
|
event.stopPropagation();
|
|
114
117
|
const {
|