made DEL key into delete shortcut

This commit is contained in:
Robert Best 2017-02-01 23:12:22 +00:00
parent a8c47291cd
commit 5ee6441d6c
2 changed files with 6 additions and 9 deletions

View file

@ -82,7 +82,7 @@ const DataModel = {
var starredCollection = serverData.Starred ? serverData.Starred : [] var starredCollection = serverData.Starred ? serverData.Starred : []
var mapperCollection = serverData.Mapper ? serverData.Mapper : [] var mapperCollection = serverData.Mapper ? serverData.Mapper : []
var mapperOptionsObj = { id: 'mapper', sortBy: 'updated_at' } var mapperOptionsObj = { id: 'mapper', sortBy: 'updated_at' }
if (serverData.Mapper.mapperId) { if (serverData.Mapper && serverData.Mapper.mapperId) {
mapperCollection = serverData.Mapper.models mapperCollection = serverData.Mapper.models
mapperOptionsObj.mapperId = serverData.Mapper.mapperId mapperOptionsObj.mapperId = serverData.Mapper.mapperId
} }

View file

@ -19,7 +19,7 @@ const Listeners = {
if (!(Active.Map || Active.Topic)) return if (!(Active.Map || Active.Topic)) return
const onCanvas = e.target.tagName === 'BODY' const onCanvas = e.target.tagName === 'BODY'
switch (e.which) { switch (e.which) {
case 13: // if enter key is pressed case 13: // if enter key is pressed
// prevent topic creation if sending a message // prevent topic creation if sending a message
@ -30,6 +30,10 @@ const Listeners = {
case 27: // if esc key is pressed case 27: // if esc key is pressed
JIT.escKeyHandler() JIT.escKeyHandler()
break break
case 46: // if DEL is pressed
e.preventDefault()
Control.deleteSelected()
break
case 65: // if a or A is pressed case 65: // if a or A is pressed
if ((e.ctrlKey || e.metaKey) && onCanvas) { if ((e.ctrlKey || e.metaKey) && onCanvas) {
const nodesCount = Object.keys(Visualize.mGraph.graph.nodes).length const nodesCount = Object.keys(Visualize.mGraph.graph.nodes).length
@ -113,12 +117,6 @@ const Listeners = {
}) })
} }
break break
case 127: // if DEL is pressed
if (e.ctrlKey || e.metaKey) {
e.preventDefault()
Control.deleteSelected()
}
break
case 191: // if / is pressed case 191: // if / is pressed
if (e.ctrlKey || e.metaKey) { if (e.ctrlKey || e.metaKey) {
Search.focus() Search.focus()
@ -129,7 +127,6 @@ const Listeners = {
break break
} }
}) })
$(window).resize(function() { $(window).resize(function() {
if (Visualize && Visualize.mGraph) { if (Visualize && Visualize.mGraph) {
Util.resizeCanvas(Visualize.mGraph.canvas) Util.resizeCanvas(Visualize.mGraph.canvas)