Parcourir la source

Adds originalTitle prop to base

main
Eric Amodio il y a 2 ans
Parent
révision
d7fa870ab3
3 fichiers modifiés avec 8 ajouts et 7 suppressions
  1. +1
    -3
      src/plus/webviews/graph/graphWebview.ts
  2. +1
    -3
      src/plus/webviews/timeline/timelineWebview.ts
  3. +6
    -1
      src/webviews/webviewBase.ts

+ 1
- 3
src/plus/webviews/graph/graphWebview.ts Voir le fichier

@ -43,7 +43,6 @@ export class GraphWebview extends WebviewWithConfigBase {
private selectedRepository?: Repository;
private currentLog?: GitLog;
private repoDisposable: Disposable | undefined;
private defaultTitle?: string;
private previewBanner?: boolean;
constructor(container: Container) {
@ -55,7 +54,6 @@ export class GraphWebview extends WebviewWithConfigBase {
'Commit Graph',
Commands.ShowGraphPage,
);
this.defaultTitle = this.title;
this.disposables.push({ dispose: () => void this.repoDisposable?.dispose() });
}
@ -325,7 +323,7 @@ export class GraphWebview extends WebviewWithConfigBase {
}
if (this.selectedRepository !== undefined) {
this.title = `${this.defaultTitle}: ${this.selectedRepository.formattedName}`;
this.title = `${this.originalTitle}: ${this.selectedRepository.formattedName}`;
}
const [commitsAndLog, remotes, tags, branches, stashCommits] = await Promise.all([

+ 1
- 3
src/plus/webviews/timeline/timelineWebview.ts Voir le fichier

@ -42,7 +42,6 @@ export class TimelineWebview extends WebviewBase {
private _context: Context;
/** The context the webview should have */
private _pendingContext: Partial<Context> | undefined;
private _originalTitle: string;
constructor(container: Container) {
super(
@ -53,7 +52,6 @@ export class TimelineWebview extends WebviewBase {
'Visual File History',
Commands.ShowTimelinePage,
);
this._originalTitle = this.title;
this._context = {
uri: undefined,
period: defaultPeriod,
@ -235,7 +233,7 @@ export class TimelineWebview extends WebviewBase {
const repoPath = gitUri.repoPath!;
const title = gitUri.relativePath;
this.title = `${this._originalTitle}: ${gitUri.fileName}`;
this.title = `${this.originalTitle}: ${gitUri.fileName}`;
const [currentUser, log] = await Promise.all([
this.container.git.getCurrentUser(repoPath),

+ 6
- 1
src/webviews/webviewBase.ts Voir le fichier

@ -35,7 +35,7 @@ export abstract class WebviewBase implements Disposable {
title: string,
showCommand: Commands,
) {
this._title = title;
this._originalTitle = this._title = title;
this.disposables.push(registerCommand(showCommand, this.onShowCommand, this));
}
@ -44,6 +44,11 @@ export abstract class WebviewBase implements Disposable {
this._disposablePanel?.dispose();
}
private _originalTitle: string | undefined;
get originalTitle(): string | undefined {
return this._originalTitle;
}
private _title: string;
get title(): string {
return this._panel?.title ?? this._title;

Chargement…
Annuler
Enregistrer