Merge branch 'refactor/code-editor' into 'release'
Passing height and language as props to CodeEditor See merge request theappsmith/internal-tools-client!100
This commit is contained in:
commit
64e8a6c68e
|
|
@ -141,6 +141,8 @@ const ApiResponseView = (props: Props) => {
|
||||||
<ResponseBodyWrapper>
|
<ResponseBodyWrapper>
|
||||||
{response.body && (
|
{response.body && (
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
|
height={500}
|
||||||
|
language={"json"}
|
||||||
input={{
|
input={{
|
||||||
value: JSON.stringify(response.body, null, 2),
|
value: JSON.stringify(response.body, null, 2),
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,10 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
// import Editor from "react-simple-code-editor";
|
|
||||||
// import { highlight, languages } from "prismjs/components/prism-core";
|
|
||||||
// import "prismjs/components/prism-clike";
|
|
||||||
// import "prismjs/components/prism-json";
|
|
||||||
// import "prismjs/components/prism-markup";
|
|
||||||
// import "prismjs/themes/prism.css";
|
|
||||||
// import { theme } from "../../constants/DefaultTheme";
|
|
||||||
import MonacoEditor from "react-monaco-editor";
|
import MonacoEditor from "react-monaco-editor";
|
||||||
|
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div<{ height: number }>`
|
||||||
height: 500px;
|
height: ${props => props.height}px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
@ -20,6 +13,8 @@ interface Props {
|
||||||
value: string;
|
value: string;
|
||||||
onChange?: (value: string) => void;
|
onChange?: (value: string) => void;
|
||||||
};
|
};
|
||||||
|
language: string;
|
||||||
|
height: number;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,10 +24,11 @@ const CodeEditor = (props: Props) => {
|
||||||
minimap: { enabled: false },
|
minimap: { enabled: false },
|
||||||
readOnly: !props.input.onChange,
|
readOnly: !props.input.onChange,
|
||||||
};
|
};
|
||||||
|
debugger;
|
||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper height={props.height}>
|
||||||
<MonacoEditor
|
<MonacoEditor
|
||||||
language="json"
|
language={props.language}
|
||||||
theme="vs-light"
|
theme="vs-light"
|
||||||
value={props.input.value}
|
value={props.input.value}
|
||||||
options={options}
|
options={options}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ const JSONEditorField = (props: { name: string }) => {
|
||||||
<Field
|
<Field
|
||||||
name={props.name}
|
name={props.name}
|
||||||
component={CodeEditor}
|
component={CodeEditor}
|
||||||
|
height={500}
|
||||||
|
language={"json"}
|
||||||
format={(value: string | object) =>
|
format={(value: string | object) =>
|
||||||
typeof value === "string" ? value : JSON.stringify(value, null, 2)
|
typeof value === "string" ? value : JSON.stringify(value, null, 2)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user