@lexical/hashtag
Version:
This package contains the functionality for Lexical hashtags.
40 lines (34 loc) • 1.13 kB
Flow
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
*/
import type {
EditorConfig,
LexicalNode,
NodeKey,
SerializedTextNode,
LexicalExtension,
} from 'lexical';
import {TextNode} from 'lexical';
declare export class HashtagNode extends TextNode {
static getType(): string;
static clone(node: HashtagNode): HashtagNode;
static importJSON(serializedNode: SerializedTextNode): HashtagNode;
constructor(text: string, key?: NodeKey): void;
createDOM(config: EditorConfig): HTMLElement;
canInsertTextBefore(): boolean;
isTextEntity(): true;
exportJSON(): SerializedTextNode;
}
declare export function $createHashtagNode(text?: string): HashtagNode;
declare export function $isHashtagNode(
node: ?LexicalNode,
): node is HashtagNode;
export type HashtagConfig = {
getHashtagMatch: (text: string) => null | {start: number; end: number};
}
declare export var HashtagExtension: LexicalExtension<HashtagConfig, "@lexical/hashtag/Hashtag", void, void>;