KeyboardShortcut.tsx 514 B

12345678910111213141516
  1. import { LogseqContext } from '../../lib/logseq-context'
  2. import * as React from 'react'
  3. export const KeyboardShortcut = ({
  4. action, shortcut, opts,
  5. ...props
  6. }: Partial<{ action: string, shortcut: string, opts: any }> & React.HTMLAttributes<HTMLElement>) => {
  7. const { renderers } = React.useContext(LogseqContext)
  8. const Shortcut = renderers?.KeyboardShortcut
  9. return (
  10. <div className="tl-menu-right-slot" {...props}>
  11. <Shortcut action={action} shortcut={shortcut} opts={opts} />
  12. </div>
  13. )
  14. }