Skip to content

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

ParameterTypeDescription
editorEditor | null | undefinedThe editor instance to extract state from

Returns

VizelEditorState

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}`);

Released under the MIT License.