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

searchParam option for setting initial value #227

Open
mbostock opened this issue Jun 4, 2022 · 2 comments
Open

searchParam option for setting initial value #227

mbostock opened this issue Jun 4, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@mbostock
Copy link
Member

mbostock commented Jun 4, 2022

It’d be nice if this

viewof id = Inputs.text({label: "id", searchParam: "id"})

were shorthand for this

viewof id = Inputs.text({label: "id", value: new URLSearchParams(location.search).get("id")})
@mbostock mbostock added the enhancement New feature or request label Jun 4, 2022
@mythmon
Copy link
Member

mythmon commented Jun 6, 2022

With the second, I think it's clear that the value from the URL is only an initial value. For the first I would expect the URL would be kept up to date with changes to the input. That would be very cool, but not an exact equivalent. I also think Observable's iframe security model wouldn't allow it, right?

@mbostock
Copy link
Member Author

mbostock commented Jun 6, 2022

I also think Observable's iframe security model wouldn't allow it, right?

Correct, not without reloading.

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

No branches or pull requests

2 participants