TagSpaces is an offline, open source, document manager with tagging support
TSN162 - refactoring
Mladen Sapundshievdd0dc661788e
diff --git a/app/components/dialogs/AddRemoveTagsDialog.js b/app/components/dialogs/AddRemoveTagsDialog.jsindex b30789091..62d864bae 100644--- a/app/components/dialogs/AddRemoveTagsDialog.js+++ b/app/components/dialogs/AddRemoveTagsDialog.js@@ -20,7 +20,7 @@import React, { Component } from 'react';import Button from 'material-ui/Button';import { DialogActions, DialogContent, DialogTitle } from 'material-ui/Dialog';-import GenericDialog from './GenericDialog';+import GenericDialog, { onEnterKeyHandler } from './GenericDialog';import { type Tag } from '../../reducers/taglibrary';import TagAutosuggestion from '../TagAutosuggestion/';import i18n from '../../services/i18n';@@ -108,6 +108,7 @@ class AddRemoveTagsDialog extends React.Component<Props, State> {<GenericDialogopen={open}onClose={onClose}+ // onEnterKey={(event) => onEnterKeyHandler(event, this.onConfirm)}renderTitle={() => (<DialogTitle>{i18n.t('core:tagOperationTitle')}</DialogTitle>)}diff --git a/app/components/dialogs/DateCalendarDialog.js b/app/components/dialogs/DateCalendarDialog.jsindex 36f8a5b82..da136be3e 100644--- a/app/components/dialogs/DateCalendarDialog.js+++ b/app/components/dialogs/DateCalendarDialog.js@@ -31,7 +31,7 @@ import Typography from 'material-ui/Typography';import Datetime from 'react-datetime';import { withStyles } from 'material-ui/styles/index';import { FormControl, FormHelperText } from 'material-ui/Form';-import GenericDialog from './GenericDialog';+import GenericDialog, { onEnterKeyHandler } from './GenericDialog';import i18n from '../../services/i18n';import { type Tag } from '../../reducers/taglibrary';import { convertToDateTime, convertToDateRange, parseDate, parseToDate, convertToDate, splitValue } from '../../utils/dates';@@ -492,6 +492,19 @@ class EditEntryTagDialog extends React.Component<Props, State> {</Button></DialogActions>);++ render() {+ 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}+ />+ );+ }}export default withStyles(styles)(EditEntryTagDialog);diff --git a/app/components/dialogs/SelectDirectoryDialog.js b/app/components/dialogs/SelectDirectoryDialog.jsindex 038b62acb..876ef5718 100644--- a/app/components/dialogs/SelectDirectoryDialog.js+++ b/app/components/dialogs/SelectDirectoryDialog.js@@ -32,7 +32,7 @@ import UndoIcon from 'material-ui-icons/Undo';import Select from 'material-ui/Select';import { FormControl, FormHelperText } from 'material-ui/Form';import Input, { InputLabel } from 'material-ui/Input';-import GenericDialog from './GenericDialog';+import GenericDialog, { onEnterKeyHandler } from './GenericDialog';import i18n from '../../services/i18n';import AppConfig from '../../config';import PlatformIO from '../../services/platform-io';@@ -93,7 +93,7 @@ const drives = ['Choose Drive', 'A:', 'B:', 'C:', 'D:', 'F:','G:', 'H:', 'I:', 'J:', 'K:', 'L:', 'M:', 'N:', 'O:', 'P:','Q:', 'R:', 'S:', 'T:', 'U:', 'V:', 'W:', 'X:', 'Y:', 'Z:'];-class SelectDirectoryDialog extends GenericDialog<Props, State> {+class SelectDirectoryDialog extends React.Component<Props, State> {state = {errorTextPath: false,alertSubFolderText: false,@@ -274,6 +274,19 @@ class SelectDirectoryDialog extends GenericDialog<Props, State> {</Button></DialogActions>);++ render() {+ 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}+ />+ );+ }}export default withStyles(styles)(SelectDirectoryDialog);diff --git a/app/components/dialogs/SettingsDialog.js b/app/components/dialogs/SettingsDialog.jsindex 672a045c9..edfd293e3 100644--- a/app/components/dialogs/SettingsDialog.js+++ b/app/components/dialogs/SettingsDialog.js@@ -31,7 +31,7 @@ import {} from 'material-ui/Dialog';import uuidv1 from 'uuid';import ConfirmDialog from './ConfirmDialog';-import GenericDialog from './GenericDialog';+import GenericDialog, { onEnterKeyHandler } from './GenericDialog';import SettingsGeneral from '../settings/SettingsGeneral';import SettingsKeyBindings from '../settings/SettingsKeyBindings';import SettingsFileTypes from '../settings/SettingsFileTypes';@@ -59,7 +59,7 @@ type State = {<Props, State>*/-class SettingsDialog extends GenericDialog {+class SettingsDialog extends React.Component {state = {currentTab: 0,items: [],@@ -269,6 +269,19 @@ class SettingsDialog extends GenericDialog {</Button></DialogActions>);++ render() {+ 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}+ />+ );+ }}const mapStateToProps = (state) => ({