- Fix codemirror cursor issue. - Fix foreign table jasmine test cases.

This commit is contained in:
Aditya Toshniwal
2021-08-26 17:02:59 +05:30
committed by Akshay Joshi
parent c8026873b4
commit 2a76027cce
4 changed files with 13 additions and 8 deletions

View File

@@ -42,7 +42,9 @@ export default function CodeMirror({currEditor, name, value, options, events, cl
useMemo(() => {
if(editor.current) {
editor.current.setValue(value);
if(value != editor.current.getValue()) {
editor.current.setValue(value);
}
}
}, [value]);

View File

@@ -8,7 +8,7 @@
//////////////////////////////////////////////////////////////
/* Common form components used in pgAdmin */
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import React, { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { Box, FormControl, OutlinedInput, FormHelperText,
Grid, IconButton, FormControlLabel, Switch, Checkbox, useTheme, InputLabel, Paper } from '@material-ui/core';
@@ -149,7 +149,7 @@ export function InputSQL({value, options, onChange, readonly, className, ...prop
}
}, [readonly]);
return useMemo(()=>(
return (
<CodeMirror
currEditor={(obj)=>editor.current=obj}
value={value||''}
@@ -166,13 +166,14 @@ export function InputSQL({value, options, onChange, readonly, className, ...prop
}}
{...props}
/>
), [value]);
);
}
InputSQL.propTypes = {
value: PropTypes.string,
options: PropTypes.object,
onChange: PropTypes.func,
readonly: PropTypes.bool
readonly: PropTypes.bool,
className: CustomPropTypes.className,
};
export function FormInputSQL({hasError, required, label, className, helpMessage, testcid, value, controlProps, noLabel, ...props}) {