trntv / yii2-aceeditor
Yii2 ajax.org Ace Editor 组件
2.1.2
2018-04-04 06:42 UTC
Requires
- bower-asset/ace-builds: ^1.3.1
- yiisoft/yii2: ^2.0.0
README
关于
这是 Yii2 框架的 Ace Editor 集成。
演示
由于这个包是作为 (Yii2 Starter Kit)yii2-starter-kit 的一部分创建的,因此演示可以在入门套件演示 此处 找到(登录:webmaster,密码:webmaster)
Ace Editor 演示可以在此找到 此处
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一:
php composer.phar require trntv/yii2-aceeditor
或添加以下内容到您的 composer.json
文件的要求部分。
"trntv/yii2-aceeditor": "^2.0.0"
使用方法
使用模型
trntv\aceeditor\AceEditor::widget([ // You can either use it for model attribute 'model' => $my_model, 'attribute' => 'my_field', // or just for input field 'name' => 'my_input_name', 'mode'=>'html', // programing language mode. Default "html" 'theme'=>'github', // editor theme. Default "github" 'readOnly'=>'true' // Read-only mode on/off = true/false. Default "false" ]);
带活动字段
$form->field($model, 'field')->widget( 'trntv\aceeditor\AceEditor', [ 'mode'=>'html', // programing language mode. Default "html" 'theme'=>'github', // editor theme. Default "github" 'readOnly'=>'true' // Read-only mode on/off = true/false. Default "false" ] )
所有可用模式和主题的列表请参见 此处