mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
Handle cases with missing id
in messages, improve index lookup logic, and refactor save handler.
This commit is contained in:

committed by
Geoff Seemueller

parent
580f361457
commit
3cf7ceb868
@@ -25,12 +25,17 @@ const MessageEditor = observer(({ message, onCancel }: MessageEditorProps) => {
|
||||
onCancel();
|
||||
};
|
||||
|
||||
const handleSave = async () => {
|
||||
await messageEditorStore.handleSave();
|
||||
onCancel();
|
||||
};
|
||||
|
||||
|
||||
|
||||
const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
||||
e.preventDefault();
|
||||
messageEditorStore.handleSave();
|
||||
handleSave();
|
||||
}
|
||||
|
||||
if (e.key === "Escape") {
|
||||
@@ -66,7 +71,7 @@ const MessageEditor = observer(({ message, onCancel }: MessageEditorProps) => {
|
||||
<IconButton
|
||||
aria-label="Save edit"
|
||||
icon={<Check />}
|
||||
onClick={() => messageEditorStore.handleSave()}
|
||||
onClick={handleSave}
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
color={"accent.confirm"}
|
||||
|
Reference in New Issue
Block a user