Closed mririgoyen closed 3 years ago
[![icon-name](https://materialdesignicons.com/icon/icon-name)](https://materialdesignicons.com/icon/icon-name)
Actually will place an image. We scan the headers for an image request and return an image preview. 😃
That actually could make this insanely easy if extensions can work with the clipboard. Copy that string to my clipboard so I can just paste it in!
@Templarian Awesome! Is there any endpoint documentation anywhere? Seems that GitHub loads this image on the server-side of https://github.com/preview
@goyney I think that's doable, I'll have to do some experiments first :-)
See also 😉
Nice!
Hey there!
I finally can find some time to tackle this one, sorry about the tiny delay.
Unfortunately, extensions aren't allowed to trigger external XHR (the extension would be rejected, at least on Firefox), so we can't stream http://mdi.houseofdesign.ie/tools/preview/?icon=vector-square&action=link
's response to the clipboard. The alternative would be to generate it in the extension.
@Templarian 's alternate proposal would be really easy to achieve (putting [![icon-name](https://materialdesignicons.com/icon/icon-name)](https://materialdesignicons.com/icon/icon-name)
in the clipboard): would that suit your need?
Yeah that would be fine with me, it may not be super useful to other people using the addon because it would be GitHub specific there, but it would still be a big time saver for us maintainers if you decided to add it.
Done! Since most users would not need this options, I added a "dev tools" toggle in the main dropdown:
When enabled, it adds the "Copy preview image" option in the icon dropdown:
I also added subtitles to each dropdown item to make it even more explicit.
What do you think? This will be released on the next update, when 6.2.95 is up!
There's many times I find myself wanting to grab the current version of an icon when answering issues for MDI. For me to do that currently, I have to find the icon in the add-on, open it up on the website, click "View SVG", copy paste the path data, go to the preview generator, paste it in, type in the name, flip the WIP switch, copy the image, go back to the issue, and finally paste it. Whew!
It would be a very welcome feature if there was another button at the bottom of the UI that, when an icon was selected, could be clicked that would generate the image and then:
The auto-generated image I'm speaking about looks like this:
The code that generates this image can be found here: https://github.com/goyney/MaterialDesign-Site/blob/master/src/app/githubPage/githubPage.component.ts
I'm sure @Templarian wouldn't mind if you borrowed it. :)