Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Markdown): missing zh-CN localization #2332

Merged
merged 4 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BootstrapBlazor.Shared/BootstrapBlazor.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<PackageReference Include="BootstrapBlazor.FontAwesome" Version="7.5.0" />
<PackageReference Include="BootstrapBlazor.Html2Pdf" Version="7.2.0" />
<PackageReference Include="BootstrapBlazor.Live2DDisplay" Version="7.0.1" />
<PackageReference Include="BootstrapBlazor.Markdown" Version="7.2.1" />
<PackageReference Include="BootstrapBlazor.Markdown" Version="7.2.2" />
<PackageReference Include="BootstrapBlazor.MaterialDesign" Version="7.0.0" />
<PackageReference Include="BootstrapBlazor.MaterialDesign.Extensions" Version="7.4.1" />
<PackageReference Include="BootstrapBlazor.OnScreenKeyboard" Version="7.0.1" />
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\..\Bundle.props" />

<PropertyGroup>
<Version>7.2.1</Version>
<Version>7.2.2</Version>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
<PackageReference Include="BootstrapBlazor" Version="7.6.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace BootstrapBlazor.Components;
/// <summary>
/// Markdown 组件
/// </summary>
[JSModuleAutoLoader("./_content/BootstrapBlazor.Markdown/Components/Markdown/Markdown.razor.js", JSObjectReference = true)]
public partial class Markdown : IAsyncDisposable
{
/// <summary>
Expand Down Expand Up @@ -80,12 +81,6 @@ public partial class Markdown : IAsyncDisposable

private MarkdownOption Option { get; } = new();

[NotNull]
private IJSObjectReference? MarkdownModule { get; set; }

[NotNull]
private DotNetObjectReference<Markdown>? Interop { get; set; }

/// <summary>
/// 获得/设置 DOM 元素实例
/// </summary>
Expand Down Expand Up @@ -120,18 +115,8 @@ protected override void OnInitialized()
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="firstRender"></param>
/// <returns></returns>
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
// import JavaScript
MarkdownModule = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "./_content/BootstrapBlazor.Markdown/Components/Markdown/Markdown.razor.js");
Interop = DotNetObjectReference.Create(this);
await MarkdownModule.InvokeVoidAsync("init", Element, Interop, Option, nameof(Update));
}
}
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Element, Interop, Option, nameof(Update));

/// <summary>
/// 更新组件值方法
Expand Down Expand Up @@ -163,13 +148,13 @@ public async Task Update(string[] vals)
}

/// <summary>
/// 设置 Value 方法
/// <inheritdoc/>
/// </summary>
/// <returns></returns>
public new async ValueTask SetValue(string value)
public new async Task SetValue(string value)
{
CurrentValueAsString = value;
await MarkdownModule.InvokeVoidAsync("update", Element, Value);
await InvokeVoidAsync("update", Element, Value);
}

/// <summary>
Expand All @@ -178,25 +163,5 @@ public async Task Update(string[] vals)
/// <param name="method"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public ValueTask DoMethodAsync(string method, params object[] parameters) => MarkdownModule.InvokeVoidAsync("invoke", Element, method, parameters);

/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="disposing"></param>
protected override async ValueTask DisposeAsync(bool disposing)
{
await base.DisposeAsync(disposing);

if (disposing)
{
Interop?.Dispose();
if (Module != null)
{
await Module.InvokeVoidAsync("dispose", Element);
await Module.DisposeAsync();
Module = null;
}
}
}
public Task DoMethodAsync(string method, params object[] parameters) => InvokeVoidAsync("invoke", Element, method, parameters);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '../../lib/tui.editor/toastui-editor-all.min.js'
import '../../lib/tui.editor/zh-cn.min.js'
import '../../lib/tui.highlight/toastui-editor-plugin-code-syntax-highlight-all.min.js'
import { addLink } from '../../../BootstrapBlazor/modules/utility.js'
import Data from '../../../BootstrapBlazor/modules/data.js'
Expand Down