fix: calculate the number of words across linebreaks correctly

This commit is contained in:
Philipp Kühn 2021-12-09 15:07:51 +01:00
parent b318d46afa
commit 0879a2f716

View File

@ -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 !== '')