project panel: Always show paste in context menu (and grey it out when it's disabled) (#17262)

![image](https://github.com/user-attachments/assets/df471567-bdb9-494b-96a5-84d1da47583f)

Release Notes:

- "Paste" is now always shown in project panel context menu.
This commit is contained in:
Piotr Osiewicz 2024-09-02 13:44:21 +02:00 committed by GitHub
parent b578be5c77
commit b6cf576d66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 53 additions and 8 deletions

View file

@ -499,8 +499,12 @@ impl ProjectPanel {
.action("Copy", Box::new(Copy))
.action("Duplicate", Box::new(Duplicate))
// TODO: Paste should always be visible, cbut disabled when clipboard is empty
.when(self.clipboard.as_ref().is_some(), |menu| {
menu.action("Paste", Box::new(Paste))
.map(|menu| {
if self.clipboard.as_ref().is_some() {
menu.action("Paste", Box::new(Paste))
} else {
menu.disabled_action("Paste", Box::new(Paste))
}
})
.separator()
.action("Copy Path", Box::new(CopyPath))