Extensions

emoji

Behaviour takes options 0.94 kB gzipped

Emoji as you type: `:tada:` becomes 🎉 the moment the closing colon lands.

Detection only, like mentions and slash commands — a picker is an interface, and `suggestion({ char: ':' })` plus `searchEmoji` are what one is built on.

1 · Install

One package for every extension · there is no @matrajs/emoji to install.

npm i @matrajs/core

2 · Add it to the editor

Import it and put it in the extensions array. That array is the whole feature list: what is not in it is not in your bundle and not in the document's schema.

import { createEditor, document, paragraph, text, emoji } from '@matrajs/core'

const editor = createEditor({
  extensions: [document, paragraph, text, emoji({ … })],
  element: document.querySelector('#editor'),
})

3 · Use it

Nothing to call · this one works once it is in the array. Emoji as you type: `:tada:` becomes 🎉 the moment the closing colon lands.

Options

emoji is a function · call it with an options object.

Option Type What it does
emojis Record<string, string> Your own shortcodes, added to or overriding the built-in set.
emoticons boolean Also replace `:)`, `:(`, `<3` and friends as they are typed. Default false.

← All 83 extensions

Edit this page on GitHub