can now disable highlighting via comment
This commit is contained in:
parent
679f30abe3
commit
6691afb9b9
2 changed files with 9 additions and 1 deletions
|
|
@ -60,7 +60,7 @@ function useCycle(props: UseCycleProps) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ready && query();
|
ready && query();
|
||||||
}, [onEvent, onSchedule, onQuery, ready]);
|
}, [onEvent, onSchedule, onQuery, onDraw, ready]);
|
||||||
|
|
||||||
const start = async () => {
|
const start = async () => {
|
||||||
setStarted(true);
|
setStarted(true);
|
||||||
|
|
|
||||||
|
|
@ -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'));
|
// 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
|
// cycle hook to control scheduling
|
||||||
const cycle = useCycle({
|
const cycle = useCycle({
|
||||||
onDraw,
|
onDraw,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue