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

feat: word counter service #705

Merged
merged 4 commits into from
Feb 7, 2024
Merged

Conversation

Xazin
Copy link
Collaborator

@Xazin Xazin commented Feb 6, 2024

My first idea was to setup a listener to the Transaction stream of the EditorState, and then update the counters only with the changeset, but this seems not quite possible with how operations currently work.

Currently, an UpdateOperation contains inserts in the delta, and whilst we do have the old attributes to compare against, it seems that it can happen that the new attributes delta can be a subset of the old one, causing it to be near impossible to rely on the difference in characters and words as the comparison of the two might not be representative of the actual changes to the document.

We can improve and build on this (eg. add Selection word/char count to the service) in the future.

@Xazin Xazin requested a review from LucasXu0 February 6, 2024 21:49
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3832f4e) 75.47% compared to head (ef98172) 75.54%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #705      +/-   ##
==========================================
+ Coverage   75.47%   75.54%   +0.07%     
==========================================
  Files         296      297       +1     
  Lines       13638    13678      +40     
==========================================
+ Hits        10293    10333      +40     
  Misses       3345     3345              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Xazin Xazin merged commit 9c27b8e into AppFlowy-IO:main Feb 7, 2024
11 checks passed
q200892907 added a commit to q200892907/appflowy-editor that referenced this pull request Feb 19, 2024
* main:
  chore: upgrade flutter version to 3.19.0 (AppFlowy-IO#719)
  fix: the positioning of the slash command menu in the web version (AppFlowy-IO#709)
  fix: unable to export image block in markdown format (AppFlowy-IO#713)
  feat: debounce on word count service (AppFlowy-IO#711)
  feat: on demand word count without listening (AppFlowy-IO#710)
  feat: support selection counters (AppFlowy-IO#706)
  feat: word counter service (AppFlowy-IO#705)
  chore: bump version 2.3.2
  chore: update Chinese i18n (AppFlowy-IO#698)
  fix: fix checkbox not work as expected in html module. (AppFlowy-IO#700)
  chore: revert ime changes (AppFlowy-IO#701)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants