@page "/editProfile" @inject NavigationManager Nav @inject RestService api @inject State State @inject IJSRuntime JS
Advanced Style you include here will be places in a <style> element in your page’s <head>.
Anything you put here will be included in your page’s <head> element.
@code { private MarkdownEditor? Editor; private string? markdownValue; private string? css; private string? head; private bool loading = false; protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); ProfileResponseData? data = await api.GetProfile(State.SelectedAddressName!); if (data != null) { markdownValue = data.Content; css = data.Css; head = data.Head; await Editor!.SetValueAsync(markdownValue); } await InvokeAsync(StateHasChanged); } Task OnMarkdownValueChanged(string value) { return Task.CompletedTask; } public async Task Save() { loading = true; await InvokeAsync(StateHasChanged); var result = await api.PostProfile(State.SelectedAddressName!, new PostProfile() { Content = markdownValue ?? string.Empty, Css = string.IsNullOrEmpty(css) ? null : css, Head = string.IsNullOrEmpty(head) ? null : head }); if (result != null) { await State.RefreshNow(); await InvokeAsync(StateHasChanged); Nav.NavigateTo($"/person/{State.SelectedAddressName}#profile"); } loading = false; } public async Task OnCustomButtonClicked(MarkdownButtonEventArgs eventArgs) { if (eventArgs.Name == "Help") { await JS.InvokeVoidAsync("open", "https://home.omg.lol/info/editor", "_blank"); } } }