Fix Issue 273: preserve whitespace in text elements

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@807 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2009-10-13 00:51:15 +00:00
parent 1cb98fe0fc
commit fb54e70a6b
1 changed files with 5 additions and 3 deletions

View File

@ -25,7 +25,7 @@ var svgWhiteList = {
"rect": ["fill", "fill-opacity", "height", "id", "opacity", "rx", "ry", "stroke", "stroke-dasharray", "stroke-linecap", "stroke-linejoin", "stroke-opacity", "stroke-width", "transform", "width", "x", "y"],
"stop": ["id", "offset", "stop-color", "stop-opacity"],
"svg": ["id", "height", "transform", "viewBox", "width", "xmlns", "xmlns:xlink"],
"text": ["fill", "fill-opacity", "font-family", "font-size", "font-style", "font-weight", "id", "opacity", "stroke", "stroke-dasharray", "stroke-linecap", "stroke-linejoin", "stroke-opacity", "stroke-width", "transform", "text-anchor", "x", "y"],
"text": ["fill", "fill-opacity", "font-family", "font-size", "font-style", "font-weight", "id", "opacity", "stroke", "stroke-dasharray", "stroke-linecap", "stroke-linejoin", "stroke-opacity", "stroke-width", "transform", "text-anchor", "x", "xml:space", "y"],
"title": [],
};
@ -555,7 +555,8 @@ function BatchCommand(text) {
var handle = svgroot.suspendRedraw(suspendLength);
for (i in attrs) {
node.setAttributeNS(null, i, attrs[i]);
var ns = (i.substr(0,4) == "xml:" ? "http://www.w3.org/XML/1998/namespace" : null);
node.setAttributeNS(ns, i, attrs[i]);
}
svgroot.unsuspendRedraw(handle);
@ -1654,7 +1655,8 @@ function BatchCommand(text) {
"font-size": cur_text.font_size,
"font-family": cur_text.font_family,
"text-anchor": "middle",
"style": "pointer-events:inherit"
"style": "pointer-events:inherit",
"xml:space": "preserve"
}
});
newText.textContent = "text";