@seafile/comment-editor 0.0.1-alpha.20 → 0.0.1-alpha.21
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.
|
@@ -37,7 +37,6 @@ const getSubmitTip = (type, content) => {
|
|
|
37
37
|
const DEFAULT_PLACEHOLDER = 'Enter_comment_shift_enter_for_new_line_Enter_to_send';
|
|
38
38
|
const CommentEditor = _ref => {
|
|
39
39
|
let {
|
|
40
|
-
commentContent,
|
|
41
40
|
content,
|
|
42
41
|
placeholder = DEFAULT_PLACEHOLDER,
|
|
43
42
|
insertContent,
|
|
@@ -100,7 +99,9 @@ const CommentEditor = _ref => {
|
|
|
100
99
|
const onSubmit = (0, _react.useCallback)(event => {
|
|
101
100
|
event && event.stopPropagation();
|
|
102
101
|
const mdString = (0, _slateToMd.default)(editor.children);
|
|
103
|
-
|
|
102
|
+
if (mdString && mdString.trim()) insertContent(mdString);
|
|
103
|
+
// updateValue(mdString);
|
|
104
|
+
|
|
104
105
|
addParticipants(userInfo.username);
|
|
105
106
|
editor.children = [(0, _core.generateEmptyElement)(_constants2.PARAGRAPH, {
|
|
106
107
|
placeholder
|
|
@@ -108,7 +109,7 @@ const CommentEditor = _ref => {
|
|
|
108
109
|
_slate.Transforms.select(editor, _slate.Editor.start(editor, []));
|
|
109
110
|
onContentChange && onContentChange(null);
|
|
110
111
|
closeComment && closeComment();
|
|
111
|
-
}, [editor,
|
|
112
|
+
}, [editor, insertContent, addParticipants, userInfo.username, placeholder, onContentChange, closeComment]);
|
|
112
113
|
const onSubmitByEnterKey = (0, _react.useCallback)(event => {
|
|
113
114
|
if (!_slateReact.ReactEditor.isFocused(editor)) return;
|
|
114
115
|
onSubmit(event);
|
|
@@ -157,9 +158,6 @@ const CommentEditor = _ref => {
|
|
|
157
158
|
// set editor children
|
|
158
159
|
(0, _react.useEffect)(() => {
|
|
159
160
|
let children = (0, _mdToSlate.default)(content);
|
|
160
|
-
if (commentContent) {
|
|
161
|
-
children = (0, _mdToSlate.default)(commentContent);
|
|
162
|
-
}
|
|
163
161
|
console.log('children', children);
|
|
164
162
|
editor.children = children;
|
|
165
163
|
_slate.Transforms.select(editor, _slate.Editor.end(editor, []));
|