[wp-trac] [WordPress Trac] #30966: Let's make word count better (master ticket)
WordPress Trac
noreply at wordpress.org
Mon Feb 2 12:29:51 UTC 2015
#30966: Let's make word count better (master ticket)
--------------------------+-------------------------
Reporter: iseulde | Owner: iseulde
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 4.2
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: javascript
--------------------------+-------------------------
Description changed by iseulde:
Old description:
> 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: #20738, #26620, #27386, #27391.
New description:
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:
[[TicketQuery(id=20738|26620|27386|27391)]]
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30966#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list