Skip to content

TagSpaces is an offline, open source, document manager with tagging support

merging develop

Ilian Sapundshievc02031e09ec1
diff --cc app/components/dialogs/EditEntryTagDialog.js
index a6d0c0dc6,22592d713..d36982f53
--- a/app/components/dialogs/EditEntryTagDialog.js
+++ b/app/components/dialogs/EditEntryTagDialog.js
@@@ -85,76 -89,71 +85,76 @@@ const EditEntryTagDialog = (props: Prop
}
}
- onConfirm = () => {
- if (!this.state.disableConfirmButton) {
- this.props.editTagForEntry(this.props.currentEntryPath, this.props.selectedTag, this.state.title);
- this.setState({ errorTag: false, disableConfirmButton: true });
- this.props.onClose();
+ function onConfirm() {
+ if (!disableConfirmButton) {
+ props.editTagForEntry(props.currentEntryPath, props.selectedTag, state.title);
+ setErrorTag(false); // this.setState({ errorTag: false, disableConfirmButton: true });
+ setDisableConfirmButton(true);
+ props.onClose();
}
- };
+ }
- renderTitle = () => (
- <DialogTitle>{i18n.t('core:tagProperties')}</DialogTitle>
- );
+ function renderTitle() {
+ return (
- <DialogTitle>{i18n.t('core:editTagTitle')}</DialogTitle>
++ <DialogTitle>{i18n.t('core:tagProperties')}</DialogTitle>
+ );
+ }
- renderContent = () => (
- <DialogContent data-tid="editEntryTagDialog" className={this.props.classes.root}>
- <FormControl
- fullWidth={true}
- error={this.state.errorTag}
- >
- <TextField
+ function renderContent() {
+ return (
+ <DialogContent data-tid="editEntryTagDialog" className={props.classes.root}>
+ <FormControl
fullWidth={true}
- error={this.state.errorTag}
- margin="dense"
- name="title"
- label={i18n.t('core:editTag')}
- onChange={this.handleInputChange}
- value={this.state.title}
- data-tid="editTagEntryDialog_input"
- />
- {this.state.errorTag && <FormHelperText>{i18n.t('core:tagTitleHelper')}</FormHelperText>}
- </FormControl>
- </DialogContent>
- );
-
- renderActions = () => (
- <DialogActions>
- <Button
- data-tid="closeEditTagEntryDialog"
- onClick={this.props.onClose}
- color="primary"
- >
- {i18n.t('core:cancel')}
- </Button>
- <Button
- disabled={this.state.disableConfirmButton}
- onClick={this.onConfirm}
- data-tid="confirmEditTagEntryDialog"
- color="primary"
- >
- {i18n.t('core:ok')}
- </Button>
- </DialogActions>
- );
+ error={errorTag}
+ >
+ <TextField
+ fullWidth={true}
+ error={errorTag}
+ margin="dense"
+ name="title"
+ label={i18n.t('core:editTag')}
+ onChange={handleInputChange}
+ value={title}
+ data-tid="editTagEntryDialog_input"
+ />
+ {errorTag && <FormHelperText>{i18n.t('core:tagTitleHelper')}</FormHelperText>}
+ </FormControl>
+ </DialogContent>
+ );
+ }
- render() {
+ function renderActions() {
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}
- />
+ <DialogActions>
+ <Button
+ data-tid="closeEditTagEntryDialog"
+ onClick={props.onClose}
+ color="primary"
+ >
+ {i18n.t('core:cancel')}
+ </Button>
+ <Button
+ disabled={disableConfirmButton}
+ onClick={onConfirm}
+ data-tid="confirmEditTagEntryDialog"
+ color="primary"
+ >
+ {i18n.t('core:ok')}
+ </Button>
+ </DialogActions>
);
}
-}
+
+ return (
+ <GenericDialog
+ open={props.open}
+ onClose={props.onClose}
+ onEnterKey={(event) => onEnterKeyHandler(event, onConfirm)}
+ renderTitle={renderTitle}
+ renderContent={renderContent}
+ renderActions={renderActions}
+ />
+ );
+};
export default withStyles(styles)(EditEntryTagDialog);