mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-02 08:40:08 +01:00
persist browser context on popout, add uri options input & toggle (#1290)
* persist browser context on popout, add uri options input & toggle * pass tab array to ngOptions, add null check
This commit is contained in:
parent
25a86608b2
commit
32db40ec7f
@ -218,7 +218,13 @@
|
||||
<div class="row-main">
|
||||
<label for="loginUri{{i}}">{{'uriPosition' | i18n : (i + 1)}}</label>
|
||||
<input id="loginUri{{i}}" type="text" name="Login.Uris[{{i}}].Uri" [(ngModel)]="u.uri"
|
||||
placeholder="{{'ex' | i18n}} https://google.com" inputmode="url" appInputVerbatim>
|
||||
[hidden]="u.showUriOptionsInput === true" placeholder="{{'ex' | i18n}} https://google.com"
|
||||
inputmode="url" appInputVerbatim>
|
||||
<select *ngIf="uriOptions != null && uriOptions.length"
|
||||
id="loginUriOptions{{i}}" name="Login.Uris[{{i}}].Options" [(ngModel)]="u.uri"
|
||||
[hidden]="u.showUriOptionsInput === false || u.showUriOptionsInput == null || uriOptions == null">
|
||||
<option *ngFor="let o of uriOptions" [ngValue]="o.url">{{o.url}}</option>
|
||||
</select>
|
||||
<label for="loginUriMatch{{i}}" class="sr-only">
|
||||
{{'matchDetection' | i18n}} {{(i + 1)}}
|
||||
</label>
|
||||
@ -229,6 +235,11 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="action-buttons">
|
||||
<a *ngIf="uriOptions != null && uriOptions.length" class="row-btn" href="#" appStopClick appBlurClick
|
||||
appA11yTitle="{{'Toggle Input Mode'}}" (click)="toggleUriInput(u)">
|
||||
<i aria-hidden="true" class="fa fa-lg"
|
||||
[ngClass]="u.showUriOptionsInput ? 'fa-edit' : 'fa-list'"></i>
|
||||
</a>
|
||||
<a class="row-btn" href="#" appStopClick appBlurClick
|
||||
appA11yTitle="{{'toggleOptions' | i18n}}" (click)="toggleUriOptions(u)">
|
||||
<i class="fa fa-lg fa-cog" aria-hidden="true"></i>
|
||||
|
@ -5,6 +5,8 @@ import {
|
||||
Router,
|
||||
} from '@angular/router';
|
||||
|
||||
import { BrowserApi } from '../../browser/browserApi';
|
||||
|
||||
import { AuditService } from 'jslib/abstractions/audit.service';
|
||||
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||
import { CollectionService } from 'jslib/abstractions/collection.service';
|
||||
@ -16,6 +18,8 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
import { StateService } from 'jslib/abstractions/state.service';
|
||||
import { UserService } from 'jslib/abstractions/user.service';
|
||||
|
||||
import { LoginUriView } from 'jslib/models/view/loginUriView';
|
||||
|
||||
import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/components/add-edit.component';
|
||||
|
||||
@Component({
|
||||
@ -23,6 +27,7 @@ import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/componen
|
||||
templateUrl: 'add-edit.component.html',
|
||||
})
|
||||
export class AddEditComponent extends BaseAddEditComponent {
|
||||
uriOptions: any[];
|
||||
showAttachments = true;
|
||||
|
||||
constructor(cipherService: CipherService, folderService: FolderService,
|
||||
@ -77,6 +82,11 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||
}
|
||||
});
|
||||
|
||||
if (!this.editMode) {
|
||||
const tabs = await BrowserApi.tabsQuery({ windowType: 'normal' });
|
||||
this.uriOptions = tabs.filter((tab) => tab.url);
|
||||
}
|
||||
|
||||
window.setTimeout(() => {
|
||||
if (!this.editMode) {
|
||||
if (this.cipher.name != null && this.cipher.name !== '') {
|
||||
@ -145,4 +155,9 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||
}
|
||||
return confirmed;
|
||||
}
|
||||
|
||||
toggleUriInput(uri: LoginUriView) {
|
||||
const u = (uri as any);
|
||||
u.showUriOptionsInput = !u.showUriOptionsInput;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user