michmech / xonomy

A schema-driven XML editor for the web.
MIT License
91 stars 32 forks source link

Elements with empty textnode doesn't collapse on xml opening #31

Open fpierrat opened 6 years ago

fpierrat commented 6 years ago

Hi, Impossible to have a collapsed empty text node: "intro": {hasText:true, asker: x.askLongString, collapsible: yes, collapsed: yes, oneLiner: yes}, Whatever I tried (collapsed, collapsable, collapsoid, oneLiner...), this text node is rendered uncollapsed on opening my XML when the <intro> tag is empty. Note: yes is a function returning true, which works perfectly well for any other elements (as well as for this element when not empty).

I finally removed the second condition on line 546 and it now displays as expected (see captures attached): if(spec.collapsed(element) && element.children.length>0) classNames+=" collapsed";

I suppose I'll have to deal with side-effects, haven't found any yet. Thanks for anybody telling me what better solution should have been employed...

collapse