除了<code>
之外,我几乎已经绑定了CKEditor所需的所有按键。如何绑定该HTML标记的击键?
config.keystrokes = [
[ CKEDITOR.CTRL + 32 /*space*/, 'removeFormat' ],
[ CKEDITOR.CTRL + 56 /*8*/, 'bulletedlist' ],
[ CKEDITOR.CTRL + CKEDITOR.SHIFT + 56 /*8*/, 'bulletedListStyle' ],
[ CKEDITOR.CTRL + 77 /*M*/, 'indent' ],
[ CKEDITOR.CTRL + CKEDITOR.SHIFT + 77 /*M*/, 'outdent' ],
[ CKEDITOR.CTRL + 188 /*COMMA*/, 'subscript' ],
[ CKEDITOR.CTRL + 190 /*PERIOD*/, 'superscript' ],
[ CKEDITOR.CTRL + CKEDITOR.SHIFT + 73 /*I*/, 'image' ],
[ CKEDITOR.CTRL + 75 /*K*/, 'link' ],
[ CKEDITOR.CTRL + CKEDITOR.SHIFT + 75 /*K*/, 'unlink' ],
[ CKEDITOR.CTRL + CKEDITOR.SHIFT + 70 /*F*/, 'find' ],
[ CKEDITOR.ALT + 88 /*X*/, 'maximize' ],
[ CKEDITOR.CTRL + 113 /*F2*/, 'preview' ],
[ CKEDITOR.CTRL + CKEDITOR.SHIFT + 80 /*P*/, 'print' ],
[ CKEDITOR.CTRL + 72 /*H*/, 'replace' ],
[ CKEDITOR.ALT + 83 /*S*/, 'scaytcheck' ],
[ CKEDITOR.ALT + 66 /*B*/, 'showblocks' ],
// [ CKEDITOR.ALT + 90 /*Z*/, 'source' ],
[ CKEDITOR.ALT + 121 /*F10*/, 'toolbarFocus' ],
[ CKEDITOR.ALT + 122 /*F11*/, 'elementsPathFocus' ],
[ CKEDITOR.SHIFT + 121 /*F10*/, 'contextMenu' ],
[ CKEDITOR.CTRL + 90 /*Z*/, 'undo' ],
[ CKEDITOR.CTRL + 89 /*Y*/, 'redo' ],
[ CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 /*Z*/, 'redo' ],
[ CKEDITOR.CTRL + 76 /*L*/, 'link' ],
[ CKEDITOR.CTRL + 66 /*B*/, 'bold' ],
//[ CKEDITOR.CTRL + CKEDITOR.SHIFT + CKEDITOR.ALT + 68 /*D*/, 'code' ],
[ CKEDITOR.CTRL + 73 /*I*/, 'italic' ],
[ CKEDITOR.CTRL + 85 /*U*/, 'underline' ],
[ CKEDITOR.ALT + 109 /*-*/, 'toolbarCollapse' ]
];
答案 0 :(得分:0)
通过编辑配置,您无法拥有这些功能。继续使用以下代码(+ fiddle):
var codeStyle = new CKEDITOR.style( {
element: 'code'
} );
CKEDITOR.replace( 'editor', {
on: {
instanceReady: function() {
// Register a new command that applies the style.
this.addCommand( 'codeCommand', new CKEDITOR.styleCommand( codeStyle ) );
// Bind the command to CTRL+SHIFT+L.
this.setKeystroke( CKEDITOR.CTRL + CKEDITOR.SHIFT + 76, 'codeCommand' );
}
}
} );
另请参阅以下文档:editor.addCommand
,editor.setKeystroke
和CKEDITOR.styleCommand
。