0

Anybody know how to add a redactor style/formatting option that effectively lets you select a bunch of text, click the formatting style, and have it wrap it in a div?

the desired scenario is basically... starting with

<p>this is the original text<p>
<p>this is the original text<p>
<p>this is the original text<p>

select the text, click the button turns it into...

<div class="my-class">
   <p>this is the original text<p>
   <p>this is the original text<p>
</div>
<p>this is the original text<p>

what's currently happening is...

<div class="my-class"><p>this is the original text<p></div>
<div class="my-class"><p>this is the original text<p></div>
<p>this is the original text<p>

I basically added... this to formattingAdd

"introduction": {
    "title": "Introduction",
    "api": "module.block.format",
    "args": {
        "tag": "div",
        "attr": {
            "class": "my-class"
        },
        "type": "toggle"
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.