volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

TinyMCE, Clear formatting

My client wants "everything" (for instance h1, h2,h3 etc.) to be unformatted when clicking on "Clear formatting" in TinyMCE (v. 2.6.5).

i'm trying to do like this:

var removeformats = @"{
formats: {
removeformat: [
{
selector: 'b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins,h1,h2,h3,h4,h5,h6',
remove: 'all',
split: true,
block_expand: true,
expand: false,
deep: true
},
{ selector: 'span', attributes: ['style', 'class'], remove: 'empty', split: true, expand: false, deep: true },
{ selector: '*', attributes: ['style', 'class'], split: false, expand: false, deep: true }
]
}
}";

config.Default().RawSettings(removeformats);

But nothing changes. "Clear formatting" is still functioning as "default".

I have succeded with simpler things like var pasteOptions = "{paste_as_text: false}" ;

So i thought this would work too...

/Linus

#201491
Edited, Feb 20, 2019 17:58
Vote:

Hi Linus,

Took a bit of trial and error, but the following works for me:

var formats = new
{
    removeformat = new object[]
    {
        new
        {
            selector =
                "b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins,h1,h2,h3,h4,h5,h6",
            remove = "all", split = true, expand = "false", block_expand = true, deep = true
        }
    }
};

config.Default().AddSetting("formats", formats).AppendToolbar("removeformat");
#201741
Mar 01, 2019 2:03

Thank you so much!

#201831
Mar 05, 2019 7:46
error This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.