MOBILE-3708 core: Deprecate core-auto-focus directive

main
Dani Palou 2021-03-04 15:50:08 +01:00
parent 6b8bfbb27b
commit 7dcfc4d989
9 changed files with 12 additions and 19 deletions

View File

@ -58,7 +58,7 @@
<ion-label position="stacked">{{ 'addon.mod_lesson.enterpassword' | translate }}</ion-label>
<core-show-password name="password">
<ion-input name="password" type="password" placeholder="{{ 'core.login.password' | translate }}"
[core-auto-focus] #passwordinput [clearOnEdit]="false">
[autofocus]="true" #passwordinput [clearOnEdit]="false">
</ion-input>
</core-show-password>
</ion-item>

View File

@ -15,7 +15,8 @@
<ion-label>{{ 'addon.mod_lesson.enterpassword' | translate }}</ion-label>
<core-show-password name="password">
<ion-input name="password" type="password" placeholder="{{ 'core.login.password' | translate }}"
[core-auto-focus] #passwordinput [clearOnEdit]="false"></ion-input>
[autofocus]="true" #passwordinput [clearOnEdit]="false">
</ion-input>
</core-show-password>
</ion-item>
<ion-button expand="block" type="submit">

View File

@ -14,7 +14,7 @@
<!-- Form to edit the file's name. -->
<ion-input type="text" name="filename" [placeholder]="'core.filename' | translate" autocapitalize="none" autocorrect="off"
(click)="$event.stopPropagation()" [core-auto-focus] [(ngModel)]="newFileName" *ngIf="editMode">
(click)="$event.stopPropagation()" [autofocus]="true" [(ngModel)]="newFileName" *ngIf="editMode">
</ion-input>
<div class="buttons" slot="end" *ngIf="manage">

View File

@ -1,5 +1,5 @@
<form #messageForm>
<textarea class="core-send-message-input" [core-auto-focus]="showKeyboard" [placeholder]="placeholder" rows="1" core-auto-rows
<textarea class="core-send-message-input" [autofocus]="showKeyboard" [placeholder]="placeholder" rows="1" core-auto-rows
[(ngModel)]="message" name="message" (onResize)="textareaResized()" (keydown.enter)="enterClicked($event)"
(keydown.control.enter)="enterClicked($event, 'control')" (keydown.meta.enter)="enterClicked($event, 'meta')"
aria-multiline="true"></textarea>
@ -10,4 +10,3 @@
</ion-button>
</ion-buttons>
</form>

View File

@ -21,6 +21,8 @@ import { CoreUtils } from '@services/utils/utils';
* Directive to auto focus an element when a view is loaded.
*
* You can apply it conditionallity assigning it a boolean value: <ion-input [core-auto-focus]="{{showKeyboard}}">
*
* @deprecated since 3.9.5. ion-input now supports an [autofocus] attribute, please use that one instead.
*/
@Directive({
selector: '[core-auto-focus]',
@ -39,16 +41,7 @@ export class CoreAutoFocusDirective implements OnInit {
* Component being initialized.
*/
ngOnInit(): void {
// @todo
// if (this.navCtrl.isTransitioning()) {
// // Navigating to a new page. Wait for the transition to be over.
// const subscription = this.navCtrl.viewDidEnter.subscribe(() => {
// this.autoFocus();
// subscription.unsubscribe();
// });
// } else {
this.autoFocus();
// }
}
/**

View File

@ -23,7 +23,7 @@
type="password"
placeholder="{{ 'core.courses.password' | translate }}"
[(ngModel)]="password"
[core-auto-focus]
[autofocus]="true"
[clearOnEdit]="false">
</ion-input>
</core-show-password>

View File

@ -31,7 +31,7 @@
<ion-item>
<ion-label></ion-label>
<ion-input type="text" name="value" placeholder="{{ 'core.login.usernameoremail' | translate }}"
formControlName="value" autocapitalize="none" autocorrect="off" [core-auto-focus]="autoFocus">
formControlName="value" autocapitalize="none" autocorrect="off" [autofocus]="autoFocus">
</ion-input>
</ion-item>
<ion-button type="submit" class="ion-margin" expand="block" [disabled]="!myForm.valid">

View File

@ -27,7 +27,7 @@
<h2>{{ 'core.login.siteaddress' | translate }}</h2>
</ion-label>
<ion-input name="url" type="url" placeholder="{{ 'core.login.siteaddressplaceholder' | translate }}"
formControlName="siteUrl" [core-auto-focus]="showKeyboard && !showScanQR">
formControlName="siteUrl" [autofocus]="showKeyboard && !showScanQR">
</ion-input>
</ion-item>
</ng-container>
@ -37,7 +37,7 @@
<h2>{{ 'core.login.siteaddress' | translate }}</h2>
</ion-label>
<ion-input name="url" placeholder="{{ 'core.login.siteaddressplaceholder' | translate }}" formControlName="siteUrl"
[core-auto-focus]="showKeyboard && !showScanQR" (ionChange)="searchSite($event, siteForm.value.siteUrl)">
[autofocus]="showKeyboard && !showScanQR" (ionChange)="searchSite($event, siteForm.value.siteUrl)">
</ion-input>
</ion-item>

View File

@ -3,7 +3,7 @@
<ion-item>
<ion-label></ion-label>
<ion-input type="search" name="search" [(ngModel)]="searchText" [placeholder]="placeholder"
[autocorrect]="autocorrect" [spellcheck]="spellcheck" [core-auto-focus]="autoFocus"
[autocorrect]="autocorrect" [spellcheck]="spellcheck" [autofocus]="autoFocus"
[disabled]="disabled" role="searchbox" (ionFocus)="focus($event)">
</ion-input>
<ion-button slot="end" fill="clear" type="submit" size="small" [attr.aria-label]="searchLabel"