Skip to content
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

Word count plugin #4800

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

karam-qaoud
Copy link
Contributor

This is the core part of the WordCountPlugin decoupled from any UI implementations. It returns the number of words in the document (updated in real-time) by actively listening to changes in TextNodes.

@vercel
Copy link

vercel bot commented Jul 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2023 9:07am
lexical-playground ❌ Failed (Inspect) Jul 24, 2023 9:07am

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 18, 2023
@karam-qaoud
Copy link
Contributor Author

Even though TextNode is a super class of both HashtagNodes and MentionNodes, their mutations are not detected via a TextNode mutation listener. It seems a bit WET to me that we need to repeat the same logic of the TextNode mutation listener in the MentionNode mutation listener. Are there other alternatives for detecting mutations in MentionNodes using the fact that they are subclassed from TextNodes?

Also, it doesn't seem like MentionNodes are part of lexical packages, and that they only have an implementation for the playground. That said, should we listen to their mutation updates at all?

@karam-qaoud
Copy link
Contributor Author

karam-qaoud commented Jul 26, 2023

@potatowagon potatowagon added stale-pr PRs that are closed due to staleness. Please reopen the PR if there are new updates and removed stale-pr PRs that are closed due to staleness. Please reopen the PR if there are new updates labels Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. stale-pr PRs that are closed due to staleness. Please reopen the PR if there are new updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants