Halo semua kali ini gw mau share cara menggunakan tinymce apa itu tinymce ? berikut penjelasanya dari wikipedia TinyMCE is a platform-independent, browser-based WYSIWYG editor control, written in JavaScript and released as open-source software under the LGPL by Ephox.Wikipedia   Langsung saj...

Cara menggunakan TinyMCE

Halo semua kali ini gw mau share cara menggunakan tinymce

apa itu tinymce ? berikut penjelasanya dari wikipedia

TinyMCE is a platform-independent, browser-based WYSIWYG editor control, written in JavaScript and released as open-source software under the LGPL by Ephox.Wikipedia
 
Langsung saja yuk tanpa basa-basi
1. Download dulu tinymce nya
atau di website nya langsung : https://www.tinymce.com/download/
2. Extract dan letakan folder tinymce pada project anda
3. Masukan kode berikut pada project anda
<script src="tinymce/tinymce.min.js"></script>
<script>
    tinymce.init({
            selector: "textarea",
            plugins: [
                    "advlist autolink autosave link image lists charmap print preview hr anchor pagebreak spellchecker",
                    "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
                    "table contextmenu directionality emoticons template textcolor paste fullpage textcolor codesample"
            ],

            toolbar1: "newdocument fullpage | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | styleselect formatselect fontselect fontsizeselect",
            toolbar2: "cut copy paste | searchreplace | bullist numlist | outdent indent blockquote | undo redo | link unlink anchor image media code | inserttime preview | forecolor backcolor",
            toolbar3: "table | hr removeformat | subscript superscript | charmap emoticons | print fullscreen | ltr rtl | spellchecker | visualchars visualblocks nonbreaking template pagebreak restoredraft codesample",

            menubar: false,
            toolbar_items_size: 'small',

            style_formats: [
                    {title: 'Bold text', inline: 'b'},
                    {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
                    {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
                    {title: 'Example 1', inline: 'span', classes: 'example1'},
                    {title: 'Example 2', inline: 'span', classes: 'example2'},
                    {title: 'Table styles'},
                    {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
            ],

            templates: [
                    {title: 'Test template 1', content: 'Test 1'},
                    {title: 'Test template 2', content: 'Test 2'}
            ]
    });
	</script>

4. Masukan form text area anda

<form action="">
	<textarea name="" id="" cols="30" rows="10"></textarea>
</form>

5. Jika sudah silahkan lihat hasilnya, berikut contoh full source code nya

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Demo TinyMCE</title>
		<script src="tinymce/tinymce.min.js"></script>
		<script>
		    tinymce.init({
	                selector: "textarea",
	                plugins: [
	                        "advlist autolink autosave link image lists charmap print preview hr anchor pagebreak spellchecker",
	                        "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
	                        "table contextmenu directionality emoticons template textcolor paste fullpage textcolor codesample"
	                ],
	 
	                toolbar1: "newdocument fullpage | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | styleselect formatselect fontselect fontsizeselect",
	                toolbar2: "cut copy paste | searchreplace | bullist numlist | outdent indent blockquote | undo redo | link unlink anchor image media code | inserttime preview | forecolor backcolor",
	                toolbar3: "table | hr removeformat | subscript superscript | charmap emoticons | print fullscreen | ltr rtl | spellchecker | visualchars visualblocks nonbreaking template pagebreak restoredraft codesample",
	 
	                menubar: false,
	                toolbar_items_size: 'small',
	 
	                style_formats: [
	                        {title: 'Bold text', inline: 'b'},
	                        {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
	                        {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
	                        {title: 'Example 1', inline: 'span', classes: 'example1'},
	                        {title: 'Example 2', inline: 'span', classes: 'example2'},
	                        {title: 'Table styles'},
	                        {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
	                ],
	 
	                templates: [
	                        {title: 'Test template 1', content: 'Test 1'},
	                        {title: 'Test template 2', content: 'Test 2'}
	                ]
	        });
	  	</script>

  	<style>
  		.wrapper {
  			width: 840px;
  		}
  	</style>
</head>
<body>
	<h1>Ini Halaman Contoh Menggunakan editor tinymce</h1>
	<div class="wrapper">
		<form action="">
			<textarea name="" id="" cols="30" rows="10"></textarea>
		</form>
	</div>
</body>
</html>

 

Terimakasih, tutorial ini ane nemu di blog orang sudah lama, lupa nama blog nya.


About Author

Shidqi


Comment & Discussions

    Please LOGIN before if you want to give the comment.