Skip to content

Commit 5fb08a4

Browse files
authored
feat(CherryMarkdown): support validate in form (#663)
* chore: bump version 0.10.1 * chore: bump version 9.0.5 * refactor: 增加样式支持 * refactor: 支持 Valdiate * refactor: 代码格式化 * refactor: 重构 Height 参数
1 parent de07ade commit 5fb08a4

12 files changed

Lines changed: 91 additions & 11 deletions

File tree

src/components/BootstrapBlazor.CherryMarkdown/BootstrapBlazor.CherryMarkdown.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.0.4</Version>
4+
<Version>9.0.5</Version>
55
</PropertyGroup>
66

77
<PropertyGroup>

src/components/BootstrapBlazor.CherryMarkdown/Components/CherryMarkdown/CherryMarkdown.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
{
77
<BootstrapLabel required="@Required" for="@Id" ShowLabelTooltip="ShowLabelTooltip" Value="@DisplayText" />
88
}
9-
<div @attributes="@AdditionalAttributes" id="@Id"></div>
9+
<div @attributes="@AdditionalAttributes" id="@Id" class="@ClassString"></div>

src/components/BootstrapBlazor.CherryMarkdown/Components/CherryMarkdown/CherryMarkdown.razor.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ public partial class CherryMarkdown
6262
[Parameter]
6363
public string? Language { get; set; }
6464

65+
private string? ClassString => CssBuilder.Default("bb-cherry-markdown")
66+
.AddClass(CssClass)
67+
.AddClass(ValidCss)
68+
.Build();
69+
6570
/// <summary>
6671
/// <inheritdoc/>
6772
/// </summary>
@@ -101,9 +106,15 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
101106
/// <inheritdoc/>
102107
/// </summary>
103108
/// <returns></returns>
104-
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop,
105-
new { Value, IsSupportMath, IsViewer, Locale = Language, Editor = EditorSettings ?? new(), Toolbars = ToolbarSettings ?? new() },
106-
nameof(Upload));
109+
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop, new
110+
{
111+
Value,
112+
IsSupportMath,
113+
IsViewer,
114+
Locale = Language,
115+
Editor = EditorSettings ?? new(),
116+
Toolbars = ToolbarSettings ?? new()
117+
}, nameof(Upload));
107118

108119
/// <summary>
109120
/// 文件上传回调

src/components/BootstrapBlazor.CherryMarkdown/Components/CherryMarkdown/CherryMarkdown.razor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import '../../js/cherry-markdown.core.js'
1+
import '../../js/cherry-markdown.core.js'
22
import { addLink, addScript } from '../../../BootstrapBlazor/modules/utility.js'
33
import Data from '../../../BootstrapBlazor/modules/data.js'
44

@@ -8,7 +8,7 @@ export async function init(id, invoke, options, callback) {
88
return;
99
}
1010

11-
await addLink('./_content/BootstrapBlazor.CherryMarkdown/css/cherry-markdown.min.css')
11+
await addLink('./_content/BootstrapBlazor.CherryMarkdown/css/cherry-markdown.css')
1212
if (options.isSupportMath) {
1313
await addScript('./_content/BootstrapBlazor.CherryMarkdown/js/katex.min.js')
1414
await addLink('./_content/BootstrapBlazor.CherryMarkdown/css/katex.min.css')
@@ -42,7 +42,7 @@ export async function init(id, invoke, options, callback) {
4242

4343
options.editor = {
4444
theme: 'Default',
45-
height: '100%',
45+
height: "200px",
4646
defaultModel: 'edit&preview',
4747
convertWhenPaste: true,
4848
...options.editor
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@import url('cherry-markdown.min.css');
2+
3+
.bb-cherry-markdown {
4+
}
5+
6+
.bb-cherry-markdown.is-valid {
7+
border: 1px solid var(--bs-success);
8+
}
9+
10+
.bb-cherry-markdown.is-invalid {
11+
border: 1px solid var(--bs-danger);
12+
}
13+
14+
.bb-cherry-markdown .cherry {
15+
border: 1px solid var(--bs-border-color);
16+
border-radius: var(--bs-border-radius);
17+
overflow: hidden;
18+
}

src/components/BootstrapBlazor.CherryMarkdown/wwwroot/css/cherry-markdown.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

src/components/BootstrapBlazor.CherryMarkdown/wwwroot/css/fonts/ch-icon.svg

Lines changed: 52 additions & 1 deletion
Loading
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)