1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

Close popout instead of navigating, style fixes

This commit is contained in:
Thomas Rittson
2021-01-15 15:58:38 +10:00
parent bef1008b9d
commit 092110fd5f
4 changed files with 21 additions and 16 deletions

View File

@@ -31,6 +31,7 @@ import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/componen
export class AddEditComponent extends BaseAddEditComponent {
currentUris: string[];
showAttachments = true;
openAttachmentsInPopup: boolean;
constructor(cipherService: CipherService, folderService: FolderService,
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
@@ -83,6 +84,8 @@ export class AddEditComponent extends BaseAddEditComponent {
if (queryParamsSub != null) {
queryParamsSub.unsubscribe();
}
this.openAttachmentsInPopup = this.popupUtilsService.inPopup(window);
});
if (!this.editMode) {
@@ -118,9 +121,9 @@ export class AddEditComponent extends BaseAddEditComponent {
attachments() {
super.attachments();
if (this.openAttachmentsInPopup()) {
let destinationUrl = this.router.createUrlTree(['/attachments'], { queryParams: { cipherId: this.cipher.id } }).toString();
let currentBaseUrl = window.location.href.replace(this.router.url, '');
if (this.openAttachmentsInPopup) {
const destinationUrl = this.router.createUrlTree(['/attachments'], { queryParams: { cipherId: this.cipher.id } }).toString();
const currentBaseUrl = window.location.href.replace(this.router.url, '');
this.popupUtilsService.popOut(window, currentBaseUrl + destinationUrl);
} else {
this.router.navigate(['/attachments'], { queryParams: { cipherId: this.cipher.id } });
@@ -170,8 +173,4 @@ export class AddEditComponent extends BaseAddEditComponent {
return (!this.editMode || this.cloneMode) && this.ownershipOptions
&& (this.ownershipOptions.length > 1 || !this.allowPersonal);
}
openAttachmentsInPopup(): boolean {
return this.popupUtilsService.inPopup(window);
}
}