diff options
| author | Ellie Huxtable <ellie@atuin.sh> | 2024-07-15 19:12:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-15 19:12:01 +0100 |
| commit | 7eb985b616c12aed261fbef74a47c5a928c03e61 (patch) | |
| tree | fe3088dc687c640176bf376b4ca8baf2088bd69f /ui/src/components/runbooks/editor/blocks | |
| parent | chore(deps): bump cachix/install-nix-action from 20 to 27 (#2268) (diff) | |
| download | atuin-7eb985b616c12aed261fbef74a47c5a928c03e61.zip | |
feat(gui): add runbook list, ability to create and delete, sql storage (#2282)
* wip
* saving works :))
* functioning delete button
* persist selection properly
Diffstat (limited to 'ui/src/components/runbooks/editor/blocks')
| -rw-r--r-- | ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx b/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx index 78928876..9b2fe515 100644 --- a/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx +++ b/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx @@ -23,17 +23,20 @@ interface RunBlockProps { isEditable: boolean; } -const RunBlock = ({ onPlay, id, code, isEditable }: RunBlockProps) => { +const RunBlock = ({ + onChange, + onPlay, + id, + code, + isEditable, +}: RunBlockProps) => { + console.log(code); const [isRunning, setIsRunning] = useState(false); const [showTerminal, setShowTerminal] = useState(false); const [value, setValue] = useState<String>(code); const [pty, setPty] = useState<string | null>(null); - const onChange = (val: any) => { - setValue(val); - }; - const handleToggle = async (event: any) => { event.stopPropagation(); @@ -88,7 +91,10 @@ const RunBlock = ({ onPlay, id, code, isEditable }: RunBlockProps) => { editable={isEditable} width="100%" autoFocus - onChange={onChange} + onChange={(val) => { + setValue(val); + onChange(val); + }} extensions={[...extensions(), langs.shell()]} basicSetup={false} /> @@ -123,14 +129,15 @@ export default createReactBlockSpec( editor.updateBlock(block, { props: { ...block.props, code: val }, }); + console.log(block.props); }; return ( <RunBlock onChange={onInputChange} id={block?.id} - code={code} - type={type} + code={block.props.code} + type={block.props.type} isEditable={editor.isEditable} /> ); |
