Fix component PR comments
- use isFinite - Refactor default props - Fix height of single line - Remove codejar dependency
This commit is contained in:
parent
7e28be8f3b
commit
427c5d5615
|
|
@ -72,7 +72,6 @@
|
|||
"@types/styled-components": "^5.1.24",
|
||||
"css-loader": "^6.7.1",
|
||||
"prettier": "^2.6.0",
|
||||
"react-codejar": "^1.1.2",
|
||||
"style-loader": "^3.3.1",
|
||||
"ts-loader": "^9.2.8",
|
||||
"webpack": "^5.70.0",
|
||||
|
|
|
|||
|
|
@ -9,21 +9,27 @@ import "ace-builds/src-noconflict/keybinding-vim";
|
|||
interface CodeEditorProps {
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
oneLine: boolean;
|
||||
oneLine?: boolean;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export let CodeEditor: FC<CodeEditorProps> = (props) => (
|
||||
export let CodeEditor: FC<CodeEditorProps> = ({
|
||||
value,
|
||||
onChange,
|
||||
oneLine = false,
|
||||
width = 500,
|
||||
}: CodeEditorProps) => (
|
||||
<AceEditor
|
||||
value={props.value}
|
||||
value={value}
|
||||
mode="golang"
|
||||
theme="github"
|
||||
width={props.width ? props.width + "px" : "500px"}
|
||||
height={props.oneLine ? "1.2em" : "500px"}
|
||||
width={width + "px"}
|
||||
maxLines={oneLine ? 1 : 15}
|
||||
minLines={oneLine ? 1 : 15}
|
||||
showGutter={false}
|
||||
highlightActiveLine={false}
|
||||
showPrintMargin={false}
|
||||
onChange={props.onChange}
|
||||
onChange={onChange}
|
||||
name="UNIQUE_ID_OF_DIV"
|
||||
editorProps={{
|
||||
$blockScrolling: true,
|
||||
|
|
@ -31,7 +37,6 @@ export let CodeEditor: FC<CodeEditorProps> = (props) => (
|
|||
setOptions={{
|
||||
enableBasicAutocompletion: false,
|
||||
enableLiveAutocompletion: true,
|
||||
enableSnippets: true,
|
||||