4 Replies Latest reply on Feb 25, 2015 8:49 AM by barbaraboie

    extra plugin in rich:editor

    barbaraboie

      Hello

      Is there anyone who has an example on how to load an extra plugin in rich:editor?

       

      I tried something like this, but it doesn't work:

       

      <rich:editor value="#{advieswaarde.waarde}" toolbar="custom" >

           <f:validateLength maximum="4000" />

           <f:facet name="config">

                plugins.addExternal('lite', '../javascript/lite/'),

                extraPlugins : 'lite',

                startupFocus: true,

                toolbar_custom:

                                  [

                                      { name: 'document', items : [ 'NewPage','Preview' ] },

                                      { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },

                                      { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] },

                                      { name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'

                                               ,'Iframe' ] },

                                              '/',

                                      { name: 'styles', items : [ 'Styles','Format' ] },

                                      { name: 'basicstyles', items : [ 'Bold','Italic','Strike','-','RemoveFormat' ] },

                                      { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote' ] },

                                      { name: 'links', items : [ 'Link','Unlink','Anchor' ] },

                                      { name: 'tools', items : [ 'Maximize' ] }

                                  ]

           </f:facet>

      </rich:editor>

               

      Thanks, barbara

        • 1. Re: extra plugin in rich:editor
          barbaraboie

          Noone?

           

          I also tried to work with a custom configuration file. I don't get errors, but the file isn't used:

           

          <rich:editor value="#{advieswaarde.waarde}">

               <f:validateLength maximum="4000" />

               <f:facet name="config">

                    customConfig: '../javascript/ckeditor_customconfig.js'

               </f:facet>

          </rich:editor>

           

          ckeditor_customconfig.js:

          CKEDITOR.editorConfig = function( config )

          {

              config.toolbar = 'MyToolbar';

           

              config.toolbar_MyToolbar =

              [

                  { name: 'document', items : [ 'NewPage','Preview' ] },

                  { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },

                  { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] }

              ];

          };

           

          This is the toolbar that I get:

          toolbar.JPG

           

          I'm using  Richfaces 4.5.0.Beta2   

          • 2. Re: extra plugin in rich:editor
            michpetrov

            Hi,

             

            I'm guessing the file paths aren't correct, since everything else looks ok. I'll check how the path is being resolved.

            • 3. Re: Re: extra plugin in rich:editor
              michpetrov

              Okay, here's how it works:

               

              The basepath of the editor is http://server/app/org.richfaces.resources/javax.faces.resource/org.richfaces.ckeditor/, unfortunately the editor can't resolve "..", so your best option is to put your plugins into a folder named "org.richfaces.ckeditor" (under webapp/resources).

               

              The code is ok except the name of the toolbar needs to be in the main config:

              <rich:editor value="#{advieswaarde.waarde}">
                   <f:validateLength maximum="4000" />
                   <f:facet name="config">
                        toolbar: 'MyToolbar',
                        customConfig: 'ckeditor_customconfig.js'
                   </f:facet>
              </rich:editor>
              
              
              

               

              CKEDITOR.editorConfig = function( config )
              {
                  config.toolbar_MyToolbar =
                  [
                      { name: 'document', items : [ 'NewPage','Preview' ] },
                      { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
                      { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] }
                  ];
              };
              
              
              
              • 4. Re: Re: extra plugin in rich:editor
                barbaraboie

                Sorry, forgot to answer. Your solution worked!! Thanks a lot!