1
0
Fork 0

chore(components): Handle escaped quotes for React render. See #437

This commit is contained in:
Joost De Cock 2020-07-12 15:27:21 +02:00
parent d2bf45e63c
commit 508adb298e
2 changed files with 4 additions and 3 deletions

View file

@ -8,7 +8,7 @@ const Text = (props) => {
for (let string of props.point.attributes.getAsArray('data-text')) {
if (strings[props.language]['plugin.' + string])
translated += strings[props.language]['plugin.' + string]
else translated += string
else translated += string.toString().replace(/"/g, '"')
translated += ' '
}
// Handle muti-line text
@ -18,13 +18,14 @@ const Text = (props) => {
text.push(<tspan key={'tspan-' + key}>{lines.shift()}</tspan>)
for (let line of lines) {
key++
console.log('multi', line, typeof line)
text.push(
<tspan
key={'tspan-' + key}
x={props.point.x}
dy={props.point.attributes.get('data-text-lineheight') || 12}
>
{line}
{line.toString().replace(/&quot;/g, '"')}
</tspan>
)
}

View file

@ -8,7 +8,7 @@ const TextOnPath = (props) => {
for (let string of props.path.attributes.getAsArray('data-text')) {
if (strings[props.language]['plugin.' + string])
translated += strings[props.language]['plugin.' + string]
else translated += string
else translated += string.toString().replace(/&quot;/g, '"')
translated += ' '
}
let textPathProps = {