can now disable highlighting via comment

This commit is contained in:
Felix Roos 2022-03-18 17:37:28 +01:00
parent 679f30abe3
commit 6691afb9b9
2 changed files with 9 additions and 1 deletions

View File

@ -60,7 +60,7 @@ function useCycle(props: UseCycleProps) {
useEffect(() => {
ready && query();
}, [onEvent, onSchedule, onQuery, ready]);
}, [onEvent, onSchedule, onQuery, onDraw, ready]);
const start = async () => {
setStarted(true);

View File

@ -54,6 +54,14 @@ function useRepl({ tune, defaultSynth, autolink = true, onEvent, onDraw }: any)
// pushLog(`# cycle ${cycle}\n` + _events.map((e: any) => e.show()).join('\n'));
}
};
// below block allows disabling the highlighting by including "strudel disable-highlighting" in the code (as comment)
onDraw = useMemo(() => {
if (activeCode && !activeCode.includes('strudel disable-highlighting')) {
return onDraw;
}
}, [activeCode]);
// cycle hook to control scheduling
const cycle = useCycle({
onDraw,