support cmd + enter to send messages on Mac (#299)

This commit is contained in:
BlowaterNostr 2023-11-18 22:53:10 +08:00 committed by GitHub
parent 0132617ee2
commit fc98ffa094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,7 +204,8 @@ export class Editor extends Component<EditorProps> {
);
}}
onKeyDown={async (e) => {
if (e.code === "Enter" && e.ctrlKey) {
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/metaKey
if (e.code === "Enter" && (e.ctrlKey || e.metaKey)) {
await sendMessage();
}
}}