#26620 closed defect (bug) (fixed)
Word Count is one number short
| Reported by: | jorbin | Owned by: | iseulde |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.3 |
| Component: | Editor | Version: | |
| Severity: | normal | Keywords: | needs-patch needs-refresh |
| Cc: | Focuses: |
Description
Write a post. The count will be one number too low in text view if you don't press enter.
For example:
This is some content. It should be ten words long.
The counter shows that being 9 words.
related: #6991
Attachments (4)
Change History (14)
#2
follow-up:
↓ 4
@
13 years ago
- Keywords has-patch added
The above patch includes both a fix and a unit test.
I'm not sure if I am correctly checking for being in txt mode vs being in tinymce mode. Is there a better way to get this information?
#4
in reply to: ↑ 2
@
13 years ago
Replying to jorbin:
I'm not sure if I am correctly checking for being in txt mode vs being in tinymce mode. Is there a better way to get this information?
Appears to be this: typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
#5
@
13 years ago
Two possible alternative fixes that are not editor-dependent:
- Add a space to the end of
txprior to running the count.
- Use
/\S(\s+|$)/gminstead (untested).
#6
@
13 years ago
Also, 26620.2.diff has JSHint errors. :-)
#7
@
13 years ago
Padding a space on to the end seemed simpler than changing the regex and works independent of the editor. New patch does that.
JSHint errors fixed.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Unit Test