Hello there
Working with another well known Wiki product on some customers sites, I appreciated the option to format wiki text with keyboard shortcuts (like Heading 1-6 …)
Given the nature of xWiki being open source and using well documented components like CKEditor, it was not a big effort to port this over.
So I created a CKEditor plugin that does more or less the same for my / our purposes.
Ctrl + 0 == Paragraph
Ctrl + 1 - 6 == Heading 1 - 6
Ctrl + 7 == Preformatted
Ctrl + 8 == Blockquote
Ctrl + Shift + B == Bullted list
Ctrl + Shift + N == Numbered list
Note: Ctrl is probably the special key for Mac users
Unfortunately, uploading a zip is not permitted.
You can download it here: customkeyboardshortcuts
As it is rather tiny, I simply post the contents of the plugin.js below (as the download link above is not guaranteed forever):
/**
* @license bbu@netsuccess.ch, version 0.0.1, provided as is
*/
/**
* @fileOverview customkeyboardshortcuts Plugin
*/
CKEDITOR.plugins.add( 'customkeyboardshortcuts', {
init: function( editor ) {
editor.addCommand( 'p' , new CKEDITOR.styleCommand( new CKEDITOR.style({ element: 'p' } )) );
editor.addCommand( 'h1' , new CKEDITOR.styleCommand( new CKEDITOR.style({ element: 'h1' } )) );
editor.addCommand( 'h2' , new CKEDITOR.styleCommand( new CKEDITOR.style({ element: 'h2' } )) );
editor.addCommand( 'h3' , new CKEDITOR.styleCommand( new CKEDITOR.style({ element: 'h3' } )) );
editor.addCommand( 'h4' , new CKEDITOR.styleCommand( new CKEDITOR.style({ element: 'h4' } )) );
editor.addCommand( 'h5' , new CKEDITOR.styleCommand( new CKEDITOR.style({ element: 'h5' } )) );
editor.addCommand( 'h6' , new CKEDITOR.styleCommand( new CKEDITOR.style({ element: 'h6' } )) );
editor.addCommand( 'pre' , new CKEDITOR.styleCommand( new CKEDITOR.style({ element: 'pre' } )) );
/* Ctrl + 0 */ editor.setKeystroke( CKEDITOR.CTRL + 48, 'p');
/* Ctrl + 1 */ editor.setKeystroke( CKEDITOR.CTRL + 49, 'h1');
/* Ctrl + 2 */ editor.setKeystroke( CKEDITOR.CTRL + 50, 'h2');
/* Ctrl + 3 */ editor.setKeystroke( CKEDITOR.CTRL + 51, 'h3');
/* Ctrl + 4 */ editor.setKeystroke( CKEDITOR.CTRL + 52, 'h4');
/* Ctrl + 5 */ editor.setKeystroke( CKEDITOR.CTRL + 53, 'h5');
/* Ctrl + 6 */ editor.setKeystroke( CKEDITOR.CTRL + 54, 'h6');
/* Ctrl + 7 */ editor.setKeystroke( CKEDITOR.CTRL + 55, 'pre');
/* Ctrl + 8 */ editor.setKeystroke( CKEDITOR.CTRL + 56, 'blockquote' );
/* Ctrl + Shift + N */ editor.setKeystroke( CKEDITOR.SHIFT + CKEDITOR.CTRL + 78, 'numberedlist');
/* Ctrl + Shift + B */ editor.setKeystroke( CKEDITOR.SHIFT + CKEDITOR.CTRL + 66, 'bulletedlist');
}
});
If the xWiki Dev Team deems this useful, feel free to integrate into CKEditor default plugins. If not, xWiki users interested in this functionality would need to integrate this into xWiki manually as any other CKEditor extension:
If there are any issues with it … like on Mac, Linux or other Browsers, please let me know …