diff --git a/site/decodal-site/src/scripts/playground.js b/site/decodal-site/src/scripts/playground.js index ecb4af0..c606c49 100644 --- a/site/decodal-site/src/scripts/playground.js +++ b/site/decodal-site/src/scripts/playground.js @@ -137,11 +137,13 @@ function saveProject() { function loadExampleProject(exampleId) { const example = playgroundExamples.find((item) => item.id === exampleId) ?? starterProject; - project.files = cloneFiles(example.files); - project.activePath = example.activePath; + const files = cloneFiles(example.files); + project.files = {}; + project.activePath = ''; project.entryPath = example.entryPath ?? example.activePath; + project.files = files; exampleSelect.value = example.id; - setActiveFile(project.activePath); + setActiveFile(example.activePath); output.textContent = ''; output.classList.remove('error'); execute(); @@ -304,7 +306,6 @@ formatButton.addEventListener('click', formatActiveFile); loadExample.addEventListener('click', () => { const example = playgroundExamples.find((item) => item.id === exampleSelect.value); if (!example) return; - if (!confirm(`Load example "${example.title}"? This replaces the current virtual files.`)) return; loadExampleProject(example.id); }); newFile.addEventListener('click', () => {