From 2dfc2d34e42c17fc53900786ab5e2b90afabcb14 Mon Sep 17 00:00:00 2001 From: woxtu Date: Mon, 16 May 2022 21:14:36 +0900 Subject: [PATCH] Replace `StateCommand` with `Command` --- pyscriptjs/src/components/pyrepl.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyscriptjs/src/components/pyrepl.ts b/pyscriptjs/src/components/pyrepl.ts index 329a9ec8..1fee4337 100644 --- a/pyscriptjs/src/components/pyrepl.ts +++ b/pyscriptjs/src/components/pyrepl.ts @@ -1,7 +1,7 @@ import { basicSetup, EditorState, EditorView } from '@codemirror/basic-setup'; import { python } from '@codemirror/lang-python'; -import { Compartment, StateCommand } from '@codemirror/state'; -import { keymap } from '@codemirror/view'; +import { Compartment } from '@codemirror/state'; +import { keymap, type Command } from '@codemirror/view'; import { defaultKeymap } from '@codemirror/commands'; import { oneDarkTheme } from '@codemirror/theme-one-dark'; @@ -32,13 +32,13 @@ mode.subscribe(value => { currentMode = value; }); -function createCmdHandler(el: PyRepl): StateCommand { +function createCmdHandler(el: PyRepl): Command { // Creates a codemirror cmd handler that calls the el.evaluate when an event // triggers that specific cmd - const toggleCheckbox: StateCommand = ({ state, dispatch }) => { - return el.evaluate(state); + return () => { + void el.evaluate(); + return true; }; - return toggleCheckbox; } let initialTheme: string;