remove gridsome
This commit is contained in:
38
docs/api/extensions/character-count.md
Normal file
38
docs/api/extensions/character-count.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# CharacterCount
|
||||
[](https://www.npmjs.com/package/@tiptap/extension-character-count)
|
||||
[](https://npmcharts.com/compare/@tiptap/extension-character-count?minimal=true)
|
||||
|
||||
The `CharacterCount` extension limits the number of allowed character to a specific length. That’s it, that’s all.
|
||||
|
||||
## Installation
|
||||
```bash
|
||||
# with npm
|
||||
npm install @tiptap/extension-character-count
|
||||
|
||||
# with Yarn
|
||||
yarn add @tiptap/extension-character-count
|
||||
```
|
||||
|
||||
## Settings
|
||||
| Option | Type | Default | Description |
|
||||
| ------ | -------- | ------- | -------------------------------------------------------- |
|
||||
| limit | `Number` | `0` | The maximum number of characters that should be allowed. |
|
||||
|
||||
## Source code
|
||||
[packages/extension-character-count/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-character-count/)
|
||||
|
||||
## Usage
|
||||
<tiptap-demo name="Extensions/CharacterCount"></tiptap-demo>
|
||||
|
||||
## 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 you’re into.
|
||||
|
||||
```js
|
||||
new Editor({
|
||||
onUpdate({ editor }) {
|
||||
const wordCount = editor.state.doc.textContent.split(' ').length
|
||||
|
||||
console.log(wordCount)
|
||||
},
|
||||
})
|
||||
```
|
||||
Reference in New Issue
Block a user