Allow autoinsert to work in IE11

This commit is contained in:
Kijin Sung 2020-07-08 19:45:49 +09:00
parent 67b39cf5d0
commit 6a4131ffd3

View file

@ -31,7 +31,12 @@
var sel = window.getSelection(); var sel = window.getSelection();
sel.removeAllRanges(); sel.removeAllRanges();
sel.addRange(range); sel.addRange(range);
document.execCommand('insertHTML', false, content); if (String(navigator.userAgent).match(/Trident\/7/)) {
range.insertNode(range.createContextualFragment(content));
range.collapse(false);
} else {
document.execCommand('insertHTML', false, content);
}
}; };
// Simplify HTML content by removing unnecessary tags. // Simplify HTML content by removing unnecessary tags.