0

I have a custom plugin for TinyMCE that adds a custom button to the toolbar to upload images using AJAX.

This is my code:

tinymce.activeEditor.execCommand('mceInsertContent', false, '<img src="'+response.url+'" />');

The problem is that after the image is added to the editor the editor height doesn't update. I must write anything or use Ctrl + A to update the height of the editor.

Screenshot: https://i.stack.imgur.com/dNveG.png

My TinyMCE settings:

'height'                => 150,

'autoresize_min_height' => 150,
DragonBorn
  • 1,809
  • 5
  • 20
  • 44

1 Answers1

0

The autoresize plugin doesn't dynamically resize on content insertion - it only makes sure the editor is taking up all the space it can inside it's parent element.

You'll need to add a line to your button code after your execCommand that invokes an editor resize event.