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

Merge pull request #1120 from mslourens/drag-drop-tabs

implemented drag/drop for tabs
This commit is contained in:
Kohei TAKATA
2017-12-09 08:05:57 +09:00
committed by GitHub
2 changed files with 36 additions and 0 deletions

View File

@@ -85,6 +85,15 @@ class SnippetTab extends React.Component {
})
}
handleDragStart (e) {
e.dataTransfer.dropEffect = 'move'
this.props.onDragStart(e)
}
handleDrop (e) {
this.props.onDrop(e)
}
render () {
const { isActive, snippet, isDeletable } = this.props
return (
@@ -98,6 +107,9 @@ class SnippetTab extends React.Component {
onClick={(e) => this.handleClick(e)}
onDoubleClick={(e) => this.handleRenameClick(e)}
onContextMenu={(e) => this.handleContextMenu(e)}
onDragStart={(e) => this.handleDragStart(e)}
onDrop={(e) => this.handleDrop(e)}
draggable='true'
>
{snippet.name.trim().length > 0
? snippet.name
@@ -127,6 +139,7 @@ class SnippetTab extends React.Component {
}
SnippetTab.propTypes = {
}
export default CSSModules(SnippetTab, styles)