在XPages下自定义CKEditor(正确的方法) [英] Customize CKEditor under XPages (the right way)

查看:102
本文介绍了在XPages下自定义CKEditor(正确的方法)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用自定义按钮集自定义CKEditor的工具栏。

I need to customize CKEditor's toolbar with custom buttons sets.

我已经阅读了以下问题/答案和链接的资源:

I have already read these questions/answers and linked ressources:

  • Customize Ckeditor plug-in into Domino 8.5.3
  • How to configure the CKEditor under XPages?

如果您总是刷新整个页面,它们会起作用。但是,如果您对页面的一部分进行了部分刷新-包括至少一个RTF控件(CKEditor版本4.3.2)-在部分之后部分刷新,CKEditor将选择一个工具栏类型,例如'Full'(我不知道,但我认为是默认类型)作为工具栏类型来显示。

What they do works, if you always do a full page refresh. But if you do a partial refresh of a part of the page - including at least one rich text control (CKEditor version 4.3.2) - after the partial refresh CKEditor chooses a toolbar like 'Full' (I don't really know, but I think the default type) as toolbar type to display.

问题是整个 dojo-widget-定制IBM CKEditor-事情。在部分刷新后,它会忘记/忽略您的工具栏 dojo属性(但仍处于设置状态!)。

The problem is the whole dojo-widget - custom IBM CKEditor - thing. It makes your toolbar dojo property being 'forgotten/ignored' after a partial refresh (but it is still set!!!).

任何有经验/知识的人,如何最好地解决这个问题,例如

Anyone having experience/knowledge, how to solve this best, e.g. the IBM way (if there is any?!?!?)?

我通过更改全局CKEditor JS变量(每次在内部执行)的属性来快速而又轻松地解决了它部分刷新块):

I solved it quick and dirty by changing properties of the global CKEditor JS variable (executed every time inside the partial refresh block):

<xp:scriptBlock id="scriptBlock2">
    <xp:this.value>
        <![CDATA[
            CKEDITOR.config.readOnly = true;
            CKEDITOR.config.removePlugins = 'autogrow';
            CKEDITOR.config.autoGrow_minHeight = 250;
            CKEDITOR.config.autoGrow_maxHeight = 250;
            CKEDITOR.config.toolbarLocation = 'top';

            CKEDITOR.config.toolbar_readonly = [
                { name: 'tools', items: ['Find','Print', 'Preview', 'Maximize']}
            ];
        ]]>
    </xp:this.value>
</xp:scriptBlock>



系统:




  • IBM Domino 9.0.1 FP2(在客户端PC上本地)

  • 正在使用OpenNTF Domino框架

  • Windows 7 32位

  • System:

    • IBM Domino 9.0.1 FP2 (local on client PC)
    • OpenNTF Domino Framework in use
    • Windows 7 32 bit
    • 推荐答案

      我知道这是一篇旧文章,但这是一种可行的方法:

      I know this is an old post, but here's an approach that works:

      CK编辑器使用配置文件。默认情况下,它是以下文件: domino / html / ckeditor / config.js 。它包含编辑器的所有设置,包括工具栏。如果您通过提供自己的版本(从原始版本复制文件)并以自己的版本配置工具栏来覆盖该文件,则即使进行部分刷新,也将始终使用该配置。

      The CK Editor uses a configuration file. By default it is this file: domino/html/ckeditor/config.js. It holds all the settings for the editor, including the toolbar. If you override that file by providing your own version (copy it from the original) and configuring the toolbar in your own version, that configuration will always be used, even when doing a partial refresh.

      要使CK编辑器使用您的自定义配置文件,您需要向 xp:inputRichText 控件中添加一个dojo属性:

      To make the CK Editor use your custom config file you need to add a dojo attribute to the xp:inputRichText control:

      <xp:dojoAttribute
          name="customConfig"
          value="yourConfigFile.js">
      </xp:dojoAttribute>
      

      这篇关于在XPages下自定义CKEditor(正确的方法)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆