mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-14 23:28:30 +00:00
Pass mininotation locations into highlight state
This commit is contained in:
parent
0b5d905120
commit
aded178ab7
@ -85,7 +85,7 @@ const miniLocations = StateField.define({
|
||||
}
|
||||
})
|
||||
.filter(Boolean);
|
||||
locations = Decoration.set(decorations); // -> DecorationSet === RangeSet<Decoration>
|
||||
locations = Decoration.set(decorations, true); // -> DecorationSet === RangeSet<Decoration>
|
||||
}
|
||||
if (e.is(showMiniLocations)) {
|
||||
// this is called every frame to show the locations that are currently active
|
||||
|
||||
@ -126,6 +126,13 @@ export function Repl({ embedded = false }) {
|
||||
isLineWrappingEnabled,
|
||||
} = useSettings();
|
||||
|
||||
const [miniLocations, setMiniLocations] = useState([]);
|
||||
useEffect(() => {
|
||||
if (view) {
|
||||
updateMiniLocations(view, miniLocations);
|
||||
}
|
||||
}, [view, miniLocations]);
|
||||
|
||||
const { code, setCode, scheduler, evaluate, activateCode, isDirty, activeCode, pattern, started, stop, error } =
|
||||
useStrudel({
|
||||
initialCode: '// LOADING...',
|
||||
@ -138,9 +145,7 @@ export function Repl({ embedded = false }) {
|
||||
cleanupDraw();
|
||||
},
|
||||
afterEval: ({ code, meta }) => {
|
||||
console.log('miniLocations', meta.miniLocations, view);
|
||||
// TODO: find a way to get hold of the codemirror view
|
||||
// then call updateMiniLocations
|
||||
setMiniLocations(meta.miniLocations);
|
||||
setPending(false);
|
||||
setLatestCode(code);
|
||||
window.location.hash = '#' + encodeURIComponent(btoa(code));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user