If browser returns selection outside of text element return cursor position as undefined
[fnpeditor.git] / modules / documentCanvas / canvas / canvas.js
index 144417a..3f6599a 100644 (file)
@@ -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,