TinyMCE自定义插件我正在创建一个插件,该插件的光标设置在div class = warningIcon内,但是在mozilla / IE中,当用户开始键入时,光标移到了div之外。有没有一种方法可以将光标设置在div内?我尝试了以下解决方案,但无法解决
that.Editor.selection.setCursorLocation(that.Editor.selection.getContent()), or
that.Editor.selection.setCursorLocation(that.Editor.selection.getNode())
that.Editor.selection.setCursorLocation(divHTML);
css文件
.divIcon {
border: 1px solid firebrick;
background: #fbeaea url(img/div.svg) no-repeat 15px center;
background-size: 28px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
max-width: 500px;
padding: 15px 12px 15px 55px;
color: rgba(0,0,0,0.9);
}
editor.addButton('showDiv', {
title : 'TINYMCE_div',
image : 'div.svg',
cmd: 'mceShowDiv'
});
editor.addCommand('mceShowDiv', function() {
var divHTML = '<div><div class="divIcon"></div> </div>';
that.Editor.insertContent(divHTML);
that.Editor.selection.setCursorLocation(that.Editor.selection.getStart());
});