Over on TDWTF, I’ve been using a bot to automatically replace Unicode emoji like with Discourse emoji codes like :smile:
; it’s useful when posting from mobile. @codinghorror suggests it could be made a Discourse feature; it never occurred to me before, but it does sound like it’d be useful. That way it could also work in PMs, which is something I haven’t got working in my bot yet.
This is what happened with my first post on the Nexus @codinghorror sent me! I was thinking about that concept too. Glad I’m not the only one.
Would we not be able to do something like this already by using…
Discourse.Dialect.registerEmoji('☺', '/plugins/trout_emoji/images/trout-square.jpg');
Or something along those lines?
Not that trivial to do efficiently, see:
In particular you need to map the unicode → code points → emoji image. This means that we need to scan through every char and check it to see if its an emoji.
We can not afford to cripple the editor here so whatever we do needs to be using lots of fancy tricks.
Does it need to be done in the editor though? On desktop, people will normally use the Discourse emoji code auto-complete instead of Unicode emoji; it’s only really those on mobile (which has no preview pane IIRC) that will be using Unicode emoji.
No, this should only be done server side on post bake. No need to clutter the client with this.
Server side this is much more practical, we already do a bunch of nokogiri passes.
Any particular benefit for this? Using Discourse™ and other programs under Linux© I usually typing emoji at least ¾ of the time inline using Compose - can make most of the really common ones even ← arrows →.
That’s right - I’m the ♔ of edge user cases.
Isn’t Emoji One designed to do exactly this?
Although I guess that would only replace with Emoji One emojis rather than the forum’s customised emoji choices.
Mostly for those on Windows 7 and other older OS’s that don’t have extensive Unicode emoji support, so they don’t see loads of little squares
Just commenting to add that there is a similar thread in the markdown community considering adding emoji directly to markdown.
I’m of the opinion that it should be kept separate as a postprocessor, and that discourse could lead by example by creating/implementing a post-processor for emoji support. It wouldn’t be that difficult to scan through the DOM and replace patterns in text nodes with their emoji equivalents.
Pretty sure this topic is a duplicate of this one:
I disagree; the title of that topic alone rules it out from being a duplicate. Sorry.
It is exactly the same issue as here, we should close one of them and if we prefer the title here then just keep this and close the old one as dupe.
When I was at Red Dot Ruby conf, Juanito said he may look at implementing this.
Will invite him here in case he is still up to it, Juanito loves Emoji
What’s the impact going to be for those of us who embed Discourse content elsewhere, such as back into WordPress?
It means when I post on iPhone and enter Emojis direct we would replace them with images, when cooking. It improves the embedding story AND ensures posts look consistent across all browsers. (and no one has ugly square blocks or monochrome emojis)
That sounds so awesome I’m surprised it’s not already a thing.
This is planned, we want to do it just have not had time, PR totally welcome (but we will eventually get to it)
Is this something you want to take on when you’re back @eviltrout? Maybe you could scope the work.