You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

KeyboardShortcutsButton.ts 1.2KB

12345678910111213141516171819202122232425262728293031323334
  1. import { connect } from 'react-redux';
  2. import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
  3. import { sendAnalytics } from '../../../analytics/functions';
  4. import { translate } from '../../../base/i18n/functions';
  5. import { IconShortcuts } from '../../../base/icons/svg';
  6. import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
  7. import { openSettingsDialog } from '../../../settings/actions';
  8. import { SETTINGS_TABS } from '../../../settings/constants';
  9. /**
  10. * Implementation of a button for opening keyboard shortcuts dialog.
  11. */
  12. class KeyboardShortcutsButton extends AbstractButton<AbstractButtonProps> {
  13. accessibilityLabel = 'toolbar.accessibilityLabel.shortcuts';
  14. icon = IconShortcuts;
  15. label = 'toolbar.shortcuts';
  16. tooltip = 'toolbar.shortcuts';
  17. /**
  18. * Handles clicking / pressing the button, and opens the appropriate dialog.
  19. *
  20. * @protected
  21. * @returns {void}
  22. */
  23. _handleClick() {
  24. const { dispatch } = this.props;
  25. sendAnalytics(createToolbarEvent('shortcuts'));
  26. dispatch(openSettingsDialog(SETTINGS_TABS.SHORTCUTS));
  27. }
  28. }
  29. export default translate(connect()(KeyboardShortcutsButton));