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
This commit is contained in:
parent
4694f79a45
commit
57b4af9f71
|
|
@ -76,7 +76,7 @@ public sealed partial class ArticleEditorPanel : Control
|
|||
|
||||
TextEditPanel.Visible = !_preview;
|
||||
PreviewPanel.Visible = _preview;
|
||||
PreviewLabel.SetMarkup(Rope.Collapse(ContentField.TextRope));
|
||||
PreviewLabel.SetMarkupPermissive(Rope.Collapse(ContentField.TextRope));
|
||||
}
|
||||
|
||||
private void OnCancel(BaseButton.ButtonEventArgs eventArgs)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,27 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ public sealed class TippyUIController : UIController
|
|||
sprite.LayerSetVisible("hiding", false);
|
||||
}
|
||||
sprite.Rotation = 0;
|
||||
tippy.Label.SetMarkup(_currentMessage.Msg);
|
||||
tippy.Label.SetMarkupPermissive(_currentMessage.Msg);
|
||||
tippy.Label.Visible = false;
|
||||
tippy.LabelPanel.Visible = false;
|
||||
tippy.Visible = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue