需求如标题所示
在tinymce的setup阶段进行配置
setup: function (editor) {
editor.on('nodechange', function (e) {
var selection = editor.selection.getNode();
var testDiv = document.getElementById('test');
while (selection != null) {
if (selection == testDiv) {
testDiv.style.borderColor = '#000';
return
}
selection = selection.parentNode;
}
testDiv.style.borderColor = '#fff';
return
});
}