fix: disable highlighting

This commit is contained in:
Felix Roos 2022-04-12 20:14:08 +02:00
parent 5aa01ce91c
commit f8cbd67557

View File

@ -23,6 +23,13 @@ function useRepl({ tune, defaultSynth, autolink = true, onEvent, onDraw }) {
const dirty = useMemo(() => code !== activeCode || error, [code, activeCode, error]);
const pushLog = useCallback((message) => setLog((log) => log + `${log ? '\n\n' : ''}${message}`), []);
// 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, onDraw]);
// cycle hook to control scheduling
const cycle = useCycle({
onDraw,
@ -111,13 +118,6 @@ function useRepl({ tune, defaultSynth, autolink = true, onEvent, onDraw }) {
}
};
// 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, onDraw]);
const togglePlay = () => {
if (!cycle.started) {
activateCode();