Skip to Content
author's profile photo Former Member
Former Member

Add a custom fckeditor plugin to the ProductCockpit Wysiwyg editor

Hi, I would like to integrate a custom fckplugin for ProductCockpit WYSIWYG Editor to insert in his toolbar. In the following there are my configuration:

"/cockpit/customcomponents/cockpit-fck-config.js"

FCKConfig.ToolbarSets['Default'] = [ ['OurPlugin'], //['Table','-','TableInsertRow','TableDeleteRows','TableInsertColumn','TableDeleteColumns','TableInsertCell','TableDeleteCells','TableMergeCells','TableSplitCell'], ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About'] ] ; var sOtherPluginPath = '/cmscockpit/cockpit/customcomponents/' ; FCKConfig.Plugins.Add( 'OurPlugin', 'en,it', sOtherPluginPath ) ;

editorArea_Product.xml file this configuration

fckToolbarConfiguration [['Bold', 'Italic','Underline','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','-','OrderedList','UnorderedList','-','Outdent','Indent','-','Table'],'/',['OurPlugin'],['FontName','FontSize','TextColor','-','Source']]

But when you open the editor WYSIWYG , a alert show this message: " OurPlugin is undefined " Does any one know a way to configure a custom fckplugin? Thank you

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Posted on May 08, 2015 at 11:23 AM

    Not sure if there's another approach, but this one worked for me:

    1) extend WysiwygUIEditor.createCockpitFCKEditor(...):

         final CockpitFCKEditor editor = super.createCockpitFCKEditor(editorParameters);
      if (editorParameters != null) {
          final String pluginToLoad = (String) editorParameters.get("fckPlugin");
          if (pluginToLoad != null) {
              final StringTokenizer tokenizer = new StringTokenizer(pluginsToLoad, "; ");
              editor.addEditorAttribute("var dummy", "FCKConfig.Plugins.Add(" + pluginToLoad + ")");
          }
      }
      editor.applySettings();
      return editor;
    
    

    2) Register the plugin in cockpit's EditorFactory (you can override default wysiwyg editor)

    3) Specify the plugin loading in editorArea's config:

              <parameter>
                  <name>fckPlugin</name>
                  <value>"scbplaceholder","en"</value>
              </parameter>
    
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 08, 2015 at 01:04 PM

    Thanks for your response. Acoording with your suggestion this is my code:

       CockpitFCKEditor fckEditor= super.createCockpitFCKEditor(editorParameters);
            if (editorParameters != null) {
                final String pluginToLoad = (String) editorParameters.get("fckPlugin");
                if (pluginToLoad != null) {
                    final StringTokenizer tokenizer = new StringTokenizer(pluginToLoad, "; ");
                    fckEditor.addEditorAttribute("var dummy", "FCKConfig.Plugins.Add(" + pluginToLoad + ")");
                }
            }
            fckEditor.applySettings();
            return fckEditor;
    
     
    
     <parameter>
        <name>fckPlugin</name>
            <value>"./cockpit/customcomponents/styleGenerator"</value>
     </parameter>
    
    

    But doesn't work. I've the same error. Any Ideas?

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

    • Did you register the editor in EditorFactory bean? Base definition can be found in cockpit/resources/cockpit/cockpit-spring-editors.xml, but almost each cockpit (cscockpit, reportcockpit, productcockpit, etc) adjusts it. Once that is done, try seeing if there are some kind of JavaScript errors - maybe plugin path cannot be found?

  • author's profile photo Former Member
    Former Member
    Posted on May 12, 2015 at 04:14 PM

    I've a javascript error : myplugin not defined

    Add a comment
    10|10000 characters needed characters exceeded

      1. Check that you've the modified editorArea config file is uploaded

      2. Check that user does not have a copy of config (reset personalised settings)

      3. Check that plugin .js file is requested (inspect network requests)

      4. Check that the plugin file is found and loaded (maybe path cannot be found)

      In other words: you'll have to pinpoint the reason why plugin is not loaded. This approach works, but you're missing something. Inspecting HTML source of cockpit might help - all can be found there.

  • Posted on Feb 07, 2017 at 01:15 PM

    What did you mean with "2) Register the plugin in cockpit's EditorFactory (you can override default wysiwyg editor)"? I have registered the extended wysiwyg-editor. This works fine. But do I have to register my new PLUGIN in this bean?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.