Search code examples
jquerylaraveltinymce

TinyMCE not saving blockquotes


Why does TinyMCE keep stripping blockquote tags and not saving them into the database? I've already added it to the valid_elements list, along with other elements (which all work, by the way). For some reason only the blockquote tags are not getting saved and I'm confused why.

Here's my code:

tinymce.init({
        selector:'#editor',
        height: 500,
        plugins: [
        'advlist autolink link image lists charmap print preview hr anchor pagebreak',
        'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',
        'emoticons template paste help'
        ],
        image_class_list: [
            {title: 'Responsive', value: 'img-responsive'},
            {title: 'Circle', value: 'img-circle'}
        ],
        relative_urls: false,
        toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | ' +
        'bullist numlist outdent indent | link image | preview media fullpage | ' +
        'emoticons | help',
        menu: {
            favs: {title: 'My Favorites', items: 'code visualaid | searchreplace | emoticons'}
        },
        menubar: 'favs file edit view insert format tools help',
        valid_elements: 'p,blockquote,div[video-container|class],iframe[src|width|height|title|frameborder|allow|allowfullscreen],h1,h2,h3,h4,h5,h6,ul,ol,li,span,figure,figcaption,a[href|target]',
        extended_valid_elements: 'img[src|alt|title|width|height],blockquote[class|style|cite]'
    });

Solution

  • When you state

    Why does TinyMCE keep stripping blockquote tags and not saving them into the database?

    You need to better clarify the issue.

    1. Is TinyMCE itself removing these tags when you extract the content from the editor to send to the server?
    2. Is TinyMCE providing you the correct HTML and then some aspect of your saving process is removing the tags?

    If the issue is (2) then this is not a TinyMCE issue but an issue in your content saving process.

    I can take your exact configuration and use it to load a <blockquote> into TinyMCE and TinyMCE correctly returns that in the HMTL so I don't believe the issue is (1) at which point this is likely not an issue with TinyMCE.