mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-07 09:25:29 +08:00
fix: calculate the number of words across linebreaks correctly
This commit is contained in:
parent
b318d46afa
commit
0879a2f716
@ -63,7 +63,7 @@ export const CharacterCount = Extension.create<CharacterCountOptions, CharacterC
|
|||||||
|
|
||||||
this.storage.words = options => {
|
this.storage.words = options => {
|
||||||
const node = options?.node || this.editor.state.doc
|
const node = options?.node || this.editor.state.doc
|
||||||
const text = node.textBetween(0, node.content.size, undefined, ' ')
|
const text = node.textBetween(0, node.content.size, ' ', ' ')
|
||||||
const words = text
|
const words = text
|
||||||
.split(' ')
|
.split(' ')
|
||||||
.filter(word => word !== '')
|
.filter(word => word !== '')
|
||||||
|
Loading…
Reference in New Issue
Block a user