AI-Studio/app/MindWork AI Studio/Tools/Services/MarkdownClipboardService.cs

20 lines
764 B
C#
Raw Normal View History

2024-05-04 08:47:42 +00:00
// ReSharper disable ClassNeverInstantiated.Global
2024-08-21 06:30:01 +00:00
namespace AIStudio.Tools.Services;
2024-05-04 08:47:42 +00:00
/// <summary>
2024-08-21 06:30:01 +00:00
/// Wire up the clipboard service to copy Markdown to the clipboard.
2024-05-04 08:47:42 +00:00
/// We use our own Rust-based clipboard service for this.
/// </summary>
2024-09-01 18:10:03 +00:00
public sealed class MarkdownClipboardService(RustService rust, ISnackbar snackbar) : IMudMarkdownClipboardService
2024-05-04 08:47:42 +00:00
{
private ISnackbar Snackbar { get; } = snackbar;
2024-09-01 18:10:03 +00:00
private RustService Rust { get; } = rust;
2024-05-04 08:47:42 +00:00
/// <summary>
2024-09-01 18:10:03 +00:00
/// Gets called when the user wants to copy the Markdown to the clipboard.
2024-05-04 08:47:42 +00:00
/// </summary>
/// <param name="text">The Markdown text to copy.</param>
2024-09-01 18:10:03 +00:00
public async ValueTask CopyToClipboardAsync(string text) => await this.Rust.CopyText2Clipboard(this.Snackbar, text);
2024-05-04 08:47:42 +00:00
}