playground improvements

This commit is contained in:
2025-07-24 20:11:45 -07:00
parent 800cec28de
commit 8386331752

View File

@@ -129,7 +129,7 @@ document.addEventListener("keydown", (ev) => {
}); });
function getSavedCode() { function getSavedCode() {
let value: string = localStorage.idrisCode || LOADING; let value: string = localStorage.code || LOADING;
let hash = window.location.hash; let hash = window.location.hash;
if (hash.startsWith("#code/")) { if (hash.startsWith("#code/")) {
try { try {
@@ -157,12 +157,10 @@ if (window.matchMedia) {
function checkDark(ev: { matches: boolean }) { function checkDark(ev: { matches: boolean }) {
console.log("CHANGE", ev); console.log("CHANGE", ev);
if (ev.matches) { if (ev.matches) {
// monaco.editor.setTheme("vs-dark");
document.body.className = "dark"; document.body.className = "dark";
state.dark.value = true; state.dark.value = true;
state.editor.value?.setDark(true); state.editor.value?.setDark(true);
} else { } else {
// monaco.editor.setTheme("vs");
document.body.className = "light"; document.body.className = "light";
state.dark.value = false; state.dark.value = false;
state.editor.value?.setDark(false); state.editor.value?.setDark(false);
@@ -366,7 +364,6 @@ function EditWrap({
vertical: boolean; vertical: boolean;
toggle: () => void; toggle: () => void;
}) { }) {
// const [file, setFile] = useState("Tour.newt");
const options = state.files.value.map((value) => const options = state.files.value.map((value) =>
h("option", { value }, value) h("option", { value }, value)
); );
@@ -395,7 +392,8 @@ function EditWrap({
{ className: "tabBar" }, { className: "tabBar" },
h( h(
"select", "select",
{ onChange: selectFile, value: state.currentFile.value }, { onChange: selectFile, value: "" },
h("option", { value: "" }, "-- load sample --"),
options options
), ),
h("div", { style: { flex: "1 1" } }), h("div", { style: { flex: "1 1" } }),