@remirror/extension-callout
v3.0.1
Published
Add callouts to your text editor.
Downloads
145,183
Readme
@remirror/extension-callout
Add callouts to your text editor.
Installation
# yarn
yarn add @remirror/extension-callout
# pnpm
pnpm add @remirror/extension-callout
# npm
npm install @remirror/extension-callout
Usage
The following code creates an instance of this extension.
import { CalloutExtension } from '@remirror/extension-callout';
const extension = new CalloutExtension();
To render a emoji at the front.
import { CalloutExtension } from '@remirror/extension-callout';
const basicExtensions = () => [new CalloutExtension({ renderEmoji, defaultEmoji: '💡' })];
/**
* If you want to update the emoji to a new one,
* you can dispatch a transaction to update the `emoji` attrs inside this function.
*/
const renderEmoji = (node: ProsemirrorNode) => {
const emoji = document.createElement('span');
emoji.textContent = node.attrs.emoji;
return emoji;
};