Fixed the white spacing collapse in the HtmlWidget.

This commit is contained in:
Lars Brubaker 2016-02-11 15:38:32 -08:00
parent 426cd4d74a
commit 133764fa3b

View file

@ -42,6 +42,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
namespace MatterHackers.MatterControl
{
@ -110,10 +111,14 @@ namespace MatterHackers.MatterControl
}
}
// Replace multiple white spaces with single whitespace
private static readonly Regex replaceMultipleWhiteSpacesWithSingleWhitespaceRegex = new Regex(@"\s+", RegexOptions.Compiled);
private void AddContent(HtmlParser htmlParser, string htmlContent)
{
ElementState elementState = htmlParser.CurrentElementState;
string decodedHtml = HtmlParser.UrlDecode(htmlContent.Replace("\r\n", "").Replace("\t", "").Trim());
htmlContent = replaceMultipleWhiteSpacesWithSingleWhitespaceRegex.Replace(htmlContent, " ");
string decodedHtml = HtmlParser.UrlDecode(htmlContent);
switch (elementState.TypeName)
{
case "a":