EWYMeditor is an extension for Yii framework. This extension is a wrapper for WYMeditor which is a web-based WYSIWYM (What You See Is What You Mean) XHTML editor (not WYSIWYG).
Move EWYMeditor folder in your applications extensions folder (default: protected/extensions).
There are three ways to use this extension.
Least obstructive (great if you want to test this extension, you don't want change your view file or you have more than one input to apply this extension to) way is:
$this->widget( 'ext.EWYMeditor.EWYMeditor', array( 'target' => 'textarea', ));
Or you can use a model to create textarea:
$this->widget( 'ext.EWYMeditor.EWYMeditor', array( 'model' => $model, // Your model 'attribute' => 'description', // Attribute for textarea ));
Or if you want to add textarea without model:
$this->widget( 'ext.EWYMeditor.EWYMeditor', array( 'name' => 'nameOfYourInput', ));
You will also need to add wymupdate class to your submit button or change the update selector. Update selector can be changed by providing updateSelector and updateEvent parameters to options array. For example you can create a submit button like this:
echo CHtml::submitButton($model->isNewRecord ? 'Submit' : 'Save', array('class' => 'wymupdate'));
You can change some default settings:
$this->widget( 'ext.EWYMeditor.EWYMeditor', array( 'target' => 'textarea', 'plugins' => array( 'fullscreen', 'hovertools', 'tidy', 'resizable' ), 'options' => array( 'skin' => 'silver', // Check http://trac.wymeditor.org/trac/wiki/0.5/Customization for available options ), ));
fullscreen, hovertools, tidy, resizable. You can provided an array or comma delimited string (requires additional processing to convert to an array) for plugins parameter. If you use plugins and provide your own postInit through options, you will need to initialize plugins yourself.
Total 4 comments
Great thing about being a programmer is what don't like something you can change it to your own needs :D
I was thinking about updating WYMeditor to the newest version, but after I saw they still use window popups decided to wait until they implement inline dialogs. I'm using a little bit different version of extension from that it's right now, but don't have the time to upload new changes. I will only probably take your update selector code :)
Thanks for that extension! Just what I was searching for.
However, as always, I liked it to behave a little bit different. ;o)
So I...
If you're interested in the changes, the fork is on github: https://github.com/bwoester/EWYMeditor
Oh man, that's a big blunder on my side. And all the time then I was writing docs for extension I was thinking "don't forget to add that part about adding
wymupdateclass on your submit button", in the end memory likes making fun from me :DThanks for spotting this bug, I already updated the documentation for extension.
Nice extension. :)
There's a bug in it, however. You need to add 'wymupdate' class to the submit button, like this:
If you don't, your changes won't get picked up by Yii. I am not sure how to integrate this into the extension, so I'm not going to create a patch on Github yet. :) Maybe later.
Leave a comment
Please login to leave your comment.