Как заставить execCommand работать на IE и Firefox?
Я работаю над созданием текстового редактора с использованием contenteditable div. Код отлично работает в chrome, но, похоже, он не работает в IE и Firefox. Форматирование работает только в IE и Firefox, но функция выделения не работает. Ниже приведена кодовая ссылка https://jsbin.com/vunenociwu
<div class='rte'>
<div class='rtecontrol'>
<img class="hi" onclick="document.execCommand('bold',false,null);hmm();" src='http://jeevan.tx0.org/rteditor/icons/text_bold.png' unselectable="on" >
<img class="hi" onclick="document.execCommand('italic',false,null);hmm();" src='http://jeevan.tx0.org/rteditor/icons/text_italic.png'>
<img class="hi" onclick ="document.execCommand('underline',false,null);hmm();" src='http://jeevan.tx0.org/rteditor/icons/text_underline.png'>
</div>
<div class='rtearea' contenteditable='true'>
Hello world;
</div>
var imageTags = document.getElementsByClassName("hi");
setInterval(function () {
var isBold = document.queryCommandValue("Bold");
var isItalic = document.queryCommandValue("Italic");
var isUnderlined = document.queryCommandValue("Underline");
if (isBold === 'true') {
imageTags[0].style.opacity = 1;
} else {
imageTags[0].style.opacity = 0.5;
}
if (isItalic === 'true') {
imageTags[1].style.opacity = 1;
} else {
imageTags[1].style.opacity = 0.5;
}
if (isUnderlined === 'true') {
imageTags[2].style.opacity = 1;
} else {
imageTags[2].style.opacity = 0.5;
}
}, 100)'