X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/ce24094b892d3fb0faf000b5e2bf64f58ce4aae5..70b1b491ce0fcdf036c97e381b8fc6867e06b3c2:/modules/nodeFamilyTree/nodeFamilyTree.js diff --git a/modules/nodeFamilyTree/nodeFamilyTree.js b/modules/nodeFamilyTree/nodeFamilyTree.js index e47821e..688f353 100644 --- a/modules/nodeFamilyTree/nodeFamilyTree.js +++ b/modules/nodeFamilyTree/nodeFamilyTree.js @@ -1,8 +1,9 @@ define([ 'libs/jquery-1.9.1.min', 'libs/underscore-min', +'utils/wlxml', 'libs/text!./template.html' -], function($, _, templateSrc) { +], function($, _, wlxmlUtils, templateSrc) { 'use strict'; @@ -39,7 +40,7 @@ return function(sandbox) { if(nodeElementParent) { parent = { - repr: nodeElementParent.getWlxmlTag() + (nodeElementParent.getWlxmlClass() ? ' / ' + nodeElementParent.getWlxmlClass() : '') + repr: wlxmlUtils.wlxmlTagNames[nodeElementParent.getWlxmlTag()] + (nodeElementParent.getWlxmlClass() ? ' / ' + wlxmlUtils.wlxmlClassNames[nodeElementParent.getWlxmlClass()] : '') }; } @@ -48,11 +49,17 @@ return function(sandbox) { nodeChildren.forEach(function(child) { if(child.getText) { var text = child.getText(); - if(text.length > 13) - text = text.substr(0,13) + '...'; - children.push({repr: '"' + text + '"', bold: child.sameNode(textElement)}); + if(!text) + text = ''; + else { + if(text.length > 13) { + text = text.substr(0,13) + '...'; + } + text = '"' + text + '"'; + } + children.push({repr: _.escape(text), bold: child.sameNode(textElement)}); } 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();