diff --git a/app/MindWork AI Studio/Components/CodeBlock.razor.cs b/app/MindWork AI Studio/Components/CodeBlock.razor.cs index e5d60f13..705e6310 100644 --- a/app/MindWork AI Studio/Components/CodeBlock.razor.cs +++ b/app/MindWork AI Studio/Components/CodeBlock.razor.cs @@ -12,7 +12,7 @@ public partial class CodeBlock : ComponentBase public string? Title { get; set; } = string.Empty; [Parameter] - public bool IsInline { get; set; } = false; + public bool IsInline { get; set; } [CascadingParameter] public CodeTabs? ParentTabs { get; set; } @@ -21,14 +21,15 @@ public partial class CodeBlock : ComponentBase { if (this.ParentTabs is not null && this.Title is not null) { - RenderFragment blockSelf = builder => + void BlockSelf(RenderTreeBuilder builder) { builder.OpenComponent(0); builder.AddAttribute(1, "Title", this.Title); builder.AddAttribute(2, "ChildContent", this.ChildContent); builder.CloseComponent(); - }; - this.ParentTabs.RegisterBlock(this.Title, blockSelf); + } + + this.ParentTabs.RegisterBlock(this.Title, BlockSelf); } } diff --git a/app/MindWork AI Studio/Components/CodeTabs.razor.cs b/app/MindWork AI Studio/Components/CodeTabs.razor.cs index 8c4abb9f..28f5a12a 100644 --- a/app/MindWork AI Studio/Components/CodeTabs.razor.cs +++ b/app/MindWork AI Studio/Components/CodeTabs.razor.cs @@ -7,8 +7,8 @@ public partial class CodeTabs : ComponentBase [Parameter] public RenderFragment? ChildContent { get; set; } - private List blocks = new(); - private int selectedIndex = 0; + private readonly List blocks = new(); + private int selectedIndex; internal void RegisterBlock(string title, RenderFragment fragment) { @@ -17,12 +17,14 @@ public partial class CodeTabs : ComponentBase Title = title, Fragment = fragment, }); + this.StateHasChanged(); } private class CodeTabItem { public string Title { get; init; } = string.Empty; + public RenderFragment Fragment { get; init; } = null!; } } \ No newline at end of file diff --git a/app/MindWork AI Studio/Tools/Pandoc.cs b/app/MindWork AI Studio/Tools/Pandoc.cs index bf857afb..2f0d7bd1 100644 --- a/app/MindWork AI Studio/Tools/Pandoc.cs +++ b/app/MindWork AI Studio/Tools/Pandoc.cs @@ -9,13 +9,14 @@ namespace AIStudio.Tools; public static partial class Pandoc { + private const string CPU_ARCHITECTURE = "win-x64"; + private const string DOWNLOAD_URL = "https://github.com/jgm/pandoc/releases/download"; + private const string LATEST_URL = "https://github.com/jgm/pandoc/releases/latest"; + private static readonly ILogger LOG = Program.LOGGER_FACTORY.CreateLogger("PandocService"); - private static readonly string DOWNLOAD_URL = "https://github.com/jgm/pandoc/releases/download"; - private static readonly string LATEST_URL = "https://github.com/jgm/pandoc/releases/latest"; private static readonly Version MINIMUM_REQUIRED_VERSION = new (3, 6); private static readonly Version FALLBACK_VERSION = new (3, 7, 0, 1); - private static readonly string CPU_ARCHITECTURE = "win-x64"; - + /// /// Checks if pandoc is available on the system and can be started as a process or present in AiStudio's data dir ///