Cakephp 3x Add TinyMCE text editor in 2 Steps

Step 1

So First Add this js to your header or default layout or your preferred location where you call other js files

<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
  <script>
   tinymce.init({ selector:'.edittextarea', height: 500,  plugins: [
    'advlist autolink lists link print preview anchor',
    'visualblocks code fullscreen',
    'insertdatetime table contextmenu paste code'
   ], });
 </script>

Step 2
Now Add edittextarea class to textarea where you want to change textarea to text editor

Here is the example of how to create text editor textarea in Cakephp 3.x

<?= $this->Form->input('description', array('type' => 'textarea','class' => 'edittextarea form-control','value'=>$description,'label' => 'Content :')); ?>

Now run your url and you will see a text editor instead of textarea . Simple 🙂

7 سال پیش

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

این سایت از اکیسمت برای کاهش هرزنامه استفاده می کند. بیاموزید که چگونه اطلاعات دیدگاه های شما پردازش می‌شوند.