Skip to main content

Class: EmojiNode

EmojiNode doesn't really need to override any of TextNode's functionality, other than these serialization and type related static methods.

The behavior is augmented in $createEmojiNode where we set mode to token so it is treated as an "atomic" unit and not considered for further text transforms.

The display behavior is all implemented in the mutation listener set up by EmojiPlan, which makes it a little easier to ensure that clean-up is done properly.

Extends

  • TextNode

Constructors

new EmojiNode()

new EmojiNode(text, shortcode?, key?): EmojiNode

Parameters

text: string

shortcode?: string

key?: string

Returns

EmojiNode

Overrides

TextNode.constructor

Defined in

EmojiNode.ts:46

Properties

__shortcode?

optional __shortcode: string

Defined in

EmojiNode.ts:44

Methods

createDOM()

createDOM(config, editor?): HTMLElement

Parameters

config: EditorConfig

editor?: LexicalEditor

Returns

HTMLElement

Overrides

TextNode.createDOM

Defined in

EmojiNode.ts:97


exportJSON()

exportJSON(): SerializedEmojiNode

Returns

SerializedEmojiNode

Overrides

TextNode.exportJSON

Defined in

EmojiNode.ts:130


getShortcode()

getShortcode(): undefined | string

Returns

undefined | string

Defined in

EmojiNode.ts:120


setShortcode()

setShortcode(shortcode?): this

Parameters

shortcode?: string

Returns

this

Defined in

EmojiNode.ts:124


updateDOM()

updateDOM(prevNode, dom, config): boolean

Parameters

prevNode: this

dom: HTMLElement

config: EditorConfig

Returns

boolean

Overrides

TextNode.updateDOM

Defined in

EmojiNode.ts:85


clone()

static clone(node): EmojiNode

Parameters

node: EmojiNode

Returns

EmojiNode

Overrides

TextNode.clone

Defined in

EmojiNode.ts:55


getType()

static getType(): "emoji"

Returns

"emoji"

Overrides

TextNode.getType

Defined in

EmojiNode.ts:51


importDOM()

static importDOM(): null | DOMConversionMap

Returns

null | DOMConversionMap

Overrides

TextNode.importDOM

Defined in

EmojiNode.ts:63


importJSON()

static importJSON(serializedNode): EmojiNode

Parameters

serializedNode: SerializedEmojiNode

Returns

EmojiNode

Overrides

TextNode.importJSON

Defined in

EmojiNode.ts:59