UNPKG

@yuntijs/ui

Version:

☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps

33 lines (32 loc) 1.19 kB
/** * source: * https://github.com/sodenn/lexical-beautiful-mentions/blob/8d2c8fbfaa63fe0100ac9f6c4bcb61e816d14a30/plugin/src/mention-converter.ts */ import { LexicalNode, TextNode } from 'lexical'; interface MentionEntry { type: 'mention-node'; trigger: string; value: string; } interface TextEntry { type: 'custom-text'; value: string; } type Entry = MentionEntry | TextEntry; export declare function convertToMentionEntries(text: string, triggers: string[], punctuation: string): Entry[]; /** * Utility function that takes a string or a text nodes and converts it to a * list of mention and text nodes. * * 🚨 Only works for mentions without spaces. Ensure spaces are disabled * via the `allowSpaces` prop. */ export declare function $convertToMentionNodes(textOrNode: string | TextNode, triggers: string[], punctuation?: string): LexicalNode[]; /** * Transforms text nodes containing mention strings into mention nodes. * * 🚨 Only works for mentions without spaces. Ensure spaces are disabled * via the `allowSpaces` prop. */ export declare function $transformTextToMentionNodes(triggers: string[], punctuation?: string): void; export {};