@page "/editNow"
@inject NavigationManager Nav
@inject RestService api
@inject State State
@code {
MarkdownEditor Editor;
bool listed;
string markdownValue;
string markdownHtml;
protected override async Task OnInitializedAsync() {
await base.OnInitializedAsync();
NowContentData? data = await api.GetNowPage(State.SelectedAddressName);
if (data != null)
{
listed = data.Listed == 1;
markdownValue = data.Content;
await Editor.SetValueAsync(markdownValue);
}
InvokeAsync(StateHasChanged);
}
Task OnMarkdownValueChanged(string value) {
return Task.CompletedTask;
}
public async Task Save() {
await api.PostNowPage(State.SelectedAddressName, markdownValue, listed);
}
}