私のページには、CKEditorインスタンスであるテキストエリアがあります。ユーザーがテキストエリアを離れると、コンテンツが保存されます。私が抱えている問題は、ツールバーからドロップダウンアイテムを選択しようとすると(たとえば、テキストの領域を強調表示してからドロップダウンからフォーマットを適用しようとした場合)、「blur」イベントがトリガーされることです。この機能を使用すると、コンテンツが(スタイルが適用される前に)保存されてから、エディターが破棄されます。
私のコードは次のとおりです。
// Initially, colName is a variable which stores the name of the column being edited
// The textarea id is editText_colName
$('#editText_' + colName).ckeditor({
toolbar : 'Basic',
format_tags : 'h1;h2;h3;p',
resize_enabled : false
});
var editor = $('#editText_' + colName).ckeditorGet();
editor.on('blur', function() {
// Get content of text editor, and save
var data = $('#editText_' + colName).val();
// ... save data ...
// ... on success, do the following ...
editor.destroy();
$('#editText_' + colName).remove();
});
ユーザーがツールバーからメニューを選択したときではなく、ユーザーがエディターを離れたときにのみぼかし機能に到達するようにするにはどうすればよいですか?