diff --git a/apps/client/src/features/comment/components/comment-actions.tsx b/apps/client/src/features/comment/components/comment-actions.tsx index e5c4f1a2..4b545f54 100644 --- a/apps/client/src/features/comment/components/comment-actions.tsx +++ b/apps/client/src/features/comment/components/comment-actions.tsx @@ -1,4 +1,4 @@ -import { Button, Group } from "@mantine/core"; +import { Button, Group, Tooltip } from "@mantine/core"; import { useTranslation } from "react-i18next"; type CommentActionsProps = { @@ -15,7 +15,7 @@ function CommentActions({ isCommentEditor, }: CommentActionsProps) { const { t } = useTranslation(); - + return ( {isCommentEditor && ( @@ -24,9 +24,11 @@ function CommentActions({ )} - + + + ); } diff --git a/apps/client/src/features/comment/components/comment-dialog.tsx b/apps/client/src/features/comment/components/comment-dialog.tsx index 2e27f65b..c37402a1 100644 --- a/apps/client/src/features/comment/components/comment-dialog.tsx +++ b/apps/client/src/features/comment/components/comment-dialog.tsx @@ -109,6 +109,7 @@ function CommentDialog({ editor, pageId }: CommentDialogProps) { { const { t } = useTranslation(); const { ref: focusRef, focused } = useFocusWithin(); @@ -42,7 +45,35 @@ const CommentEditor = forwardRef( }), Underline, Link, + EmojiCommand, ], + editorProps: { + handleDOMEvents: { + keydown: (_view, event) => { + if ( + [ + "ArrowUp", + "ArrowDown", + "ArrowLeft", + "ArrowRight", + "Enter", + ].includes(event.key) + ) { + const emojiCommand = document.querySelector("#emoji-command"); + if (emojiCommand) { + return true; + } + } + + if (event.ctrlKey && event.key === 'Enter') { + event.preventDefault(); + if (onSave) onSave(); + + return true; + } + }, + }, + }, onUpdate({ editor }) { if (onUpdate) onUpdate(editor.getJSON()); }, @@ -75,7 +106,7 @@ const CommentEditor = forwardRef( /> ); - }, + } ); export default CommentEditor; diff --git a/apps/client/src/features/comment/components/comment-list-item.tsx b/apps/client/src/features/comment/components/comment-list-item.tsx index 293c4f9e..ef9a2311 100644 --- a/apps/client/src/features/comment/components/comment-list-item.tsx +++ b/apps/client/src/features/comment/components/comment-list-item.tsx @@ -112,6 +112,7 @@ function CommentListItem({ comment }: CommentListItemProps) { defaultContent={content} editable={true} onUpdate={(newContent: any) => setContent(newContent)} + onSave={handleUpdateComment} autofocus={true} /> diff --git a/apps/client/src/features/comment/components/comment-list.tsx b/apps/client/src/features/comment/components/comment-list.tsx index 3296d5ea..3d49d677 100644 --- a/apps/client/src/features/comment/components/comment-list.tsx +++ b/apps/client/src/features/comment/components/comment-list.tsx @@ -142,6 +142,7 @@ const CommentEditorWithActions = ({ commentId, onSave, isLoading }) => { {focused && } diff --git a/apps/client/src/features/comment/components/comment.module.css b/apps/client/src/features/comment/components/comment.module.css index b3d0a261..14478e90 100644 --- a/apps/client/src/features/comment/components/comment.module.css +++ b/apps/client/src/features/comment/components/comment.module.css @@ -16,17 +16,19 @@ .commentEditor { .focused { + border-radius: var(--mantine-radius-sm); box-shadow: 0 0 0 2px var(--mantine-color-blue-3); } .ProseMirror :global(.ProseMirror){ + border-radius: var(--mantine-radius-sm); max-width: 100%; white-space: pre-wrap; word-break: break-word; max-height: 20vh; padding-left: 6px; padding-right: 6px; - margin-top: 2px; + margin-top: 10px; margin-bottom: 2px; overflow: hidden auto; } diff --git a/apps/client/src/features/editor/components/emoji-menu/render-emoji-items.ts b/apps/client/src/features/editor/components/emoji-menu/render-emoji-items.ts index ba035a8b..82fb24a9 100644 --- a/apps/client/src/features/editor/components/emoji-menu/render-emoji-items.ts +++ b/apps/client/src/features/editor/components/emoji-menu/render-emoji-items.ts @@ -33,7 +33,7 @@ const renderEmojiItems = () => { showOnCreate: true, interactive: true, trigger: "manual", - placement: "bottom-start", + placement: "bottom", }); }, onStart: (props: {