热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

config.js不适用于CKEditor-config.jsdoesn'tworkforCKEditor

Ihavethefollowinginmyconfig.jsforCKEditor:我的config.js中有以下CKEditor:CKEDITOR.editorConfig

I have the following in my config.js for CKEditor:

我的config.js中有以下CKEditor:

CKEDITOR.editorCOnfig= function( config )
{
    config.toolbar =
    [
        [ 'Source', '-', 'Bold', 'Italic' ]
    ];
    // config.toolbar_Basic =
    // [
    //     [ 'Source', '-', 'Bold', 'Italic' ]
    // ];
    // config.toolbar = 'Basic';
}

The editor is still showing with all the options in the toolbar.

编辑器仍显示工具栏中的所有选项。

It is also loading the JS files in the right order:

它还以正确的顺序加载JS文件:




So I am not sure what is happening here. Any thoughts?

所以我不确定这里发生了什么。有什么想法吗?

Also important to note that I tried the alternative way of declaring that Basic toolbar (see the commented out code in the snippet above) and it didn't work either.

同样重要的是要注意我尝试了另一种方式来声明基本工具栏(请参阅上面代码段中注释掉的代码)并且它也不起作用。

After every change, I restart my server.

每次更改后,我都会重新启动服务器。

5 个解决方案

#1


4  

How do you load you ckeditor in place of the textarea? Maybe the toolbar is overridden there.

你怎么加载ckeditor代替textarea?也许工具栏被覆盖了。

#2


2  

Your config.js file looks OK (both versions of it).

你的config.js文件看起来还不错(它的两个版本)。

What may be wrong is how you load CKEditor. First of all - you don't need to load config.js - CKEditor will do that. Second, what's in the init.js file?

可能有什么问题是你如何加载CKEditor。首先 - 你不需要加载config.js - CKEditor会这样做。第二,init.js文件中有什么?

Have you cleared a cache in your browser? On some it can be really hard to do that automatically.

您是否在浏览器中清除了缓存?在某些情况下,自动执行此操作真的很难。

#3


1  

Download CKEditor 3.2.1 here: http://ckeditor.com/download

在此处下载CKEditor 3.2.1:http://ckeditor.com/download

Extract the downloaded .tar.gz file.

解压缩下载的.tar.gz文件。

Copy the contents of the ckeditor folder into /sites/all/modules/contrib/ckeditor/ckeditor

将ckeditor文件夹的内容复制到/ sites / all / modules / contrib / ckeditor / ckeditor

At this point you may want to edit the available toolbar options removing any unnecessary items. In most cases, I prefer the following configuration as it allows maximum fanciness while minimizing the types of markup which could override the site's styling

此时,您可能希望编辑可用的工具栏选项,删除任何不必要的项目。在大多数情况下,我更喜欢以下配置,因为它允许最大的功能,同时最小化可能覆盖网站样式的标记类型

edit /sites/all/modules/contrib/ckeditor/ckeditor.config.js

Create a new toolbar by adding the following configuration to ckeditor.config.js:

通过将以下配置添加到ckeditor.config.js来创建新工具栏:

**

config.toolbar_DrupalCustom = [
      ['Source'],
      ['Cut','Copy','Paste','PasteText','-','SpellChecker', 'Scayt'],
      ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
      ['Image','HorizontalRule','Smiley','SpecialChar'],
      ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
      ['NumberedList','BulletedList','-','Blockquote'],
      ['Link','Unlink','Anchor','LinkToNode', 'LinkToMenu'],      
      ['Format','Font','FontSize'],
      ['TextColor','BGColor'],
      ['Maximize', 'ShowBlocks'],
      ['DrupalBreak', 'DrupalPageBreak']
     ];

** You can now select this option within the CKEditor Appearance section at /admin/settings/ckeditor/edit/Advanced

**您现在可以在/ admin / settings / ckeditor / edit / Advanced的CKEditor外观部分中选择此选项

#4


1  

I too had problems with CKEditor and the "caching" issue. Cleared cache, loaded a custom config file... and timestamps...

我也遇到过CKEditor和“缓存”问题。清除缓存,加载自定义配置文件...和时间戳...

http://ckeditor.com/forums/CKEditor/Problem-with-config.js-not-updating

Nothing worked. Then i simply added it as options when instantiating the editor:

没有任何效果。然后我只是在实例化编辑器时将其添加为选项:

CKEDITOR.replace( 'controls_' + int_control_cnt + '_label_text' ,
            {
            toolbar: [
                ['Bold', 'Italic', 'Underline', '-', 'TextColor', '-', 'RemoveFormat'],
                ['Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo']
            ]
            });

This did the trick

这样做了

#5


0  

use only:

仅用于:

and be sure to clear your browser cache!

并确保清除您的浏览器缓存!


推荐阅读
author-avatar
aofeng12_313
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有