Hi. I need to do so the user could select a toolbar between Basic and Full. I have next code:
When page start it's ok. But when I try to choise other toolbar (Basic or Full) it's not worked. Why?
<input type="radio" name="ckeditor_toolbar" id="toolbar_min" checked="checked" value="Basic" onChange="ckeditor('Basic')" /> Basic <input type="radio" name="ckeditor_toolbar" id="toolbar_max" value="Full" onChange="ckeditor('Full')" /> Full <textarea name="text" id="task_text"></textarea>
$(document).ready(function (){ var toolbar=$('input[name="ckeditor_toolbar"]:checked').val(); CKEDITOR.replace('text', { toolbar : toolbar }); }); function ckeditor(toolbar) { CKEDITOR.replace('task_text', { toolbar : toolbar }); } </script>
When page start it's ok. But when I try to choise other toolbar (Basic or Full) it's not worked. Why?
Re: How to change toolbar?
If you look at your error console you'll see that you have an error because you already have a CKEditor instance the second time you try to replace the textarea.
If you want to go that route you should destroy the existing instance before creating the new one.
In this ticket I've added a patch that will a method to easily switch toolbars: http://dev.ckeditor.com/ticket/7280
I might release a standalone plugin to perform that task when I have some extra time (and after a release of WriteArea with such plugin)