我正在使用此帖子Angular2 - CKEditor use的答案中解释的解决方案,但是我收到以下错误:
编辑器实例“editor1”已附加到提供的内容中 元件。
import {Component, Input} from "angular2/core";
@Component({
selector: 'CKEDITOR',
template: `
<textarea name="targetId" id="targetId" rows="rows" cols="cols">
This is my CKEditor component.
</textarea>
`
})
export class Ckeditor {
@Input() targetId;
@Input() rows = 10; //you can also give default values here
@Input() cols;
constructor(){}
ngOnInit(){
window['CKEDITOR']['replace']( this.targetId );
}
}
templateUrl: `<CKEDITOR [targetId]="editor1" [rows]="10" [cols]="80"></CKEDITOR>`,
directives: [Ckeditor]
我正在使用自定义ckeditor
<script src="/ckeditor/ckeditor.js"></script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
},
"ng2-ckeditor": {
"defaultExtension": "js"
}
}, map: {
"ng2-ckeditor": "node_modules/ng2-ckeditor/lib/CKEditor.js"
}
});