Merge pull request #296 from paulkaplan/fix-escaping
Remove duplicate xml escaping
This commit is contained in:
@@ -169,12 +169,16 @@ class SVGTextBubble {
|
||||
return svgString;
|
||||
}
|
||||
|
||||
_buildTextFragment (text) {
|
||||
const textNode = this.svgTextWrapper.wrapText(MAX_LINE_LENGTH, text);
|
||||
const serializer = new XMLSerializer();
|
||||
return serializer.serializeToString(textNode);
|
||||
}
|
||||
|
||||
buildString (type, text, pointsLeft) {
|
||||
this.type = type;
|
||||
this.pointsLeft = pointsLeft;
|
||||
const textNode = this.svgTextWrapper.wrapText(MAX_LINE_LENGTH, text);
|
||||
const serializer = new XMLSerializer();
|
||||
this._textFragment = serializer.serializeToString(textNode);
|
||||
this._textFragment = this._buildTextFragment(text);
|
||||
|
||||
let fragment = '';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const TextWrapper = require('./text-wrapper');
|
||||
const xmlescape = require('xml-escape');
|
||||
|
||||
/**
|
||||
* Measure text by using a hidden SVG attached to the DOM.
|
||||
@@ -118,7 +117,7 @@ class SVGTextWrapper extends TextWrapper {
|
||||
const tspanNode = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
||||
tspanNode.setAttribute('x', '0');
|
||||
tspanNode.setAttribute('dy', '1.2em');
|
||||
tspanNode.textContent = xmlescape(line);
|
||||
tspanNode.textContent = line;
|
||||
textElement.appendChild(tspanNode);
|
||||
}
|
||||
return textElement;
|
||||
|
||||
Reference in New Issue
Block a user