Merge pull request #3776 from gitbutlerapp/hunk-context-menu-read-only

feat: Add readonly prop for HunkContextMenu and HunkViewer
This commit is contained in:
Kiril Videlov 2024-05-17 13:01:08 +02:00 committed by GitHub
commit eed84f51b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -9,6 +9,7 @@
export let filePath: string; export let filePath: string;
export let projectPath: string | undefined; export let projectPath: string | undefined;
export let readonly: boolean;
const branchController = getContext(BranchController); const branchController = getContext(BranchController);
@ -22,7 +23,7 @@
<PopupMenu bind:this={popupMenu} let:item let:dismiss> <PopupMenu bind:this={popupMenu} let:item let:dismiss>
<ContextMenu> <ContextMenu>
<ContextMenuSection> <ContextMenuSection>
{#if item.hunk !== undefined} {#if item.hunk !== undefined && !readonly}
<ContextMenuItem <ContextMenuItem
label="Discard" label="Discard"
on:click={() => { on:click={() => {

View File

@ -43,7 +43,7 @@
if (popupMenu) popupMenu.$destroy(); if (popupMenu) popupMenu.$destroy();
return new HunkContextMenu({ return new HunkContextMenu({
target: document.body, target: document.body,
props: { projectPath: project.vscodePath, filePath } props: { projectPath: project.vscodePath, filePath, readonly }
}); });
} }