[frontend/components] Add copy contents button to note footer menu

This commit is contained in:
pancakes 2025-02-26 00:27:29 +10:00
parent 039d7b2931
commit ba784683d4
No known key found for this signature in database

View file

@ -109,6 +109,12 @@
<Text>@Loc["Copy link (remote)"]</Text> <Text>@Loc["Copy link (remote)"]</Text>
</MenuElement> </MenuElement>
} }
@if (!string.IsNullOrWhiteSpace(Note.Text))
{
<MenuElement Icon="Icons.Copy" OnSelect="CopyContents">
<Text>@Loc["Copy contents"]</Text>
</MenuElement>
}
@if (Note.User.Id == Session.Current?.Id) @if (Note.User.Id == Session.Current?.Id)
{ {
<hr class="rule"/> <hr class="rule"/>
@ -154,6 +160,8 @@
private void CopyLinkRemote() => Js.InvokeVoidAsync("navigator.clipboard.writeText", Note.Url); private void CopyLinkRemote() => Js.InvokeVoidAsync("navigator.clipboard.writeText", Note.Url);
private void CopyContents() => Js.InvokeVoidAsync("navigator.clipboard.writeText", Note.Text);
private void Like() private void Like()
{ {
_ = NoteActions.ToggleLikeAsync(Note); _ = NoteActions.ToggleLikeAsync(Note);