Skip to content

Commit

Permalink
toggleTableView: Show active toolbar button on col1 instead of parent.
Browse files Browse the repository at this point in the history
Make consistent with 79815dc
  • Loading branch information
raineorshine committed Nov 5, 2024
1 parent 6e4fa53 commit 2f074c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/shortcuts/toggleTableView.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Shortcut from '../@types/Shortcut'
import { toggleAttributeActionCreator as toggleAttribute } from '../actions/toggleAttribute'
import TableViewIcon from '../components/icons/TableViewIcon'
import { HOME_PATH } from '../constants'
import attributeEquals from '../selectors/attributeEquals'
import hasMulticursor from '../selectors/hasMulticursor'
import rootedParentOf from '../selectors/rootedParentOf'
import simplifyPath from '../selectors/simplifyPath'
import head from '../util/head'
import isRoot from '../util/isRoot'

const toggleTableViewShortcut: Shortcut = {
id: 'toggleTableView',
Expand Down Expand Up @@ -34,8 +34,8 @@ const toggleTableViewShortcut: Shortcut = {
)
},
isActive: state => {
const { cursor } = state
const path = cursor ? simplifyPath(state, cursor) : HOME_PATH
if (!state.cursor || isRoot(state.cursor)) return false
const path = simplifyPath(state, rootedParentOf(state, state.cursor))
return attributeEquals(state, head(path), '=view', 'Table')
},
}
Expand Down

0 comments on commit 2f074c6

Please sign in to comment.