简体   繁体   English

如何将插入图像按钮添加到CKEditor?

[英]How to add Insert Image button to CKEditor?

I'm using CKEditor 4.1.1 and can't figure out how to show the Insert Image button in th toolbar. 我正在使用CKEditor 4.1.1,无法弄清楚如何在工具栏中显示“插入图像”按钮。 This is my current CKEditor configuration in config.js . 这是我在config.js当前CKEditor配置。

CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here.
    // For the complete reference:
    // http://docs.ckeditor.com/#!/api/CKEDITOR.config

    // The toolbar groups arrangement, optimized for a single toolbar row.
    config.toolbarGroups = [
        { name: 'document',    groups: [ 'mode', 'document', 'doctools' ] },
        { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
        { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
        { name: 'forms' },
        { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
        { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
        { name: 'links' },
        { name: 'insert' },
        { name: 'styles' },
        { name: 'colors' },
        { name: 'tools' },
        { name: 'others' },
        { name: 'about' }
    ];

    // The default plugins included in the basic setup define some buttons that
    // we don't want too have in a basic editor. We remove them here.
    config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript,Font,SpellChecker';

    config.disableNativeSpellChecker = false;
    config.removePlugins = 'scayt,menubutton,contextmenu';

    // Let's have it basic on dialogs as well.
    config.removeDialogTabs = 'link:advanced';
};

How should I modify this to show the Insert Image button? 我该如何修改它以显示“插入图像”按钮?

I have been reading the documentation and trying various things, but nothing has worked thus far. 我一直在阅读文档并尝试各种各样的东西,但迄今为止没有任何工作。

I used to have the same issues long time ago. 我以前很久以前也遇到过同样的问题。 I have opened my old site code to check it out for you : 我已打开旧网站代码为您检查:

try to add this to your config.js 尝试将此添加到您的config.js

in the config.toolbarGroups Object config.toolbarGroups对象中

 { name: 'insert', items: [ 'Image']},

instead of 代替

 { name: 'insert'},

if that doesn't work replace image with lowercase 如果不起作用用小写替换image

Btw I have found this documentation which might be helpful 顺便说一下,我找到了这个可能有用的文档

Good Luck 祝好运

first you need to check your CKEditor Which css using for example CK Editor\\skins\\office2003\\editor.css in that you can add image the icon of image button i searched and checked it works for me 首先你需要检查你的CKEditor哪个css使用例如CK Editor \\ skins \\ office2003 \\ editor.css,你可以添加图像我搜索的图像按钮的图标并检查它是否适合我

.cke_skin_office2003 .cke_button a.cke_button_ICONNAME .cke_icon
{
    background-image:url(ICONNAME.png);
    background-repeat:repeat; 
    background-position:0px;
}

hopes it helps some one 希望它有所帮助

Make sure you install the Image ( https://ckeditor.com/cke4/addon/image ). 确保安装Image( https://ckeditor.com/cke4/addon/image )。 Extract the downloaded file, and put into plugins folder in ckeditor installation path. 解压缩下载的文件,并将其放入ckeditor安装路径中的plugins文件夹中。 after that, edit your config.js file put line like below: 之后,编辑你的config.js文件,如下所示:

CKEDITOR.editorConfig = function( config ) {
.....

   config.extraPlugins = 'image';
});

Reload your page and done. 重新加载您的页面并完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM