[wp-trac] [WordPress Trac] #30966: Let's make word count better (master ticket)

WordPress Trac noreply at wordpress.org
Fri Jun 19 17:45:57 UTC 2015


#30966: Let's make word count better (master ticket)
--------------------------+-------------------------
 Reporter:  iseulde       |       Owner:  iseulde
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  4.3
Component:  Editor        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  javascript
--------------------------+-------------------------

Comment (by azaozz):

 Yeah, when counting words we can replace all punctuation with spaces. Will
 make things a bit easier.

 Another "speed-up" thing to try is using `editor.getBody().textContent`
 instead of `editor.getContent{'raw')`. That will give us only the text,
 with tags and entities already removed. If that works well, we will need
 to pass the context to the counting function as we will still need to
 strip tags for the Text editor (the tag stripping regex needs to catch
 html comments too).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30966#comment:31>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list