caretTo = 'start';
}
var el = canvas.getDocumentElement(utils.nearestInDocumentOrder('[document-text-element]', direction, element.dom()[0]));
- canvas.setCurrentElement(el, {caretTo: caretTo});
+ if(el) {
+ canvas.setCurrentElement(el, {caretTo: caretTo});
+ }
}
},
keyup: function(event, canvas) {