vova07/yii2-imperavi-widget The imperavi redactor widget for Yii 2 framework.

extensionwidgetimperaviwysiwygredactor

Imperavi Redactor Widget for Yii 2

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Imperavi Redactor Widget is a wrapper for Imperavi Redactor, a high quality WYSIWYG editor.

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.

Install

The preferred way to install this extension is through composer.

Either run

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

or add

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

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code:

Like a widget

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

Like an ActiveForm widget

use vova07\imperavi\Widget;

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

Like a widget for a predefined textarea

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

Add images that have already been uploaded

// DefaultController.php
public function actions()
{
    return [
        'images-get' => [
            'class' => 'vova07\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 \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        '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' => 'vova07\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 \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'fileManagerJson' => Url::to(['/default/files-get']),
        'plugins' => [
            'filemanager'
        ]
    ]
]);

Upload image

// DefaultController.php
public function actions()
{
    return [
        'image-upload' => [
            'class' => 'vova07\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 \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'imageUpload' => Url::to(['/default/image-upload'])
    ]
]);

Upload file

// DefaultController.php
public function actions()
{
    return [
        'file-upload' => [
            'class' => 'vova07\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.
            'uploadOnlyImage' => false, // For not image-only uploading.
        ],
    ];
}

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

Add custom plugins

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

Testing

$ phpunit

Further Information

Please, check the Imperavi Redactor documentation for further information about its configuration options.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

YiiWheels
Available also on YiiWheels

Changelog

Changelog

All Notable changes to yii2-imperavi-widget will be documented in this file.

1.2.10

Changed

  • Imperavi redactor updated to 10.2.5. (vova07)

1.2.9

Changed

  • Imperavi redactor updated to 10.2.3. (vova07)

1.2.8

Changed

  • Imperavi redactor updated to 10.2.2. (vova07)

1.2.7

Changed

  • Imperavi redactor updated to 10.2.0. (vova07)

1.2.6

Changed

  • Imperavi redactor updated to 10.1.3. (vova07)

1.2.5

Fixed

  • FileHelper::findFiles() issue on OS Windows. (vova07)

1.2.4

Fixed

  • Issue #39. (vova07)
  • Issue #35. (vova07)
  • Issue #19. (vova07)

1.2.3

Changed

  • Imperavi redactor updated to 10.1.1. (vova07)

1.2.2

Changed

  • Imperavi redactor updated to 10.0.9. (vova07)

1.2.1

Changed

  • Updated README files. (vova07)

Added

  • Code tests. (vova07)

Fixed

  • Issue #32. (vova07)
  • Scrutinizer support. (vova07)

1.2.0

Changed

  • Extension skeleton. (vova07)

1.1.12

  • Added human readable file size and fix findFiles() method in FileHelper class. (maxmirazh33)

1.1.11

  • Added 'pt-BR' language. (vova07, lcidral)

1.1.10

  • Imperavi redactor updated to 10.0.7 (vova07)

1.1.9

  • Added 'DE' language. (vova07, tonwi)

1.1.8

  • Fixed README file (vova07)

1.1.7

  • Imperavi redactor updated to 10.0.6 (vova07)

1.1.6

  • Fixed README file (vova07)

1.1.5

  • Imperavi redactor updated to 10.0.5 (vova07)

1.1.4

  • Fixes for use GetAction with fileManager plugin (maxmirazh33)

1.1.3

  • Imperavi redactor updated to 10.0.3 (vova07)

1.1.2

  • Imperavi redactor updated to 10.0.2 (vova07)

1.1.1

  • Imperavi redactor updated to 10.0.1 (vova07)

1.1.0

  • Imperavi redactor updated to 10.0.0 (vova07)

1.0.1

  • Imperavi redactor updated to 9.2.5 (vova07)

1.0.0

  • Initial release (vova07)

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



1.3.1 is the latest of 28 releases



BSD-3-Clause license
Stats
180 github stars & 74 github forks
3 downloads in the last day
7256 downloads in the last 30 days
131086 total downloads