You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Personally I prefer to use self-hosted version of TinyMCE and it can be downloaded at https://www.tiny.cloud/get-tiny/self-hosted/

In order to use TinyMCE self-hosted version, you need to download the latest version of TinyMCE package. It can be downloaded at https://www.tiny.cloud/get-tiny/self-hosted/. In my case I just upload all the files to /js 

Below is a basic example based on TinyMCE 5.2.0.

<!DOCTYPE html>
<html>
<head>
  <script src="http://kurapa.com/js/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
  <script>tinymce.init({ selector:'textarea' });</script>
</head>
<body>
  <textarea cols=80 rows=20>Chun Kang is genius !!!</textarea>
</body>
</html>

You can simply hide menu bar and tool bar as below. For more information, please refer to https://www.tiny.cloud/docs/configure/editor-appearance/#menu.

<!DOCTYPE html>
<html>
<head>
  <script src="http://kurapa.com/js/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
  <script>
  	tinymce.init({
  		selector:'textarea',
  		menubar: '',
  		toolbar: ''
  	});
  	
  </script>
</head>
<body>
  <textarea cols=80 rows=20>Chun Kang is genius !!!</textarea>
</body>
</html>

You can also select menu item based on your preference like below

<!DOCTYPE html>
<html>
<head>
  <script src="http://kurapa.com/js/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
  <script>
  	tinymce.init({
  		selector:'textarea',
  		menubar: 'file edit insert format table tools help'
  	});
  	
  </script>
</head>
<body>
  <textarea cols=80 rows=20>Chun Kang is genius !!!</textarea>
</body>
</html>

Changing Skins by "oxide-dark". 

I wanted to find a option can show editor like Sublime Editor, and found a great options as below. This feature is only available for TInyMCE 5.1 and later.

<!DOCTYPE html>
<html>
<head>
  <script src="http://kurapa.com/js/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
  <script>
  	tinymce.init({
  		selector:'textarea',
  		menubar: '',
  		toolbar: '',
  		skin: 'oxide-dark',
  		content_css: 'dark'
  	});
  	
  </script>
</head>
<body>
  <textarea cols=80 rows=20 style="background-color:orange;">Chun Kang is genius !!!</textarea>
</body>
</html>
  • No labels