怎么在easyui框架增加富文本编辑器

怎么在easyui框架增加富文本编辑器,第1张

1.首先,想在项目中引入相关的jar包

2.html页面中加入相关的引用

<!-- kindeditor -->

<script type="text/javascript"

th:src="@{/lib/kindeditor/kindeditor.js}"></script>

<script type="text/javascript"

th:src="@{/lib/kindeditor/lang/zh_CN.js}"></script>

<th>公告内容:</th>

<td>

<textarea id="detail" name="detail" style="width:100%height:200px">

</textarea>

</td>

3.js文件中的方法的处理

//介绍富文本编辑

KindEditor.ready(function(K) {

introEditor = K.create("#detail", {

width : 100,

minHeight : '300px',

uploadJson : parent.baseUrl + "file/kindeditorUploadImg",

items : [ 'source', '|', 'undo', 'redo', '|', 'preview', 'print',

'template', 'code', 'cut', 'copy', 'paste', 'plainpaste',

'wordpaste', '|', 'justifyleft', 'justifycenter',

'justifyright', 'justifyfull', 'insertorderedlist',

'insertunorderedlist', 'indent', 'outdent', 'subscript',

'superscript', 'clearhtml', 'quickformat', 'selectall',

'|', 'formatblock', 'fontname', 'fontsize', '|',

'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',

'strikethrough', 'lineheight', 'removeformat', '|',

'image', 'flash', 'media', 'insertfile', 'table', 'hr',

'pagebreak', 'anchor', 'link', 'unlink', '|', 'about',

'fullscreen' ],

})

})

首先,为需要编辑的列设置编辑器

例如:

{field:'F1',title:'编辑咧列',width:100,align:'center',

editor: {

type: 'numberbox',

options: {

min:1

}

}

}

第二步,按钮点击事件中添加代码

$('#dg').datagrid('appendRow',{

F1: '新名称'

})

三,开启编辑列

$('#dg').datagrid("beginEdit", i)//i为需要编辑的行号


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11879209.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存