Marcin Wtykło

nbsp

  1 +/**
  2 + * @file insert Non-Breaking SPace for CKEditor
  3 + * Copyright (C) 2014 Alfonso Martínez de Lizarrondo
  4 + * Create a command and enable the Ctrl+Space shortcut to insert a non-breaking space in CKEditor
  5 + *
  6 + */
  7 +
  8 +CKEDITOR.plugins.add( 'nbsp',
  9 +{
  10 + init : function( editor )
  11 + {
  12 + // Insert   if Ctrl+Space is pressed:
  13 + editor.addCommand( 'insertNbsp', {
  14 + exec: function( editor ) {
  15 + editor.insertHtml( ' ' );
  16 + }
  17 + });
  18 + editor.setKeystroke( CKEDITOR.CTRL + 32 /* space */, 'insertNbsp' );
  19 + }
  20 +
  21 +} );