3 Replies Latest reply on Sep 20, 2007 9:03 AM by Bieth Bruno

    Rich Text Editor

    Hannes Schulz Newbie

      Hello,

      does anyone know a rich text editor that can be used with sun jsf 1.2? I found FCK Faces but it only works with myfaces.

      Any hints would be great.

      Thanks,
      hasc

        • 1. Re: Rich Text Editor
          Bieth Bruno Newbie

          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.


          • 2. Re: Rich Text Editor
            Hannes Schulz Newbie

            thanks for your fast response.

            is it possible to confgure the resource path and upload images with this editor?

            regards,
            hasc


            • 3. Re: Rich Text Editor
              Bieth Bruno Newbie

              donno, I haven't used it with resources