aboutsummaryrefslogtreecommitdiffstats
path: root/ui/src/components/runbooks/editor/blocks
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/components/runbooks/editor/blocks')
-rw-r--r--ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx23
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}
/>
);