mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-08-20 16:32:57 +00:00
Handled nullable content and improved null checks in MudCopyClipboardButton.
This commit is contained in:
parent
e4cd2a75a1
commit
eca0d33da3
@ -48,10 +48,10 @@ public partial class MudCopyClipboardButton : ComponentBase
|
|||||||
|
|
||||||
private async Task HandleCopyClick()
|
private async Task HandleCopyClick()
|
||||||
{
|
{
|
||||||
if (this.Type == ContentType.NONE)
|
if (this.Type is ContentType.NONE)
|
||||||
await this.CopyToClipboard(this.StringContent);
|
await this.CopyToClipboard(this.StringContent);
|
||||||
else
|
else
|
||||||
await this.CopyToClipboard(this.Content!);
|
await this.CopyToClipboard(this.Content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -65,8 +65,11 @@ public partial class MudCopyClipboardButton : ComponentBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copy this block's content to the clipboard.
|
/// Copy this block's content to the clipboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task CopyToClipboard(IContent contentToCopy)
|
private async Task CopyToClipboard(IContent? contentToCopy)
|
||||||
{
|
{
|
||||||
|
if (contentToCopy is null)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (this.Type)
|
switch (this.Type)
|
||||||
{
|
{
|
||||||
case ContentType.TEXT:
|
case ContentType.TEXT:
|
||||||
|
Loading…
Reference in New Issue
Block a user