diff --git a/src/ui/widgets/DialogsProvider.tsx b/src/ui/widgets/DialogsProvider.tsx index f036469..a45b95a 100644 --- a/src/ui/widgets/DialogsProvider.tsx +++ b/src/ui/widgets/DialogsProvider.tsx @@ -16,7 +16,7 @@ import { IconButton, } from "@material-ui/core"; import { Close } from "@material-ui/icons"; -import React from "react"; +import React, { FormEvent } from "react"; let cache: ApplicationDialogsProvider; @@ -94,6 +94,7 @@ export class ApplicationDialogsProvider extends React.Component< this.acceptConfirm = this.handleCloseConfirm.bind(this, true); this.rejectConfirm = this.handleCloseConfirm.bind(this, false); + this.submitInput = this.submitInput.bind(this); this.handleInputValueChanged = this.handleInputValueChanged.bind(this); this.cancelInput = this.handleCloseInput.bind(this, true); this.confirmInput = this.handleCloseInput.bind(this, false); @@ -158,7 +159,14 @@ export class ApplicationDialogsProvider extends React.Component< this.setState({ inputValue: e.target.value }); } + submitInput(e: FormEvent) { + e.preventDefault(); + this.handleCloseInput(false); + } + handleCloseInput(cancel: boolean) { + if (!cancel && !this.isInputValid) return; + this.setState({ showInputDialog: false, }); @@ -286,14 +294,15 @@ export class ApplicationDialogsProvider extends React.Component< ) : ( )} - - +
+ +