Dennis Kronbügel
Dennis Kronbügel

Reputation: 114

How to configure the CKEditor under XPages?

My goal is to add some custom-styles to the CKEditor (Version 3.6.6.2).

I already got a solution, but they interfere with the build-in image-upload functionality.

enter image description here

The feature to add an image, which is then stored in the current document, is gone.

So i am afraid that there are more, currently undiscovered, problems with it.

My Current Solution

    <xp:inputRichText value="#{document1.Body}" id="html1" htmlFilter="identity" htmlFilterIn="identity" />
    <xp:scriptBlock id="scriptBlock1" type="text/javascript">
       <xp:this.value><![CDATA[
           var ckEditorClientId = "#{javascript: getClientId("html1")}";                        
           CKEDITOR.replace( ckEditorClientId,
               {stylesSet: [
                   { name : 'MyStyle', element : 'span', attributes : { 'class' : 'myStyle' } }
               ],
               toolbar : CKEDITOR.config.toolbar_Full                               
               }            
           );                   
       ]]></xp:this.value>
    </xp:scriptBlock>

I haved tried to achieve that via dojoAttributes and/or config.js all day long - nothing worked out for me, but that.

I would be so happy, if anybody can tell me the right way to configure the CKEditor under XPages.

Upvotes: 0

Views: 1121

Answers (1)

Paul Stephen Withers
Paul Stephen Withers

Reputation: 15739

Is this still relevant? intec.co.uk/xpages-8-5-2-rich-text-extending-the-ckeditor It may not be, now a lot of the resources are in a plugin

[Edit by Dennis K.]

Solution

<xp:inputRichText value="#{document1.html}" id="html1" htmlFilter="identity" htmlFilterIn="identity">
    <xp:this.dojoAttributes>
        <xp:dojoAttribute name="extraPlugins" value="stylesheetparser"></xp:dojoAttribute>
        <xp:dojoAttribute name="toolbarType" value="Full"></xp:dojoAttribute>
        <xp:dojoAttribute name="contentsCss" value="CKStyles.css"></xp:dojoAttribute>
    </xp:this.dojoAttributes>
</xp:inputRichText>

CKStyles.css

//Example
span.myClass {
   color: #00A6C7;
   font-size: 1.8em;
   font-weight:normal;
}

Upvotes: 2

Related Questions