1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

confirm on blur

This commit is contained in:
Dick Choi
2016-09-08 18:30:30 +09:00
parent 6bd81fe12a
commit 54437cec19

View File

@@ -35,6 +35,10 @@ class UnstyledFolderItem extends React.Component {
} }
handleConfirmButtonClick (e) { handleConfirmButtonClick (e) {
this.confirm()
}
confirm () {
let { storage, folder } = this.props let { storage, folder } = this.props
dataApi dataApi
.updateFolder(storage.key, folder.key, { .updateFolder(storage.key, folder.key, {
@@ -87,6 +91,17 @@ class UnstyledFolderItem extends React.Component {
}) })
} }
handleFolderItemBlur (e) {
let el = e.relatedTarget
while (el != null) {
if (el === this.refs.root) {
return false
}
el = el.parentNode
}
this.confirm()
}
renderEdit (e) { renderEdit (e) {
const popover = { position: 'absolute', zIndex: 2 } const popover = { position: 'absolute', zIndex: 2 }
const cover = { const cover = {
@@ -97,7 +112,11 @@ class UnstyledFolderItem extends React.Component {
position: 'absolute' position: 'absolute'
}, this.state.folder.colorPickerPos) }, this.state.folder.colorPickerPos)
return ( return (
<div styleName='folderList-item'> <div styleName='folderList-item'
onBlur={(e) => this.handleFolderItemBlur(e)}
tabIndex='-1'
ref='root'
>
<div styleName='folderList-item-left'> <div styleName='folderList-item-left'>
<button styleName='folderList-item-left-colorButton' style={{color: this.state.folder.color}} <button styleName='folderList-item-left-colorButton' style={{color: this.state.folder.color}}
onClick={(e) => !this.state.folder.showColumnPicker && this.handleColorButtonClick(e)} onClick={(e) => !this.state.folder.showColumnPicker && this.handleColorButtonClick(e)}