javascript - Del key doesn't fire in WebBrowser-hosted CKEditor
问题描述
I have a WebBrowser-hosted CKEditor instance, but pressing the Del
key doesn't do anything.
I tried this to get through thre problem:
In my WebBrowser-derived class:
Protected Overrides Sub OnPreviewKeyDown(e As PreviewKeyDownEventArgs)
MyBase.OnPreviewKeyDown(e)
If e.KeyData = Keys.Delete Then
Document.InvokeScript("pressDelete")
End If
End Sub
In my HTML page that loads CKEditor:
<script type="text/javascript">
function pressDelete() {
return CKEDITOR.instances.myeditor.fire('key', { keyCode: 46 });
}
</script>
and
<script type="text/javascript">
function pressDelete() {
return CKEDITOR.instances.myeditor.document.fire('key', { keyCode: 46 });
}
</script>
and
<script type="text/javascript">
function pressDelete() {
return CKEDITOR.instances.myeditor.execCommand('delete');
}
</script>
The first script raised a Script Error; the other two did nothing.
The case is, the rich text editor I intend to host in my Winforms application is lame if pressing Del
doesn't work.
解决方案
推荐阅读
- youtube-api - 通过 YouTube 数据 API 对评论进行分页
- marzipano - Marzipano - 如何打开/关闭图层?
- flutter - listview.builder 的每一项都有不同的数据
- sharepoint - 如何将 Power BI 表数据作为列表导出到 sharepoint
- ballerina - 模拟 nil 结果时测试失败
- c# - 当表上有任何此类实体要删除时,为什么 EF Extensions 不会引发异常?
- reactjs - 如何将反应日期选择器时间设置为 UTC
- mysql - 无法在 my.cnf 中禁用 query_cache_type
- json - 我应该在请求正文中输入什么来发送带有超链接的电子邮件?
- node.js - 如何将 Sequelize 节点连接到 Amazon RDS Postgres