inputs icon indicating copy to clipboard operation
inputs copied to clipboard

searchParam option for setting initial value

Open mbostock opened this issue 3 years ago • 2 comments

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 avatar Jun 04 '22 15:06 mbostock

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?

mythmon avatar Jun 06 '22 15:06 mythmon

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

Correct, not without reloading.

mbostock avatar Jun 06 '22 15:06 mbostock