rinja-rs / play-rinja

Rinja Playground | Online Preview
https://rinja-rs.github.io/play-rinja/
Apache License 2.0
1 stars 0 forks source link

Store state in URL #11

Closed Kijewski closed 3 months ago

GuillaumeGomez commented 3 months ago

I had something different in mind. First, the hash (#) is for anchors, a DOM element with the ID provided with the hash. So it'd be better to use URL parameters instead (like tpl_src=blabla&struct_src=yeye).

Also, I hash in mind a "share" button which would generate URLs to provide others and would generate only when cliked. And finally, don't watch over URL changes. If the URL change, it will simply reload the page and that's when the script will check for the URL parameters.

Sorry, should have been more clear about what I had in mind. ^^'

Also I didn't expect you to implement it so fast. XD

Kijewski commented 3 months ago

Using the anchor to store a state is fine. It's still used by many applications. It's just that twitter, facebook etc. used it wrong anno 2010, what gave this method a bad rep.

But I added a share button, now, that uses query parameters.

Are you maybe inclined to make the share button + dialog pretty? Maybe you have something you just can copy+paste? :)

GuillaumeGomez commented 3 months ago

I can definitely improve looks. Give me a few minutes to check locally.

Kijewski commented 3 months ago

The copy-to-clipboard button does not work locally, because it works only over an HTTPS connection. But I am fairly confident that it would work. :D

GuillaumeGomez commented 3 months ago

It works on rustdoc without trouble though. I'll take a look at it too. :)

GuillaumeGomez commented 3 months ago

Ok, I think I'm mostly done with UI improvements. Please take a look and tell me if it looks all good to you. :)

GuillaumeGomez commented 3 months ago

Forgot to check the copy to clipboard bug. XD

GuillaumeGomez commented 3 months ago

Fixed the copy to clipboard. ^^'

Kijewski commented 3 months ago

I like the new menu! But it does not seem to work a 100%. When I they to switch the theme, then the click to open the drop down list of the select also closes the menu.

GuillaumeGomez commented 3 months ago

Ah indeed. Event propagation is a bit different apparently. Anyway, fixed it.

GuillaumeGomez commented 3 months ago

Removed the changes in "copy to clipboard".

Kijewski commented 3 months ago

Thank you very much for adding the menu and styles! I did some minor changes to the spacing and such. IMHO it's quite perfect now, but I might be a little biased. :)

GuillaumeGomez commented 3 months ago

Looks all good. :)

Kijewski commented 3 months ago

https://rinja-rs.github.io/play-rinja/?saved=eJwrM2QISUxJVGTwLFEozy_KLlaw0gQAPIIF2Q.. :D

GuillaumeGomez commented 3 months ago

That's super cool. Great work! :D