Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Fixes context menu not working on tabsbar #9525

Merged
merged 1 commit into from
Jun 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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