fix: disable highlighting
This commit is contained in:
parent
5aa01ce91c
commit
f8cbd67557
1 changed files with 7 additions and 7 deletions
|
|
@ -23,6 +23,13 @@ function useRepl({ tune, defaultSynth, autolink = true, onEvent, onDraw }) {
|
||||||
const dirty = useMemo(() => code !== activeCode || error, [code, activeCode, error]);
|
const dirty = useMemo(() => code !== activeCode || error, [code, activeCode, error]);
|
||||||
const pushLog = useCallback((message) => setLog((log) => log + `${log ? '\n\n' : ''}${message}`), []);
|
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
|
// cycle hook to control scheduling
|
||||||
const cycle = useCycle({
|
const cycle = useCycle({
|
||||||
onDraw,
|
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 = () => {
|
const togglePlay = () => {
|
||||||
if (!cycle.started) {
|
if (!cycle.started) {
|
||||||
activateCode();
|
activateCode();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue