2017 © Pedro Peláez
 

yii2-extension yii2-imperavi-widget

The imperavi redactor widget for Yii 2 framework.

image

hongyukeji/yii2-imperavi-widget

The imperavi redactor widget for Yii 2 framework.

  • Friday, July 7, 2017
  • by hongyukeji
  • Repository
  • 0 Watchers
  • 0 Stars
  • 35 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Imperavi Redactor Widget for Yii 2

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads, (*1)

Imperavi Redactor Widget is a wrapper for Imperavi Redactor, a high quality WYSIWYG editor., (*2)

Note that Imperavi Redactor itself is a proprietary commercial copyrighted software but since Yii community bought OEM license you can use it for free with Yii., (*3)

Install

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

Either run, (*5)

$ php composer.phar require --prefer-dist hongyukeji/yii2-imperavi-widget "*"

or add, (*6)

"hongyukeji/yii2-imperavi-widget": "*"

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

Usage

Once the extension is installed, simply use it in your code:, (*8)

Like a widget

echo \hongyukeji\imperavi\Widget::widget([
    'name' => 'redactor',
    'settings' => [
        'lang' => 'zh_cn',
        'minHeight' => 200,
        'plugins' => [
            'clips',
            'fullscreen'
        ]
    ]
]);

Like an ActiveForm widget

use hongyukeji\imperavi\Widget;

echo $form->field($model, 'content')->widget(Widget::className(), [
    'settings' => [
        'lang' => 'zh_cn',
        'minHeight' => 200,
        'plugins' => [
            'clips',
            'fullscreen'
        ]
    ]
]);

Like a widget for a predefined textarea

echo \hongyukeji\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'zh_cn',
        'minHeight' => 200,
        'plugins' => [
            'clips',
            'fullscreen'
        ]
    ]
]);

Add images that have already been uploaded

// DefaultController.php
public function actions()
{
    return [
        'images-get' => [
            'class' => 'hongyukeji\imperavi\actions\GetAction',
            'url' => 'http://my-site.com/images/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
            'type' => GetAction::TYPE_IMAGES,
        ]
    ];
}

// View.php
echo \hongyukeji\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'zh_cn',
        'minHeight' => 200,
        'imageManagerJson' => Url::to(['/default/images-get']),
        'plugins' => [
            'imagemanager'
        ]
    ]
]);

Add files that have already been uploaded

// DefaultController.php
public function actions()
{
    return [
        'files-get' => [
            'class' => 'hongyukeji\imperavi\actions\GetAction',
            'url' => 'http://my-site.com/files/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
            'type' => GetAction::TYPE_FILES,
        ]
    ];
}

// View.php
echo \hongyukeji\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'zh_cn',
        'minHeight' => 200,
        'fileManagerJson' => Url::to(['/default/files-get']),
        'plugins' => [
            'filemanager'
        ]
    ]
]);

Upload image

// DefaultController.php
public function actions()
{
    return [
        'image-upload' => [
            'class' => 'hongyukeji\imperavi\actions\UploadAction',
            'url' => 'http://my-site.com/images/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path' // Or absolute path to directory where files are stored.
        ],
    ];
}

// View.php
echo \hongyukeji\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'zh_cn',
        'minHeight' => 200,
        'imageUpload' => Url::to(['/default/image-upload'])
    ]
]);

Upload file

// DefaultController.php
public function actions()
{
    return [
        'file-upload' => [
            'class' => 'hongyukeji\imperavi\actions\UploadAction',
            'url' => 'http://my-site.com/files/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path' // Or absolute path to directory where files are stored.
        ],
    ];
}

// View.php
echo \hongyukeji\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'zh_cn',
        'minHeight' => 200,
        'fileUpload' => Url::to(['/default/file-upload'])
    ]
]);

Add custom plugins

echo \hongyukeji\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'zh_cn',
        'minHeight' => 200,
        'plugins' => [
            'clips',
            'fullscreen'
        ]
    ],
    'plugins' => [
        'my-custom-plugin' => 'app\assets\MyPluginBundle'
    ]
]);

Testing

bash $ phpunit, (*9)

Further Information

Please, check the Imperavi Redactor documentation for further information about its configuration options., (*10)

Contributing

Please see CONTRIBUTING for details., (*11)

Credits

License

The BSD License (BSD). Please see License File for more information., (*12)

YiiWheels
Available also on YiiWheels, (*13)

The Versions

07/07 2017

dev-master

9999999-dev https://github.com/hongyukeji/yii2-imperavi-widget

The imperavi redactor widget for Yii 2 framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 yii yii 2 widget wysiwyg imperavi redactor

18/03 2017

1.0.1

1.0.1.0 https://github.com/hongyukeji/yii2-imperavi-widget

The imperavi redactor widget for Yii 2 framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 yii yii 2 widget wysiwyg imperavi redactor

18/03 2017

1.0.0

1.0.0.0 https://github.com/hongyukeji/yii2-imperavi-widget

The imperavi redactor widget for Yii 2 framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 yii yii 2 widget wysiwyg imperavi redactor