feat: edit print templates on the printer page and store them on presets
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -38,4 +38,55 @@ public class MarkdownTablePasteService
|
||||
_logger.LogError(ex, "Unexpected error initializing paste-markdown for editor {EditorId}", editorId ?? "unknown");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<string?> GetValueAsync(string editorId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _jsRuntime.InvokeAsync<string?>("markdownTablePaste.getValue", editorId);
|
||||
}
|
||||
catch (JSDisconnectedException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (JSException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to read markdown editor {EditorId}", editorId);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> SetValueAsync(string editorId, string text)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _jsRuntime.InvokeAsync<bool>("markdownTablePaste.setValue", editorId, text);
|
||||
}
|
||||
catch (JSDisconnectedException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
catch (JSException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to set markdown editor {EditorId}", editorId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> InsertAtCursorAsync(string editorId, string text)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _jsRuntime.InvokeAsync<bool>("markdownTablePaste.insertAtCursor", editorId, text);
|
||||
}
|
||||
catch (JSDisconnectedException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
catch (JSException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to insert into markdown editor {EditorId}", editorId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user