Try eval()
(js) or <iframe>
(html) with document.querySelector('iframe').contentDocument.scripts[0].innerHTML
(js) and same with the css
and html
. If that doesn't work then I don't know.
document.querySelector('div.js-editor').addEventListener('blur',()=>{
try{
document.body.appendChild(document.createElement('div')).innerText=eval(document.querySelector('div.js-editor').innerText)
}
catch(e){
document.body.appendChild(document.createElement('div')).innerText=e
}
});
<!DOCTYPE html>
<html>
<body>
<div class="js-editor" contenteditable="true">
/*code here*/
</div>
</body>
</html>
Does that help?