Skip to content

Commit

Permalink
fix Editor textArea issue
Browse files Browse the repository at this point in the history
The SimpleEdior bugs out if we define height and overflow directly to it.
So wrapped it in a div with stylings applied there.
  • Loading branch information
apoorvlathey committed Aug 9, 2021
1 parent 9541953 commit 3dde116
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/components/common/JsonTextArea.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { chakra, useColorMode } from "@chakra-ui/react";
import { chakra, Box, useColorMode } from "@chakra-ui/react";
import SimpleEditor from "react-simple-code-editor";

import "../../styles/scroll.css";
Expand All @@ -23,28 +23,29 @@ function JsonTextArea({
const borderColor = { light: "gray.500", dark: "gray.400" };

return (
<ChakraSimpleEditor
placeholder={placeholder}
aria-label={ariaLabel}
value={value}
onValueChange={setValue}
readOnly={readOnly}
bg={bg}
<Box
h="60"
style={{
overflowY: "scroll",
}}
overflowY="scroll"
className="scroll"
highlight={(contents) =>
hljs.highlight(contents, { language: "json" }).value
}
bg={bg}
border="1px"
borderColor={borderColor[colorMode]}
roundedLeft="md"
roundedRight="4px"
fontFamily={"SFMono-Regular,Menlo,Monaco,Consolas,monospace"}
resize={canResize ? "both" : "none"}
/>
>
<ChakraSimpleEditor
placeholder={placeholder}
aria-label={ariaLabel}
value={value}
onValueChange={setValue}
readOnly={readOnly}
highlight={(contents) =>
hljs.highlight(contents, { language: "json" }).value
}
fontFamily={"SFMono-Regular,Menlo,Monaco,Consolas,monospace"}
/>
</Box>
);
}

Expand Down

0 comments on commit 3dde116

Please sign in to comment.