mirror of
https://github.com/linsa-io/linsa.git
synced 2026-01-12 12:20:23 +01:00
delete keybind
This commit is contained in:
@@ -14,6 +14,7 @@ import { PersonalLink } from "@/lib/schema"
|
||||
import { ID } from "jazz-tools"
|
||||
import { globalLinkFormExceptionRefsAtom } from "./partials/form/link-form"
|
||||
import { toast } from "sonner"
|
||||
import { useKeybind } from "@/lib/providers/keybind-provider"
|
||||
|
||||
interface ToolbarButtonProps {
|
||||
icon: keyof typeof icons
|
||||
@@ -64,6 +65,8 @@ export const LinkBottomBar: React.FC = () => {
|
||||
const plusBtnRef = useRef<HTMLButtonElement>(null)
|
||||
const plusMoreBtnRef = useRef<HTMLButtonElement>(null)
|
||||
|
||||
const { addKeybind, removeKeybind } = useKeybind()
|
||||
|
||||
const confirm = useConfirm()
|
||||
|
||||
useEffect(() => {
|
||||
@@ -151,6 +154,13 @@ export const LinkBottomBar: React.FC = () => {
|
||||
const shortcutKeys = getSpecialShortcut("expandToolbar")
|
||||
const shortcutText = formatShortcut(shortcutKeys)
|
||||
|
||||
useEffect(() => {
|
||||
if (personalLink) {
|
||||
addKeybind({ key: "Control+x", callback: handleDelete })
|
||||
return () => removeKeybind("Control+x")
|
||||
}
|
||||
}, [personalLink])
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
className="bg-background absolute bottom-0 left-0 right-0 border-t"
|
||||
|
||||
Reference in New Issue
Block a user