tinymce add div and class within blockquote

646 views Asked by At

I am using the stfalcontinymce bundle for tinymce for symfony. I want to add a div with a class attribute within a blockquote

In the config file I have the following settings:

plugins:
             - "advlist autolink lists link image charmap print preview anchor"
             - "searchreplace visualblocks code fullscreen"
             - "media contextmenu paste"
         toolbar1: "insertfile undo redo | styleselect | bold italic underline | blockquote | bullist numlist | link image media | code preview"
         menubar: false
         removed_menuitems: 'newdocument'
         style_formats:
         - {title: 'Heading 1', block: 'h1'}
         - {title: 'Heading 2', block: 'h2'}
         - {title: 'Heading 3', block: 'h3'}
         - {title: 'Heading 4', block: 'h4'}
         - {title: 'Heading 5', block: 'h5'}
         - {title: 'Heading 6', block: 'h6'}
         file_browser_callback : 'elFinderBrowser'
         document_base_url: "http://dev/web/"
         relative_urls: false
         valid_children: "+blockquote[div|p]"
         formats :
         - blockquote: {inline : 'div', 'classes' : 'content'}

I am trying to accomplish inserting a div into the blockquote. FOr eg:

<blockquote>
        <div class="content">
        .....
        </div>
</blockquote>

However no changes appear on the blockquote div. What am I doing wrong here?

1

There are 1 answers

0
softie On

I figured out a solution from the following link:

Add a div class parent to img and iframes with exception for blockquotes

$('blockquote p').each(function(){
                            $(this).wrap('<div class="content" />');
                        });

However the issue now is more of a jquery issue. The div gets applied to every p tag inside the blockquote.

<blockquote>
    <div class="content">
        <p></p>
    </div>
    <div class="content">
        <p></p>
    </div>
</blockquote>

I want the following format:

<blockquote>
    <div class="content">
        <p></p>
        <p></p>
    </div>
</blockquote>