Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ namespace BootstrapBlazor.Components;
/// </summary>
public partial class CherryMarkdown
{
private const string StylePath = "_content/BootstrapBlazor.CherryMarkdown/css/cherry-markdown.css";
private const string KatexStylePath = "_content/BootstrapBlazor.CherryMarkdown/css/katex.min.css";

#if NET9_0_OR_GREATER
private string StyleUrl => Assets[StylePath];
private string KatexStyleUrl => Assets[KatexStylePath];
#else
private static string StyleUrl => StylePath;
private static string KatexStyleUrl => KatexStylePath;
#endif

/// <summary>
/// 获得/设置 编辑器设置
/// </summary>
Expand Down Expand Up @@ -114,7 +125,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
Locale = Language,
Editor = EditorSettings ?? new(),
Toolbars = ToolbarSettings ?? new()
}, nameof(Upload));
}, nameof(Upload), StyleUrl, KatexStyleUrl);

/// <summary>
/// 文件上传回调
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import '../../js/cherry-markdown.core.js'
import { addLink, addScript } from '../../../BootstrapBlazor/modules/utility.js'
import Data from '../../../BootstrapBlazor/modules/data.js'

export async function init(id, invoke, options, callback) {
export async function init(id, invoke, options, callback, styleUrl, katexStyleUrl) {
const el = document.getElementById(id);
if (el === null) {
return;
}

await addLink('./_content/BootstrapBlazor.CherryMarkdown/css/cherry-markdown.css')
await addLink(styleUrl)
if (options.isSupportMath) {
await addScript('./_content/BootstrapBlazor.CherryMarkdown/js/katex.min.js')
await addLink('./_content/BootstrapBlazor.CherryMarkdown/css/katex.min.css')
await addLink(katexStyleUrl)
options.engine = {
syntax: {
mathBlock: { engine: 'katex', },
Expand Down
Loading