Skip to content

Commit

Permalink
Merge pull request #20792 from nebula2/19785-html-uimessagealert
Browse files Browse the repository at this point in the history
feat(blazor): html ui message alert
  • Loading branch information
maliming authored Sep 18, 2024
2 parents f96b918 + 2476b34 commit b23affb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,9 @@ public class UiMessageOptions
/// Custom icon for the Cancel button.
/// </summary>
public object? CancelButtonIcon { get; set; }

/// <summary>
/// Whether the message is html (true) or plain text (false)
/// </summary>
public bool IsMessageHtmlMarkup { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
</DisplayHeading>
}
<Paragraph TextAlignment="TextAlignment.Center" Margin="Margin.Is0.FromBottom" Style="white-space: break-spaces;">
@Message
@if (!IsMessageHtmlMarkup)
{
@Message
}
else
{
@((MarkupString)Message)
}
</Paragraph>
</ModalBody>
<ModalFooter class="d-flex justify-content-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ protected virtual bool CenterMessage
protected virtual bool ShowMessageIcon
=> Options?.ShowMessageIcon ?? true;

protected virtual bool IsMessageHtmlMarkup
=> Options?.IsMessageHtmlMarkup ?? false;

protected virtual object? MessageIcon => Options?.MessageIcon ?? MessageType switch
{
UiMessageType.Info => IconName.Info,
Expand Down

0 comments on commit b23affb

Please sign in to comment.