docs: update content

This commit is contained in:
Hans Pagel
2021-03-30 21:17:10 +02:00
parent 8fcfaef4f1
commit 69ba3e3c97
3 changed files with 154 additions and 1 deletions

View File

@@ -23,3 +23,16 @@ yarn add @tiptap/extension-character-count
## Usage
<demo name="Extensions/CharacterCount" />
## Count words, emojis, letters …
Want to count words instead? Or emojis? Or the letter *a*? Sure, no problem. You can access the `textContent` directly and count whatever youre into.
```js
new Editor({
onUpdate({ editor }) {
const wordCount = editor.state.doc.textContent.split(' ').length
console.log(wordCount)
},
})
```