Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#29360 closed defect (bug) (worksforme)

How I can disable the `auto-height` in Editor?

Reported by: kingyes's profile KingYes Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: Editor Keywords:
Focuses: Cc:

Description

Continue from here: #28328

Hey.. I just want to know how I can disable the resize height in Editor. I use the wp_editor() in Model, and it's not work good.

Screenshot: http://i.imgur.com/mTtpaC5.png

Change History (12)

#1 @ocean90
11 years ago

Can you please provide some code snippet/test plugin which you're using?

This ticket was mentioned in IRC in #wordpress-dev by helen. View the logs.


11 years ago

#4 in reply to: ↑ 2 ; follow-up: @azaozz
11 years ago

Replying to KingYes:

You are copying the TinyMCE init object from the "main" editor _.extend( {}, tinyMCEPreInit.mceInit.content );. It has wp_autoresize_on: true which enables the auto-resize. Either set that to false or delete it. Some other settings may need tweaking/adjusting as that init object is meant for the "main" editor only.

#5 in reply to: ↑ 4 ; follow-up: @KingYes
11 years ago

Replying to azaozz:

How I can disable wp_autoresize_on: true after TinyMCE get ready on my Popup?

Last edited 11 years ago by KingYes (previous) (diff)

#6 in reply to: ↑ 5 ; follow-up: @azaozz
11 years ago

Replying to KingYes:

As I mentioned above, you have to set it to false after you copy the init object:

window.tinyMCEPreInit.mceInit[ last_element_id ] = _.extend({}, tinyMCEPreInit.mceInit.content);
window.tinyMCEPreInit.mceInit[ last_element_id ].wp_autoresize_on = false;

It's not the best idea to blindly copy the init object. There may be other settings (including settings added by other plugins) that could interfere.

#7 @KingYes
11 years ago

It's really work's, thanks !! :)

#8 @helen
11 years ago

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

#9 in reply to: ↑ 6 ; follow-up: @nacin
11 years ago

Replying to azaozz:

Replying to KingYes:

As I mentioned above, you have to set it to false after you copy the init object:

window.tinyMCEPreInit.mceInit[ last_element_id ] = _.extend({}, tinyMCEPreInit.mceInit.content);
window.tinyMCEPreInit.mceInit[ last_element_id ].wp_autoresize_on = false;

It's not the best idea to blindly copy the init object. There may be other settings (including settings added by other plugins) that could interfere.

This is messy, what about a PHP filter?

#10 in reply to: ↑ 9 @azaozz
11 years ago

Replying to nacin:

Was thinking about a PHP filter too. It won't work in this case (this is specific for the hack @KingYes is using in JS).

Currently to disable editor expand, the script has to be deregistered and wp_autoresize_on unset. Something like:

add_action( 'admin_init', 'my_deregister_editor_expand' );
function my_deregister_editor_expand() {
	wp_deregister_script('editor-expand');
}

add_filter( 'tiny_mce_before_init', 'my_unset_autoresize_on' );
function my_unset_autoresize_on( $init ) {
	unset( $init['wp_autoresize_on'] );
	return $init;
}

That's pretty easy but having a filter will make it more straightforward.

#11 @KingYes
11 years ago

azaozz: What the better way to show Editor in Popup?

Note: See TracTickets for help on using tickets.