vakata / jstree

jquery tree plugin
http://jstree.com
MIT License
5.15k stars 1.38k forks source link

How to deal with items that are long and that contain <br> #2451

Closed MagTun closed 3 years ago

MagTun commented 4 years ago

Hi,

I am having some troubles to implement your plugin with the structure of my lists. Some of my items contain long text and <br>, <i>,<b> tags. Here is an example:

<ul>
<li>Tree<ul>
        <li>Title 1<br>Text under Title 1 <br>Lorem ipsum <b>dolor</b> sit amet <b><i>consectetur</i></b>
            adipisicing elit. Ad, quidem culpa quisquam aliquid dignissimos a error laudantium tenetur natus
            perspiciatis consectetur officiis obcaecati! Facere fugiat sequi totam aliquid. Similique,
            nesciunt?<ul>
                <li>Title 1.1<br>Text under title 1.1 <br><br>Lorem ipsum dolor sit amet consectetur
                    adipisicing elit. Ad, quidem culpa quisquam aliquid dignissimos a error laudantium
                    tenetur natus perspiciatis consectetur officiis obcaecati! Facere fugiat sequi totam
                    aliquid. Similique, nesciunt?<ul>
                        <li><b>Title</b> <i>1.1.1</i><br>Text under title 1.1.1</li>
                    </ul>
                </li>
                <li>Title 1.2</li>
            </ul>
        </li>

So jstree doesn't render the list properly. You can see what I mean here I have try these two solutions (here and here) but without any success. How can I best implement jstree with such a list structure? Thanks for you help!

Also, thanks a lot for this very nice plugin!

vakata commented 3 years ago

Sorry for the trouble you are having. Did you try this, I know it is not perfect (the solution you found), but I doubt there is a way for this too look any nicer in any tree: https://jsfiddle.net/k4fp5edh/

MagTun commented 3 years ago

Thanks for your answer. As I wasn't able to make it work, I improved on this simple script that generates a nested list