Skip to content
Discussion options

You must be logged in to vote

you can get word count by this way. then set to readonly when reach the limit

export function getEditorWordCount(editor: SlateEditor) {
  const text = editor.api.string([]);

  return text ? text.trim().split(/\s+/).filter(Boolean).length : 0;
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@engin-can
Comment options

Answer selected by zbeyens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants