Skip to content

Instantly share code, notes, and snippets.

@craigbutcher
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigbutcher/5700b34ff76a5bb79d40 to your computer and use it in GitHub Desktop.
Save craigbutcher/5700b34ff76a5bb79d40 to your computer and use it in GitHub Desktop.
CKEditor Configuration
/**
* @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
/* Updates for this file:
+ Moved all variables to top
+ MS Word configurations
+ Font Style
+ Updated Toolbars
+ Disabled keystrokes (to be removed later) */
CKEDITOR.editorConfig = function( config ) {
// Editor variables
config.language = 'en';
config.autoGrow_maxHeight = 1000;
config.toolbarCanCollapse = true;
// Enable font colours
config.colorButton_enableMore = true;
// Format tags, Font sizes
// config.format_tags = 'p;h1;h2;h3;pre;address';
config.font_names = 'Courier New;Verdana;Arial/Arial;Arial Narrow;Calibri;Tahoma;Times New Roman';
config.fontSize_sizes = 'smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large';
// Spell checker
config.disableNativeSpellChecker = false;
// MS Word configurations
config.allowedContent = true;
config.pasteFromWordNumberedHeadingToList = true;
config.pasteFromWordPromptCleanup = false;
config.pasteFromWordRemoveStyles = false;
config.pasteFromWordRemoveFontStyles = false;
config.height = 500;
// This is actually the default value for it.
config.font_style = {
element: 'span',
styles: { 'font-family': '#(family)' },
overrides: [ { element: 'font', attributes: { 'face': null } } ]
};
// Toolbar
config.toolbar = [
['Source','-','NewPage','Preview','-','Templates'],
['SelectAll','Cut','Copy','Paste','PasteText','PasteFromWord','-','Print','SpellCheck'],
['Undo','Redo','-','Find','Replace'],
['Maximize'],
'/',
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
// FIX THESE BELOW
['NumberedList','BulletedList','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor'],
['Image','Table'],
['HorizontalRule','SpecialChar'],
'/',
['Format','Font','FontSize'],
['TextColor','BGColor'],
['ShowBlocks']
];
// Add keystrokes
// Keystrokes
// config.keystrokes = [
// [ CKEDITOR.CTRL + 115, 'save'],
// [ CKEDITOR.CTRL + 65 #<{(|A|)}>#, true ],
// [ CKEDITOR.CTRL + 67 #<{(|C|)}>#, true ],
// [ CKEDITOR.CTRL + 70 #<{(|F|)}>#, true ],
// [ CKEDITOR.CTRL + 83 #<{(|S|)}>#, true ],
// [ CKEDITOR.CTRL + 84 #<{(|T|)}>#, true ],
// [ CKEDITOR.CTRL + 88 #<{(|X|)}>#, true ],
// [ CKEDITOR.CTRL + 86 #<{(|V|)}>#, 'Paste' ],
// [ CKEDITOR.SHIFT + 45 #<{(|INS|)}>#, 'Paste' ],
// [ CKEDITOR.CTRL + 88 #<{(|X|)}>#, 'Cut' ],
// [ CKEDITOR.SHIFT + 46 #<{(|DEL|)}>#, 'Cut' ],
// [ 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 + 73 #<{(|I|)}>#, 'Italic' ],
// [ CKEDITOR.CTRL + 85 #<{(|U|)}>#, 'Underline' ],
// [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 83 #<{(|S|)}>#, 'Save' ],
// [ CKEDITOR.CTRL + CKEDITOR.ALT + 13 #<{(|ENTER|)}>#, 'Maximize' ]
// ];
//
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment