TagSpaces is an offline, open source, document manager with tagging support
added autofocus to create tag group and create tags dialogs
Ilian Sapundshiev40f770dc2125
diff --git a/app/components/TagLibrary.js b/app/components/TagLibrary.jsindex 7ebc205af..f8877235f 100644--- a/app/components/TagLibrary.js+++ b/app/components/TagLibrary.js@@ -18,6 +18,7 @@*/import React from 'react';+import uuidv1 from 'uuid';import { bindActionCreators } from 'redux';import { connect } from 'react-redux';import { withStyles } from '@material-ui/core/styles';@@ -318,6 +319,7 @@ class TagLibrary extends React.Component<Props, State> {confirmDialogTID={'confirmDeleteTagGroupDialog'}/><CreateTagGroupDialog+ key={uuidv1()}open={this.state.isCreateTagGroupDialogOpened}onClose={this.handleCloseDialogs}createTagGroup={this.props.createTagGroup}@@ -325,6 +327,7 @@ class TagLibrary extends React.Component<Props, State> {textcolor={this.props.tagTextColor}/><CreateTagsDialog+ key={uuidv1()}open={this.state.isCreateTagDialogOpened}onClose={this.handleCloseDialogs}addTag={this.props.addTag}diff --git a/app/components/dialogs/CreateTagGroupDialog.js b/app/components/dialogs/CreateTagGroupDialog.jsindex bbb5df3eb..a665ade25 100644--- a/app/components/dialogs/CreateTagGroupDialog.js+++ b/app/components/dialogs/CreateTagGroupDialog.js@@ -59,25 +59,12 @@ class CreateTagGroupDialog extends React.Component<Props, State> {disableConfirmButton: true,title: '',children: '',- color: '',- textcolor: '',+ color: this.props.color,+ textcolor: this.props.textcolor,expanded: true,uuid: ''};- componentWillReceiveProps = (nextProps: any) => {- if (nextProps.open === true) {- this.setState({- uuid: '',- title: '',- children: '',- expanded: true,- color: nextProps.color,- textcolor: nextProps.textcolor- });- }- };-handleInputChange = (event: Object) => {const target = event.target;const value = target.type === 'checkbox' ? target.checked : target.value;@@ -177,6 +164,7 @@ class CreateTagGroupDialog extends React.Component<Props, State> {<TextFieldfullWidth={true}error={this.state.inputError}+ autoFocusname="title"label={i18n.t('core:createTagGroupName')}value={this.state.title}diff --git a/app/components/dialogs/CreateTagsDialog.js b/app/components/dialogs/CreateTagsDialog.jsindex 4f695961d..95dc9ec32 100644--- a/app/components/dialogs/CreateTagsDialog.js+++ b/app/components/dialogs/CreateTagsDialog.js@@ -40,8 +40,7 @@ type State = {inputError?: boolean,disableConfirmButton?: boolean,open?: boolean,- tagTitle?: string,- uuid?: string+ tagTitle?: string};class CreateTagsDialog extends React.Component<Props, State> {@@ -50,17 +49,6 @@ class CreateTagsDialog extends React.Component<Props, State> {disableConfirmButton: true,open: false,tagTitle: '',- uuid: ''- };-- componentWillReceiveProps = (nextProps: any) => {- if (nextProps.open === true) {- this.setState({- tagTitle: '',- open: true,- uuid: nextProps.selectedTagGroupEntry.uuid,- });- }};handleInputChange = (event: Object) => {@@ -85,7 +73,7 @@ class CreateTagsDialog extends React.Component<Props, State> {onConfirm = () => {if (!this.state.disableConfirmButton) {this.setState({ open: false, disableConfirmButton: true });- this.props.addTag(this.state.tagTitle, this.state.uuid);+ this.props.addTag(this.state.tagTitle, this.props.selectedTagGroupEntry.uuid);this.props.onClose();}};@@ -103,6 +91,7 @@ class CreateTagsDialog extends React.Component<Props, State> {<TextFielderror={this.state.inputError}name="tagTitle"+ autoFocuslabel={i18n.t('core:addTagsToGroupTagsPlaceholder')}onChange={this.handleInputChange}value={this.state.tagTitle}