autoplay and reset cps on default
This commit is contained in:
parent
b1d49552ae
commit
961e931c31
2 changed files with 10 additions and 5 deletions
|
|
@ -164,11 +164,12 @@ export function Repl({ embedded = false }) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUpdate = async (patternData, reset = false) => {
|
const handleUpdate = async (patternData, reset = false) => {
|
||||||
if (reset) {
|
|
||||||
await resetEditor();
|
|
||||||
}
|
|
||||||
setViewingPatternData(patternData);
|
setViewingPatternData(patternData);
|
||||||
editorRef.current.setCode(patternData.code);
|
editorRef.current.setCode(patternData.code);
|
||||||
|
if (reset) {
|
||||||
|
await resetEditor();
|
||||||
|
handleEvaluate();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEvaluate = () => {
|
const handleEvaluate = () => {
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,8 @@ export function PatternsTab({ context }) {
|
||||||
};
|
};
|
||||||
const viewingPatternID = viewingPatternData?.id;
|
const viewingPatternID = viewingPatternData?.id;
|
||||||
|
|
||||||
|
const autoResetPatternOnChange = !window.location.pathname.includes('oodles');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="px-4 w-full dark:text-white text-stone-900 space-y-2 pb-4 flex flex-col overflow-hidden max-h-full">
|
<div className="px-4 w-full dark:text-white text-stone-900 space-y-2 pb-4 flex flex-col overflow-hidden max-h-full">
|
||||||
<ButtonGroup
|
<ButtonGroup
|
||||||
|
|
@ -156,7 +158,9 @@ export function PatternsTab({ context }) {
|
||||||
<section className="flex overflow-y-scroll max-h-full flex-col">
|
<section className="flex overflow-y-scroll max-h-full flex-col">
|
||||||
{patternFilter === patternFilterName.user && (
|
{patternFilter === patternFilterName.user && (
|
||||||
<PatternButtons
|
<PatternButtons
|
||||||
onClick={(id) => updateCodeWindow({ ...userPatterns[id], collection: userPattern.collection }, false)}
|
onClick={(id) =>
|
||||||
|
updateCodeWindow({ ...userPatterns[id], collection: userPattern.collection }, autoResetPatternOnChange)
|
||||||
|
}
|
||||||
patterns={userPatterns}
|
patterns={userPatterns}
|
||||||
started={context.started}
|
started={context.started}
|
||||||
activePattern={activePattern}
|
activePattern={activePattern}
|
||||||
|
|
@ -171,7 +175,7 @@ export function PatternsTab({ context }) {
|
||||||
<h2 className="text-xl mb-2">{collection}</h2>
|
<h2 className="text-xl mb-2">{collection}</h2>
|
||||||
<div className="font-mono text-sm">
|
<div className="font-mono text-sm">
|
||||||
<PatternButtons
|
<PatternButtons
|
||||||
onClick={(id) => updateCodeWindow({ ...patterns[id], collection }, false)}
|
onClick={(id) => updateCodeWindow({ ...patterns[id], collection }, autoResetPatternOnChange)}
|
||||||
started={context.started}
|
started={context.started}
|
||||||
patterns={patterns}
|
patterns={patterns}
|
||||||
activePattern={activePattern}
|
activePattern={activePattern}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue