import { BookmarkManager } from "./BookmarkManager" ; export class KeyHandler { private bookmarkManager : BookmarkManager ; constructor ( bookmarkManager ) { this . bookmarkManager = bookmarkManager ; } handleKeyUp ( event ) { if ( event . key !== 'Delete' ) { return ; } const hoverNodes = document . querySelectorAll ( ':hover[data-item-id]:not(.folder)' ) ; if ( hoverNodes . length !== 1 ) { return ; } const bookmark = hoverNodes [ 0 ] ; if ( ! ( bookmark instanceof HTMLElement ) ) { return ; } this . bookmarkManager . deleteBookmark ( bookmark ) ; } }