|
function exportHtml() { |
|
const htmlCode = editor.getHtml(); |
|
const cssCode = editor.getCss(); |
|
const jsCode = editor.getJs(); |
|
|
|
|
|
const selectedScripts = []; |
|
if (document.getElementById('script1-checkbox').checked) { |
|
selectedScripts.push(document.getElementById('script1-checkbox').value); |
|
} |
|
if (document.getElementById('script2-checkbox').checked) { |
|
selectedScripts.push(document.getElementById('script2-checkbox').value); |
|
} |
|
if (document.getElementById('script3-checkbox').checked) { |
|
selectedScripts.push(document.getElementById('script3-checkbox').value); |
|
} |
|
|
|
|
|
const additionalScripts = selectedScripts.map(script => `<script src="${script}"><\/script>`).join(''); |
|
|
|
|
|
const fullHtml = ` |
|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<style>${cssCode}</style> |
|
</head> |
|
<body> |
|
${htmlCode} |
|
<script>${jsCode}<\/script> |
|
${additionalScripts} |
|
</body> |
|
</html> |
|
`; |
|
|
|
|
|
const blob = new Blob([fullHtml], { type: 'text/html' }); |
|
const url = URL.createObjectURL(blob); |
|
const a = document.createElement('a'); |
|
a.href = url; |
|
a.download = 'page.html'; |
|
a.click(); |
|
} |