move 'env' from state to context

This commit is contained in:
Joeri Exelmans 2025-05-13 14:33:35 +02:00
parent 9ef160aeb7
commit f09261df93
13 changed files with 178 additions and 148 deletions

View file

@ -3,6 +3,7 @@ import './App.css'
import { Editor, type EditorState } from './Editor'
import { initialEditorState, nonEmptyEditorState, tripleFunctionCallEditorState } from "./configurations";
import { CommandContext } from './CommandContext';
import { EnvContext } from './EnvContext';
export function App() {
const [history, setHistory] = useState([initialEditorState]);
@ -52,7 +53,7 @@ export function App() {
const commands = [
["call" , "[c] call" ],
["eval" , "[u] [Tab] [Enter] eval"],
["transform", "[t] transform" ],
["transform", "[t] [.] transform" ],
["let" , "[=] let ... in ..." ],
];
@ -80,15 +81,14 @@ export function App() {
}
</header>
<main>
<CommandContext value={doHighlight}>
<main onKeyDown={onKeyDown}>
<CommandContext value={{undo: onUndo, redo: onRedo, doHighlight}}>
<Editor
state={history.at(-1)!}
setState={pushHistory}
onResolve={() => {}}
onCancel={() => {}}
filter={() => true}
focus={true}
/>
</CommandContext>
</main>