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

Make hash configurable #8596

Closed
SebCorbin opened this issue Aug 5, 2019 · 5 comments
Closed

Make hash configurable #8596

SebCorbin opened this issue Aug 5, 2019 · 5 comments

Comments

@SebCorbin
Copy link
Contributor

SebCorbin commented Aug 5, 2019

Motivation

Hash option is a boolean, if we set it, we can't use location.hash for anything else other than the mapbox hash. It would be nice to implement a query parameter style, if defined, like myurl.org/mymap#map=10.37/14.589/-61.0225&config=myotheroptions.
This is useful for permalinks for application containing a configurable map of anything else actually.

Design Alternatives

Add an optional (to prevent breaking change) hashName option, that if defined, make the hash a query parameter-styled string.

Implementation

Add and document this option, modify ui/hash.js so that it replaces (if defined), only the hashName part of the map.

@asheemmamoowala
Copy link
Contributor

@SebCorbin Thanks for the proposal. Would you be interested in implementing it as well? The changes should be limited to https://github.com/mapbox/mapbox-gl-js/blob/master/src/ui/hash.js and fairly isolated to test.

@SebCorbin
Copy link
Contributor Author

Sure, I have a PR in progress, I think I'll drop the hashName in favor of a hash option that can be boolean or string. I see that you support IE11, so I may not use URLSearchParams, right?

@andrewharvey
Copy link
Collaborator

Related to #7725. I like this approach to make it more flexible and let the developer choose the name they want to use.

SebCorbin pushed a commit to makinacorpus/mapbox-gl-js that referenced this issue Aug 6, 2019
@SebCorbin SebCorbin mentioned this issue Aug 6, 2019
7 tasks
SebCorbin pushed a commit to makinacorpus/mapbox-gl-js that referenced this issue Aug 6, 2019
@JesseWeinstein
Copy link

I'm very glad to see this -- please consider also allowing the named form as a input only alternative, ideally on by default. That way all maps using mapbox-gl will automatically be able to accept pasted-in URLs from OSM without barfing.

@andrewharvey
Copy link
Collaborator

was closed by #8603

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants