Merge pull request #1247 from gitbutlerapp/fix-popup-menu-collapse

chore: update context menu in code editor component
This commit is contained in:
Nikita Galaiko 2023-09-28 09:07:34 +02:00 committed by GitHub
commit 568c59cd4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 13 deletions

View File

@ -222,11 +222,17 @@
{/each}
{#if !subsection.expanded}
<div
role="group"
class="border-color-3 flex w-full"
class:border-t={sidx == section.subSections.length - 1 ||
(sidx > 0 && sidx < section.subSections.length - 1)}
class:border-b={sidx == 0 ||
(sidx > 0 && sidx < section.subSections.length - 1)}
on:contextmenu|preventDefault={(e) =>
popupMenu.openByMouse(e, {
section: section,
hunk
})}
>
<div
class="bg-color-4 text-color-4 hover:text-color-2 border-color-3 border-r text-center"

View File

@ -16,21 +16,23 @@
</script>
<PopupMenu bind:this={popupMenu} let:item>
<PopupMenuItem
on:click={() => {
if ('expanded' in item.section) {
{#if 'expanded' in item.section}
<PopupMenuItem
on:click={() => {
item.section.expanded = false;
}
}}
>
Collapse
</PopupMenuItem>
}}
>
Collapse
</PopupMenuItem>
{/if}
{#if item.hunk !== undefined && !item.hunk.locked}
<PopupMenuItem on:click={() => branchController.unapplyHunk(item.hunk)}>Discard</PopupMenuItem>
{/if}
<PopupMenuItem
on:click={() => open(`vscode://file${projectPath}/${file.path}:${item.lineNumber}`)}
>
Open in Visual Studio Code
</PopupMenuItem>
{#if item.lineNumber}
<PopupMenuItem
on:click={() => open(`vscode://file${projectPath}/${file.path}:${item.lineNumber}`)}
>
Open in Visual Studio Code
</PopupMenuItem>
{/if}
</PopupMenu>