-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Console): add IsHtml parameter on ConsoleMessageItem (#3005)
* refactor: 重构代码 * refactor: 精简代码 * doc: 更新示例文档 * doc: 重构代码 * feat: 增加 IsHtml 参数 * refactor: 增加 IsHtml 实现逻辑 * test: 增加 IsHtml 单元测试
- Loading branch information
Showing
8 changed files
with
119 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/BootstrapBlazor/Extensions/ConsoleItemMessageExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
// Website: https://www.blazor.zone or https://argozhang.github.io/ | ||
|
||
namespace BootstrapBlazor.Components; | ||
|
||
static class ConsoleMessageItemExtensions | ||
{ | ||
/// <summary> | ||
/// 渲染消息方法 | ||
/// </summary> | ||
/// <param name="item"></param> | ||
/// <returns></returns> | ||
public static RenderFragment RenderMessage(this ConsoleMessageItem item) => builder => | ||
{ | ||
if (item.IsHtml) | ||
{ | ||
builder.AddContent(0, new MarkupString(item.Message)); | ||
} | ||
else | ||
{ | ||
builder.AddContent(0, item.Message); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters