我试图在ckeditor中创建一个自定义插件,以便可以将我的应用程序中当前经过身份验证的用户分配到CKEditor中的“用户”插件中。不幸的是,我似乎无法在自定义插件中使用angular DI。这是我的插件的示例代码。
import {FetchUserService} from "../../fetchuser-service";
export default class CommentsIntegration {
public editor;
constructor( editor, fetchUserService : FetchUserService) {
this.editor = editor;
console.log(this.fetchUserService); // prints undefined
}
这是我传递给编辑器的配置对象
public defaultConfig = {
// Settings specific to the auto-save plugin. It should save every second and a half.
autosave: {
waitingTime: 1500,
save(editor) {
return saveData( editor.getData() );
}
},
extraPlugins: [ CommentsIntegration ]
};
我也尝试注入其他服务,其中一些与我的应用程序相关,其中一些与angular相关,而其他与CKEditor相关,但是在控制台日志打印中都未定义。
所以我的问题是,CKEditor插件是否不支持依赖项注入,或者如果这样做,我做错了什么导致服务未被注入?