Open Folklor opened 10 years ago
A temporary solution was the use of the above files(https://github.com/janisto/yii-redactor/tree/master/actions) from another extension.
Ironically, they are fully compatible with the widget WhRedactor. I hope this will help in the development of your extensions.
<?php
$attribute = 'content';
$this->widget('yiiwheels.widgets.redactor.WhRedactor', array(
'name' => ... ,
'value' => ... ,
'attribute' => $attribute,
'pluginOptions' => array(
'lang' => substr(Yii::app()->language, 0, 2),
'plugins' => array('fullscreen', 'fontsize', 'fontfamily'),
'fileUpload' => Yii::app()->createUrl('file/fileUpload', array(
'attr' => $attribute
)),
'fileUploadErrorCallback' => new CJavaScriptExpression(
'function(obj,json) { alert(json.error); }'
),
'imageUpload' => Yii::app()->createUrl('file/imageUpload', array(
'attr' => $attribute
)),
'imageGetJson' => Yii::app()->createUrl('file/imageList', array(
'attr' => $attribute
)),
'imageUploadErrorCallback' => new CJavaScriptExpression(
'function(obj,json) { alert(json.error); }'
),
),
)); ?>
And controller:
class FileController extends Controller{
public function actions(){
return array(
'fileUpload'=>array(
'class'=>'common.components.actions.FileUpload',
'uploadPath'=>Yii::app()->basePath.'/www/uploads/files',
'uploadUrl'=>Yii::app()->baseUrl.'/uploads/files',
'uploadCreate'=>true,
),
'imageUpload'=>array(
'class'=>'common.components.actions.ImageUpload',
'uploadPath'=>Yii::app()->basePath.'/www/uploads/images',
'uploadUrl'=>Yii::app()->baseUrl.'/uploads/images',
'uploadCreate'=>true,
),
'imageList'=>array(
'class'=>'common.components.actions.ImageList',
'uploadPath'=>Yii::app()->basePath.'/www/uploads/images',
'uploadUrl'=>Yii::app()->baseUrl.'/uploads/images',
),
);
}
}
I would like to see similar functionality in your text editor widget.
Thank you for your work.
@Folklor Thanks for your great feedback. We didn't include the file upload handling as it was out of the scope of the widget and there many ways to do it. For example, we use S3 as a backend storage nowadays, nearly none of our projects uploads directly to server.
Nevertheless, I will mark this issue as an enhancement and will port those actions to the library.
When I use this widget, I need upload files/images to server...
How can I do this by native way?
In some extensions there is something like this: Example of actions: https://github.com/janisto/yii-redactor/tree/master/actions