Created
March 18, 2010 18:13
-
-
Save Sutto/336662 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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