diff --git a/packages/components/src/Draft/Text/index.js b/packages/components/src/Draft/Text/index.js index b274b5a3d0c..c99cae7e004 100644 --- a/packages/components/src/Draft/Text/index.js +++ b/packages/components/src/Draft/Text/index.js @@ -15,7 +15,7 @@ const Text = (props) => { if (translated.indexOf('\n') !== -1) { let key = 0 let lines = translated.split('\n') - text.push({lines.shift()}) + text.push() let lineHeight = (props.point.attributes.get('data-text-lineheight') || 12) * (props.scale || 1) for (let line of lines) { key++ @@ -24,12 +24,11 @@ const Text = (props) => { key={'tspan-' + key} x={props.point.x} dy={lineHeight} - > - {line.toString().replace(/"/g, '"')} - + dangerouslySetInnerHTML={{ __html: line.toString().replace(/"/g, '"')}} + /> ) } - } else text.push({translated}) + } else text.push() return ( { if (align && align.indexOf('center') > -1) textPathProps.startOffset = '50%' else if (align && align.indexOf('right') > -1) textPathProps.startOffset = '100%' + /* + * We need dangerouslySetInnerHTML here to make sure we have a way to + * add whitespace that works both in the browser as in SVG. + * Whitespace =   + */ return ( - {translated} + )