Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#42716 closed defect (bug) (worksforme)

When using the wp_editor_settings filter and setting tinymce to false, the Word Count feature breaks.

Reported by: conner_bw's profile conner_bw Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9
Component: Editor Keywords:
Focuses: Cc:

Description

As a Plugin Developer WordPress has a filter named wp_editor_settings and I use it. This filter allows me to set tinymce to false:

add_filter( 'wp_editor_settings', function ( $settings ) {
	$settings['tinymce'] = false;
 	return $settings;
});

When I do this the Word Counter breaks. The reason this happens is because the code is tightly coupled with this JS function.

Expected: <td id="wp-word-count" class="hide-if-no-js"> is hidden, or the description is changed to something like "Last Known Word Count" (terrible, please come up with better words...)

Actual: Word Counter initialized at start of post, not updated until page refresh.

Thank you for your consideration.

Change History (1)

#1 @azaozz
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Can't reproduce this in the main editor on the Add/Edit Post screen. Adding the example code stops TinyMCE from loading but the word count works well in the textarea.

The function in post.js is for showing the count on that screen, if it's used at another location, it will need something similar.

Closing as worksforme for now, feel free to reopen with more details of what is broken and where.

Note: See TracTickets for help on using tickets.