@ -1,8 +1,12 @@
import { ViewColumn } from 'vscode' ;
import { Commands } from '../../../constants' ;
import type { DraftSelectedEvent } from '../../../eventBus' ;
import type { Repository } from '../../../git/models/repository' ;
import { executeCommand } from '../../../system/command' ;
import { configuration } from '../../../system/configuration' ;
import { setContext } from '../../../system/context' ;
import type { Serialized } from '../../../system/serialize' ;
import type { WebviewsController } from '../../../webviews/webviewsController' ;
import type { WebviewPanelShowCommandArgs , Webview sController } from '../../../webviews/webviewsController' ;
import type { Change , State } from './protocol' ;
interface CreateDraftFromChanges {
@ -54,6 +58,12 @@ export function registerPatchDetailsWebviewView(controller: WebviewsController)
return new PatchDetailsWebviewProvider ( container , host ) ;
} ,
async ( . . . args ) = > {
if ( configuration . get ( 'cloudPatches.experimental.layout' ) === 'editor' ) {
await setContext ( 'gitlens:views:patchDetails:mode' , undefined ) ;
void executeCommand < WebviewPanelShowCommandArgs > ( Commands . ShowPatchDetailsPage , undefined , . . . args ) ;
return ;
}
const arg = args [ 0 ] ;
if ( arg == null ) return ;
@ -61,3 +71,30 @@ export function registerPatchDetailsWebviewView(controller: WebviewsController)
} ,
) ;
}
export function registerPatchDetailsWebviewPanel ( controller : WebviewsController ) {
return controller . registerWebviewPanel < State , Serialized < State > , PatchDetailsWebviewShowingArgs > (
{ id : Commands.ShowPatchDetailsPage , options : { preserveInstance : true } } ,
{
id : 'gitlens.patchDetails' ,
fileName : 'patchDetails.html' ,
iconPath : 'images/gitlens-icon.png' ,
title : 'Patch' ,
contextKeyPrefix : ` gitlens:webview:patchDetails ` ,
trackingFeature : 'patchDetailsWebview' ,
plusFeature : true ,
column : ViewColumn.Active ,
webviewHostOptions : {
retainContextWhenHidden : false ,
enableFindWidget : false ,
} ,
allowMultipleInstances : true ,
} ,
async ( container , host ) = > {
const { PatchDetailsWebviewProvider } = await import (
/* webpackChunkName: "patchDetails" */ './patchDetailsWebview'
) ;
return new PatchDetailsWebviewProvider ( container , host ) ;
} ,
) ;
}