Request: Easily insert fa-icons in posts

(PJH) #1

I’d like some way of being able to include fa-icons within posts themselves.

With some of the potential avenues of abuse that have been fixed recently, there appears to be no way, currently, of doing so.

Ideally, it’d be nice to use the syntax Font Awesome themselves recommend, or at least something close to it:

<i class="fa fa-gavel"></i> fa-gavel - fa-gavel

<i class="fa fa-ban red"></i> fa-ban - fa-ban

But failing that, any sort of markup that will allow - at least - selection of icons. Colour even better…

(Manthan Mallikarjun) #2

I dont really think end users would use this.

(PJH) #3

I’ve already had one request for it, and I certainly would, having created a series of posts that use images of fa-icons…

(InsaneMosquito) #4

Just curious…why not? It could look/be used just like existing emoji.

(PJH) #5

That could be an alternative markup actually… (no colours though):

:fa-gavel:, :fa-ban: etc.

(Manthan Mallikarjun) #6

I would too, but that is because I know how to embed fa-icons, but I dont think people would go through the trouble of making an <i> tag. Maybe if it were an kind of like an emoji, then people would use it.

(PJH) #7

Request I had.

Topic I made using images instead. (Edit - changed to link to top of topic)

(Jens Maier) #8

That particular syntax would likely collide with the emoji plugin.

(Sam Saffron) #9

You are going to need a plugin that whitelists this.

I knocked up one real quick

The whitelist there could be narrowed down not to support fa-spin

This concept could be extended to have special auto complete, like the the emoji one does.

To play with this stuff it is critical you have a dev box setup, x32 should work fine, but you will need to follow: to get a basic dev setup going.

@eviltrout we don’t support es6 on serverside includes, huge problem for stuff like this. Also, needing 2 files here seems totally overkill, we should clean that up.

(Robin Ward) #10

I need to get ES6 working on the server side before v1, it is necessary going forward.

Also you’ll only need one file when that happens. All es6 files are included automatically, you can just create the initialzier and be done with it.

(PJH) #11

Thinking about it - got one in mind. Just waiting for another issue to get addressed before I seriously start considering it…

(Sam Saffron) #12

You still need plugin.rb though for the metadata etc.

(Abhishek Gupta) #13

You will it be all like , we can plugins by just importingDiscourse and the module we need to modify behaviour for? like

import Discourse from "discourse" ;
import Discourse.LinkController from "discourse/controller" ;
Discourse.LinkController.extend({ sumthing here });

(Robin Ward) #14

It will be better to create initializers that look up the factories of the components using the container, as it guarantees it will be added when the app starts up, plus you can specify a dependency graph.

(Robin Ward) #15

I personally don’t like shoving a bunch of JS in the ruby code. It’s not formatted properly by my text editor nor is it linted properly by jshint. I think the experience is much better with a separate file.