Class: StateConfig<K, V>
lexical.StateConfig
The return value of createState, for use with $getState and $setState.
Type parameters
| Name | Type |
|---|---|
K | extends string |
V | V |
Constructors
constructor
• new StateConfig<K, V>(key, stateValueConfig): StateConfig<K, V>
Type parameters
| Name | Type |
|---|---|
K | extends string |
V | V |
Parameters
| Name | Type |
|---|---|
key | K |
stateValueConfig | StateValueConfig<V> |
Returns
StateConfig<K, V>
Defined in
packages/lexical/src/LexicalNodeState.ts:261
Properties
defaultValue
• Readonly defaultValue: V
The result of stateValueConfig.parse(undefined), which is computed only
once and used as the default value. When the current value isEqual to
the defaultValue, it will not be serialized to JSON.
Defined in
packages/lexical/src/LexicalNodeState.ts:260
isEqual
• Readonly isEqual: (a: V, b: V) => boolean
An equality function from the StateValueConfig, with a default of Object.is.
Type declaration
▸ (a, b): boolean
Parameters
| Name | Type |
|---|---|
a | V |
b | V |
Returns
boolean
Defined in
packages/lexical/src/LexicalNodeState.ts:254
key
• Readonly key: K
The string key used when serializing this state to JSON
Defined in
packages/lexical/src/LexicalNodeState.ts:241
parse
• Readonly parse: (value?: unknown) => V
The parse function from the StateValueConfig passed to createState
Type declaration
▸ (value?): V
Parameters
| Name | Type |
|---|---|
value? | unknown |
Returns
V
Defined in
packages/lexical/src/LexicalNodeState.ts:243
unparse
• Readonly unparse: (value: V) => unknown
The unparse function from the StateValueConfig passed to createState, with a default that is simply a pass-through that assumes the value is JSON serializable.
Type declaration
▸ (value): unknown
Parameters
| Name | Type |
|---|---|
value | V |
Returns
unknown