if(grandParent && grandParent.children().length === 1) {
goto = grandParent.append({text: ''});
} else {
- goto = canvas.getDocumentElement(utils.nearestInDocumentOrder('[document-text-element]', direction, element.dom()[0]));
+ goto = canvas.getDocumentElement(utils.nearestInDocumentOrder('[document-text-element]:visible', direction, element.dom()[0]));
}
parent.detach();
} else {
- goto = canvas.getDocumentElement(utils.nearestInDocumentOrder('[document-text-element]', direction, element.dom()[0]));
+ goto = canvas.getDocumentElement(utils.nearestInDocumentOrder('[document-text-element]:visible', direction, element.dom()[0]));
element.detach();
}
canvas.setCurrentElement(goto, {caretTo: caretTo});