Revert "fixed incorrect paste on data grid"

This reverts commit dda614165f.
This commit is contained in:
Jan Prochazka 2020-06-11 15:43:51 +02:00
parent bab14883a2
commit 5c1920d60d

View File

@ -215,7 +215,7 @@ export default function DataGridCore(props) {
const { isLoading, loadedRows, isLoadedAll, loadedTime, allRowCount, errorMessage } = loadProps;
const loadedTimeRef = React.useRef(0);
const focusFieldRef = React.useRef(null);
const focusFieldRef = React.useRef();
const [vScrollValueToSet, setvScrollValueToSet] = React.useState();
const [vScrollValueToSetDate, setvScrollValueToSetDate] = React.useState(new Date());
@ -237,7 +237,6 @@ export default function DataGridCore(props) {
const changeSet = changeSetState && changeSetState.value;
const setChangeSet = React.useCallback((value) => dispatchChangeSet({ type: 'set', value }), [dispatchChangeSet]);
const isFocusingRef = React.useRef(false);
const changeSetRef = React.useRef(changeSet);
@ -333,9 +332,8 @@ export default function DataGridCore(props) {
};
case 'close': {
const [row, col] = currentCell || [];
if (focusFieldRef.current) {
focusFieldRef.current.focus();
}
// @ts-ignore
if (focusFieldRef.current) focusFieldRef.current.focus();
// @ts-ignore
if (action.mode == 'enter' && row) setTimeout(() => moveCurrentCell(row + 1, col), 0);
if (action.mode == 'save') setTimeout(handleSave, 0);
@ -413,13 +411,7 @@ export default function DataGridCore(props) {
React.useEffect(() => {
if (tabVisible) {
// @ts-ignore
if (focusFieldRef.current) {
isFocusingRef.current = true;
focusFieldRef.current.focus();
setTimeout(() => {
isFocusingRef.current = false;
}, 1);
}
if (focusFieldRef.current) focusFieldRef.current.focus();
}
}, [tabVisible, focusFieldRef.current]);
@ -631,7 +623,6 @@ export default function DataGridCore(props) {
}
function handlePaste(event) {
if (isFocusingRef.current) return;
var pastedText = undefined;
// @ts-ignore
if (window.clipboardData && window.clipboardData.getData) {