|
1 | 1 | import deleteBin6Line from '@iconify/icons-ri/delete-bin-6-line'
|
2 |
| -import { Comment as CommentType, defaultContent, NodeEditorContent } from '@mexit/core' |
| 2 | +import { Comment as CommentType, defaultContent, mog, NodeEditorContent } from '@mexit/core' |
3 | 3 | import { RelativeTime } from '@mexit/shared'
|
4 | 4 | import { PlateProvider } from '@udecode/plate'
|
5 | 5 | import { IconButton } from '@workduck-io/mex-components'
|
6 | 6 | import { tinykeys } from '@workduck-io/tinykeys'
|
7 | 7 | import React, { useCallback, useEffect, useMemo } from 'react'
|
8 | 8 | import { useMentions } from '../../Hooks/useMentions'
|
9 | 9 | import { useAuthStore } from '../../Stores/useAuth'
|
| 10 | +import { areEqual } from '../../Utils/hash' |
10 | 11 | import { CommentEditor } from '../CommentEditor'
|
11 | 12 | import { CommentEditorWrapper } from '../CommentEditor/styled'
|
12 | 13 | import Plateless from '../Editor/Plateless'
|
13 | 14 | import { ProfileImage } from '../User/ProfileImage'
|
14 | 15 | import {
|
15 |
| - CommentActions, |
16 |
| - CommentAuthor, |
17 |
| - CommentContentWrapper, |
18 |
| - CommentHeader, |
19 |
| - CommentsWrapper, |
20 |
| - CommentTime, |
21 |
| - CommentWrapper, |
22 |
| - NewCommentWrapper |
| 16 | + CommentActions, |
| 17 | + CommentAuthor, |
| 18 | + CommentContentWrapper, |
| 19 | + CommentHeader, |
| 20 | + CommentsWrapper, |
| 21 | + CommentTime, |
| 22 | + CommentWrapper, |
| 23 | + NewCommentWrapper |
23 | 24 | } from './Comments.style'
|
24 | 25 |
|
25 | 26 | type OnAddComment = (content: NodeEditorContent) => Promise<void>
|
@@ -90,6 +91,7 @@ export const NewComment = ({ onAddComment, byUser }: NewCommentProps) => {
|
90 | 91 | }
|
91 | 92 |
|
92 | 93 | const onSubmit = useCallback(() => {
|
| 94 | + if (areEqual(content, defaultContent.content)) return |
93 | 95 | onAddComment(content)
|
94 | 96 | .then(() => {
|
95 | 97 | setContent(defaultContent.content)
|
|
0 commit comments