2017 © Pedro Peláez
 

yii2-extension yii2-redactor

Extension redactor for Yii2 Framework.

image

karneds/yii2-redactor

Extension redactor for Yii2 Framework.

  • Monday, April 7, 2014
  • by karneds
  • Repository
  • 1 Watchers
  • 1 Stars
  • 96 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 92 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

yii2-redactor

The preferred way to install this extension is through composer., (*1)

Either run, (*2)

php composer.phar require --prefer-dist "karneds/yii2-redactor *"

or add, (*3)

"karneds/yii2-redactor": "*"

to the require section of your composer.json., (*4)

Usage:

in controller

    public function actions(){
        return [
            'file' => [
                'class'=>'yii\redactor\actions\FileUploadAction',
                'uploadDir'=>'@webroot/uploads/files/'
            ],
            'image' => [
                'class'=>'yii\redactor\actions\ImageUploadAction',
                'uploadDir'=>'@webroot/uploads/images/'
            ],
            'imagejson' => [
                'class'=>'yii\redactor\actions\ImageGetJsonAction',
                'sourcePath'=>'@webroot/uploadsimages/'
            ],
            'clipboard' => [
                'class'=>'yii\redactor\actions\ClipboardUploadAction',
                'uploadDir'=>'@webroot/uploads/files/'
            ],
        ];
    }

in view

    use \yii\helpers\Url;
    ...
    = $form->field($model,'text')->widget(yii\redactor\widgets\Redactor::className(),[
        'clientOptions'=>[
            'lang'=>'ru',
            'formattingTags'=>['p', 'blockquote', 'pre', 'h2', 'h3', 'h4'],
            'imageTabLink'=>false,
            'imageGetJson' => Url::toRoute(['pages/imagejson']),
            'imageUpload' => Url::toRoute(['pages/image']),
            'clipboardUploadUrl' =>Url::toRoute(['pages/clipboard']),
            'fileUpload' => Url::toRoute(['pages/file']),
            'plugins' => ['clips', 'fullscreen']
        ]
    ])?>

Advanced application template

in config.php

    'components' => [
       'urlManagerFrontend'=>[
            'class' => 'yii\web\UrlManager',
            'baseUrl'=>'',
            'hostInfo'=>'http://example.com'
       ],
    ]

in controller

        public function actions(){
            return [
                'image' => [
                    'class'=>'yii\redactor\actions\ImageUploadAction',
                    'uploadDir'=>'@frontend/web/uploads/images/',
                    'baseDir'=>'@frontend/web',
                    'baseUrl'=>Yii::$app->urlManagerFrontend->hostInfo.Yii::$app->urlManagerFrontend->baseUrl
                ],
                'imagejson' => [
                    'class'=>'yii\redactor\actions\ImageGetJsonAction',
                    'sourcePath'=>'@frontend/web/uploads/images/'
                    'baseDir'=>'@frontend/web',
                    'baseUrl'=>Yii::$app->urlManagerFrontend->hostInfo.Yii::$app->urlManagerFrontend->baseUrl
                ],
        ];
    }

in view

```php use \yii\helpers\Url; ... = $form->field($model,'text')->widget(yii\redactor\widgets\Redactor::className(),[ 'clientOptions'=>[ 'lang'=>'ru', 'imageGetJson' => Url::toRoute(['pages/imagejson']), 'imageUpload' => Url::toRoute(['pages/image']) ] ])?>, (*5)

The Versions

07/04 2014

dev-master

9999999-dev

Extension redactor for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 wysiwyg imperavi redactor html editor