From: Aleksander Ɓukasz Date: Tue, 16 Jul 2013 09:45:47 +0000 (+0200) Subject: Better representation o an empty text element in familyTree X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/faae581f8b54b9cd3000d3060c446ed7dfe13447 Better representation o an empty text element in familyTree --- diff --git a/modules/nodeFamilyTree/nodeFamilyTree.js b/modules/nodeFamilyTree/nodeFamilyTree.js index e47821e..af5d4d7 100644 --- a/modules/nodeFamilyTree/nodeFamilyTree.js +++ b/modules/nodeFamilyTree/nodeFamilyTree.js @@ -48,9 +48,15 @@ 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 = '<pusty tekst>'; + else { + if(text.length > 13) { + text = text.substr(0,13) + '...'; + } + text = '"' + text + '"'; + } + children.push({repr: text, bold: child.sameNode(textElement)}); } else { children.push({repr: child.getWlxmlTag() + (child.getWlxmlClass() ? ' / ' + child.getWlxmlClass() : '')}); }