Skip to content

Commit

Permalink
fix dragging files onto tab bar
Browse files Browse the repository at this point in the history
  • Loading branch information
PalmerAL committed Sep 15, 2024
1 parent de24ad7 commit 1e1f111
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
17 changes: 13 additions & 4 deletions js/navbar/tabBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,19 @@ tabBar.container.addEventListener('dragover', e => e.preventDefault())
tabBar.container.addEventListener('drop', e => {
e.preventDefault()
var data = e.dataTransfer
require('browserUI.js').addTab(tabs.add({
url: data.files[0] ? 'file://' + data.files[0].path : data.getData('text'),
private: tabs.get(tabs.getSelected()).private
}), { enterEditMode: false, openInBackground: !settings.get('openTabsInForeground') })
var path = data.files[0] ? 'file://' + electron.webUtils.getPathForFile(data.files[0]) : data.getData('text')
if (!path) {
return
}
if (tabEditor.isShown || tabs.isEmpty()) {
webviews.update(tabs.getSelected(), path)
tabEditor.hide()
} else {
require('browserUI.js').addTab(tabs.add({
url: path,
private: tabs.get(tabs.getSelected()).private
}), { enterEditMode: false, openInBackground: !settings.get('openTabsInForeground') })
}
})

module.exports = tabBar
3 changes: 3 additions & 0 deletions js/navbar/tabEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ const tabEditor = {
container: document.getElementById('tab-editor'),
input: document.getElementById('tab-editor-input'),
star: null,
isShown: false,
show: function (tabId, editingValue, showSearchbar) {
/* Edit mode is not available in modal mode. */
if (modalMode.enabled()) {
return
}

tabEditor.container.hidden = false
tabEditor.isShown = true

bookmarkStar.update(tabId, tabEditor.star)
contentBlockingToggle.update(tabId, tabEditor.contentBlockingToggle)
Expand Down Expand Up @@ -71,6 +73,7 @@ const tabEditor = {
hide: function () {
tabEditor.container.hidden = true
tabEditor.container.removeAttribute('style')
tabEditor.isShown = false

tabEditor.input.blur()
searchbar.hide()
Expand Down

0 comments on commit 1e1f111

Please sign in to comment.