Forum OpenACS Q&A: Problem with Xinha Stylist Config - used to work now doesn't in latest Xowiki

I have copied this from a working form on one site, to a new form in a new site that is running HEAD checkout of xowiki, and xowiki now chokes on the xinha_config.stylistLoadStylesheet declaration. Specifically, it reports:

"Error in field Form Constraints: From field 'af_terrain' has unknown specification '{ '.wr_heading1' : 'Large Title'' "

{my_field:richtext,editor=xinha,label=Content,plugins=Stylist OacsFs,javascript=xinha_config.toolbar=new Array(new Array('popupeditor')__COMMA__new Array('separator'__COMMA__'textindicator')__COMMA__new Array('separator'__COMMA__'justifyleft'__COMMA__'justifycenter'__COMMA__'justifyright'__COMMA__'justifyfull')__COMMA__new Array('separator'__COMMA__'insertorderedlist'__COMMA__'insertunorderedlist'__COMMA__'outdent'__COMMA__'indent')__COMMA__new Array('separator'__COMMA__'inserthorizontalrule'__COMMA__'createlink'__COMMA__'insertimage'__COMMA__'inserttable')__COMMA__new Array('linebreak'__COMMA__'undo'__COMMA__'redo'__COMMA__'separator'__COMMA__'selectall'__COMMA__'print')__COMMA__new Array('separator'__COMMA__'killword'__COMMA__'clearfonts'__COMMA__'removeformat'__COMMA__'toggleborders'__COMMA__'splitblock'__COMMA__'lefttoright'__COMMA__'righttoleft')__COMMA__new Array('separator'__COMMA__'htmlmode'__COMMA__'showhelp'__COMMA__'about'));
xinha_config.stylistLoadStylesheet('/content/download/file/resources/css/om_xinha.css',
{
'.wr_heading1' : 'Large Title',
'.wr_heading2' : 'Standard Title',
'.wr_heading3' : 'Subtitle',
'.wr_heading4' : 'Small Subtitle',
'.wr_bodytext' : 'Standard Text',
'.wr_largetext' : 'Large Text',
'.wr_smalltext' : 'Small Text'
}
);}

Chokes on example stylist code as well:

xinha_config.stylistLoadStylesheet('/resources/xowiki/examples/xinha-mc-styles.css', {'p.angabe' : 'Aufgabenstellung', 'p.loesungshinweis' : 'Lösungshinweis', 'li.correct_choice' : 'Richtige Antwort', 'li.incorrect_choice' : 'Falsche Antwort'});}

The behavior of xinha can be configured in XoWiki in various ways.

For ::xowiki::Page, goto parameters, and add e.g. the following to the widget specs:

*,text {richtext(richtext),nospell,optional 
  {label Content} 
  {html {style {width: 100%}}} 
  {options {editor xinha plugins {Stylist OacsFs} height 350px 
    javascript { 
      xinha_config.toolbar = [ ['popupeditor', 'bold','italic','createlink','insertimage','separator'], ['killword','removeformat'] ];
      xinha_config.stylistLoadStylesheet('/resources/xowiki/examples/xinha-mc-styles.css', {
       'p.angabe' : 'Aufgabenstellung', 
       'p.loesungshinweis' : 'Lösungshinweis', 
       'li.correct_choice' : 'Richtige Antwort', 
       'li.incorrect_choice' : 'Falsche Antwort'}); 
}}}}  
For more details, see: xowiki default xinha configuration

If you want to use richtext fields in ::xowiki::Forms, the recommended way to tailor the richtext form-field is to subclass it. This is especially recommended when you want to use the same setup for several fields in several forms. For an example of tailoring see e.g. the option "slim" in form-field-procs.tcl.

If you really want to entry the full sermon via the form field specs, make sure that you replace within the field "," by "__COMMA__", otherwise the option parser thinks, this are different options. Your specification looks therefore like:

{my_field:richtext,editor=xinha,label=Content,plugins=Stylist OacsFs,javascript=xinha_config.toolbar=new Array(new Array('popupeditor')__COMMA__new Array('separator'__COMMA__'textindicator')__COMMA__new Array('separator'__COMMA__'justifyleft'__COMMA__'justifycenter'__COMMA__'justifyright'__COMMA__'justifyfull')__COMMA__new Array('separator'__COMMA__'insertorderedlist'__COMMA__'insertunorderedlist'__COMMA__'outdent'__COMMA__'indent')__COMMA__new Array('separator'__COMMA__'inserthorizontalrule'__COMMA__'createlink'__COMMA__'insertimage'__COMMA__'inserttable')__COMMA__new Array('linebreak'__COMMA__'undo'__COMMA__'redo'__COMMA__'separator'__COMMA__'selectall'__COMMA__'print')__COMMA__new Array('separator'__COMMA__'killword'__COMMA__'clearfonts'__COMMA__'removeformat'__COMMA__'toggleborders'__COMMA__'splitblock'__COMMA__'lefttoright'__COMMA__'righttoleft')__COMMA__new Array('separator'__COMMA__'htmlmode'__COMMA__'showhelp'__COMMA__'about'));
xinha_config.stylistLoadStylesheet('/resources/xowiki/examples/xinha-mc-styles.css' __COMMA__
{'.wr_heading1' : 'Large Title' __COMMA__
 '.wr_heading2' : 'Standard Title' __COMMA__
 '.wr_heading3' : 'Subtitle' __COMMA__
 '.wr_heading4' : 'Small Subtitle' __COMMA__
 '.wr_bodytext' : 'Standard Text' __COMMA__
 '.wr_largetext' : 'Large Text' __COMMA__
 '.wr_smalltext' : 'Small Text'});}

Make sure, that your style-file /content/download/file/resources/css/om_xinha.css is found if you move stuff around. When the style file is not found, xinha refuses to draw the stylist pane.

Hope this helps

-gustaf neumann

Gustaf,

Thank you very much. I have altered the spec for the 'slim' option and everything is now as I want it.

I have however noticed a quirk.

If I create a style called:

'.mystyle' : 'My Style'

....it will work just fine.

However, if I change it to:

'ul.mystyle' : 'My Style'

....then the style is displayed with name 'ul.mystyle' in the styles palette instead of the pretty name.

I have checked the page source and Xowiki is delivering the correct config. It seems to be a Xinha thing.

Regards
Richard