6

我有一个标准安装(如示例):

<meta charset="utf-8"></meta>
<script src="../ckeditor.js"></script>

带有许多<div contenteditable="true">块的 HTML 内容。我需要通过本地或外部configTypeX.js文件配置每个编辑器,

  <script>
   CKEDITOR.on( 'instanceCreated', function( event ) {
     var editor = event.editor, element = editor.element;
         if ( element.is( 'h1', 'h2', 'h3' ) ) {
        editor.on( 'configLoaded', function() {
            editor.config.toolbar = [
                [ 'Source', '-', 'Bold', 'Italic' ]
            ];  // BUG: about "Source"?? NOT AT INTERFACE!
        }); 
         } else {
            // WHERE PUT THIS ITEM?
    customConfig: 'configType2.js';
         }
   });
  </script>

所以,我的问题是

  1. customConfig在这种情况下怎么做?
  2. 哪里有“最好的完整文档”,关于editor.config.toolbar没有在线配置工具的配置菜单(),我可以在哪里理解如何放置和删除具有正确名称的菜单项? 这里没有关于如何在完整安装中修复“源”错误的信息。

我愿意,

git clone git://github.com/ckeditor/ckeditor-releases.git
cd ckeditor-releases
cp samples/inlineall.html samples/myinline.html 

samples/myinline.html并使用上面的代码进行编辑。

4

1 回答 1

10
  1. 对于内联编辑器,标准Source按钮是隐藏的,因为除了wysiwyg. 因此,为那些编辑器创建了新插件 - sourcedialog,但默认情况下它不包含在任何构建中。您可以使用在线 CKBuilder或使用带有参数的预设之一使用此插件构建编辑器。all例如:./build.sh full all。还要记住加载sourcedialog插件(使用config.extraPlugins = 'sourcedialog')。

  2. 如果你想自由配置内联编辑器,那么你应该看看inlinebycode示例。首先,您需要禁用可编辑元素上的自动编辑器初始化,然后调用CKEDITOR.inline()您想成为编辑器的元素:

    // We need to turn off the automatic editor creation first.
    CKEDITOR.disableAutoInline = true;
    
    CKEDITOR.inline( 'editable1', {
        customConfig: 'editableConfig.js'
    } );
    CKEDITOR.inline( 'editable1', {
        toolbar: [ ... ]
    } );
    
于 2013-08-25T16:31:17.163 回答