gdpelican / retort

A reactions plugin for Discourse
MIT License
57 stars 39 forks source link

New feature: Empty emoji ==> line-break in limited set. #33

Closed schungx closed 6 years ago

gdpelican commented 6 years ago

Hm, I'm not rreally a fan of this approach, as it seems a little unintuitive and fragile, plus this doesn't seem like something the admin should care about or necessarily have control over.

I've pushed a fix which puts some sensible layouts on rendering custom emojis up to 25, hopefully that should cover most cases for this.

schungx commented 6 years ago

@gdpelican, I still believe there is a need to give an administrator more control over the layout. You can make it a secret option that only advanced users will know.

I can see you're using the Flex-box to layout the icons in a dynamic grid, which is less convenient than if you just put a wrapper div inside and just flow the icons. Jump to the next line with <br/>. This way you don't have to manually calculate the flex column widths.

And you don't have to keep a mapping table... just sqrt the number of icons and find the closest ceiling integer factor as row width. If you don't like a squarish layout, try a 4:3 layout by dividing the aspect ratio before taking the sqrt -- then scale up again to get the row width.

What about, instead of using a blank entry to force a line-break, you choose some secret unknown emoji (such as \n or line-break). If you don't use flexbox to layout your icons, this will be super-easy, one-liner to add. And you don't have to advertise the functionality until someone asks for it.