secret zen mode

This commit is contained in:
Felix Roos 2022-11-13 15:47:11 +01:00
parent c92cb1c096
commit 1b8ec1f01c
5 changed files with 111 additions and 75 deletions

View file

@ -108,6 +108,7 @@ function App() {
const [view, setView] = useState(); // codemirror view
const [lastShared, setLastShared] = useState();
const [activeFooter, setActiveFooter] = useState('');
const [isZen, setIsZen] = useState(false);
const { code, setCode, scheduler, evaluate, activateCode, isDirty, activeCode, pattern, started, stop } = useStrudel({
initialCode: '// LOADING',
@ -238,6 +239,8 @@ function App() {
handleUpdate,
handleShuffle,
handleShare,
isZen,
setIsZen,
}}
>
<div
@ -248,7 +251,15 @@ function App() {
>
{!hideHeader && <Header />}
<section className="grow flex text-gray-100 relative overflow-auto cursor-text pb-0" id="code">
<CodeMirror value={code} onChange={handleChangeCode} onViewChanged={setView} />
<CodeMirror
value={code}
onChange={handleChangeCode}
onViewChanged={setView}
onSelectionChange={(selection) => {
// TODO: scroll to selected function in reference
// console.log('selectino change', selection.ranges[0].from);
}}
/>
</section>
<Footer />
</div>