在ueditor编辑器的光标停留处插入内容
微wx笑
2022-08-28【前端开发】
0
0关键字:
ueditor
插入内容的方式
newstext.execCommand('inserthtml', '要插入的内容');
newstext.setContent('要追加的内容',true);
在ueditor编辑器的光标停留处插入内容
插入内容的方式
newstext.execCommand('inserthtml', '要插入的内容');
newstext.setContent('要追加的内容',true);
newstext为Ueditor的实例,获取实例的方法:
var newstext = UE.getEditor('editor');
if( nKeyCode == 13 && bCtrlKeyCode ) { // ctrl+enter
window.setTimeout(function () {
var dt = new Date();
var tm = "";
if (dt.getHours() < 10){
tm += "0" + dt.getHours();
}else{
tm += "" + dt.getHours();
}
if (dt.getMinutes() < 10){
tm += ":0" + dt.getMinutes();
}else{
tm += ":" + dt.getMinutes();
}
tm += " ";
newstext.execCommand('inserthtml', tm);
//newstext.setContent(tm,true);
}, 100);
}本文由 微wx笑 创作,采用 署名-非商业性使用-相同方式共享 4.0 许可协议,转载请附上原文出处链接及本声明。
原文链接:https://www.ivu4e.cn/blog/front/2022-08-28/1364.html



