docs: add a StackBlitz "Try It" button in code examples#35644
docs: add a StackBlitz "Try It" button in code examples#35644
Conversation
|
Can anyone review this? |
|
Hello @PuruVJ . Thank you for your contribution. We may see that we are only a few people here for reviews, so please have patience I did a check on the netlify preview and got this (on several examples) |
|
That's strange. I'll look into it |
|
@GeoSot can you try disabling your adblocker/Brave shields on stackblitz? Cuz it is working perfectly for me 🤔 |
|
To be honest, I love it 😍 Wish the rest of the team have the same opinion
It seems related to firefox on both linux & win10 systems. Edge & chrome are fine |
|
I don't like the fact we load this in all pages and it definitely needs some more tweaks... |
|
Also, the fact that this doesn't work with Firefox is a huge downside to the point we shouldn't land it unless fixed. |
|
@XhmikosR True, it makes no sense if it can't work on the major browsers. I'll look into it |
ffoodd
left a comment
There was a problem hiding this comment.
A few things to improve and consider. The feature looks like a good idea IMHO. :)
It's not a matter of size only. JS affects execution time and everything. I find no reason to include it everywhere. Also, we should load the script from our server which is where we are loading all assets from. |
|
Alright. So can you help me with where to put the script? Or am I on my own for that part? I have a way in mind to selectively load but it's horribly hacky and I wanna get suggestions before from people who know the codebase better than me 🙂 |
|
Please don't mark this as ready. It's broken right now. |
|
The title is still wrong AFAICT. |
|
The title is good now. I just checked on my own. Can you share ss of what yur seeing? |
|
Copy to Clipboard is shown on the Try it button as one can see in the preview. |
|
I am seeing this locally. Can you share the netlify preview? CleanShot.2022-03-02.at.14.34.18.mp4 |
|
Oof my bad. Just fixed now |
|
Cool, it works now. One last thing I notice is that the Try button's tooltip is still shown even after closing the StackBlitz tab. |
|
...and for some reason the HTML tab is empty on Edge Chromium, and I get nothing loaded on Firefox. These 2 issues are probably not related to this PR, something looks broken on their side. |
I tried to handle it, using a fabulous timeout. It closes the tip, opens the new window... and we are fine. Hope you don't mind, I pushed two minor changes. One typo and the other forces the stackblitz editor to open the file In short, if we do not want any other optimizations, I think we are good to go 😮 (The only optimization I can think of, is to use the stackblitz post api , instead of SDK (only 2kb), but I suppose we can leave this way) |
|
Hi, might I ask what is the blocker in merging this 🙂 |
|
I'd still like the Firefox Private Window to be fixed somehow upstream, but for now I don't think there's anything we can do here :/ We can revisit loading and stuff later if needed. @PuruVJ Thanks for your patience and your contribution! |


Based on #35188, this PR adds the "Edit" button on code examples, clicking which will open up stackblitz editor in new tab with the code example in mind.
Here's a video:
CleanShot.2022-01-03.at.00.29.35.mp4
Preview: https://deploy-preview-35644--twbs-bootstrap.netlify.app/