skip to Main Content

I have a tinyMCE component. The underline is made with in tiny. I want to automatically change all <u> in <span style="text-decoration: underline">.

I know that you can ask tiny to automatically change some markups in others, with the "valid-elements". It works with the following code for "storng" and "em", but not for the underline: valid_elements: "#p,strong,b,em,i,u,span[style=text-decoration: underline],span[style=text-decoration: underline]/u,strong/b,em/i" Is there any other way to do this? ==> when the richtext has <u>underlined text</u> it automatically change and save as <span style="text-decoration:underline">underlined text</span>. Thank you for your answers!

2

Answers


  1. Chosen as BEST ANSWER

    Thank you for your answer. But it was not exactly what I wanted to do. We found a way to do it :

    valid_elements:'tmpunderline/u[style~text-decoration:underline], span/tmpunderline[style]'
    

    We have to create a temporary variable with specific style to make the change.


  2. You can change it using the style formats in your init section. Something like the following:

    tinyMCE.init({
        ...
        style_formats : [
            // use the following for inline style - not exactly sure on the syntax for text decoration
            {title : 'Underline', inline : 'span', styles : {textDecoration : 'underline'}}, 
            // or use the following if you want to add a class
            {title : 'Underline', inline : 'span', classes : 'underline'},  
        ]
    });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search