Files
tbd-station-14/Content.Client/Message/RichTextLabelExt.cs
Julian Giebel 1fa493e1af Implement permissive version of AddMarkup and use it for tips (#28204)
* Implement permissive version of ddMarkup
Use permissive ddMarkup for news article input
Use permissive ddMarkup for tips

* Fix doc comment format
2024-05-22 10:23:55 -04:00

32 lines
907 B
C#

using Robust.Client.UserInterface.Controls;
using Robust.Shared.Utility;
namespace Content.Client.Message;
public static class RichTextLabelExt
{
/// <summary>
/// Sets the labels markup.
/// </summary>
/// <remarks>
/// Invalid markup will cause exceptions to be thrown. Don't use this for user input!
/// </remarks>
public static RichTextLabel SetMarkup(this RichTextLabel label, string markup)
{
label.SetMessage(FormattedMessage.FromMarkup(markup));
return label;
}
/// <summary>
/// Sets the labels markup.<br/>
/// Uses <c>FormatedMessage.FromMarkupPermissive</c> which treats invalid markup as text.
/// </summary>
public static RichTextLabel SetMarkupPermissive(this RichTextLabel label, string markup)
{
label.SetMessage(FormattedMessage.FromMarkupPermissive(markup));
return label;
}
}