fnpjs: Action now triggers actionExecuted event instead of using callback
[fnpeditor.git] / src / editor / modules / documentCanvas / canvas / canvas.js
index 50c0ae4..29edbe5 100644 (file)
@@ -457,6 +457,9 @@ $.extend(Selection.prototype, {
             return doc.createFragment(doc.CaretFragment, {node: anchorNode, offset: this.nativeSelection.anchorOffset});
         }
         if(this.type === 'textSelection') {
             return doc.createFragment(doc.CaretFragment, {node: anchorNode, offset: this.nativeSelection.anchorOffset});
         }
         if(this.type === 'textSelection') {
+            if(!anchorNode || !focusNode) {
+                return;
+            }
             if(anchorNode.isSiblingOf(focusNode)) {
                 return doc.createFragment(doc.TextRangeFragment, {
                     node1: anchorNode,
             if(anchorNode.isSiblingOf(focusNode)) {
                 return doc.createFragment(doc.TextRangeFragment, {
                     node1: anchorNode,