Raphael seems to support multi-line strings by putting "\ n" in the text. This may be a cheap solution for you, systematically replacing "" with "\ n" in your shortcuts.
Another (more complicated) solution would be to replace the "text" element in the SVG generated by raphael with an extraneous element that allows word wrap:
<foreignObject x="20" y="10" width="150" height="200">
<p xmlns="http://www.w3.org/1999/xhtml">Wrapping text using some foreignObject in SVG!</p>
</foreignObject>
or if you need a reserve:
<switch>
<foreignObject x="160" y="10" width="150" height="200"><p xmlns="http://www.w3.org/1999/xhtml">Wrapping text using some foreignObject in SVG!</p></foreignObject>
<text x="20" y="20">Your SVG viewer cannot display html.</text>
</switch>
I do not know how best to perform this replacement of the “text” with a foreign object: either after rendering Morris, or by hacking Morris / Raphael.
source
share