Emanuele
Emanuele

Reputation: 664

Tinymce and removeformat option

i'm using tinymce 4 and removeformat button. It works very well. Now i need to remove only particular format (b, strong). I found

removeformat: [
                {selector: 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand: true, 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}
            ],

Where is documentation about it? I need to understand every parameter (expand, deep...)

If i select an image and click on remove format, i will lose classes. How can i avoid this behaviour? I tried to remove * selector line but it doesn't work.

I tried also to attach original js to debug. I see my removeformat line is not considered. It considers only its default removeformat.

Thanks

Upvotes: 0

Views: 4741

Answers (1)

tabris17
tabris17

Reputation: 56

the example in official document (https://www.tinymce.com/docs/configure/content-formatting/#removingaformat) is wrong. It should be:

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  format: {
      removeformat: [
        {selector: 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand: true, 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}
      ]
  }
});

Upvotes: 3

Related Questions