Skip to content

Commit 12bc1ea

Browse files
committed
use codemirror editor in request and output nodes
1 parent 6401253 commit 12bc1ea

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/components/atoms/Editor.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.cm-editor {
2+
height: 380px;
3+
width: 380px;
4+
}
5+
.cm-scroller {
6+
overflow: auto;
7+
}

src/components/atoms/Editor.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { indentWithTab, history } from '@codemirror/commands';
77
import { json } from '@codemirror/lang-json';
88
import { defaultKeymap } from '@codemirror/commands';
99
import { syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language';
10+
import 'components/atoms/Editor.css';
1011

1112
export const Editor = ({ ...props }) => {
1213
const editor = useRef();
@@ -39,5 +40,5 @@ export const Editor = ({ ...props }) => {
3940
};
4041
}, []);
4142

42-
return <div ref={editor} className='max-h-96 max-w-80'></div>;
43+
return <div ref={editor} className='cm-editor cm-scroller'></div>;
4344
};

src/components/molecules/flow/nodes/OutputNode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const OutputNode = ({ id, data }) => {
1212
handleRight={true}
1313
handleRightData={{ type: 'source' }}
1414
>
15-
<div className='w-full text-xs text-gray-900 border border-gray-300 rounded-lg nodrag nowheel min-h-96 min-w-80 bg-gray-50 outline-blue-300 focus:border-blue-100 focus:ring-blue-100'>
15+
<div className='w-full text-xs text-gray-900 border border-gray-300 rounded-lg nodrag nowheel min-h-96 min-w-96 bg-gray-50 outline-blue-300 focus:border-blue-100 focus:ring-blue-100'>
1616
{data.output ? (
1717
<Editor name='output-text' value={JSON.stringify(data.output, null, 2)} readOnly={true} />
1818
) : (

src/components/molecules/flow/nodes/RequestBody.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const RequestBody = ({ nodeId, nodeData }) => {
130130
<>
131131
<NodeHorizontalDivider />
132132
<div className='p-4 bg-background'>
133-
<div className='w-full nodrag nowheel min-w-72'>
133+
<div className='w-full nodrag nowheel min-w-72 bg-gray-50'>
134134
<Editor name='request-body-json' onChange={(e) => handleRawJson(e)} value={nodeData.requestBody.body} />
135135
<Button
136136
btnType={BUTTON_TYPES.secondary}

0 commit comments

Comments
 (0)