Skip to content

Instantly share code, notes, and snippets.

@Sutto
Created March 18, 2010 18:13
Show Gist options
  • Save Sutto/336662 to your computer and use it in GitHub Desktop.
Save Sutto/336662 to your computer and use it in GitHub Desktop.
BHM.withNS('CKEditor', function(ns) {
ns.editorSelector = '.ckeditor textarea';
ns.editorOptions = {
toolbar: 'bhm',
width: '74%'
};
ns.toolbar_layout = [
['Source','-','Templates'], ['Cut','Copy','Paste','PasteText','PasteFromWord','-', 'SpellChecker', 'Scayt'],
['Undo','Redo','-','Find','Replace','RemoveFormat'],
'/',
['Bold','Italic','Underline','Strike'], ['NumberedList','BulletedList', 'Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','Anchor'], ['Image','Flash','Table','HorizontalRule'],
'/',
['Styles','Format','Font','FontSize'], ['TextColor','BGColor'], ['Maximize', 'ShowBlocks']
];
function currentEditorOptions() {
var o = $.extend({}, ns.editorOptions)
o.toolbar_bhm = ns.toolbar_layout;
return o;
}
ns.setup = function() {
$(ns.editorSelector).ckeditor(currentEditorOptions());
};
$(document).ready(ns.setup);
});
I then added ckeditor, the jquery adapter and the above as js to my page, and added a class 'ckeditor' to the wrapper html in formtastic. Instant WYSIWYG!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment