.NET 8 Blazor add a component

279 Views Asked by At

In my new .NET 8 Blazor solution, I have 2 projects, LIU.Website and LIU.Website.Client. Those projects were created by Visual Studio 2022 Preview.

enter image description here

Now, I want to add a component for the Markdown editor and I follow the instructions to configure the component. In the LIU.Website, I opened App.razor and add the CSS in the header

<link href="/_content/PSC.Blazor.Components.MarkdownEditor/css/alert.css" rel="stylesheet" />
<link href="/_content/PSC.Blazor.Components.MarkdownEditor/css/easymde.min.css" rel="stylesheet" />

and the JavaScript at the bottom of the page

<script src="/_content/PSC.Blazor.Components.MarkdownEditor/js/mermaid.min.js"></script>
<script src="/_content/PSC.Blazor.Components.MarkdownEditor/js/easymde.min.js"></script>
<script src="/_content/PSC.Blazor.Components.MarkdownEditor/js/markdownEditor.js"></script>

When I render a page with the component, the page is not executing the JavaScript but the CSS and the JavaScript are loaded. The component uses JavaInterop to call the JavaScript to configure the textarea as the Markdown Editor.

enter image description here

I put a breakdown but the application is not calling this function at all.

0

There are 0 best solutions below