Fixed shortcuts.

This commit is contained in:
Martin Edenhofer 2016-04-06 16:06:26 +02:00
parent 691f2006b2
commit e5c0c7f109
2 changed files with 19 additions and 18 deletions

View file

@ -31,19 +31,20 @@ class App.KeyboardShortcutWidget extends Spine.Module
for area in areas
for item in area.content
for shortcut in item.shortcuts
modifier = ''
if shortcut.hotkeys
modifier += navigationHotkeys
if shortcut.key
if modifier isnt ''
modifier += '+'
modifier += shortcut.key
if shortcut.callback
@log 'debug', 'bind for', modifier
$(document).bind('keydown', modifier, (e) ->
e.preventDefault()
shortcut.callback()
)
do (shortcut) =>
modifier = ''
if shortcut.hotkeys
modifier += navigationHotkeys
if shortcut.key
if modifier isnt ''
modifier += '+'
modifier += shortcut.key
if shortcut.callback
@log 'debug', 'bind for', modifier
$(document).bind('keydown', modifier, (e) ->
e.preventDefault()
shortcut.callback()
)
App.Event.bind('global-shortcut', (e) ->
for area in areas
@ -127,7 +128,7 @@ App.Config.set(
hotkeys: true
description: 'List of shortcuts'
globalEvent: 'list-of-shortcuts'
callback: (e) =>
callback: =>
if @dialog && @dialog.exists()
@dialog.close()
@dialog = false
@ -135,7 +136,7 @@ App.Config.set(
@dialog = new App.KeyboardShortcutModal()
}
{
key: 'x'
key: 'w'
hotkeys: true
description: 'Close current tab'
globalEvent: 'close-current-tab'
@ -397,7 +398,7 @@ App.Config.set(
globalEvent: 'richtext-h3'
}
{
key: 'w'
key: 'x'
hotkeys: true,
description: 'Removes any hyperlink'
globalEvent: 'richtext-remove-hyperlink'

View file

@ -75,7 +75,7 @@ class KeyboardShortcutsTest < TestCase
)
# close again
shortcut(key: 'x')
shortcut(key: 'w')
watch_for_disappear(
css: '.active.content',
@ -94,7 +94,7 @@ class KeyboardShortcutsTest < TestCase
sleep 5
# close again
shortcut(key: 'x')
shortcut(key: 'w')
watch_for_disappear(
css: '.active.content',
value: ticket1[:number],