From 91959bd1c7c23942de39716944cdd41100ea6fab Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Sun, 21 Nov 2021 14:45:47 +0200 Subject: [PATCH 1/3] auto recompile when option changed --- src/.vuepress/public/editor.html | 62 +++++++++++++++++++------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/src/.vuepress/public/editor.html b/src/.vuepress/public/editor.html index 5388f232a..66a0b75df 100644 --- a/src/.vuepress/public/editor.html +++ b/src/.vuepress/public/editor.html @@ -550,6 +550,13 @@
Documentation
} }, { passive: false }) + document.querySelectorAll('input[id][type="checkbox"],input[id][type="radio"]').forEach(input => { + input.addEventListener('change', e => { + const activePane = document.querySelector('.tab.active') + recompile(activePane.id) + }) + }) + // Make tabs switchable document.querySelectorAll('.tab').forEach(element => { element.addEventListener('click', () => { @@ -558,31 +565,35 @@
Documentation
document.querySelectorAll('.pane').forEach(element => element.classList.remove('active')) const pane = document.getElementById(element.id.substring(0, element.id.length - 3)) pane.classList.add('active') - if (element.id == 'binaryTab') { - binaryEditor.setValue('(module\n 🚀\n)\n') - setTimeout(() => { - compile() - }, 10) - } else if (element.id == 'playTab') { - function serialize() { - return 'data:text/html;base64,' + btoa([ - '