mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-20 08:01:46 +03:00
fix: hunk and file context menu now correctly dismiss
This commit is contained in:
parent
f36ba52b27
commit
de7d869411
@ -21,14 +21,20 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<PopupMenu bind:this={popupMenu} let:item>
|
||||
<PopupMenu bind:this={popupMenu} let:item let:dismiss>
|
||||
<ContextMenu>
|
||||
<ContextMenuSection>
|
||||
{#if item.files !== undefined}
|
||||
{#if containsBinaryFiles(item)}
|
||||
<ContextMenuItem label="Discard file (Binary files not yet supported)" disabled />
|
||||
{:else}
|
||||
<ContextMenuItem label="Discard file" on:click={() => confirmationModal.show(item)} />
|
||||
<ContextMenuItem
|
||||
label="Discard file"
|
||||
on:click={() => {
|
||||
confirmationModal.show(item);
|
||||
dismiss();
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
{/if}
|
||||
</ContextMenuSection>
|
||||
|
@ -16,17 +16,25 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<PopupMenu bind:this={popupMenu} let:item>
|
||||
<PopupMenu bind:this={popupMenu} let:item let:dismiss>
|
||||
<ContextMenu>
|
||||
<ContextMenuSection>
|
||||
{#if item.hunk !== undefined}
|
||||
<ContextMenuItem label="Discard" on:click={() => branchController.unapplyHunk(item.hunk)} />
|
||||
<ContextMenuItem
|
||||
label="Discard"
|
||||
on:click={() => {
|
||||
branchController.unapplyHunk(item.hunk);
|
||||
dismiss();
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
{#if item.lineNumber}
|
||||
<ContextMenuItem
|
||||
label="Open in VS Code"
|
||||
on:click={() =>
|
||||
projectPath && open(`vscode://file${projectPath}/${filePath}:${item.lineNumber}`)}
|
||||
on:click={() => {
|
||||
projectPath && open(`vscode://file${projectPath}/${filePath}:${item.lineNumber}`);
|
||||
dismiss();
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</ContextMenuSection>
|
||||
|
@ -55,7 +55,7 @@
|
||||
use:clickOutside={{ handler: () => onDismiss() }}
|
||||
style="position: absolute; top:{pos.y}px; left:{pos.x}px"
|
||||
>
|
||||
<slot {item} />
|
||||
<slot {item} dismiss={onDismiss} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user