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

Feature: Show word count in RichText #2664

Merged
merged 6 commits into from
Oct 5, 2022
Merged

Feature: Show word count in RichText #2664

merged 6 commits into from
Oct 5, 2022

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Jul 4, 2022

Summary

Show word count as last element of the overflow menu,
which now will be always shown. The word count
is updated when the menu is openend as the
tiptap word count is not reactive.

Modified ActionList: Added a named slot for adding
elements that should always shown as the last elements.


What should be mentioned: This solution refreshes on menu open, but it is also possible to refresh it on content change.
So the current solution do not introduce many unneeded calculations, but (and I am not sure if this is even possible) does not update the label if typing while the menu is open.

@susnux
Copy link
Contributor Author

susnux commented Jul 4, 2022

/compile

@susnux
Copy link
Contributor Author

susnux commented Jul 4, 2022

from #2630 (comment) @juliushaertl


I'm a bit hesitant to add even more to the menu, especially on mobile. Also it is not fully related to the other actions which are more formatting actions that are targeting the current position/selection. To me it would be more suitable on the right hand side. Maybe we need to adapt the "collaborator" menu a bit to cover more details about the document in general.

For reference this is how it currently looks:
Screenshot 2022-07-04 at 14 09 37

Screenshot 2022-07-04 at 14 07 58

@jancborchardt What do you think?

Dropbox Paper for example also has a separate context menu for the document itself:
Screenshot 2022-07-04 at 14 10 37

@susnux
Copy link
Contributor Author

susnux commented Jul 4, 2022

I implemented this as suggested in this comment #470 (comment) by @jancborchardt

But I noticed there are quite a lot of feature requests for implementing stuff that require new buttons. Maybe this should be discussed together with:

#2438 (comment)
and
#2611 (comment)

@vinicius73
Copy link
Member

@susnux I'm working in a "sidebar" (ouline) for text editor to wrap the Table Of Contents #107
Maybe we can use it to show word counter as well.

I have some visual issues, but I will open a PR and get some feedback from the team.

@susnux susnux added enhancement New feature or request 3. to review labels Jul 4, 2022
@vinicius73 vinicius73 mentioned this pull request Jul 12, 2022
@susnux
Copy link
Contributor Author

susnux commented Jul 14, 2022

/compile amend

@susnux
Copy link
Contributor Author

susnux commented Jul 18, 2022

/compile amend

@susnux
Copy link
Contributor Author

susnux commented Sep 13, 2022

/compile amend

@susnux
Copy link
Contributor Author

susnux commented Sep 13, 2022

@jancborchardt affirmed this should go into the "..." menu: #2688 (comment)

So I think this is ready to go.

Copy link
Collaborator

@max-nextcloud max-nextcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Thanks for including a test.
Will give it a try and then work towards getting this merged.

@max-nextcloud
Copy link
Collaborator

UI also looks okay to me. It looks somewhat funny when it's the only entry in the three dots menu. But i guess that's okay. We'll redesign the menubar anyway.

@mejo-
Copy link
Member

mejo- commented Oct 4, 2022

I rebased the PR to latest master and pushed a few additional changes. Hope you don't mind, @susnux.

After discussing with @jancborchardt we decided (and I implemented) to:

  • Add an icon to the word count
  • Alsow add character count
  • Always move the formatting help under the three-dot-menu. That way the counts are never the only entry

Screenshot:

grafik

@mejo-
Copy link
Member

mejo- commented Oct 4, 2022

/compile

@mejo-
Copy link
Member

mejo- commented Oct 4, 2022

/compile

@susnux
Copy link
Contributor Author

susnux commented Oct 4, 2022

👍
The reason why I did not use ActionText but ActionCaption is that the latter one does not show a pointing cursor when hovering it. As there is no action behind the the text, so the action text is a bit confusing.

@mejo-
Copy link
Member

mejo- commented Oct 4, 2022

The reason why I did not use ActionText but ActionCaption is that the latter one does not show a pointing cursor when hovering it. As there is no action behind the the text, so the action text is a bit confusing.

I agree. At the same time, ActionCaption doesn't support an icon slot, so that's why I went with ActionText. I think, it's an acceptable tradeoff, don't you think so? Also, there's still no background change on hover, so it's different from the clickable menu entries.

@susnux
Copy link
Contributor Author

susnux commented Oct 4, 2022

Yes I think this is ok, just wanted to mention this as it might be confusing.

@mejo-
Copy link
Member

mejo- commented Oct 4, 2022

Thanks for continuously pushing the test fix and big sorry for overwriting it several times @susnux 😬

Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks a lot @susnux and also @mejo- :)

@mejo- mejo- force-pushed the feature/word-count branch 2 times, most recently from 96fae8d to 97b90b2 Compare October 5, 2022 00:43
@mejo-
Copy link
Member

mejo- commented Oct 5, 2022

/rebase

susnux and others added 4 commits October 5, 2022 11:33
Show word count as last element of the overflow menu,
which now will be always shown. The word count
is updated when the menu is openend as the
tiptap word count is not reactive.

Modified ActionList: Added a named slot for adding
elements that should always shown as the last elements.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
@mejo-
Copy link
Member

mejo- commented Oct 5, 2022

/compile

nextcloud-command and others added 2 commits October 5, 2022 09:38
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Signed-off-by: Jonas <jonas@freesources.org>
@mejo- mejo- merged commit f40c459 into master Oct 5, 2022
@delete-merged-branch delete-merged-branch bot deleted the feature/word-count branch October 5, 2022 11:23
@adrienneteicher
Copy link

Hi all,
This is just what I need but I don't see it in my version of the app. I am on 3.5.1
Is it that I should just be patient for updates?
Thank you!

@mejo-
Copy link
Member

mejo- commented Dec 7, 2022

Hey @adrienneteicher. Which Nextcloud version do you use? The feature is only available starting with Nextcloud 25.

@susnux
Copy link
Contributor Author

susnux commented Dec 7, 2022

3.5.1 is the version used on Nextcloud 24. So you would have to upgrade to Nextcloud 25 to get this feature.

@adrienneteicher
Copy link

adrienneteicher commented Dec 7, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Word Count
7 participants