mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-07 01:12:56 +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 => {
|
||||
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
|
||||
.split(' ')
|
||||
.filter(word => word !== '')
|
||||
|
Loading…
Reference in New Issue
Block a user