@seafile/comment-editor 0.0.1-alpha.23 → 0.0.1-alpha.25
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.
|
@@ -43,6 +43,7 @@ const CommentEditor = _ref => {
|
|
|
43
43
|
onContentChange,
|
|
44
44
|
hiddenComment,
|
|
45
45
|
hiddenUserInfo,
|
|
46
|
+
hiddenToolMenu,
|
|
46
47
|
closePanel,
|
|
47
48
|
addParticipants
|
|
48
49
|
} = _ref;
|
|
@@ -91,14 +92,15 @@ const CommentEditor = _ref => {
|
|
|
91
92
|
event && event.stopPropagation();
|
|
92
93
|
const mdString = (0, _slateToMd.default)(editor.children);
|
|
93
94
|
if (mdString && mdString.trim()) insertContent(mdString);
|
|
94
|
-
addParticipants(userInfo.username);
|
|
95
|
+
addParticipants && addParticipants(userInfo.username);
|
|
95
96
|
editor.children = [(0, _core.generateEmptyElement)(_constants2.PARAGRAPH, {
|
|
96
97
|
placeholder
|
|
97
98
|
})];
|
|
98
99
|
_slate.Transforms.select(editor, _slate.Editor.start(editor, []));
|
|
99
100
|
onContentChange && onContentChange(null);
|
|
100
101
|
closePanel && closePanel();
|
|
101
|
-
|
|
102
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
103
|
+
}, [editor, insertContent, addParticipants, placeholder, onContentChange, closePanel]);
|
|
102
104
|
const onSubmitByEnterKey = (0, _react.useCallback)(event => {
|
|
103
105
|
if (!_slateReact.ReactEditor.isFocused(editor)) return;
|
|
104
106
|
onSubmit(event);
|
|
@@ -130,7 +132,7 @@ const CommentEditor = _ref => {
|
|
|
130
132
|
const isPreventCancel = isClickOnListContainer || isClickOnCommentEditorContainer || isClickResizeContainer || isSdocContentWrapper;
|
|
131
133
|
if (isPreventCancel) return;
|
|
132
134
|
}
|
|
133
|
-
hiddenComment(false);
|
|
135
|
+
hiddenComment && hiddenComment(false);
|
|
134
136
|
if (onContentChange) {
|
|
135
137
|
if (editor.children.find(n => _slate.Node.string(n).trim())) {
|
|
136
138
|
onContentChange((0, _slateToMd.default)(editor.children));
|
|
@@ -266,6 +268,7 @@ const CommentEditor = _ref => {
|
|
|
266
268
|
onBeforeInput: eventProxy.onBeforeInput
|
|
267
269
|
})))), /*#__PURE__*/_react.default.createElement(_commentEditorToolbar.default, {
|
|
268
270
|
editor: editor,
|
|
271
|
+
hiddenToolMenu: hiddenToolMenu,
|
|
269
272
|
onSubmit: onSubmit,
|
|
270
273
|
submitBtnText: t(submitTip),
|
|
271
274
|
onCancel: onCancel
|
|
@@ -22,13 +22,14 @@ const CommentEditorToolbar = _ref => {
|
|
|
22
22
|
readonly = false,
|
|
23
23
|
onSubmit,
|
|
24
24
|
submitBtnText,
|
|
25
|
-
onCancel
|
|
25
|
+
onCancel,
|
|
26
|
+
hiddenToolMenu
|
|
26
27
|
} = _ref;
|
|
27
28
|
(0, _useSelectionUpdate.default)();
|
|
28
29
|
const eventBus = _eventBus.default.getInstance();
|
|
29
30
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
30
31
|
className: "comment-editor-toolbar"
|
|
31
|
-
}, /*#__PURE__*/_react.default.createElement(_commons.MenuGroup, {
|
|
32
|
+
}, !hiddenToolMenu && /*#__PURE__*/_react.default.createElement(_commons.MenuGroup, {
|
|
32
33
|
className: "menu-group comment-editor-menu-group"
|
|
33
34
|
}, /*#__PURE__*/_react.default.createElement(_comemntEditorMenu.default, {
|
|
34
35
|
editor: editor,
|
|
@@ -26,6 +26,7 @@ const SeafileCommentEditor = _ref => {
|
|
|
26
26
|
onContentChange,
|
|
27
27
|
hiddenUserInfo,
|
|
28
28
|
hiddenComment,
|
|
29
|
+
hiddenToolMenu,
|
|
29
30
|
closePanel,
|
|
30
31
|
addParticipants,
|
|
31
32
|
// api
|
|
@@ -45,6 +46,7 @@ const SeafileCommentEditor = _ref => {
|
|
|
45
46
|
onContentChange: onContentChange,
|
|
46
47
|
hiddenUserInfo: hiddenUserInfo,
|
|
47
48
|
hiddenComment: hiddenComment,
|
|
49
|
+
hiddenToolMenu: hiddenToolMenu,
|
|
48
50
|
closePanel: closePanel,
|
|
49
51
|
addParticipants: addParticipants
|
|
50
52
|
})));
|