Forum OpenACS Development: Allowing attributes in richtext widget

Is there any way to allow attributes in the richtext/htmlarea widgets?

For example, here is an error when converting some static pages to htmlarea.

The attribute 'class' is not allowed for div tags

when the tag is <div class='someclass'>

Collapse
Posted by xx xx on
There is a parameter that lets you specify the allowed tags and the allowed attributes. I think it is in Kernel but it may be in Templating. It is not specific to the richtext widget, though.
Collapse
Posted by Jon Griffin on
Albert,
Unfortunatly that kernel flag doesn't work. It sees the div with extra stuff (in this case class) and doesn't like it.
Collapse
Posted by Janine Ohmer on
If you add "class" to the AllowedAttribute param under acs-kernel it should work.  I haven't actually tried it for "div class" but it worked for me with "font size".
Collapse
Posted by Jon Griffin on
Janine, This doesn't work for div tags. I haven't had time to look at the preprocessor, but maybe for fonts it is allowed. I am about to hit the road and won't have time to look at this until tomorrow, but any other suggestions are appreciated. Again, in this case, the html is as follows:

<div class="pull-quote">

Collapse
Posted by xx xx on
Adding class to AllowedAttribute and div to AllowedTag works for me (openACS 5.1.0). Richtext accepts it and I can convert it to HTMLarea.

However, while in "HTMLarea mode" you cannot insert <div>, unless you define your own button afaik. Version 3 is supposed to have a way to paste HTML.

Collapse
Posted by xx xx on
HTMLarea can probably do what you like it to do. Look at this and hit the symbol next to T to view the page.
Collapse
Posted by Jon Griffin on
That works, I forgot about the seperation of attributes and tags in the main site.