Closed Visiluna closed 2 years ago
Hi, I'm asking the same here
I have tried to get this working with Redactor APIs which are better documented now. https://imperavi.com/redactor/docs/api-modules/#s-format.
This seems to do what you were after I think.
{
"customStyles": {
"align": {
"dropdown": {
"alignLeft": {
"api": "module.block.remove",
"args": {
"class": "align-right align-center align-justify"
}
},
"alignRight": {
"api": "module.block.set",
"args": {
"class": "align-right"
}
},
"alignCenter": {
"api": "module.block.set",
"args": {
"class": "align-center"
}
},
"alignJustify": {
"api": "module.block.set",
"args": {
"class": "align-justify"
}
}
}
}
}
}
Is there any way to add/remove a class from the current block element without specifying an element tag?
In your example, If I use one of the alignment options (e.g. - Align Center), the current block element, whatever it may have been, is converted to a
<p>
tag. What if I want to Center Align an<h1>
tag? Am I out of luck?The same seems to go for removing a class. In the example, it appears the only way to Align Left is to explicitly set the block element to
<p>
when all I really want to do is remove thealign-center
class from the current block element, regardless of whether that happens to be a<p>
,<h1>
, or<blockquote>
.