Tinymce 4の場合、私にとってはうまくいきます。
editor.on('keyup', function(e) {
alert('keyup occured');
//console.log('init event', e);
console.log('Editor contents was modified. Contents: ' + editor.getContent());
check_submit(); //another function calling
});
編集:
keyupはすべてのケースをキャプチャするわけではないことに注意してください。たとえばcopy
/ paste
/cut
からmenu
ではなくからkeyboard
必要に応じて、それらをキャプチャできます
editor.on('paste', function(e) {
console.debug('paste event');
});
editor.on('cut', function(e) {
console.debug('cut event');
});
注意: tinymce から
キャプチャする場合はcut
、paste
keyup からこれらのイベントを処理しないでください。私がしたことは、キーがcut
& paste
ie のキーでない場合にのみ保存することです:
/**
* MCE keyup callback, update the master model selected attribute
*
* @method tinyMCEKeyup
*/
tinyMCEKeyUp : function(e) {
console.log('tinymce:keyup');
var ctrlDown = false;
var ctrlKey = 17, vKey = 86, xKey = 88;
if ((e.ctrlKey) && (e.keyCode === vKey)) {
console.log('paste from keyboard')
/* got here. do nothing. let paste event handle this one */
return;
} else if ((e.ctrlKey) && (e.keyCode === xKey)) {
console.log('cut from keyboard')
/* got here. do nothing. let paste event handle this one */
return;
}
this.doSave();
},
keyup イベントからこの関数を呼び出します。このようにして、カットアンドペーストでいくつかのアクションを2回実行する必要がなくなります
すぐに、style changes
から発生したものはそれらのイベントもトリガーしないmenu
ことがわかります..
スタイルの変化を捉えるための答えをまだ探しています。