How to use the draft-js-mention-plugin/lib/utils/getTypeByTrigger function in draft-js-mention-plugin

To help you get started, we’ve selected a few draft-js-mention-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oneteam-dev / oneteam-rte / src / plugins / mention / index.js View on Github external
import merge from 'lodash/merge';
import draftJsMentionPlugin from 'draft-js-mention-plugin';
import getTypeByTrigger from 'draft-js-mention-plugin/lib/utils/getTypeByTrigger';
import createPositionSuggestions from '../helpers/createPositionSuggestions';
import Mention from './components/Mention';

export const mentionTrigger = '@';
export const entityType = getTypeByTrigger(mentionTrigger);
export const mentionEntityType = entityType; // alias
export const entityMutability = 'IMMUTABLE';
export const mentionRegExp = '[\\-\\w\u4e00-\u9eff\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7A3\u3130-\u318F]*';

export const defaultConfig = {
  mentionTrigger,
  entityMutability,
  positionSuggestions: createPositionSuggestions(
    'bottom',
    ({ state, props }) => state.isActive && props.suggestions.length > 0
  ),
  mentionRegExp,
  mentionComponent: Mention
};

const createMentionPlugin = config => {

draft-js-mention-plugin

Mention Plugin for DraftJS

MIT
Latest version published 5 years ago

Package Health Score

67 / 100
Full package analysis