yii2中集成使用kindeditor富文本编辑器
来源:互联网 发布:淘宝执行运营工资高吗 编辑:程序博客网 时间:2024/04/20 08:15
我们以advanced模板中frontend应用为例
kindeditor下载、安装
首先下载kindeditor
http://kindeditor.googlecode.com/files/kindeditor-4.1.10.zip
使用
打开views\site\contract.php文件
引用kindeditor中的css、js等文件
实例化Kindeditor
修改form中的body输入框
这样就实现完成了。
注意
在创建kindeditor的时候
name对应的值为textarea中的name的值,并且不能包含[],具体原因还没细看。
因为通过Yii中的form生成的输入框的name是Contact[body] 所以要更改为 body
当然,除了使用textarea的name属性之外,还可以使用id选择器。在使用id选择器的时候就不会存在以上的问题了。
kindeditor下载、安装
首先下载kindeditor
http://kindeditor.googlecode.com/files/kindeditor-4.1.10.zip
然后解压到web目录,如
frontend web libs kindeditor
使用
打开views\site\contract.php文件
引用kindeditor中的css、js等文件
$this->registerCssFile('libs/kindeditor/themes/default/default.css');$this->registerJsFile('libs/kindeditor/kindeditor-min.js');$this->registerJsFile('libs/kindeditor/lang/zh_CN.js');
实例化Kindeditor
$js=<<<JS var editor; KindEditor.ready(function(K) { editor = K.create('textarea[name="body"]', { allowFileManager : true }); });JS;$this->registerJs($js,View::POS_END);
修改form中的body输入框
<?= $form->field($model, 'body')->textArea(['name'=>'body','style'=>'width:800px;height:400px;visibility:hidden;']) ?>
这样就实现完成了。
注意
在创建kindeditor的时候
editor = K.create('textarea[name="body"]' )
name对应的值为textarea中的name的值,并且不能包含[],具体原因还没细看。
因为通过Yii中的form生成的输入框的name是Contact[body] 所以要更改为 body
当然,除了使用textarea的name属性之外,还可以使用id选择器。在使用id选择器的时候就不会存在以上的问题了。
editor = K.create("#contract-body")
0 0
- yii2中集成使用kindeditor富文本编辑器
- domino集成kindeditor富文本编辑器
- Html编辑器,富文本编辑器KindEditor使用
- yii2集成富文本编辑器redactor
- jsp中kindeditor富文本编辑器的使用
- 在WEB API项目中使用KindEditor富文本编辑器
- kindeditor富文本编辑器
- kindeditor富文本编辑器的使用
- 富文本编辑器 kindeditor的使用
- kindeditor富文本编辑器初步使用教程
- KindEditor富文本编辑器的使用
- 24.富文本编辑器Kindeditor的使用
- Django项目中集成富文本编辑器的通用方法,适合KindEditor,xhEditor,NicEditor,wymeditor等
- Django项目中集成富文本编辑器的通用方法,适合KindEditor,xhEditor,NicEditor,wymeditor等 .
- Django项目中集成富文本编辑器的通用方法,适合KindEditor,xhEditor,NicEditor,wymeditor等
- kindeditor富文本编辑器配置
- 在Rails中使用Kindeditor富文本编辑器的那些坑...
- 在页面中添加一个富文本编辑器kindeditor
- 推荐一款好用的jquery弹出层插件——wbox
- SVN权限配置
- 总有一些缘,自认为刻骨铭心,而美丽难以触及
- POJ 3693 Maximum repetition substring (后缀数组)
- HuaweiOJ-扑克牌大小
- yii2中集成使用kindeditor富文本编辑器
- AnimatePacker3.0接口封装
- Swift中文教程(七) 闭包
- 分布式缓存中三种负载均衡的方法
- GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-
- nginx rewrite 指令last break区别
- c++ 开源日志库选择
- android 开源工具库
- libGDX视频教程(二) -- 纹理绘制