Replace inline "style" attribute with "class" attribute/CSS?

Last post 08-08-2006, 9:20 AM by Dmitri. 4 replies.
Sort Posts: Previous Next
  •  08-06-2006, 12:06 PM 21573

    Replace inline "style" attribute with "class" attribute/CSS?

    Hello,
     
    I have found no way to make the Editor control create 'class' attributes (with <STYLE> tag definitions) instead of creating inline 'style' attributes.
    In other words, what I need is, for example, instead of this:
     
    <p style="color:red">red text</p>
     
    to have this:
     
    <style>
    .redText { color:red; }
    </style>
    <p class="redText">red text</p>
     
    The reason I need this is because we're planning to use your control to generate some (limited) HTML to be rendered inside Flash, and Flash doesn't understand inline 'style' attributes, but does understand 'class' attributes/CSS...
     
    Is there no way, or did I miss something?
     
    Thanks in advance,
    Dmitri
     
  •  08-06-2006, 12:14 PM 21574 in reply to 21573

    Re: Replace inline "style" attribute with "class" attribute/CSS?

    Dmitri,
     
    If you use Css Class dropdown, you will get <p class="redText">red text</p>.
     
    Please test the following link:
     
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  08-06-2006, 6:29 PM 21578 in reply to 21574

    Re: Replace inline "style" attribute with "class" attribute/CSS?

    Thank you for your reply!
     
    I know about that functionality...  Problem is, I would have to create an entry in that dropdown list for every possible color, background color, and the plethora of other stylistic options available/supported in (D)HTML, which would make that a rather long list. :-)
    I just wanted to make, for example, the color button generate a class instead of a 'style'... as well as other buttons/actions.
     
    Right now I'm thinking about maybe using the XHTML property to load the output as XML and parse out all the 'style' attributes, make them into <style> values, and replace the 'style' with the correspondent 'class' attributes.  A lot of work, but I don't see how to do it any other way. (and still hoping I'm wrong... :-))
     
    Hope this is making some sense to you....
     
    Thanks.
     
  •  08-07-2006, 1:33 PM 21598 in reply to 21578

    Re: Replace inline "style" attribute with "class" attribute/CSS?

    Dmitri,
     
    There is a easier solution.
     
    Please open you toolbar configuration file.
     
    And change the following code:
     
      <item type="dropdown" name="CssStyle" width="50" RenderItemBorder="true" text="[[CssStyle]]" command="CssStyle" />
     
    to:
     
      <item type="dropdown" name="CssStyle" width="50" RenderItemBorder="true" text="[[CssStyle]]" command="CssClass" />
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  08-08-2006, 9:20 AM 21628 in reply to 21598

    Re: Replace inline "style" attribute with "class" attribute/CSS?

    Thanks for the prompt reply, but that's not what I'm talking about...
    Sorry, I guess I was still not being clear enough.
     
    Some of the standard buttons (e.g. the highlighter) are generating HTML that uses inline 'style' attributes.
    For example, the 'Highlight' button generates '<font style="BACKGROUND-COLOR: yellow">'.  Flash doesn't "understand"/support those.  How do I go about changing that button (and some others that generate, by default, inline 'style' attributes) to generate 'class' attributes instead, with the class defined as a correspondent CSS (<style> tag)?  I'm thinking this is not possible/supported, partly because there is no "place" in the API to store those <style> tag values (i.e. you'd have to do something like this:  '<style>.highlighter{BACKGROUND-COLOR: yellow;}</style><font class="highlighter">'), but I just wanted to make sure I'm not missing something.
     
    Thanks.
     
View as RSS news feed in XML