Fix: adding/clearing node widgets corrupted widgets on all children nodes
[fnpeditor.git] / modules / nodeFamilyTree / nodeFamilyTree.js
index af5d4d7..688f353 100644 (file)
@@ -1,8 +1,9 @@
 define([
 'libs/jquery-1.9.1.min',
 'libs/underscore-min',
 define([
 'libs/jquery-1.9.1.min',
 'libs/underscore-min',
+'utils/wlxml',
 'libs/text!./template.html'
 'libs/text!./template.html'
-], function($, _, templateSrc) {
+], function($, _, wlxmlUtils, templateSrc) {
 
 'use strict';
 
 
 'use strict';
 
@@ -39,7 +40,7 @@ return function(sandbox) {
 
             if(nodeElementParent) {
                 parent = {
 
             if(nodeElementParent) {
                 parent = {
-                    repr: nodeElementParent.getWlxmlTag() + (nodeElementParent.getWlxmlClass() ? ' / ' + nodeElementParent.getWlxmlClass() : '')
+                    repr: wlxmlUtils.wlxmlTagNames[nodeElementParent.getWlxmlTag()] + (nodeElementParent.getWlxmlClass() ? ' / ' + wlxmlUtils.wlxmlClassNames[nodeElementParent.getWlxmlClass()] : '')
                 };
             }
         
                 };
             }
         
@@ -49,16 +50,16 @@ return function(sandbox) {
                 if(child.getText) {
                     var text = child.getText();
                     if(!text)
                 if(child.getText) {
                     var text = child.getText();
                     if(!text)
-                        text = '<pusty tekst>';
+                        text = '<pusty tekst>';
                     else {
                         if(text.length > 13) {
                             text = text.substr(0,13) + '...';
                         }
                         text = '"' + text + '"';
                     }
                     else {
                         if(text.length > 13) {
                             text = text.substr(0,13) + '...';
                         }
                         text = '"' + text + '"';
                     }
-                    children.push({repr: text, bold: child.sameNode(textElement)});
+                    children.push({repr: _.escape(text), bold: child.sameNode(textElement)});
                 } else {
                 } else {
-                    children.push({repr: child.getWlxmlTag() + (child.getWlxmlClass() ? ' / ' + child.getWlxmlClass() : '')});
+                    children.push({repr: wlxmlUtils.wlxmlTagNames[child.getWlxmlTag()] + (child.getWlxmlClass() ? ' / ' + wlxmlUtils.wlxmlClassNames[child.getWlxmlClass()] : '')});
                 }
             });
             this.dom.empty();
                 }
             });
             this.dom.empty();