如何将预定义和自定义ckeditor插件添加到ng2-ckeditor

时间:2017-07-24 07:24:18

标签: javascript angular ckeditor

我正在尝试在angular2中的ckeditor的内联模式下将stylesheetparser插件添加到ng2-ckeditor模块。但我在样式下拉列表中使用右方括号以及" Source" ckeditor中的按钮丢失了。

例如:div.editable]

我使用以下代码添加插件

CKEDITOR.config.extraPlugins =' stylesheetparser';

使用的ckeditor的CDN版本是" https://cdn.ckeditor.com/4.5.11/full-all/ckeditor.js"

请帮我找一个解决方案。

先谢谢

1 个答案:

答案 0 :(得分:0)

添加此代码是html和ts文件。希望它能正常工作。

<强> Component.ts

ckeConfig : any;
this.ckeConfig = {
   height: 500,
   width: '60%',
   allowedContent: false,
   fullPage : true,
   toolbar: [
       { name: "styles", items: ['Format', 'Font', 'FontSize', "-", "TextColor", "BGColor"] },
       { name: "basicstyles", items: ["Bold", "Italic", "Underline", "RemoveFormat"] },
       "/",
       { name: "justify", items: ["JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock"] },
       { name: "paragraph", items: ["NumberedList", "BulletedList", "-", "Outdent", "Indent", "-", "Blockquote"] },
       { name: "links", items: ["Link", "Unlink"] },
       { name: "insert", items: ["Image", "Table", "HorizontalRule", "Smiley","SpecialChar"] },
       { name: "document", items: ["Source"] },
   ]
 };

Component.html: -

<ckeditor [config]="ckeConfig" ></ckeditor>