首页 文章

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

提问于
浏览
0

我试图在angular2的ckeditor的内联模式下将stylesheetparser插件添加到ng2-ckeditor模块 . 但是我在样式下拉列表中使用右方括号获得输出,并且缺少ckeditor中的“Source”按钮 .

例如:div.editable]

我使用以下代码添加插件,

CKEDITOR.config.extraPlugins = 'stylesheetparser';

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

请帮我找到解决方案 .

提前致谢

1 回答

  • 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>
    

相关问题