Yii-Aloha-Editor-Widget
Yii Widget for the Aloha Editor
Requirements
Installation
Usage
$this->widget('application.widgets.alohaeditor.AlohaEditor', array( 'model' => $model, 'attribute' => 'some_attribute', 'showTextarea' => true ));
$this->widget('application.widgets.alohaeditor.AlohaEditor', array( 'selector' => '.editable' ));
$this->widget('application.widgets.alohaeditor.AlohaEditor', array('toolbar' => 'basic', 'model' => $model, 'attribute' => 'some_attribute' ));
$this->widget('application.widgets.alohaeditor.AlohaEditor', array('toolbar' => 'basic', 'plugins' => array('extra/hints'), 'model' => $model, 'attribute' => 'some_attribute' ));
$this->widget('application.widgets.alohaeditor.AlohaEditor', array('alohaSettings' => array('lang' => 'fr'), 'model' => $model, 'attribute' => 'some_attribute' ));
$this->widget('application.widgets.alohaeditor.AlohaEditor', array( 'name' => 'some name', 'value' => 'some value' ));
Authors
Vincent Gabriel http://vadimg.com
Total 7 comments
Hi, I have been trying to use this extension for quite a while, but I can't get it to running somehow.
I tried the widget by calling
$this->widget('application.widgets.alohaeditor.AlohaEditor', array( 'model' => $model, 'attribute' => 'some_attribute', 'showTextarea' => true ));But when I check the source, my model doesn't seem to be loaded anywhere. Am I missing something?
Sorry for the late reply but I will pull it from the repo now.
Edit The changes are there and work great.
Thanks
You'll need to pull from the repo to see the fixes. I just used your suggestions and used local copies instead of the CDN ones.
This is now fixed. You can pull from the repo to see the fixes.
Thanks.
My experience is great now that these scripts are registered in Yii.
The points about using cdn vs local for css are all user preference I understand that, but you did not mention the 2 scripts and the fact that you must register them with Yii. Will you fix that?
Yii does not automatically load and use scripts just because you reference it later in code. You must register as I have show in my previous post. If yours has worked it is only because something else may be registering it in your test case.
With Yii 1.1.12 and a brand new web app created with "yiic webapp blah" I can confirm that calling the widget in a page as you have suggested doe NOT load the scripts. After making the changes I mention I now see the following in the source code of my page:
Prior to my addition I only saw the aloha.css entry.
All of these scripts are needed. Aloha Editor's site has a guides section that describes this in detail in section 5:
Using Aloha Editor
EDIT I am home now, not behind the corporate proxy. This is definitely a proxy issue. Maybe documenting these issues/fixes in the form of comments can help others behind a proxy would be helpful?
Again, great widget! I find it great for allowing non-technical staff to edit content on static pages as well. I know, odd usage but it is very helpful to let office staff update portions of web pages that need changing often.
The reason i used the CDN is because they update their stylesheet often, So instead of keep updating the extension or telling the users to update it i thought using the CDN will be easier, Apparently for some it's not. I've had no problems with this, Obviously some users need to modify it to fit their needs, I think this is one of those cases.
I had a nothing but trouble seeing and using the aloha toolbar with this widget. I discovered it was because your widget does not register 'jquery.ui' or the aloha 'require.js' scripts with Yii!
In your widget's main entry script (AlohaEditor.php) I added these lines right under the line where you register the aloha css file...
Please also not that I use your "$assets" variable to point to the 'require.js', and I used the Yii core jquery ui script and not the cdn version. Also, I personally chose to change the css line as well to the following.
Again you will see that I use your variable "$assets" and append the rest of the path. If you already have the css and js files under the aloaeditor tree, then why point to an external source (aloha cdn)?
By using the local source already installed you avoid issues with proxies, host side path changes, version differences, and many more. In my case I am behind a proxy and my web server has issues reaching out to a remote file for inclusion. Many production networks are setup that way. You might consider the points I make as a sane default and add in that one can change these as needed. ;-)
Leave a comment
Please login to leave your comment.