fix: IME input composing

This commit is contained in:
Kieran 2023-12-04 15:23:13 +00:00
parent 572ed3d783
commit eea617686f
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
2 changed files with 3 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import "./textarea.css";
import { type ChangeEvent, type KeyboardEvent, useContext } from "react";
import { useContext } from "react";
import ReactTextareaAutocomplete, { TriggerType } from "@webscopeio/react-textarea-autocomplete";
import "@webscopeio/react-textarea-autocomplete/style.css";
import uniqWith from "lodash/uniqWith";
@ -39,13 +39,7 @@ const UserItem = (metadata: MetadataCache) => {
);
};
interface TextareaProps {
emojis: EmojiTag[];
value: string;
onChange: (e: ChangeEvent<HTMLTextAreaElement>) => void;
onKeyDown: (e: KeyboardEvent<Element>) => void;
rows?: number;
}
type TextareaProps = { emojis: EmojiTag[] } & React.TextareaHTMLAttributes<HTMLTextAreaElement>;
export function Textarea({ emojis, ...props }: TextareaProps) {
const system = useContext(SnortContext);

View File

@ -69,7 +69,7 @@ export function WriteMessage({ link, emojiPacks }: { link: NostrLink; emojiPacks
}
async function onKeyDown(e: React.KeyboardEvent) {
if (e.code === "Enter") {
if (e.code === "Enter" && !e.nativeEvent.isComposing) {
e.preventDefault();
await sendChatMessage();
}