make sure draw logic works with multiple repls

This commit is contained in:
Felix Roos 2024-06-01 15:41:55 +02:00
parent 827993a8c9
commit 375c68775c
7 changed files with 20 additions and 16 deletions

View file

@ -154,9 +154,9 @@ export class StrudelMirror {
this.prebaked = prebake();
autodraw && this.drawFirstFrame();
this.repl = repl({
...replOptions,
id,
onToggle: (started) => {
replOptions?.onToggle?.(started);
if (started) {
@ -171,11 +171,11 @@ export class StrudelMirror {
} else {
this.drawer.stop();
updateMiniLocations(this.editor, []);
cleanupDraw(false);
cleanupDraw(false, id);
}
},
beforeEval: async () => {
cleanupDraw();
cleanupDraw(true, id);
this.painters = [];
const self = this;
// this is similar to repl.mjs > injectPatternMethods