PyroCMS. I needed to build a custom widget that had a WYSIWYG textarea. This is what worked for me.
Add this to template in the constructors function.
// my new template
$this->template
->set_partial('shortcuts', 'admin/partials/shortcuts')
->append_js('module::widgets.js')
->append_css('module::widgets.css')
->append_metadata($this->load->view('fragments/wysiwyg', $this->data, TRUE));
The following javascript needs to be added to the top of your view/form.php file.
// my self special jquery
(function($){
$('textarea.wysiwyg-simple').ckeditor({
// this is the config for the simple wysiwyg
toolbar: [
['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink']
],
width: '99%',
height: 100,
dialog_backgroundCoverColor: '#000',
defaultLanguage: '',
language: ''
});
})(jQuery);
Also, you need to have the wysiwyg-simple class on your textarea.
echo form_textarea(array('name'=> 'html', 'value' => $options['html'], 'class' => 'wysiwyg-simple'));
I'm a full-stack developer, co-organizer of PHP Vancouver meetup, and winner of a Canadian Developer 30 under 30 award. I'm a huge Open Source advocate and contributor to a lot of projects in my community. When I am not sitting at a computer, I'm trying to perfect some other skill.