Search code examples
javascripttinymcewysiwygtinymce-4html-editor

How to start TinyMCE 4 in full screen mode?


Is there a way to start TinyMCE 4 in full screen mode? I just upgraded from TinyMCE 3.x, but the way it was done in 3.x does not seem to work in 4.x:

<head>
<script type="text/javascript" src="TinyMCE/tinymce.min.js"></script>
<script type="text/javascript">
  tinyMCE.init({
    oninit : function() {
      tinyMCE.get('editor').execCommand('mceFullScreen');
    }
  });
</script>
</head>

<body>
  <textarea id="editor"></textarea>
</body>

Any suggestions?


Solution

  • Found out how to do it:

    <head>
    <script type="text/javascript" src="TinyMCE/tinymce.min.js"></script>
    <script type="text/javascript">
      tinyMCE.init({
        plugins: [ 'fullscreen' ],
        setup: function(editor) {
          editor.on('init', function(e) {
            editor.execCommand('mceFullScreen');
          });
        }
      });
    </script>
    </head>
    
    <body>
      <textarea id="editor"></textarea>
    </body>