How to wrap lengthy text in JointJs Rectangle

2019-09-14 03:27发布

问题:

Can anyone tell me how to wrap lengthy text inside rectangle in JointJS.

Thanks in advance

回答1:

You can use either "TextBlock" or if you trying to create a custom element you can write like this

joint.shapes.devs.testModel = joint.shapes.basic.TextBlock.extend( {

markup: ['<g class="rotatable"><g class="scalable"><rect class="body"/><rect class="leftthick"/></g>',
         joint.env.test('svgforeignobject') ? '<foreignObject class="fobj"><body xmlns="http://www.w3.org/1999/xhtml"><div class="content"/></body></foreignObject>' : '<text class="content"/>',
         '<image/><text class="label"/><g class="inPorts"/><g class="outPorts"/>',            
        '</g>'].join(''),

defaults: joint.util.deepSupplement({


标签: jointjs