[wp-trac] [WordPress Trac] #30966: Let's make word count better (master ticket)
WordPress Trac
noreply at wordpress.org
Fri Jan 9 14:05:01 UTC 2015
#30966: Let's make word count better (master ticket)
--------------------------+----------------------------
Reporter: avryl | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Editor | Version:
Severity: normal | Keywords: needs-patch
Focuses: javascript |
--------------------------+----------------------------
1) Make the code readable (don't use short variable names such as `tx`,
`w`, `tc`, `t`, `wc`, `c`, which have no meaning).
2) Make the word count function more abstract so that it can be used
elsewhere. So, it should only count the words in a given text, nothing
else.
3) Maybe move to `wp-includes`.
4) The word count should update at the right times. At the moment it
updates on `enter`, `delete` and `backspace`. It should at least be
updated on `space` too. Consider things like cut and paste, and look at
TinyMCE events that change the content.
5) Exclude more patterns like known shortcodes and ellipsis (#27386,
#27391).
6) Add some good unit tests for all of this.
7) Make sure it's as fast as it can be (e.g. don't needlessly manipulate
the DOM).
This could be a small improvement that makes people less annoyed with
WordPress. :)
More inspiration, although not ideal either:
https://github.com/tinymce/tinymce/blob/master/js/tinymce/plugins/wordcount/plugin.js
Depends on: #26620, #27386, #27391.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30966>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list