2014-04-15 27 views
0

我的目標是將一些自定義樣式添加到CKEditor(版本3.6.6.2)。如何在XPages下配置CKEditor?

我已經有了一個解決方案,但它們會影響內置的圖像上傳功能。

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> 

我haved試圖做到這一點通過dojoAttributes和/或config.js整天 - 沒有制定出對我來說,這樣的作用。

如果有人能告訴我在XPage下配置CKEditor的正確方法,我會非常高興。

+0

這是還有用嗎? http://www.intec.co.uk/xpages-8-5-2-rich-text-extending-the-ckeditor/ 它可能不是,現在很多資源都在插件中 –

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