加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.html 3.83 KB
一键复制 编辑 原始数据 按行查看 历史
KnifeZ 提交于 2018-12-01 12:53 . 新增attachment附件上传
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>layedit demo</title>
<link href="Content/Layui-KnifeZ/css/layui.css" rel="stylesheet"/>
<script src="Content/Layui-KnifeZ/layui.js"></script>
<script src="Content/ace/ace.js"></script>
</head>
<body>
<div>
<textarea id="layeditDemo"></textarea>
</div>
<script>
layui.use(['layedit', 'layer', 'jquery'], function () {
var $ = layui.jquery;
var layedit = layui.layedit;
layedit.set({
//暴露layupload参数设置接口 --详细查看layupload参数说明
uploadImage: {
url: 'your url',
accept: 'image',
acceptMime: 'image/*',
exts: 'jpg|png|gif|bmp|jpeg',
size: 1024 * 10,
done: function (data) {
console.log(data);
}
}
, uploadVideo: {
url: 'your url',
accept: 'video',
acceptMime: 'video/*',
exts: 'mp4|flv|avi|rm|rmvb',
size: 1024 * 10 * 2,
done: function (data) {
console.log(data);
}
}
, uploadFiles: {
url: 'your url',
accept: 'file',
acceptMime: 'file/*',
size: '20480',
done: function (data) {
console.log(data);
}
}
//右键删除图片/视频时的回调参数,post到后台删除服务器文件等操作,
//传递参数:
//图片: imgpath --图片路径
//视频: filepath --视频路径 imgpath --封面路径
, calldel: {
url: 'your url',
done: function (data) {
console.log(data);
}
}
//开发者模式 --默认为false
, devmode: true
//插入代码设置 --hide:true 等同于不配置codeConfig
, codeConfig: {
hide: false, //是否显示编码语言选择框
default: 'javascript' //hide为true时的默认语言格式
}
//新增iframe外置样式和js
//, quote:{
// style: ['/Content/Layui-KnifeZ/css/layui.css','/others'],
// js: ['/Content/Layui-KnifeZ/lay/modules/jquery.js']
//}
//自定义样式-暂只支持video添加
//, customTheme: {
// video: {
// title: ['原版', 'custom_1', 'custom_2']
// , content: ['', 'theme1', 'theme2']
// , preview: ['', '/images/prive.jpg', '/images/prive2.jpg']
// }
//}
//插入自定义链接
, customlink:{
title: '插入layui官网'
, href: 'https://www.layui.com'
,onmouseup:''
}
,facePath:'/Content/Layui-KnifeZ/'
, tool: [
'html', 'undo', 'redo', 'code', 'strong', 'italic', 'underline', 'del', 'addhr', '|', 'fontFomatt','fontfamily', 'fontBackColor', 'colorpicker', 'face'
, '|', 'left', 'center', 'right', '|', 'link', 'unlink', 'images', 'image_alt', 'video','attachment', 'anchors'
, '|'
, 'table','customlink'
, 'fullScreen'
]
, height: '90%'
});
var ieditor = layedit.build('layeditDemo');
//设置编辑器内容
layedit.setContent(ieditor, "<h1>hello layedit</h1>", false);
})
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化