TagSpaces is an offline, open source, document manager with tagging support
fixing issues with dialogs
Ilian Sapundshiev63c4af1f2c36
diff --git a/app/components/dialogs/GenericDialog.js b/app/components/dialogs/GenericDialog.jsindex 71d218800..fc8e55f5c 100644--- a/app/components/dialogs/GenericDialog.js+++ b/app/components/dialogs/GenericDialog.js@@ -22,7 +22,7 @@ import uuidv1 from 'uuid';import Dialog from '@material-ui/core/Dialog';import Slide from '@material-ui/core/Slide';-function Transition(props) {+export function DialogTransition(props) {return <Slide direction="down" {...props} />;}@@ -79,10 +79,9 @@ const GenericDialog = (props: Props) => {} = props;return (<Dialog- key={uuidv1()}fullScreen={fullScreen}open={open}- TransitionComponent={Transition}+ TransitionComponent={DialogTransition}keepMountedonClose={onClose}onBackdropClick={onBackdropClick && onClose}diff --git a/app/components/dialogs/RenameDirectoryDialog.js b/app/components/dialogs/RenameDirectoryDialog.jsindex 1a7966309..7306f6a69 100644--- a/app/components/dialogs/RenameDirectoryDialog.js+++ b/app/components/dialogs/RenameDirectoryDialog.js@@ -53,12 +53,8 @@ class RenameDirectoryDialog extends React.Component<Props, State> {};handleInputChange = (event: Object) => {- const target = event.target;- const value = target.type === 'checkbox' ? target.checked : target.value;- const name = target.name;-this.setState({- [name]: value+ name: event.target.value}, this.handleValidation);};@@ -136,6 +132,7 @@ class RenameDirectoryDialog extends React.Component<Props, State> {);render() {+ console.log('Render dialog');return (<GenericDialogopen={this.props.open}diff --git a/app/components/dialogs/RenameFileDialog.js b/app/components/dialogs/RenameFileDialog.jsindex fba1ba94d..eabe6973f 100644--- a/app/components/dialogs/RenameFileDialog.js+++ b/app/components/dialogs/RenameFileDialog.js@@ -22,13 +22,14 @@ import { bindActionCreators } from 'redux';import { connect } from 'react-redux';import Button from '@material-ui/core/Button';import TextField from '@material-ui/core/TextField';+import Dialog from '@material-ui/core/Dialog';import DialogActions from '@material-ui/core/DialogActions';import DialogContent from '@material-ui/core/DialogContent';import DialogTitle from '@material-ui/core/DialogTitle';import { withStyles } from '@material-ui/core/styles';import FormControl from '@material-ui/core/FormControl';import FormHelperText from '@material-ui/core/FormHelperText';-import GenericDialog, { onEnterKeyHandler } from './GenericDialog';+import { onEnterKeyHandler, DialogTransition } from './GenericDialog';import AppConfig from '../../config';import i18n from '../../services/i18n';import { extractFileName, extractContainingDirectoryPath } from '../../utils/paths';@@ -124,27 +125,26 @@ class RenameFileDialog extends React.Component<Props, State> {);renderContent = () => (- <DialogContent>- <div className={this.props.classes.root} data-tid="renameFileDialog">- <FormControl- fullWidth={true}+ <DialogContent className={this.props.classes.root}>+ <FormControl+ data-tid="renameFileDialog"+ fullWidth={true}+ error={this.state.inputError}+ >+ <TextFielderror={this.state.inputError}- >- <TextField- error={this.state.inputError}- margin="dense"- name="fileName"- // autoFocus- inputRef={(ref) => { this.fileName = ref; }}- label={i18n.t('core:renameNewFileName')}- onChange={this.handleInputChange}- value={this.state.fileName}- data-tid="renameFileDialogInput"- fullWidth={true}- />- {this.state.inputError && <FormHelperText>Empty File Name</FormHelperText>}- </FormControl>- </div>+ margin="dense"+ name="fileName"+ autoFocus+ inputRef={(ref) => { this.fileName = ref; }}+ label={i18n.t('core:renameNewFileName')}+ onChange={this.handleInputChange}+ value={this.state.fileName}+ data-tid="renameFileDialogInput"+ fullWidth={true}+ />+ {this.state.inputError && <FormHelperText>Empty File Name</FormHelperText>}+ </FormControl></DialogContent>);@@ -169,15 +169,20 @@ class RenameFileDialog extends React.Component<Props, State> {);render() {+ const { onClose, open } = this.props;return (- <GenericDialog- open={this.props.open}- onClose={this.props.onClose}- onEnterKey={(event) => onEnterKeyHandler(event, this.onConfirm)}- renderTitle={this.renderTitle}- renderContent={this.renderContent}- renderActions={this.renderActions}- />+ <Dialog+ open={open}+ TransitionComponent={DialogTransition}+ keepMounted+ onClose={onClose}+ onBackdropClick={onClose}+ // onKeyDown={((event) => onEnterKeyHandler(event, this.onConfirm))}+ >+ {this.renderTitle()}+ {this.renderContent()}+ {this.renderActions()}+ </Dialog>);}}