私のアプリケーションには、CKEditorのインスタンスがあります。ユーザがテキストをエディタに入力している間、最初の後者は大文字でなければなりません。そのために私はこのように、jQueryのKeyDownイベントのイベントハンドラを書いた:CKeditorのKeyDownイベント
$(document).ready(function() {
CKEDITOR.instances.CKEditor1.on('contentDom', function() {
CKEDITOR.instances.CKEditor1.document.on('keydown', function (event) {
if (this.selectionStart == 0 && event.keyCode >= 65 && event.keyCode <= 90 && !(event.shiftKey) && !(event.ctrlKey) && !(event.metaKey) && !(event.altKey)) {
var $t = $(this);
event.preventDefault();
var char = String.fromCharCode(event.keyCode);
$t.val(char + $t.val().slice(this.selectionEnd));
this.setSelectionRange(1, 1);
}
});
});
});
それはランタイムエラーすなわちを与え、
がどのように私はCKEditorバージョンのためのKeyDownイベントを作成することができます(私が書いた上記のコードを。 .aspxページ)0x800a138f - JavaScript runtime error: Unable to get property 'on' of undefined or null reference