发布于2026-07-22 阅读(0)
扫一扫,手机访问
对于网页编辑器来说,能在项目开发中派上大用场,确实能大大减轻开发人员的负担。KindSoft 一直是个不错的选择,不少团队都在持续使用它。下面就把一些常见的配置要点整理一下。
首先,把下载好的 KindSoft 文件放到项目目录下。然后在页面的 Head 部分引入两个核心脚本:
接着插入一段初始化代码,把编辑器绑定到指定的输入框上:
这里的 tbContent 就是你要嵌入编辑器的 Input 标签的 id 值。搞定这一步,惊喜就出现了——如下图所示:
如果要做图片、Flash 或视频的上传,很多人会卡在上传路径不对的问题上。其实只需要调整一下初始化参数,把上传和文件管理器的路径指对就行了:
上面标记颜色的路径部分,需要根据你自己的实际项目结构来调整,保证能正确指向那两个 .ashx 处理程序。
默认的工具栏按钮可能不是每个项目都需要的,可以按需裁剪。在 KindEditor 的源码文件 kindeditor.js 中,大概第 246 行附近有一个 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', '|', 'fullscreen', '/',
'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
'anchor', 'link', 'unlink', '|', 'about'
]
每个按钮对应的功能说明如下:
| source | HTML代码 |
| preview | 预览 |
| undo | 后退 |
| redo | 前进 |
| cut | 剪切 |
| copy | 复制 |
| paste | 粘贴 |
| plainpaste | 粘贴为无格式文本 |
| wordpaste | 从Word粘贴 |
| selectall | 全选 |
| justifyleft | 左对齐 |
| justifycenter | 居中 |
| justifyright | 右对齐 |
| justifyfull | 两端对齐 |
| insertorderedlist | 编号 |
| insertunorderedlist | 项目符号 |
| indent | 增加缩进 |
| outdent | 减少缩进 |
| subscript | 下标 |
| superscript | 上标 |
| formatblock | 段落 |
| fontname | 字体 |
| fontsize | 文字大小 |
| forecolor | 文字颜色 |
| hilitecolor | 文字背景 |
| bold | 粗体 |
| italic | 斜体 |
| underline | 下划线 |
| strikethrough | 删除线 |
| removeformat | 删除格式 |
| image | 图片 |
| flash | Flash |
| media | 视音频 |
| table | 表格 |
| hr | 插入横线 |
| emoticons | 插入表情 |
| link | 超级链接 |
| unlink | 取消超级链接 |
| fullscreen | 全屏显示 |
| about | 关于 |
| 打印 | |
| code | 插入程序代码 |
| map | Google地图 |
| baidumap | 百度地图 |
| lineheight | 行距 |
| clearhtml | 清理HTML代码 |
| pagebreak | 插入分页符 |
| quickformat | 一键排版 |
| insertfile | 插入文件 |
| template | 插入模板 |
| anchor | 插入锚点 |
以上是 KindEditor 最常用的几个配置点,从引入到上传再到工具栏定制,基本覆盖了日常开发中的常见需求。实际项目中可以根据具体场景灵活调整,不必拘泥于默认设置。
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
正版软件
正版软件
正版软件
正版软件
正版软件
1
2
3
7
8