Skip to content

Commit

Permalink
Merge pull request brave#9525 from NejcZdovc/hotfix/brave#9524-tabsbar
Browse files Browse the repository at this point in the history
Fixes context menu not working on tabsbar
  • Loading branch information
bsclifton authored Jun 19, 2017
2 parents 40ebed2 + cdaad86 commit fab48e2
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions app/renderer/components/tabs/tabsToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const React = require('react')
const Immutable = require('immutable')

// Components
const ReduxComponent = require('../reduxComponent')
const Tabs = require('./tabs')
const PinnedTabs = require('./pinnedTabs')

// Store
const windowStore = require('../../../../js/stores/windowStore')

// Utils
const contextMenus = require('../../../../js/contextMenus')
const frameStateUtil = require('../../../../js/state/frameStateUtil')
Expand All @@ -23,16 +21,18 @@ class TabsToolbar extends React.Component {
this.onHamburgerMenu = this.onHamburgerMenu.bind(this)
}

get activeFrame () {
return windowStore.getFrame(this.props.activeFrameKey)
}

onContextMenu (e) {
if (e.target.tagName === 'BUTTON') {
return
}

contextMenus.onTabsToolbarContextMenu(this.props.activeFrame, undefined, undefined, e)
contextMenus.onTabsToolbarContextMenu(
this.props.activeFrameTitle,
this.props.activeFrameLocation,
undefined,
undefined,
e
)
}

onHamburgerMenu (e) {
Expand All @@ -41,16 +41,17 @@ class TabsToolbar extends React.Component {

mergeProps (state, ownProps) {
const currentWindow = state.get('currentWindow')
const activeFrame = frameStateUtil.getActiveFrame(currentWindow)
const activeFrame = frameStateUtil.getActiveFrame(currentWindow) || Immutable.Map()
const pinnedTabs = frameStateUtil.getPinnedFrames(currentWindow)

const props = {}
// used in renderer
props.hasPinnedTabs = pinnedTabs.size > 0

// used in other functions
props.activeFrameKey = activeFrame && activeFrame.get('key')
props.activeFrameLocation = (activeFrame && activeFrame.get('location')) || ''
props.activeFrameKey = activeFrame.get('key')
props.activeFrameLocation = activeFrame.get('location', '')
props.activeFrameTitle = activeFrame.get('title', '')

return props
}
Expand Down

0 comments on commit fab48e2

Please sign in to comment.