Make WordPress Core


Ignore:
Timestamp:
06/19/2015 10:34:59 AM (10 years ago)
Author:
iseulde
Message:

Editor: restructure word count

  • The WordCounter should only do one thing: count words. This makes it also easier to test.
  • Add some really basic unit tests.
  • Instead of only refreshing the count on enter and delete, refresh the count when the user stops typing. Also look at paste and content changes in TinyMCE.
  • Use match instead of replace when it is appropriate.
  • More readable code.

See #30966. Fixes #26620.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/qunit/index.html

    r32699 r32856  
    3333        <script src="../../src/wp-includes/js/shortcode.js"></script>
    3434        <script src="../../src/wp-admin/js/customize-controls.js"></script>
     35        <script src="../../src/wp-admin/js/word-count.js"></script>
    3536
    3637        <!-- Unit tests -->
     
    4142        <script src="wp-admin/js/customize-controls.js"></script>
    4243        <script src="wp-admin/js/customize-controls-utils.js"></script>
     44        <script src="wp-admin/js/word-count.js"></script>
    4345
    4446        <!-- Customizer templates for sections -->
Note: See TracChangeset for help on using the changeset viewer.