简体   繁体   English

CKEditor:使Shift + Enter与Ctrl + Enter相同

[英]CKEditor: Make Shift+Enter same as Ctrl+Enter

When you press Shift + Enter in a CKEditor, a new line is created. 在CKEditor中按Shift + Enter时,将创建一个新行。 When you press Ctrl + Enter , nothing happens. Ctrl + Enter时 ,没有任何反应。

How can I make pressing Ctrl + Enter , to behave same as Shift + Enter ? 如何按Ctrl + Enter键 ,其行为与Shift + Enter相同?

Make sure that Enterkey plugin is loaded. 确保已加载Enterkey插件。 Then use editor.setKeystroke() to assign a new keystroke to an existing command ( Enter is 13) ( fiddle ): 然后使用editor.setKeystroke()为现有命令分配新的击键( Enter is 13)( 小提琴 ):

CKEDITOR.replace( 'editor', {
    on: {
        instanceReady: function() {
            this.setKeystroke( [
                [ CKEDITOR.CTRL + 13, 'shiftEnter' ]
            ] );                        
        }
    }
} );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM