hashmode / Tinymce-Image-Upload-Cakephp

Tinymce image/file upload with integration of Elfinder file manager for cakephp
9 stars 7 forks source link

Tynimce init #2

Closed FayinFra closed 10 years ago

FayinFra commented 10 years ago

I'm new to this and wonder how to do this couple of things. Where am I supposed to put tynimce.min.js? Where to put [tynimce.init]? pd. sorry for my English.

hashmode commented 10 years ago

it is like this, first of all you should load tinymce.min.js file from your js folder, so if the path is app/webroot/js/tinymce.min.js, than in your view just put <?php echo $this->Html->script('tinymce.min.js'); ?> after this line, you should define elfinder settings, and then put tinymce init, so it will look like smth like this

<?php echo $this->Html->script('tinymce.min.js');?>
<?php $this->TinymceElfinder->defineElfinderBrowser()?>

<script type="text/javascript">
 $(document).ready(function() {
            // tinymce init
            tinymce.init({
                file_browser_callback : elFinderBrowser,
                selector: "textarea.tinymce",
                theme: "modern",
                relative_urls: false,
                plugins: [
                     "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
                     "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
                     "save table contextmenu directionality emoticons template paste textcolor"
               ],
               toolbar: "insertfile undo redo | styleselect | fontsizeselect | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | "+
                        " link image | print preview media fullpage | forecolor backcolor emoticons", 
                    theme_advanced_font_sizes : "8px,9px,10px,11px,12px,13px,14px,16px,18px,20px,24px,32px,36px",
                theme_concrete_font_sizes : "22px,12px,14px,16px,22px"
             });    

        });

</script>
FayinFra commented 10 years ago

Thank you!