extensions: Add copy author info button in context menu (#27221)

Closes #26108

Add "Copy Author Info" button to extension context menu.

Release Notes:

- Added option to copy extension author's name and email from extension
context menu.
This commit is contained in:
Smit Barmase 2025-03-21 03:45:06 +05:30 committed by GitHub
parent bc1c0a2297
commit 9134630841
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -612,6 +612,7 @@ impl ExtensionsPage {
self.buttons_for_entry(extension, &status, has_dev_extension, cx); self.buttons_for_entry(extension, &status, has_dev_extension, cx);
let version = extension.manifest.version.clone(); let version = extension.manifest.version.clone();
let repository_url = extension.manifest.repository.clone(); let repository_url = extension.manifest.repository.clone();
let authors = extension.manifest.authors.clone();
let installed_version = match status { let installed_version = match status {
ExtensionStatus::Installed(installed_version) => Some(installed_version), ExtensionStatus::Installed(installed_version) => Some(installed_version),
@ -749,6 +750,7 @@ impl ExtensionsPage {
Some(Self::render_remote_extension_context_menu( Some(Self::render_remote_extension_context_menu(
&this, &this,
extension_id.clone(), extension_id.clone(),
authors.clone(),
window, window,
cx, cx,
)) ))
@ -761,6 +763,7 @@ impl ExtensionsPage {
fn render_remote_extension_context_menu( fn render_remote_extension_context_menu(
this: &Entity<Self>, this: &Entity<Self>,
extension_id: Arc<str>, extension_id: Arc<str>,
authors: Vec<String>,
window: &mut Window, window: &mut Window,
cx: &mut App, cx: &mut App,
) -> Entity<ContextMenu> { ) -> Entity<ContextMenu> {
@ -782,6 +785,12 @@ impl ExtensionsPage {
cx.write_to_clipboard(ClipboardItem::new_string(extension_id.to_string())); cx.write_to_clipboard(ClipboardItem::new_string(extension_id.to_string()));
} }
}) })
.entry("Copy Author Info", None, {
let authors = authors.clone();
move |_, cx| {
cx.write_to_clipboard(ClipboardItem::new_string(authors.join(", ")));
}
})
}); });
context_menu context_menu