2016-07-23 59 views
1

我使用的是最新版本,4.4.0,並具有限定爲大多數鍵快捷方式沒有問題,但不能得到任何一個熱鍵工作加回車鍵:是否可以在TinyMCE中添加Cmd-Enter的快捷方式?

// this works great (meta = Cmd on macs) 
editor.addShortcut('meta+b', 'testB',() => console.log('meta+b!')) 

// nope! 
editor.addShortcut('meta+enter', 'testEnter',() => console.log('y u no work')) 

這是不受支持?或者有一些祕密咒語? documentation相當稀疏,我找到的那forum post是不確定的並且是過時的。

回答

0

我得到這個定義一個​​事件處理程序,而不是使用addShortcut工作:

editor.on('keydown', event => { 
    if (event.which === 13 && event.metaKey) { 
    console.log('yay') 
    } 
}) 
相關問題