mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 02:06:29 +00:00
set Input disabled when saving
This commit is contained in:
@@ -87,25 +87,36 @@ class RepositorySection extends React.Component {
|
|||||||
handleNameInputBlur (e) {
|
handleNameInputBlur (e) {
|
||||||
let { dispatch, repository } = this.props
|
let { dispatch, repository } = this.props
|
||||||
|
|
||||||
this.getRepository()
|
this.setState({
|
||||||
.then((repositoryInstance) => {
|
isSaving: true
|
||||||
return repositoryInstance.addFolder({
|
}, () => {
|
||||||
name: this.state.newFolder.name
|
this.getRepository()
|
||||||
})
|
.then((repositoryInstance) => {
|
||||||
})
|
return repositoryInstance.addFolder({
|
||||||
.then((folder) => {
|
name: this.state.newFolder.name
|
||||||
console.log(folder)
|
})
|
||||||
dispatch({
|
|
||||||
type: 'ADD_FOLDER',
|
|
||||||
key: repository.key,
|
|
||||||
folder: folder
|
|
||||||
})
|
})
|
||||||
|
.then((folder) => {
|
||||||
|
dispatch({
|
||||||
|
type: 'ADD_FOLDER',
|
||||||
|
key: repository.key,
|
||||||
|
folder: folder
|
||||||
|
})
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isCreatingFolder: false,
|
isCreatingFolder: false,
|
||||||
isSaving: false
|
isSaving: false
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
.catch((err) => {
|
||||||
|
console.error(err)
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
isCreatingFolder: false,
|
||||||
|
isSaving: false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
@@ -138,7 +149,9 @@ class RepositorySection extends React.Component {
|
|||||||
className='RepositorySection'
|
className='RepositorySection'
|
||||||
styleName='root'
|
styleName='root'
|
||||||
>
|
>
|
||||||
<div styleName='header'>
|
<div styleName='header'
|
||||||
|
onContextMenu={(e) => this.handleContextButtonClick(e)}
|
||||||
|
>
|
||||||
<div styleName='header-name'>
|
<div styleName='header-name'>
|
||||||
<i className='fa fa-archive'/> {repository.name}
|
<i className='fa fa-archive'/> {repository.name}
|
||||||
</div>
|
</div>
|
||||||
@@ -149,7 +162,7 @@ class RepositorySection extends React.Component {
|
|||||||
>
|
>
|
||||||
<i className='fa fa-ellipsis-v'/>
|
<i className='fa fa-ellipsis-v'/>
|
||||||
</button>
|
</button>
|
||||||
<button styleName='header-control-button'
|
<button styleName='header-control-button--show'
|
||||||
onClick={(e) => this.handleToggleButtonClick(e)}
|
onClick={(e) => this.handleToggleButtonClick(e)}
|
||||||
>
|
>
|
||||||
<i className={toggleButtonIconClassName}/>
|
<i className={toggleButtonIconClassName}/>
|
||||||
@@ -163,6 +176,7 @@ class RepositorySection extends React.Component {
|
|||||||
? <div styleName='newFolderForm'>
|
? <div styleName='newFolderForm'>
|
||||||
<input styleName='newFolderForm-nameInput'
|
<input styleName='newFolderForm-nameInput'
|
||||||
ref='nameInput'
|
ref='nameInput'
|
||||||
|
disabled={this.state.isSaving}
|
||||||
value={this.state.newFolder.name}
|
value={this.state.newFolder.name}
|
||||||
onChange={(e) => this.handleNewFolderFormChange(e)}
|
onChange={(e) => this.handleNewFolderFormChange(e)}
|
||||||
onBlur={(e) => this.handleNameInputBlur(e)}
|
onBlur={(e) => this.handleNameInputBlur(e)}
|
||||||
|
|||||||
@@ -97,6 +97,8 @@
|
|||||||
outline none
|
outline none
|
||||||
&:focus
|
&:focus
|
||||||
border-color $focus-border-color
|
border-color $focus-border-color
|
||||||
|
&:disabled
|
||||||
|
background-color $disabled-input-background
|
||||||
|
|
||||||
.newFolderButton
|
.newFolderButton
|
||||||
height 33px
|
height 33px
|
||||||
|
|||||||
Reference in New Issue
Block a user