diff options
| author | Ellie Huxtable <ellie@atuin.sh> | 2024-07-23 13:18:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-23 13:18:54 +0100 |
| commit | f8c963c7d668fc57680f25413f20bc207d4bf64a (patch) | |
| tree | c7f952ddc0220cded24f5447d03b3bff46fb1d45 /ui/src/components/runbooks/editor/blocks | |
| parent | fix(themes): Restore default theme, refactor (#2294) (diff) | |
| download | atuin-f8c963c7d668fc57680f25413f20bc207d4bf64a.zip | |
feat(gui): clean up home page, fix a few bugs (#2304)
* wip home screen changes
* more
* adjust
* fixes and things
* patch runbook pty check
Diffstat (limited to 'ui/src/components/runbooks/editor/blocks')
| -rw-r--r-- | ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx b/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx index 15653611..b3a96166 100644 --- a/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx +++ b/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx @@ -1,4 +1,4 @@ -import React from "react"; +// @ts-ignore import { createReactBlockSpec } from "@blocknote/react"; import "./index.css"; @@ -48,7 +48,7 @@ const RunBlock = ({ ], ); - const isRunning = pty !== null; + const isRunning = pty !== null && pty !== ""; const handleToggle = async (event: any | null) => { if (event) event.stopPropagation(); @@ -63,21 +63,21 @@ const RunBlock = ({ cleanupPtyTerm(pty); if (onStop) onStop(pty); - decRunbookPty(currentRunbook); + if (currentRunbook) decRunbookPty(currentRunbook); } if (!isRunning) { let pty = await invoke<string>("pty_open"); if (onRun) onRun(pty); - incRunbookPty(currentRunbook); + if (currentRunbook) incRunbookPty(currentRunbook); let val = !value.endsWith("\n") ? value + "\r\n" : value; await invoke("pty_write", { pid: pty, data: val }); } }; - const handleCmdEnter = (view) => { + const handleCmdEnter = () => { handleToggle(null); return true; }; @@ -145,7 +145,7 @@ export default createReactBlockSpec( default: "bash", }, code: { default: "" }, - pty: { default: null }, + pty: { default: "" }, }, content: "none", }, @@ -154,19 +154,21 @@ export default createReactBlockSpec( render: ({ block, editor, code, type }) => { const onInputChange = (val: string) => { editor.updateBlock(block, { + // @ts-ignore props: { ...block.props, code: val }, }); }; const onRun = (pty: string) => { editor.updateBlock(block, { + // @ts-ignore props: { ...block.props, pty: pty }, }); }; - const onStop = (pty: string) => { - editor.updateBlock(block, { - props: { ...block.props, pty: null }, + const onStop = (_pty: string) => { + editor?.updateBlock(block, { + props: { ...block.props, pty: "" }, }); }; |
