我试图在一个棱角形的应用程序中捕捉到CKEditor5内部的输入,使用类型记录。我能够让CKEditor显示,并能够记录编辑器的存在。然而,我似乎无法捕捉到输入。在CKEditor4中,这似乎非常简单,在这里,下面这样的简单代码起作用了:
editor.on('key', function (event) {
//some work goes here
}然而,用我当前的ClassicEditor来尝试这一点似乎不是这样的。我正在使用CKEditor5,并已在index.html中初始化了它,并以以下格式在代码中调用它
declare var ClassicEditor: any;
export class AlterInput implements OnInit {
ngOnInit() {
ClassicEditor
.create( document.querySelector( '#editor' ) )
.then(editor => {
console.log("THIS GETS PRINTED", editor)
editor.on('key', (event) => {
console.log('THIS DOES NOT GET PRINTED', event);
})
.catch( error => {
console.error( error );
} );
}
}我最初用CKEditor4创建了一个插件--它是通过调用CKEDITOR.plugins.add('pluginName', {\**some work in the init function**\})来完成的
然而,我似乎找不到一个恰当的例子来说明如何使用CKEditor5来做到这一点。我的最终目标是输入字符的关键代码,添加一个,并粘贴它。
发布于 2022-08-25 05:40:40
目前正在使用实时协作插件实现CKEditor 5,我不知道如何将当前登录的用户添加到存在列表中,而不是CKEditor给出的随机用户,在他们的官方文档中,我无法清楚地获得它。
https://stackoverflow.com/questions/49714473
复制相似问题