Skip to content

Commit

Permalink
Add drag and drop support to tab bar and webview
Browse files Browse the repository at this point in the history
  • Loading branch information
Sestowner committed Aug 7, 2020
1 parent c1c7218 commit fca2c1c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions js/navbar/tabBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,18 @@ if (window.platformType === 'mac') {
})
}

tabBar.container.addEventListener('dragover', e => e.preventDefault())

tabBar.container.addEventListener('drop', e => {
e.preventDefault()
var data = e.dataTransfer
var tab = tabs.add({
url: data.files[0] ? 'file://' + data.files[0].path : data.getData('text'),
private: tabs.get(tabs.getSelected()).private
})

tabBar.addTab(tab)
webviews.add(tab)
})

module.exports = tabBar
3 changes: 2 additions & 1 deletion js/webviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ const webviews = {
allowPopups: false,
partition: partition,
enableWebSQL: false,
autoplayPolicy: 'user-gesture-required'
autoplayPolicy: 'user-gesture-required',
navigateOnDragDrop: true
}
}),
boundsString: JSON.stringify(webviews.getViewBounds()),
Expand Down

0 comments on commit fca2c1c

Please sign in to comment.