TextEditPanel.Visible = !_preview;
PreviewPanel.Visible = _preview;
- PreviewLabel.SetMarkup(Rope.Collapse(ContentField.TextRope));
+ PreviewLabel.SetMarkupPermissive(Rope.Collapse(ContentField.TextRope));
}
private void OnCancel(BaseButton.ButtonEventArgs eventArgs)
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;
+ }
}
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;