editor: canvas fix - fix selecting node without direct text node child
[fnpeditor.git] / src / editor / modules / documentCanvas / canvas / genericElement.js
index d3debb2..4dfbe59 100644 (file)
@@ -33,7 +33,7 @@ $.extend(generic, {
             }
         }.bind(this));
 
-        this.commentsView = new CommentsView(this.wlxmlNode, {});
+        this.commentsView = new CommentsView(this.wlxmlNode, this.canvas.metadata.user);
         this.addToGutter(this.commentsView);
         this.commentTip = $('<div class="comment-tip"><i class="icon-comment"></i></div>');
         this.addWidget(this.commentTip);
@@ -80,13 +80,18 @@ $.extend(generic, {
         return toret;
     },
 
-    getVerticallyFirstTextElement: function() {
+    getVerticallyFirstTextElement: function(params) {
         var toret;
+        
+        params = _.extend({
+            considerChildren: true
+        }, params);
+        
         this.children().some(function(child) {
             if(child instanceof documentElement.DocumentTextElement) {
                 toret = child;
                 return true; // break
-            } else {
+            } else if(params.considerChildren) {
                 toret = child.getVerticallyFirstTextElement();
                 if(toret) {
                     return true; // break