2020-01-09 00:27:52 +01:00
|
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
|
using Robust.Shared.Utility;
|
|
|
|
|
|
2023-08-18 07:41:48 +03:00
|
|
|
namespace Content.Client.Message;
|
|
|
|
|
|
|
|
|
|
public static class RichTextLabelExt
|
2020-01-09 00:27:52 +01:00
|
|
|
{
|
2024-05-22 16:23:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sets the labels markup.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Invalid markup will cause exceptions to be thrown. Don't use this for user input!
|
|
|
|
|
/// </remarks>
|
2023-08-18 07:41:48 +03:00
|
|
|
public static RichTextLabel SetMarkup(this RichTextLabel label, string markup)
|
2020-01-09 00:27:52 +01:00
|
|
|
{
|
2024-09-01 14:00:53 +03:00
|
|
|
label.SetMessage(FormattedMessage.FromMarkupOrThrow(markup));
|
2023-08-18 07:41:48 +03:00
|
|
|
return label;
|
2020-01-09 00:27:52 +01:00
|
|
|
}
|
2024-05-22 16:23:55 +02:00
|
|
|
|
|
|
|
|
/// <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;
|
|
|
|
|
}
|
2020-01-09 00:27:52 +01:00
|
|
|
}
|