Skip to content

Commit

Permalink
feat(chat): clear input on save
Browse files Browse the repository at this point in the history
  • Loading branch information
cannarocks committed Dec 28, 2023
1 parent 5d8fc88 commit 3033197
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/stories/chat/parts/commentBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ export const CommentBox = ({
}: PropsWithChildren<ChatEditorArgs>) => {
const { children, hasInlineMenu, bubbleOptions, author } = props;

const { setEditor, triggerSave } = useChatContext();
const { editor, setEditor, triggerSave } = useChatContext();

const onKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>) => {
if ((event.ctrlKey || event.metaKey) && event.key === "Enter") {
triggerSave();
editor?.commands.clearContent();
}
};

Expand Down

0 comments on commit 3033197

Please sign in to comment.