From: Aleksander Ɓukasz Date: Fri, 9 Aug 2013 11:04:19 +0000 (+0200) Subject: Fixing left/right arrow support in empty text element X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/9a7ea3b25b1989eeb004820bfa8c939426599c8a?ds=inline Fixing left/right arrow support in empty text element --- diff --git a/modules/documentCanvas/canvas/canvas.js b/modules/documentCanvas/canvas/canvas.js index 1b39183..8ba871b 100644 --- a/modules/documentCanvas/canvas/canvas.js +++ b/modules/documentCanvas/canvas/canvas.js @@ -188,8 +188,8 @@ $.extend(Canvas.prototype, { direction = 'below'; caretTo = 'start'; } - var el = canvas.getDocumentElement(utils.nearestInDocumentOrder('[document-text-element]', direction, window.getSelection().focusNode)) - canvas.setCurrentElement(element, {caretTo: caretTo}); + var el = canvas.getDocumentElement(utils.nearestInDocumentOrder('[document-text-element]', direction, element.dom()[0])); + canvas.setCurrentElement(el, {caretTo: caretTo}); } else { var txt = element.dom().contents()[0].data; if(e.which === KEYS.ARROW_LEFT && position.offset > 1 && txt.charAt(position.offset-2) === utils.unicode.ZWS) {