mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-25 10:33:21 +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>
|
</script>
|
||||||
|
|
||||||
<PopupMenu bind:this={popupMenu} let:item>
|
<PopupMenu bind:this={popupMenu} let:item let:dismiss>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<ContextMenuSection>
|
<ContextMenuSection>
|
||||||
{#if item.files !== undefined}
|
{#if item.files !== undefined}
|
||||||
{#if containsBinaryFiles(item)}
|
{#if containsBinaryFiles(item)}
|
||||||
<ContextMenuItem label="Discard file (Binary files not yet supported)" disabled />
|
<ContextMenuItem label="Discard file (Binary files not yet supported)" disabled />
|
||||||
{:else}
|
{:else}
|
||||||
<ContextMenuItem label="Discard file" on:click={() => confirmationModal.show(item)} />
|
<ContextMenuItem
|
||||||
|
label="Discard file"
|
||||||
|
on:click={() => {
|
||||||
|
confirmationModal.show(item);
|
||||||
|
dismiss();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</ContextMenuSection>
|
</ContextMenuSection>
|
||||||
|
@ -16,17 +16,25 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<PopupMenu bind:this={popupMenu} let:item>
|
<PopupMenu bind:this={popupMenu} let:item let:dismiss>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<ContextMenuSection>
|
<ContextMenuSection>
|
||||||
{#if item.hunk !== undefined}
|
{#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}
|
||||||
{#if item.lineNumber}
|
{#if item.lineNumber}
|
||||||
<ContextMenuItem
|
<ContextMenuItem
|
||||||
label="Open in VS Code"
|
label="Open in VS Code"
|
||||||
on:click={() =>
|
on:click={() => {
|
||||||
projectPath && open(`vscode://file${projectPath}/${filePath}:${item.lineNumber}`)}
|
projectPath && open(`vscode://file${projectPath}/${filePath}:${item.lineNumber}`);
|
||||||
|
dismiss();
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</ContextMenuSection>
|
</ContextMenuSection>
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
use:clickOutside={{ handler: () => onDismiss() }}
|
use:clickOutside={{ handler: () => onDismiss() }}
|
||||||
style="position: absolute; top:{pos.y}px; left:{pos.x}px"
|
style="position: absolute; top:{pos.y}px; left:{pos.x}px"
|
||||||
>
|
>
|
||||||
<slot {item} />
|
<slot {item} dismiss={onDismiss} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user