Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add hyperlink in ui and text example #568

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

add hyperlink in ui and text example #568

wants to merge 3 commits into from

Conversation

chaosprint
Copy link
Contributor

@chaosprint chaosprint commented Jul 7, 2023

2023-07-07.09-00-18.mp4

@chaosprint chaosprint requested a review from philpax July 7, 2023 07:20
ambient_project = { path = "../../shared_crates/project" }
ambient_shared_types = { path = "../../shared_crates/shared_types", features = [
"native",
] }

webbrowser = "0.8.10"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good idea to use open, which we have a workspace dep for. Not sure if it'd be a security risk, though - does open::that("explorer.exe") work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good idea to use open, which we have a workspace dep for. Not sure if it'd be a security risk, though - does open::that("explorer.exe") work?

open works.
I am not on Windows so I am not sure of the latter. Isn't that only used for URL? https://docs.rs/open/latest/open/

) -> Element {
crate::prelude::Button::new(&url.clone(), move |world| {
println!("Opening url {}", &url);
let link = Entity::new().with(hyperlink(), url.clone());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth adding a function for this instead of an entity. That would also allow us to return an error if we find the thing that's being opened to be invalid/questionable.

Copy link
Contributor Author

@chaosprint chaosprint Jul 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth adding a function for this instead of an entity. That would also allow us to return an error if we find the thing that's being opened to be invalid/questionable.

I tried before to call webbrowser here but get a 'wbindgen_placeholder' error. That's why I have to send to the world and watch it. Perhaps we can do the check there and then decide whether we want to open it or not?

--- edit

cannot put open here as well. so it has to communicate with backend?

@chaosprint chaosprint marked this pull request as draft July 7, 2023 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants