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.
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.
Once the extension is installed, simply use it in your code:
echo \vova07\imperavi\Widget::widget([
'name' => 'redactor',
'settings' => [
'lang' => 'ru',
'minHeight' => 200,
'plugins' => [
'clips',
'fullscreen'
]
]
]);
use vova07\imperavi\Widget;
echo $form->field($model, 'content')->widget(Widget::className(), [
'settings' => [
'lang' => 'ru',
'minHeight' => 200,
'plugins' => [
'clips',
'fullscreen'
]
]
]);
echo \vova07\imperavi\Widget::widget([
'selector' => '#my-textarea-id',
'settings' => [
'lang' => 'ru',
'minHeight' => 200,
'plugins' => [
'clips',
'fullscreen'
]
]
]);
// 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'
]
]
]);
// 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'
]
]
]);
// 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'])
]
]);
// 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.
],
];
}
// View.php
echo \vova07\imperavi\Widget::widget([
'selector' => '#my-textarea-id',
'settings' => [
'lang' => 'ru',
'minHeight' => 200,
'fileUpload' => Url::to(['/default/file-upload'])
]
]);
echo \vova07\imperavi\Widget::widget([
'selector' => '#my-textarea-id',
'settings' => [
'lang' => 'ru',
'minHeight' => 200,
'plugins' => [
'clips',
'fullscreen'
]
],
'plugins' => [
'my-custom-plugin' => 'app\assets\MyPluginBundle'
]
]);
$ phpunit
Please, check the Imperavi Redactor documentation for further information about its configuration options.
Please see CONTRIBUTING for details.
The BSD License (BSD). Please see License File for more information.