Add MarkdownTablePasteService and integrate with NoteEditDialog and PageNoteDialog components

This commit introduces the MarkdownTablePasteService to facilitate markdown table pasting functionality. The service is registered in Program.cs and injected into NoteEditDialog and PageNoteDialog components. Additionally, OnAfterRenderAsync lifecycle methods are implemented in both dialog components to initialize the service after the editor is rendered, enhancing the user experience for note editing. This change supports improved markdown handling within the application.
This commit is contained in:
2026-01-17 11:33:57 -05:00
parent b4c11cd0a6
commit 84b31800ad
6 changed files with 313 additions and 1 deletions
@@ -5,6 +5,7 @@
@inject INotesService NotesService
@inject ISnackbar Snackbar
@inject IDialogService DialogService
@inject MarkdownTablePasteService MarkdownTablePasteService
<MudDialog Class="@MarkdownHelper.GetNoteColorClass(_note.Id)">
<DialogContent>
@@ -42,6 +43,7 @@
public bool IsEdit { get; set; }
private Note _note = null!;
private bool _pasteMarkdownInitialized = false;
private bool IsPageNote => Note?.Title?.StartsWith("@") ?? false;
@@ -55,6 +57,17 @@
};
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender && !_pasteMarkdownInitialized)
{
// Initialize paste-markdown after EasyMDE has rendered
await Task.Delay(150); // Wait for EasyMDE to initialize
await MarkdownTablePasteService.InitializeAsync();
_pasteMarkdownInitialized = true;
}
}
private async Task Save()
{
if (string.IsNullOrWhiteSpace(_note.Title))