1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

[keypress] replaced 'onKeyPress' with 'onKeyDown' as 'keypress' is de… (#5764)

* [keypress] replaced 'onKeyPress' with 'onKeyDown' as 'keypress' is deprecated

* cleaned up code
This commit is contained in:
llj
2023-11-14 20:25:25 +08:00
committed by GitHub
parent c6862887bd
commit a4e2e4aba4
32 changed files with 60 additions and 74 deletions

View File

@@ -63,7 +63,7 @@ class Rename extends React.Component {
}
};
handleKeyPress = (e) => {
handleKeyDown = (e) => {
if (e.key === 'Enter') {
this.handleSubmit();
}
@@ -123,7 +123,7 @@ class Rename extends React.Component {
<ModalHeader toggle={this.toggle}>{type === 'file' ? gettext('Rename File') : gettext('Rename Folder') }</ModalHeader>
<ModalBody>
<p>{type === 'file' ? gettext('New file name'): gettext('New folder name')}</p>
<Input onKeyPress={this.handleKeyPress} innerRef={this.newInput} value={this.state.newName} onChange={this.handleChange} />
<Input onKeyDown={this.handleKeyDown} innerRef={this.newInput} value={this.state.newName} onChange={this.handleChange} />
{this.state.errMessage && <Alert color="danger" className="mt-2">{this.state.errMessage}</Alert>}
</ModalBody>
<ModalFooter>