Do not escape text in plugin, instead escape at render time
This commit is contained in:
parent
332b28e618
commit
e9784509ee
3 changed files with 24 additions and 5 deletions
|
@ -182,7 +182,7 @@ Svg.prototype.renderPathText = function(path) {
|
|||
let svg = this.nl() + '<text>'
|
||||
this.indent()
|
||||
svg += `<textPath xlink:href="#${path.attributes.get('id')}" ${offset}><tspan ${attributes}>${
|
||||
this.text
|
||||
this.escapteText(this.text)
|
||||
}</tspan></textPath>`
|
||||
this.outdent()
|
||||
svg += this.nl() + '</text>'
|
||||
|
@ -214,7 +214,8 @@ Svg.prototype.renderText = function(point) {
|
|||
svg += `<tspan x="${point.x}" dy="${lineHeight}">${line}</tspan>`
|
||||
}
|
||||
} else {
|
||||
svg += `<tspan>${this.text}</tspan>`
|
||||
svg += `<tspan>${this.escapeText(this.text)
|
||||
}</tspan>`
|
||||
}
|
||||
this.outdent()
|
||||
svg += this.nl() + '</text>'
|
||||
|
@ -222,6 +223,10 @@ Svg.prototype.renderText = function(point) {
|
|||
return svg
|
||||
}
|
||||
|
||||
Svg.prototype.escapeText = function(text) {
|
||||
return text.replace('"', '“')
|
||||
}
|
||||
|
||||
Svg.prototype.renderCircle = function(point) {
|
||||
return `<circle cx="${point.x}" cy="${point.y}" r="${point.attributes.get(
|
||||
'data-circle'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue