GithubHelp home page GithubHelp logo

gdseller / emoji-picker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jmadler/emoji-picker

0.0 2.0 0.0 3.3 MB

Add a slick emoji selector to input fields and textareas on your website.

Home Page: http://one-signal.github.io/emoji-picker/

License: Other

CSS 6.77% HTML 2.00% JavaScript 89.73% CoffeeScript 1.50%

emoji-picker's Introduction

Emoji Picker

๐Ÿ˜ ๐Ÿ˜œ ๐Ÿ˜‚ ๐Ÿ˜› Instantly add Emoji support to input fields on your website! ๐Ÿ’ฅ โœจ ๐Ÿ‘ ๐Ÿค˜

Example Screenshot

Demo: http://one-signal.github.io/emoji-picker/

#You get:

  • Input fields converted to contenteditable rich text areas with emoji support
  • A happy face icon on the top right of each rich text area, which brings up the menu on click
  • An emoji selection menu, with recently selected emojis at the top (thanks to angular-emoji-popup's author)
  • Text area values can be easily converted between Unicode and HTML (Unicode+Image Tags)

#What happens under the hood:

  • When you call new EmojiPicker().discover(), all elements with the data attribute data-emojiable="true" are found, a contenteditable div is created after each one, and the original input field is hidden.
  • When you type text into this contenteditable div, events are triggered upon each keypress/text change as well as each emoji selection, and the contents of this contenteditable div are copied to the original (now hidden) input field
  • Text entered into this contenteditable div is plain text; selected emojis are actually <img> tags
  • To get the value of the contenteditable div, call element.val() on the underlying hidden input field. The <img> emojis will be converted into Unicode emojis (plain text)

#Credits: This is a slightly modified version of angular-emoji-popup, which was written based on jquery-emojiarea (converts input fields to rich emoji input areas) and uses nanoScrollerJs (for the popup's custom-skinned scrollbar). This version removes AngularJS as a dependency.

#Improvements from the original forks:

  • The top-right smiley face that allows you to bring up the emoji picker menu
  • The smiley face shifts left appropriately when text entered exceeds the height and causes a scrollbar to appear
  • The maxlength property of input fields is respected (emoji selections count as a single character)
  • CSS classes from the original input field are copied over to the new contenteditable div

We built this to power emoji selection for OneSignal, our multi-platform push notification service.

emoji-picker's People

Contributors

gdeglin avatar

Watchers

James Cloos avatar Eric Ting avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.