mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-24 20:18:34 +00:00
fix: mini repl play toggle button
This commit is contained in:
parent
b5edcde638
commit
9c13f6bb53
@ -182,7 +182,7 @@ export class StrudelMirror {
|
|||||||
}
|
}
|
||||||
async toggle() {
|
async toggle() {
|
||||||
if (this.repl.scheduler.started) {
|
if (this.repl.scheduler.started) {
|
||||||
this.repl.scheduler.stop();
|
this.repl.stop();
|
||||||
} else {
|
} else {
|
||||||
this.evaluate();
|
this.evaluate();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { useState, useRef, useCallback, useEffect } from 'react';
|
import { useState, useRef, useCallback, useEffect } from 'react';
|
||||||
import { Icon } from './Icon';
|
import { Icon } from './Icon';
|
||||||
|
// import { useInView } from 'react-hook-inview';
|
||||||
|
|
||||||
export function MicroRepl({ code, hideHeader = false }) {
|
export function MicroRepl({ code, hideHeader = false }) {
|
||||||
/* const [ref, isVisible] = useInView({
|
/* const [ref, isVisible] = useInView({
|
||||||
@ -10,7 +11,7 @@ export function MicroRepl({ code, hideHeader = false }) {
|
|||||||
const wc = useRef();
|
const wc = useRef();
|
||||||
function togglePlay() {
|
function togglePlay() {
|
||||||
if (wc.current) {
|
if (wc.current) {
|
||||||
wc.current?.editor.evaluate();
|
wc.current?.editor.toggle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const listener = useCallback((e) => setReplState({ ...e.detail }), []);
|
const listener = useCallback((e) => setReplState({ ...e.detail }), []);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user