forked from Kieran/zap.stream
fix: IME input composing
This commit is contained in:
parent
572ed3d783
commit
eea617686f
@ -1,5 +1,5 @@
|
|||||||
import "./textarea.css";
|
import "./textarea.css";
|
||||||
import { type ChangeEvent, type KeyboardEvent, useContext } from "react";
|
import { useContext } from "react";
|
||||||
import ReactTextareaAutocomplete, { TriggerType } from "@webscopeio/react-textarea-autocomplete";
|
import ReactTextareaAutocomplete, { TriggerType } from "@webscopeio/react-textarea-autocomplete";
|
||||||
import "@webscopeio/react-textarea-autocomplete/style.css";
|
import "@webscopeio/react-textarea-autocomplete/style.css";
|
||||||
import uniqWith from "lodash/uniqWith";
|
import uniqWith from "lodash/uniqWith";
|
||||||
@ -39,13 +39,7 @@ const UserItem = (metadata: MetadataCache) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface TextareaProps {
|
type TextareaProps = { emojis: EmojiTag[] } & React.TextareaHTMLAttributes<HTMLTextAreaElement>;
|
||||||
emojis: EmojiTag[];
|
|
||||||
value: string;
|
|
||||||
onChange: (e: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
||||||
onKeyDown: (e: KeyboardEvent<Element>) => void;
|
|
||||||
rows?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function Textarea({ emojis, ...props }: TextareaProps) {
|
export function Textarea({ emojis, ...props }: TextareaProps) {
|
||||||
const system = useContext(SnortContext);
|
const system = useContext(SnortContext);
|
||||||
|
@ -69,7 +69,7 @@ export function WriteMessage({ link, emojiPacks }: { link: NostrLink; emojiPacks
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onKeyDown(e: React.KeyboardEvent) {
|
async function onKeyDown(e: React.KeyboardEvent) {
|
||||||
if (e.code === "Enter") {
|
if (e.code === "Enter" && !e.nativeEvent.isComposing) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
await sendChatMessage();
|
await sendChatMessage();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user