Imperavi Redactor Widget
is a wrapper for Imperavi Redactor 10.2.5,
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 within 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.
For basic usage follow the intructions provided by vova07
Simply add the following lines to your Redactor configuration
use vova07\imperavi\Widget;
echo $form->field($model, 'content')->widget(Widget::className(), [
'settings' => [
...
'codemirror' => true,
'soure' => [
'codemirror' => [
'lineNubers' => true,
'mode' => 'htmlmixed',
'theme' => 'ayu-mirage',
'indentWithTabs' => true,
# Add all other codemirror options here.
]
],
...
],
]);
For all CodeMirror options review the manual
To use custom CodeMirror assets (modes, themes, plugins) other than the ones predefined here you need to add those assets to the codemirror assets folder src/assets/codemirror
If you need to add a mode added to the modes
folder; same with the themes. Just make sure to maintain the folder order. You can get all assets from CodeMirror.
After including the assets you need to update the CodemirrorAsset.php
file:
class CodemirrorAsset extends AssetBundle
{
public $sourcePath = '@vova07/imperavi/assets';
public $js = [
'codemirror/codemirror.js',
# Add your modes and plugins here
];
public $css = [
'codemirror/codemirror.css',
# Add your themes and styles here
];
public $depends = [
'app\modules\admin\assets\AdminAppAsset'
];
}
Please, check the Imperavi Redactor v10 documentation for further information about its configuration options.
Please see CONTRIBUTING for vova07
previous contributtor details. All changes staged in this fork have been done by NickgGoodwind
The BSD License (BSD). Please see License File for more information.
Please check the UPGRADE GUIDE for details.