单页面多个文本编辑器

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>WangEditor(但页面多个文本编辑器)</title>
<style type="text/css">
.text {
border:1px solid #ccc;
height:200px;
}
.toolbar {
background-color:#f1f1f1;
border:1px solid #ccc;
}
</style>
</head>
<body>
<div id="div1" class="toolbar"></div>
<div style="padding:20px;border:1px solid #ccc"></div>
<div id="div2" class="text"><p>第一个demo(菜单和编辑器分开)</p></div>

<div id="div3"><p>第二个demo常规</p></div>
<script src="wangEditor.min.js"></script>
<script>
var E = window.wangEditor;

    var editor1 = new E('#div1', '#div2')
    editor1.create();

    var editor2 = new E("#div3");
    editor2.create();

    editor1.$textElem.attr('contenteditable', false);
    editor2.$textElem.attr('contenteditable', false);
    //禁用编辑器
    editor1.$textElem.attr('contenteditable', true);
    editor2.$textElem.attr('contenteditable', true);
    //启用编辑器
</script>

</body>
</html>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容