Home > @uniformdev/mesh-sdk-react > VariableNode

VariableNode class

Renders a variable reference node within a Lexical editor

Signature:

Extends: DecoratorNode<ReactNode>

Constructors

Constructor

Modifiers

Description

(constructor)(reference, state, key)

Constructs a new instance of the VariableNode class

Properties

Property

Modifiers

Type

Description

reference

Readonly<string>

Methods

Method

Modifiers

Description

clone(node)

static

createDOM()

Creates the DOM wrapper that hosts the node

decorate()

Render the variable node using React. NOTE: this is effectively an island of React, and you may not call hooks, rely on Context, etc in this renderer.

exportJSON()

Serializes the node to JSON for editor initial state

getState()

Gets the node's current state

getTextContent()

Copy variable to clipboard in a format we will read back if pasted (albeit it won't get the fancy chip-node)

getType()

static

importDOM()

static

importJSON(serializedNode)

static

Imports the node from serialized JSON (i.e. the data provided to the editor's initial state)

setState(state)

Updates the node's variables state so it knows its current validity, display name, etc The plugin updates this whenever the variables prop changes.

updateDOM()