Add url preview tooltip to repository link in extensions view (#8179)
Because the `repository` url field is defined via the user's `extension.json` file, a user could insert a malicious link. I want to be able to preview repository urls before clicking the button. Release Notes: - Add url preview tooltip to repository link in extensions view.
This commit is contained in:
parent
38c3a93f0c
commit
e5d971f4c7
1 changed files with 4 additions and 2 deletions
|
@ -11,7 +11,7 @@ use settings::Settings;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::{ops::Range, sync::Arc};
|
use std::{ops::Range, sync::Arc};
|
||||||
use theme::ThemeSettings;
|
use theme::ThemeSettings;
|
||||||
use ui::prelude::*;
|
use ui::{prelude::*, Tooltip};
|
||||||
|
|
||||||
use workspace::{
|
use workspace::{
|
||||||
item::{Item, ItemEvent},
|
item::{Item, ItemEvent},
|
||||||
|
@ -195,6 +195,7 @@ impl ExtensionsPage {
|
||||||
.color(Color::Accent);
|
.color(Color::Accent);
|
||||||
|
|
||||||
let repository_url = extension.repository.clone();
|
let repository_url = extension.repository.clone();
|
||||||
|
let tooltip_text = Tooltip::text(repository_url.clone(), cx);
|
||||||
|
|
||||||
div().w_full().child(
|
div().w_full().child(
|
||||||
v_flex()
|
v_flex()
|
||||||
|
@ -269,7 +270,8 @@ impl ExtensionsPage {
|
||||||
.style(ButtonStyle::Filled)
|
.style(ButtonStyle::Filled)
|
||||||
.on_click(cx.listener(move |_, _, cx| {
|
.on_click(cx.listener(move |_, _, cx| {
|
||||||
cx.open_url(&repository_url);
|
cx.open_url(&repository_url);
|
||||||
})),
|
}))
|
||||||
|
.tooltip(move |_| tooltip_text.clone()),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue