From: Aleksander Ɓukasz Date: Tue, 16 Jul 2013 09:31:24 +0000 (+0200) Subject: If browser returns selection outside of text element return cursor position as undefined X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/50cc0c32bb9b2322e3f25be4803ad1adbf1d92a6 If browser returns selection outside of text element return cursor position as undefined This fixes entering caret out side of text element when clicking on a node element with one empty text node --- diff --git a/modules/documentCanvas/canvas/canvas.js b/modules/documentCanvas/canvas/canvas.js index 144417a..3f6599a 100644 --- a/modules/documentCanvas/canvas/canvas.js +++ b/modules/documentCanvas/canvas/canvas.js @@ -419,6 +419,9 @@ $.extend(Cursor.prototype, { anchorElement = this.canvas.getDocumentElement(selection.anchorNode), focusElement = this.canvas.getDocumentElement(selection.focusNode); + if(anchorElement instanceof documentElement.DocumentNodeElement || focusElement instanceof documentElement.DocumentNodeElement) + return {}; + if(which === 'anchor') { return { element: anchorElement,