Hi,

I've something working fine with TinyMCE.
There's post about how to use it with ajax : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=109794

This is how I use it (with ajax re-rendering):
- copy the tinymce scripts into your project
- add this script (init-tiny.js) :

  | tinyMCE.init({
  |     mode:"none",
  |     theme : "advanced",
  |     theme_advanced_toolbar_location : "top",
  |     theme_advanced_statusbar_location : "bottom",
  |     theme_advanced_toolbar_align : "left",
  |     // everything on the first line
  |     theme_advanced_buttons1 : 
"bold,italic,underline,justifyleft,justifycenter,justifyright 
,fontselect,fontsizeselect,forecolor,backcolor",
  |     theme_advanced_buttons2 : "",
  |     theme_advanced_buttons3 : "",
  |     theme_advanced_resize_horizontal : false,
  |     theme_advanced_resizing : true,
  |     convert_newlines_to_brs : true              
  | });
  |     
  | function updateValue(control)
  | {   
  |     var textareas = document.getElementsByTagName('textarea');
  |     for( i = 0; i < textareas.length; i ++ ) {
  |             if( textareas[ i ].id == control ) {
  |                     textareas[ i ].value = tinyMCE.getContent(control);
  |             }
  |     }
  | }
  | 
  | function addMCE(control) {
  |     cleanMCE();
  |     tinyMCE.execCommand('mceAddControl', false, control);
  |     tinyMCE.switchClassCache = [];
  | }
  | 
  | function cleanMCE() {
  |     tinyMCE.idCounter = 0;
  |     tinyMCE.instances = new Array();
  | }
  | 

- to add the editor, add this attribute to your ajax tag :

  | oncomplete="addMCE( 'yourFormComponentId:yourTxtAreaComponentId' );"
  | 

- to remove the editor, add this attribute to your ajax tag :

  | oncomplete="cleanMCE();"
  | 

- add this attribute to your form tag (otherwise the textarea value is not 
updated) :

  | onsubmit="updateValue('#formId:inputAreaId');"
  | 



PS: You should post this on the richfaces forum.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086521#4086521

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086521
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to