@atlaskit/editor-plugin-emoji
Version:
Emoji plugin for @atlaskit/editor-core
29 lines (28 loc) • 1.47 kB
TypeScript
import type { TypeAheadItem } from '@atlaskit/editor-common/types';
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
import type { EmojiDescription, EmojiProvider } from '@atlaskit/emoji';
import type { EmojiPlugin, EmojiPluginState } from './emojiPluginType';
export declare const emojiToTypeaheadItem: (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem;
export declare function memoize<ResultFn extends (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem>(fn: ResultFn): {
call: ResultFn;
clear: () => void;
};
/**
* Emoji plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
* from `@atlaskit/editor-core`.
*/
export declare const emojiPlugin: EmojiPlugin;
/**
*
* Wrapper to call `onLimitReached` when a specified number of calls of that function
* have been made within a time period.
*
* Note: It does not rate limit
*
* @param fn Function to wrap
* @param limitTime Time limit in milliseconds
* @param limitCount Number of function calls before `onRateReached` is called (per time period)
* @returns Wrapped function
*/
export declare function createRateLimitReachedFunction<LimitedFunction extends (...args: any[]) => any>(fn: Function, limitTime: number, limitCount: number, onLimitReached: () => void): (...args: Parameters<LimitedFunction>) => ReturnType<LimitedFunction> | undefined;
export declare const emojiPluginKey: PluginKey<EmojiPluginState>;