Make WordPress Core

Opened 12 years ago

Closed 9 years ago

Last modified 9 years ago

#20738 closed enhancement (duplicate)

Improve Javascript Word Counting for TinyMCE

Reported by: westi's profile westi Owned by: chriscct7's profile chriscct7
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: I18N Keywords: close
Focuses: Cc:

Description

This is a follow on from #8759 to further improve the code.

While we improved it in 3.4 we can do a better job to more fully support the customisation for all different locales.

For know issues see the comments on the previous ticket.

Attachments (2)

20738.patch (1.3 KB) - added by chriscct7 9 years ago.
20738.2.patch (1.3 KB) - added by chriscct7 9 years ago.
Missed some formatting

Download all attachments as: .zip

Change History (21)

#1 @sirzooro
12 years ago

  • Cc sirzooro added

#2 @chriscct7
9 years ago

  • Keywords dev-feedback added

Now that we have utf8mb4 done, has anyone tested to see if the word counter works for languages like Chinese? There is/was a plugin for this: https://wordpress.org/plugins/chinese-word-count/

#3 @chriscct7
9 years ago

Sample 你吃饭了吗 returns a count of 0 words.

#4 @chriscct7
9 years ago

Actually this plugin seems to do a good job at fixing this: https://wordpress.org/plugins/word-count-with-double-byte-character/

All that plugin does is deregister the version of word counter in core and enqueue a slighly modified version. We could patch ours with their changes

@chriscct7
9 years ago

#6 @chriscct7
9 years ago

  • Keywords has-patch added; needs-patch dev-feedback removed
  • Owner set to chriscct7
  • Status changed from new to accepted

If #30966 doesn't ship with 4.3, this should be so we can at least provide accurate word counts for multibyte character words in 4.3 now that we support them fully.

#7 @chriscct7
9 years ago

  • Milestone changed from Future Release to 4.3

Marking for 4.3 inclusion, if #30966 makes the deadline for 4.3 we should use that, else use this and we'll get #30966 in for 4.4

Last edited 9 years ago by chriscct7 (previous) (diff)

This ticket was mentioned in Slack in #core-editor by chriscct7. View the logs.


9 years ago

@chriscct7
9 years ago

Missed some formatting

#9 @chriscct7
9 years ago

Turns out #30966 fixes a slightly different issue. Related but not duplicates :)

This ticket was mentioned in Slack in #core-editor by chriscct7. View the logs.


9 years ago

#11 @obenland
9 years ago

@azaozz, could you review and commit/punt when you get a chance?

#12 follow-up: @iseulde
9 years ago

Let's get #30966 in first. :)

#13 in reply to: ↑ 12 @obenland
9 years ago

Replying to iseulde:

Let's get #30966 in first. :)

Is that going to happen before beta?

#14 @iseulde
9 years ago

Let's try to get it in today.

#15 follow-up: @iseulde
9 years ago

  • Keywords needs-unit-tests added

@chriscct7 We'll also need some basic unit tests for this.

#16 in reply to: ↑ 15 @chriscct7
9 years ago

Replying to iseulde:

@chriscct7 We'll also need some basic unit tests for this.

If someone can write them, I can look over them if needed. I don't think I'll have the time to come up with a robust set of tests before my (college) classes for the day start in 10 minutes.

#17 follow-up: @azaozz
9 years ago

  • Keywords close added; has-patch needs-unit-tests removed

Looking at 20738.2.patch, it has three loops, one of them nested and is testing each individual character, twice. This seems far too slow in longer posts. It would count any non-ASCII char, including emoji, etc.

Also, seems the character count works differently for Japanese and Chinese, one counts spaces, the other doesn't according to the comments and patches on the original ticket: https://core.trac.wordpress.org/ticket/8759#comment:15.

In that terms maybe it will be better to concentrate on #30966 and close this one as "close enough" duplicate.

Last edited 9 years ago by azaozz (previous) (diff)

#18 in reply to: ↑ 17 @obenland
9 years ago

  • Milestone 4.3 deleted
  • Resolution set to duplicate
  • Status changed from accepted to closed

Replying to azaozz:

In that terms maybe it will be better to concentrate on #30966 and close this one as "close enough" duplicate.

Let's do that.

This ticket was mentioned in Slack in #core by iseulde. View the logs.


9 years ago

Note: See TracTickets for help on using tickets.