EditorState.field method
EditorState › field
Official
Retrieve the value of a state field. Throws an error when the state doesn't have that field, unless you passfalse as second parameter. Signature:
field(field: StateField<T>): TParameters:
| Parameter | Type | Description |
|---|---|---|
| field | StateField<T> | The state field. |
Returns: T — The field value.
Official
Retrieve the value of a state field, orundefined if not present. Signature:
field(field: StateField<T>, require: false): T | undefinedParameters:
| Parameter | Type | Description |
|---|---|---|
| field | StateField<T> | The state field. |
| require | false | Whether to throw if not present. |
Returns: T | undefined — The field value or undefined.