-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A brand new CharacterCount
extension
#2256
Conversation
✔️ Deploy Preview for tiptap-embed ready! 🔨 Explore the source changes: 04ca755 🔍 Inspect the deploy log: https://app.netlify.com/sites/tiptap-embed/deploys/61b0f23062da120007b4bac3 😎 Browse the preview: https://deploy-preview-2256--tiptap-embed.netlify.app |
So cool! Thanks for putting so much effort into it! |
@caroillemann Oh you are right. Should be fixed with this patch. |
@philippkuehn Just noticed
With both of these changes, we couldn't need to call To finish, I have a question about this issue: The only I can think of to work around this is: const count = (editor.storage.characterCount as CharacterCountStorage).characters?.({}) || 0 And I'm wondering if there's a better way without casting? |
Oh, the first bug should be fixed with this patch. We can’t move these methods to |
Granted that you have a lot more context than me, what if you check for |
@rfgamaral There is no |
@philippkuehn Got it! What about having dummy functions that just return |
@rfgamaral yeah, I like that 👍 Fixed. |
Awesome, thanks! |
With this PR we introduce the redesigned
CharacterCount
extension. It’s a full re-write and fixes some bugs.New features
Add
mode
optionYou can now choose between
textSize
andnodeSize
for calculating the character size. Defaults totextSize
.Add
characters()
storage methodGet the number of characters for the current document with this new storage method. This deprecates
editor.getCharacterCount()
.Add
words()
storage methodGet the number of words for the current document with this new storage method.
Preview
https://deploy-preview-2256--tiptap-embed.netlify.app/preview/Extensions/CharacterCount
Fixes #1049
Fixes #1550
Fixes #1839
Fixes #2245