Live-update preview on type

This commit is contained in:
Tangent Wantwight 2023-11-20 22:09:02 -05:00
parent 710106af8b
commit 63f40309c7
2 changed files with 10 additions and 18 deletions

11
TODO
View file

@ -1,9 +1,5 @@
- arithmatic
- finish event listener:
- path to event listener:
- rerender w/ a signal to branch into handler
- capture correct position information in script blocks
- card fields (vars maybe not needed yet?)
- set field command
- buffer output/side-effects in VM
@ -11,6 +7,11 @@
- unit test
- command
- set field inline instead of separate data???
- capture correct position information in script blocks
- arithmatic
- if blocks
- impl vars

View file

@ -50,7 +50,9 @@ fieldInput.value = String.raw`
title "Hello, World!"
`.trim();
const codeInput = document.createElement("textarea");
const codeInput = Object.assign(document.createElement("textarea"), {
oninput: render,
});
Object.assign(codeInput.style, TEXTAREA_STYLE, { height: "20em" });
codeInput.value = String.raw`
h1 [get title]
@ -99,10 +101,6 @@ para {
}
`.trim();
const rerender = Object.assign(document.createElement("button"), {
onclick: () => render(),
textContent: "Render",
});
const state = document.createElement("pre");
const display = document.createElement("blockquote");
const debugDisplay = document.createElement("pre");
@ -164,14 +162,7 @@ function triggerEvent(handlerPos: number) {
}
render();
document.body.append(
fieldInput,
codeInput,
rerender,
display,
state,
debugDisplay
);
document.body.append(fieldInput, codeInput, display, state, debugDisplay);
RegisterJumpHere(codeInput);
RegisterButtonOnClick(triggerEvent);