pr/editor-traversing-shortcuts: fix widget check

This commit is contained in:
jean-emmanuel 2018-10-10 15:16:15 +02:00 • committed by GitHub
parent 5eb225ee14
commit 82b3179d30

View file

@ -131,7 +131,7 @@ var Editor = class Editor {
else if(e.key == 'ArrowDown' ){
const toSelectList = curWidget.childrenHashes
.map(h=>widgetManager.widgets[h])
.filter(w && w=>w.parent==curWidget)
.filter(w=>w && w.parent==curWidget)
if(toSelectList && toSelectList.length){
toSelectList.sort((a,b)=>a.container.offsetLeft>b.container.offsetLeft)
@ -142,7 +142,7 @@ var Editor = class Editor {
else if((e.key == 'ArrowLeft') || (e.key == 'ArrowRight')){
const toSelectList = curWidget.parent.childrenHashes
.map(h=>widgetManager.widgets[h])
.filter(w && w=>w.parent==curWidget.parent)
.filter(w=>w && w.parent==curWidget.parent)
if(toSelectList && toSelectList.length){
toSelectList.sort((a,b)=>a.container.offsetLeft>b.container.offsetLeft)
const idx = toSelectList.findIndex(e=>e.hash===curWidget.hash)