How to wrap lengthy text in JointJs Rectangle

2019-09-14 03:15发布

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

Thanks in advance

标签: jointjs
1条回答
欢心
2楼-- · 2019-09-14 03:37

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({
查看更多
登录 后发表回答