CharacterCount counts non-existing characters
See original GitHub issueWhat happens? CharacterCount extension counts non-existing characters.
An empty editor with CharacterCount enabled will show +2 for every newline, and + 4 for every list; even though there are no characters. When adding characters, the count increments on top of those non-existing counted characters.
I haven’t tested “Code” and “CodeBlock”, but I expect a similar result.
Steps to reproduce the behavior:
1. Go to the editor on https://next.tiptap.dev/api/extensions/character-count/
2. On a newline, type "Enter".
3. See count + 2, where it should be + 0.
1. Create a default editor with "Ordered List" or "Unordered List".
2. Add "CharacterCount" extension.
2. On a newline, create a list.
3. See count + 4, where it should be + 0.
Create a new Codesandbox replicating your error Try in the documentation editor: https://next.tiptap.dev/api/extensions/character-count/
What behavior did you expect? Count +0 on newlines and lists.
What’s your environment?
- macOS
- Chrome
- Desktop
Anything else? I haven’t tested “Code” and “CodeBlock”, but I expect a similar result.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Character Count Tool - The Best Character Counter
The must-have character counter that provides an extensive report about the character count, word count, and many other useful statistics.
Read more >Character Counter - WordCounter.net
Character Count is a free online tool that calculates the number of characters and words written in your writing.
Read more >How to Stay Under the Character Count in Essay Contests
If the rules don't explicitly state that some characters are excluded from the character count, play it safe by counting them all.
Read more >Count characters in cells - Microsoft Support
Count characters in cells by using the LEN function. This topic explains how to count one or more cells and use LEN in...
Read more >Count the number of occurrences of a character in a string
For this particular instance, counting characters, I would prefer collections.counter. For finding instances of a specific substring, I would use a regular ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maybe we could add an option
{ mode: 'nodeSize' | 'textSize' }
?This is used in the Editor too, so that would require us to add the ability to register helper functions through extensions. 👀
https://github.com/ueberdosis/tiptap-next/blob/main/packages/core/src/Editor.ts#L426