mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
Pop out attachments page on Firefox and Safari
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
|
||||
import { BrowserApi } from '../../browser/browserApi';
|
||||
|
||||
import { PopupUtilsService } from '../services/popup-utils.service';
|
||||
import { AuditService } from 'jslib/abstractions/audit.service';
|
||||
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||
import { CollectionService } from 'jslib/abstractions/collection.service';
|
||||
@@ -37,7 +38,8 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||
userService: UserService, collectionService: CollectionService,
|
||||
messagingService: MessagingService, private route: ActivatedRoute,
|
||||
private router: Router, private location: Location,
|
||||
eventService: EventService, policyService: PolicyService) {
|
||||
eventService: EventService, policyService: PolicyService,
|
||||
private popupUtilsService: PopupUtilsService) {
|
||||
super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService,
|
||||
userService, collectionService, messagingService, eventService, policyService);
|
||||
}
|
||||
@@ -115,7 +117,14 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||
|
||||
attachments() {
|
||||
super.attachments();
|
||||
this.router.navigate(['/attachments'], { queryParams: { cipherId: this.cipher.id } });
|
||||
|
||||
if (this.openAttachmentsInPopup()) {
|
||||
let destinationUrl = this.router.createUrlTree(['/attachments'], { queryParams: { cipherId: this.cipher.id } }).toString();
|
||||
let currentBaseUrl = window.location.href.replace(this.router.url, '');
|
||||
this.popupUtilsService.popOut(window, currentBaseUrl + destinationUrl);
|
||||
} else {
|
||||
this.router.navigate(['/attachments'], { queryParams: { cipherId: this.cipher.id } });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -161,4 +170,8 @@ 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) && !this.platformUtilsService.isChrome();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user