Search code examples
javascriptresizewindowtinymcewysiwyg

Resize tinymce instance on window resize


I have the following javascript code:

var editor = new tinymce.Editor(id, settings);

On window resize, I'd like to resize the editor. I've tried to call

editor.execCommand("mceResize");

but appearantly it doesn't work. I have also tried enabling and disabling it, by calling

tinymce.execCommand('removeAddControl', true, id);
tinymce.execCommand('mceAddControl', true, id);

However, the "added" control isn't added with the same settings as those settings originally passed to new tinymce.editor();

Any suggestions on how to make this work are appreciated!


Solution

  • Have you tried to set relative size?

     tinyMCE.init({
                    mode : "textareas",
                    width : "100%",
                    height : "800",
                    theme : "advanced",
                    plugins : "preview,table,fullpage,jqueryinlinepopups",
                    plugin_preview_width : "100%",
                    plugin_preview_height : "600",
    
                    ...
    
                });