短篇小說:如何從JavaScript模擬在CKEditor的DEL按鍵
// get the editor instance
var editor = CKEDITOR.instances.editor1;
// this is what I want, but it does not exist
editor.execCommand('delete');
// I've played with this, found somewhere, but without success.
editor.fire('key', { keyCode : 46 })
長的故事:
有利用.NET WindowsForms WebBrowser控件中的CKEditor當問題。幾個鍵,包括DELete鍵根本不會傳播到控件。
我設法攔截使用全局鍵盤鉤子的密鑰,並將窗口消息直接發送到嵌入式IE窗口句柄,但沒有成功。
現在我的目標是模擬JavaScript中的刪除鍵,因爲我可以從我的.NET應用程序調用js函數。 不知何故,這必須工作,因爲它在虛擬鍵盤插件內工作。 (請參閱sample)
很遺憾,我無法從插件代碼得知它是如何工作的。 如果有人可以發佈工作示例,我會很高興。
謝謝!