wangEditor 富文本编辑器
在vue中引入 import E from "wangeditor";正常引入 var E=window.wangEditor定义var editor = new E("#left");创建editor.create(); //当编辑器 改变时 记录其内容!!editor.customConfig.onchange =() => {//处理回调
·
在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); });
更多推荐



所有评论(0)