1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Fix message display / html stripping

This commit is contained in:
Dean Herbert 2019-05-15 16:42:12 +09:00
parent 88528e797f
commit 5ddd28bf30

View File

@ -10,6 +10,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.RegularExpressions;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -262,13 +263,16 @@ namespace osu.Game.Overlays.Changelog
ChangelogEntries.Add(title); ChangelogEntries.Add(title);
if (!string.IsNullOrEmpty(entry.MessageHtml))
{
TextFlowContainer messageContainer = new TextFlowContainer TextFlowContainer messageContainer = new TextFlowContainer
{ {
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}; };
messageContainer.AddText($"{entry.MessageHtml?.Replace("<p>", "").Replace("</p>", "")}\n", t => // todo: use markdown parsing once API returns markdown
messageContainer.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t =>
{ {
t.Font = OsuFont.GetFont(size: 14); // web: 12, t.Font = OsuFont.GetFont(size: 14); // web: 12,
t.Colour = new Color4(235, 184, 254, 255); t.Colour = new Color4(235, 184, 254, 255);
@ -280,3 +284,4 @@ namespace osu.Game.Overlays.Changelog
} }
} }
} }
}