add composer shortcut
This commit is contained in:
@@ -10,7 +10,9 @@ import {
|
||||
} from "@shared/icons";
|
||||
import { useActiveAccount } from "@stores/accounts";
|
||||
import { useComposer } from "@stores/composer";
|
||||
import { Fragment } from "react";
|
||||
import { COMPOSE_SHORTCUT } from "@stores/shortcuts";
|
||||
import { register } from "@tauri-apps/api/globalShortcut";
|
||||
import { Fragment, useEffect } from "react";
|
||||
|
||||
export function Composer() {
|
||||
const account = useActiveAccount((state: any) => state.account);
|
||||
@@ -23,6 +25,16 @@ export function Composer() {
|
||||
toggle(false);
|
||||
};
|
||||
|
||||
const registerShortcut = async () => {
|
||||
await register(COMPOSE_SHORTCUT, () => {
|
||||
toggle(true);
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
registerShortcut();
|
||||
}, [registerShortcut]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button onClick={() => toggle(true)} preset="small">
|
||||
|
||||
Reference in New Issue
Block a user