Pictogrammers / Browser-Icon-Picker

A cute Material Design Icons icon picker for your web browser.
GNU General Public License v2.0
68 stars 7 forks source link

Enhancement: Auto-preview generation #25

Closed mririgoyen closed 3 years ago

mririgoyen commented 5 years ago

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: image

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. :)

Templarian commented 5 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. 😃

mririgoyen commented 5 years ago

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!

quentin-st commented 5 years ago

@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 :-)

PeterShaggyNoble commented 5 years ago

See also 😉

quentin-st commented 5 years ago

Nice!

quentin-st commented 3 years ago

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?

mririgoyen commented 3 years ago

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.

quentin-st commented 3 years ago

Done! Since most users would not need this options, I added a "dev tools" toggle in the main dropdown:

image

When enabled, it adds the "Copy preview image" option in the icon dropdown:

image

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!

vector-square