2019-08-24 11:45:04 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
2019-11-03 06:59:51 +00:00
|
|
|
<title>wangEditor</title>
|
2019-08-24 11:45:04 +00:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
2019-08-27 07:10:13 +00:00
|
|
|
<link rel="stylesheet" href="../../css/oksub.css">
|
2019-08-24 11:45:04 +00:00
|
|
|
</head>
|
|
|
|
|
<body>
|
2019-11-03 06:59:51 +00:00
|
|
|
<div class="ok-body">
|
|
|
|
|
<div id="editor">
|
|
|
|
|
<p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p>
|
|
|
|
|
</div>
|
|
|
|
|
<br/>
|
|
|
|
|
<button type="button" class="layui-btn" onclick="setContent()">设置内容</button>
|
|
|
|
|
<button type="button" class="layui-btn" onclick="appendContent()">追加内容</button>
|
|
|
|
|
<button type="button" class="layui-btn" onclick="clearContent()">清空内容</button>
|
|
|
|
|
<button type="button" class="layui-btn" onclick="getHtmlContent()">获取HTML内容</button>
|
|
|
|
|
<button type="button" class="layui-btn" onclick="getTextContent()">获取TEXT内容</button>
|
2019-08-24 11:45:04 +00:00
|
|
|
</div>
|
2019-11-03 07:12:05 +00:00
|
|
|
<!--js逻辑-->
|
2019-12-13 16:40:09 +00:00
|
|
|
<script src="https://cdn.bootcss.com/wangEditor/10.0.13/wangEditor.min.js"></script>
|
2019-11-03 06:59:51 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
|
let E = window.wangEditor;
|
|
|
|
|
let editor = new E("#editor");
|
|
|
|
|
editor.create();
|
2019-08-24 11:45:04 +00:00
|
|
|
|
2019-11-03 06:59:51 +00:00
|
|
|
function setContent() {
|
|
|
|
|
editor.txt.html("<p>欢迎使用 <b>ok-admin v2.0</b> :) </p>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function appendContent() {
|
|
|
|
|
editor.txt.append("<p>追加的内容</p>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function clearContent() {
|
|
|
|
|
editor.txt.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getHtmlContent() {
|
|
|
|
|
alert(editor.txt.html());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getTextContent() {
|
|
|
|
|
alert(editor.txt.text());
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2019-08-24 11:45:04 +00:00
|
|
|
</body>
|
|
|
|
|
</html>
|