如何在XPage下配置CKEditor?

时间:2014-04-15 12:38:51

标签: xpages

我的目标是为CKEditor(版本3.6.6.2)添加一些自定义样式。

我已经有了解决方案,但它们会干扰内置图片上传功能。

enter image description here

添加图像的功能随后会存储在当前文档中。

所以我担心会有更多,目前尚未发现的问题。

我当前的解决方案

    <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>

我试图通过dojoAttributes和/或config.js整天实现这一目标 - 对我来说没什么用,但是那个。

如果有人能告诉我在XPage下配置CKEditor的正确方法,我会很高兴。

1 个答案:

答案 0 :(得分:2)

这仍然相关吗? intec.co.uk/xpages-8-5-2-rich-text-extending-the-ckeditor它可能不是,现在很多资源都在插件中

[Dennis K编辑]

解决方案

<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;
}