Laravel Voyager admin panel (tiny editor)

1.1k views Asked by At

In my laravel voyager admin panel, the tiny editor is displaying as it is the source code, how can I eliminate the HTML tags and can only display the words?

2

There are 2 answers

0
Muhammad Shahzaib On

go to config/voyager.php and add this code

'additional_js' => [
        'js/custom.js',
    ],

now create a new file public/js/custom.js and add this code,


function tinymce_init_callback(editor) {
    editor.remove();
    editor = null;

    tinymce.init({
        selector: 'textarea.richTextBox',
        skin: 'voyager',
        min_height: 100,
        height: 500,
        resize: 'vertical',
        inline_styles: false,
        keep_styles: false,
        font_formats: 'Open Sans, sans-serif',
        plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists textcolor wordcount imagetools contextmenu colorpicker textpattern code',
        
        file_browser_callback: function (field_name, url, type, win) {
            if (type == 'image') {
                $('#upload_file').trigger('click');
            }
        },
        toolbar: 'styleselect bold italic underline | forecolor backcolor | alignleft aligncenter alignright | bullist numlist outdent indent | link image table youtube giphy | code',
        convert_urls: false,
        image_caption: true,
        image_title: true,
        valid_elements: 'p[*],ul[*],li[*],ol[*],hr,br,img[*],-b,-i,-u,-h1,-h2,-h3,-h4,-h5,-h6',
        valid_children: '+li[p]'
    });
}

you can configure anything in this code.

0
user2770348 On

It shows plugins not found Failed to load plugin: template from url http://domain/admin/plugins/template/plugin.js net::ERR_ABORTED 404 (Not Found)