Code Monkey home page Code Monkey logo

hypermd-emojione's Introduction

hypermd-emojione

In HyperMD, Use emojione to lookup and display emoji :smile: ๐Ÿ˜„

Demo | GitHub | NPM version

โš ๏ธ License

Please follow https://www.emojione.com/licenses/free if you use this powerpack. ไฝฟ็”จๅ‰่ฏทๆณจๆ„้˜…่ฏป EmojiOne ไฝฟ็”จ่ฎธๅฏ

How to use

  1. install emojione and hypermd-emojione
  2. import before creating HyperMD editor
  3. create HyperMD editor

For webpack / parcel

Install the packages: npm install --save hypermd-emojione emojione

import * as HyperMD from "hypermd"
import "hypermd-emojione"

const your_textarea = document.getElementById('input-box')
const editor = HyperMD.fromTextArea(your_textarea)

For requirejs (example)

In your HTML:

<textarea id="input-box" cols="30" rows="10"># Emoji X emojione :tada:</textarea>

<script src="https://cdn.jsdelivr.net/npm/requirejs/require.js"></script> <!-- ๐Ÿ‘ˆ RequireJS -->
<script src="https://cdn.jsdelivr.net/npm/hypermd/goods/patch-requirejs.js"></script> <!-- ๐Ÿ‘ˆ IMPORTANT -->
<script data-main src="main.js"></script>

In your JavaScript, before defining your main entry, don't forget :

requirejs.config({
  packages: [
    { name: 'hypermd-emojione', main: 'index.js' },
    { name: 'emojione', main: 'lib/js/emojione.min.js' },
  ]
})

Finally, here is an example of main.js and a live demo.

For Plain Browser Env

Why hurting yourself? The bundlers and module loaders are the future!

See the source of example file. Basically, all you need is adding few lines after CodeMirror and HyperMD, before creating your editor:

<script src='https://cdn.jsdelivr.net/npm/emojione@4/lib/js/emojione.min.js'></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/emojione@4/extras/css/emojione.min.css">
<script src="https://cdn.jsdelivr.net/npm/hypermd-emojione/index.js"></script>

Develop

  1. (if needed) update pbe.manifest.json and define modules' global var name
  2. npm run dev
  3. Start test. You have to refresh the page manually...

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.