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
|
@ -4,12 +4,26 @@ Unreleased:
|
|||
Changed:
|
||||
Deprecated:
|
||||
Fixed:
|
||||
Removed:
|
||||
Security:
|
||||
|
||||
2.4.4:
|
||||
date: 2020-03-15
|
||||
Changes:
|
||||
plugin-dimension:
|
||||
- Don't escape inch symbol in text. Instead let Svg.escapeText() handle it at render time
|
||||
Fixed:
|
||||
core:
|
||||
- New Svg.escapeText() method to escape text at render time, rather than at draft time
|
||||
This fixes the difference in the inch symbol is displayed in the React component or rendered SVG
|
||||
huey:
|
||||
- The `sleevecapBackFactorY` and `sleevecapFrontFactorY` options had a minimum above the default
|
||||
simon:
|
||||
- The `sleevecapBackFactorY` and `sleevecapFrontFactorY` options had a minimum above the default
|
||||
simone:
|
||||
- The `sleevecapBackFactorY` and `sleevecapFrontFactorY` options had a minimum above the default
|
||||
Removed:
|
||||
Security:
|
||||
sven:
|
||||
- The `sleevecapBackFactorY` and `sleevecapFrontFactorY` options had a minimum above the default
|
||||
|
||||
2.4.3:
|
||||
date: 2020-03-12
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -6,7 +6,7 @@ function drawDimension(from, to, so, self) {
|
|||
.move(from)
|
||||
.line(to)
|
||||
.attr('class', 'mark')
|
||||
.attr('data-text', so.text || self.units(from.dist(to)).replace('"', '“'))
|
||||
.attr('data-text', so.text || self.units(from.dist(to)))
|
||||
.attr('data-text-class', 'fill-mark center')
|
||||
if (!so.noStartMarker) dimension.attributes.set('marker-start', 'url(#dimensionFrom)')
|
||||
if (!so.noEndMarker) dimension.attributes.set('marker-end', 'url(#dimensionTo)')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue