@tiptap-extend/emoji-replacer
TypeScript icon, indicating that this package has built-in type declarations

2.1.6 • Public • Published

@tiptap-extend/emoji-replacer

npm version

Description

This is a plugin to customize emoji replacements in the tiptap editor. The extensions includes many default replacements which can be overriden if the find option is duplicated.

see source code for the list of default configs

A usecase for this is to add replacements for emoji short codes.

See example below

Usage

import { Editor } from '@tiptap/core';
// ... extensions
import { EmojiReplacer } from '@tiptap-extend/emoji-replacer';

new Editor({
  element: document.body,
  extensions: [
    // ... extensions
    EmojiReplacer.configure({
      // list of rule configs that will be replaced in the editor
      ruleConfigs: [
        {
          find: ':100:',
          replace: '💯',
        },
      ],
      // adds an extra space at the end of the `find` option
      shouldUseExtraLookupSpace: false,

      // adds an extra space at the end of the `replace` option
      shouldUseExtraReplacementSpace: true,
    }),
  ],
});

Development

This library was generated with Nx.

Building

Run nx build emoji-replacer to build the library.

Running unit tests

Run nx test emoji-replacer to execute the unit tests via Jest.

Package Sidebar

Install

npm i @tiptap-extend/emoji-replacer

Weekly Downloads

61

Version

2.1.6

License

MIT

Unpacked Size

17.1 kB

Total Files

8

Last publish

Collaborators

  • lwhiteley