在vue中引入
import E from "wangeditor";
正常引入
var E=window.wangEditor
定义
var editor = new E("#left");
创建
editor.create();
//当编辑器 改变时 记录其
内容!!
editor.customConfig.onchange =() => {
//处理回调函数
};想要在光标处插入内容时
$$(".aslide .noclass-l .right").on("click", "button", function() { //获取光标位置let range = window.getSelection().getRangeAt(0); //新建标签及内容 let newSpan=document.createElement("span"); newSpan.style.color = '#000'; newSpan.style.background = 'gray'; newSpan.style.padding = '5px 10px'; newSpan.setAttribute("data-item",$$.trim($$(this).html()) ); newSpan.appendChild(document.createTextNode("【"+$$.trim($$(this).html())+"】"));//插到光标处 range.insertNode(newSpan); });
最后
以上就是醉熏外套最近收集整理的关于wangEditor 富文本编辑器的全部内容,更多相关wangEditor内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复