Vizel API / core/src / getVizelEditorState
Function: getVizelEditorState()
ts
function getVizelEditorState(editor): VizelEditorState;Defined in: packages/core/src/utils/editorHelpers.ts:247
Extracts the current editor state from an editor instance. This provides a snapshot of common editor state values including focus, empty status, undo/redo availability, and character/word counts.
Parameters
| Parameter | Type | Description |
|---|---|---|
editor | Editor | null | undefined | The editor instance to extract state from |
Returns
The current editor state
Example
typescript
const state = getVizelEditorState(editor);
console.log(`Characters: ${state.characterCount}, Words: ${state.wordCount}`);
console.log(`Can undo: ${state.canUndo}, Can redo: ${state.canRedo}`);