`,
language: 'html',
theme: 'vs-dark',
automaticLayout: true
});function runCode() {
var code = editor.getValue();
var outputFrame = document.getElementById('outputFrame');
var output = outputFrame.contentWindow || outputFrame.contentDocument;
output.document.open();
output.document.write(code);
output.document.close();document.getElementById('editor').style.height = '10vh';
outputFrame.style.height = '90vh';
editor.layout();
}document.getElementById('editor').addEventListener('mouseenter', function() {
document.getElementById('editor').style.height = '75vh';
document.getElementById('outputFrame').style.height = '25vh';
editor.layout();
});document.getElementById('runButton').onclick = runCode;document.getElementById('backToEditorButton').onclick = function() {
document.getElementById('editor').style.height = '75vh';
document.getElementById('outputFrame').style.height = '25vh';
editor.layout();
};window.addEventListener('keydown', function(event) {
if (event.ctrlKey && event.key === 's') {
event.preventDefault();
runCode();
}
});document.getElementById('formatButton').onclick = function() {
editor.getAction('editor.action.formatDocument').run();
};document.getElementById('copyButton').onclick = function() {
var code = editor.getValue();
navigator.clipboard.writeText(code).then(function() {
alert("تم نسخ الكود إلى الحافظة!");
}, function(err) {
console.error('فشل النسخ: ', err);
});
};
});