Fixed shortcuts.
This commit is contained in:
parent
691f2006b2
commit
e5c0c7f109
2 changed files with 19 additions and 18 deletions
|
@ -31,19 +31,20 @@ class App.KeyboardShortcutWidget extends Spine.Module
|
||||||
for area in areas
|
for area in areas
|
||||||
for item in area.content
|
for item in area.content
|
||||||
for shortcut in item.shortcuts
|
for shortcut in item.shortcuts
|
||||||
modifier = ''
|
do (shortcut) =>
|
||||||
if shortcut.hotkeys
|
modifier = ''
|
||||||
modifier += navigationHotkeys
|
if shortcut.hotkeys
|
||||||
if shortcut.key
|
modifier += navigationHotkeys
|
||||||
if modifier isnt ''
|
if shortcut.key
|
||||||
modifier += '+'
|
if modifier isnt ''
|
||||||
modifier += shortcut.key
|
modifier += '+'
|
||||||
if shortcut.callback
|
modifier += shortcut.key
|
||||||
@log 'debug', 'bind for', modifier
|
if shortcut.callback
|
||||||
$(document).bind('keydown', modifier, (e) ->
|
@log 'debug', 'bind for', modifier
|
||||||
e.preventDefault()
|
$(document).bind('keydown', modifier, (e) ->
|
||||||
shortcut.callback()
|
e.preventDefault()
|
||||||
)
|
shortcut.callback()
|
||||||
|
)
|
||||||
|
|
||||||
App.Event.bind('global-shortcut', (e) ->
|
App.Event.bind('global-shortcut', (e) ->
|
||||||
for area in areas
|
for area in areas
|
||||||
|
@ -127,7 +128,7 @@ App.Config.set(
|
||||||
hotkeys: true
|
hotkeys: true
|
||||||
description: 'List of shortcuts'
|
description: 'List of shortcuts'
|
||||||
globalEvent: 'list-of-shortcuts'
|
globalEvent: 'list-of-shortcuts'
|
||||||
callback: (e) =>
|
callback: =>
|
||||||
if @dialog && @dialog.exists()
|
if @dialog && @dialog.exists()
|
||||||
@dialog.close()
|
@dialog.close()
|
||||||
@dialog = false
|
@dialog = false
|
||||||
|
@ -135,7 +136,7 @@ App.Config.set(
|
||||||
@dialog = new App.KeyboardShortcutModal()
|
@dialog = new App.KeyboardShortcutModal()
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
key: 'x'
|
key: 'w'
|
||||||
hotkeys: true
|
hotkeys: true
|
||||||
description: 'Close current tab'
|
description: 'Close current tab'
|
||||||
globalEvent: 'close-current-tab'
|
globalEvent: 'close-current-tab'
|
||||||
|
@ -397,7 +398,7 @@ App.Config.set(
|
||||||
globalEvent: 'richtext-h3'
|
globalEvent: 'richtext-h3'
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
key: 'w'
|
key: 'x'
|
||||||
hotkeys: true,
|
hotkeys: true,
|
||||||
description: 'Removes any hyperlink'
|
description: 'Removes any hyperlink'
|
||||||
globalEvent: 'richtext-remove-hyperlink'
|
globalEvent: 'richtext-remove-hyperlink'
|
||||||
|
|
|
@ -75,7 +75,7 @@ class KeyboardShortcutsTest < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# close again
|
# close again
|
||||||
shortcut(key: 'x')
|
shortcut(key: 'w')
|
||||||
|
|
||||||
watch_for_disappear(
|
watch_for_disappear(
|
||||||
css: '.active.content',
|
css: '.active.content',
|
||||||
|
@ -94,7 +94,7 @@ class KeyboardShortcutsTest < TestCase
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
# close again
|
# close again
|
||||||
shortcut(key: 'x')
|
shortcut(key: 'w')
|
||||||
watch_for_disappear(
|
watch_for_disappear(
|
||||||
css: '.active.content',
|
css: '.active.content',
|
||||||
value: ticket1[:number],
|
value: ticket1[:number],
|
||||||
|
|
Loading…
Reference in a new issue