Make WordPress Core

Changeset 65802


Ignore:
Timestamp:
11/26/2026 02:34:18 PM (4 days ago)
Author:
wildworks
Message:

Editor: Count numbers in the classic editor word count.

The classic editor's word count now includes numbers such as 2026, 1,500, and $5, which were previously stripped along with punctuation before counting. This brings it in line with the block editor's word count.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/16070

Props sainathpoojary, wildworks.
Fixes #66716.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/utils/word-count.js

    r63600 r65802  
    8383
    8484                                // Basic Latin (extract).
    85                                 '\u0021-\u0040\u005B-\u0060\u007B-\u007E',
     85                                '\u0021-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E',
    8686
    8787                                // Latin-1 Supplement (extract).
  • trunk/tests/qunit/wp-admin/js/word-count.js

    r46586 r65802  
    3535                                message: 'Punctuation.',
    3636                                string: 'It\'s two three \u2026 4?',
    37                                 words: 3,
     37                                words: 4,
    3838                                characters_excluding_spaces: 15,
    3939                                characters_including_spaces: 19
     40                        },
     41                        {
     42                                message: 'Numbers.',
     43                                string: 'Should be 4 words',
     44                                words: 4,
     45                                characters_excluding_spaces: 14,
     46                                characters_including_spaces: 17
     47                        },
     48                        {
     49                                message: 'Number formats.',
     50                                string: 'In 2026 we sold 1,500 units for $5 each',
     51                                words: 9,
     52                                characters_excluding_spaces: 31,
     53                                characters_including_spaces: 39
    4054                        },
    4155                        {
Note: See TracChangeset for help on using the changeset viewer.