Skip to content

Commit

Permalink
fix: right click in welcome screen did not open the context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Apr 28, 2022
1 parent 702fba1 commit 7934e9a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/lib/components/modes/treemode/TreeMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -1906,7 +1906,7 @@
}
function handleContextMenu(event) {
if (readOnly || !selection || selection.edit || !refContents) {
if (readOnly || selection?.edit) {
return
}
Expand All @@ -1927,7 +1927,7 @@
} else {
// type === 'keydown' (from the quick key Ctrl+Q)
// or target is hidden input -> context menu button on keyboard
const anchor = refContents.querySelector('.context-menu-button.selected')
const anchor = refContents?.querySelector('.context-menu-button.selected')
if (anchor) {
openContextMenu({
anchor,
Expand All @@ -1938,14 +1938,16 @@
})
} else {
// fallback on just displaying the ContextMenu top left
const rect = refContents.getBoundingClientRect()
openContextMenu({
top: rect.top + 2,
left: rect.left + 2,
width: CONTEXT_MENU_WIDTH,
height: CONTEXT_MENU_HEIGHT,
showTip: false
})
const rect = refContents?.getBoundingClientRect()
if (rect) {
openContextMenu({
top: rect.top + 2,
left: rect.left + 2,
width: CONTEXT_MENU_WIDTH,
height: CONTEXT_MENU_HEIGHT,
showTip: false
})
}
}
}
Expand Down

0 comments on commit 7934e9a

Please sign in to comment.