<commit_before>kd       = require 'kd'
_        = require 'lodash'
recorder = require 'record-shortcuts'
Pane     = require './accounteditshortcutspane'
facade   = require './accounteditshortcutsfacade'

RESTORE_CONFIRM_TEXT = 'Are you sure you want to restore the default shortcuts?'

restoreDefaults = ->

  return  unless confirm RESTORE_CONFIRM_TEXT
  kd.getSingleton('shortcuts').restore()
  @domElement.blur()


module.exports =

class AccountEditShortcuts extends kd.View

  destroy: ->

    @parent.parent.off 'KDTabPaneInactive', @bound 'destroy'
    @tabView.off 'PaneDidShow', recorder.cancel

    kd.getSingleton('shortcuts').unpause()
    facade.dispose()

    super
<commit_msg>Implemented modal for restore default shortcuts<commit_after>kd       = require 'kd'
_        = require 'lodash'
recorder = require 'record-shortcuts'
Pane     = require './accounteditshortcutspane'
facade   = require './accounteditshortcutsfacade'
KDModalView = kd.ModalView

RESTORE_CONFIRM_TEXT = 'Are you sure you want to restore the default shortcuts?'

restoreDefaults = ->

  @restoreModal = KDModalView.confirm
    title        : 'Are you sure?'
    description  : RESTORE_CONFIRM_TEXT
    ok           :
      style      : 'solid medium red'
      title      : 'Restore'
      callback   : =>
        kd.getSingleton('shortcuts').restore()
        @domElement.blur()
        @restoreModal.destroy()
    cancel       :
      style      : 'solid medium light-gray'
      title      : 'Cancel'
      callback   : => @restoreModal.destroy()


module.exports =

class AccountEditShortcuts extends kd.View

  destroy: ->

    @parent.parent.off 'KDTabPaneInactive', @bound 'destroy'
    @tabView.off 'PaneDidShow', recorder.cancel

    kd.getSingleton('shortcuts').unpause()
    facade.dispose()

    super

{'fraction_non_alphanumeric': 0.10377358490566038, 'fraction_numerical': 0.0, 'mean_word_length': 3.0977272727272727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6641837', 'n_tokens_mistral': 584, 'n_tokens_neox': 552, 'n_words': 125}