MOBILE-3320 core: Fix supress events usage on send message form
parent
fa67fbef81
commit
877c79ed5a
|
@ -17,7 +17,7 @@
|
||||||
>
|
>
|
||||||
</textarea>
|
</textarea>
|
||||||
<ion-button fill="clear" size="large" type="submit" [disabled]="!message || sendDisabled"
|
<ion-button fill="clear" size="large" type="submit" [disabled]="!message || sendDisabled"
|
||||||
[attr.aria-label]="'core.send' | translate" [core-suppress-events] (click)="submitForm($event)">
|
[attr.aria-label]="'core.send' | translate" [core-suppress-events] (onClick)="submitForm($event)">
|
||||||
<ion-icon name="send" color="dark" slot="icon-only" aria-hidden="true"></ion-icon>
|
<ion-icon name="send" color="dark" slot="icon-only" aria-hidden="true"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
// Based on http://roblouie.com/article/198/using-gestures-in-the-ionic-2-beta/
|
// Based on http://roblouie.com/article/198/using-gestures-in-the-ionic-2-beta/
|
||||||
|
|
||||||
import { Directive, ElementRef, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
import { Directive, ElementRef, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||||
|
import { CoreLogger } from '@singletons/logger';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directive to suppress all events on an element. This is useful to prevent keyboard closing when clicking this element.
|
* Directive to suppress all events on an element. This is useful to prevent keyboard closing when clicking this element.
|
||||||
|
@ -29,6 +30,8 @@ import { Directive, ElementRef, OnInit, Input, Output, EventEmitter } from '@ang
|
||||||
* If you only want to suppress a single event just pass the name of the event. If you want to suppress a set of events,
|
* If you only want to suppress a single event just pass the name of the event. If you want to suppress a set of events,
|
||||||
* pass an array with the names of the events to suppress.
|
* pass an array with the names of the events to suppress.
|
||||||
*
|
*
|
||||||
|
* Usage of onClick instead of click is mandatory to make this directive work.
|
||||||
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
*
|
*
|
||||||
* <ion-button [core-suppress-events] (onClick)="toggle($event)">
|
* <ion-button [core-suppress-events] (onClick)="toggle($event)">
|
||||||
|
@ -51,6 +54,13 @@ export class CoreSupressEventsDirective implements OnInit {
|
||||||
* Initialize event listeners.
|
* Initialize event listeners.
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
if (this.onClick.observers.length == 0) {
|
||||||
|
CoreLogger.getInstance('CoreSupressEventsDirective')
|
||||||
|
.error('No onClick output was defined causing this directive to fail', this.element);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let events: string[];
|
let events: string[];
|
||||||
|
|
||||||
if (this.suppressEvents == 'all' || typeof this.suppressEvents == 'undefined' || this.suppressEvents === null) {
|
if (this.suppressEvents == 'all' || typeof this.suppressEvents == 'undefined' || this.suppressEvents === null) {
|
||||||
|
|
Loading…
Reference in New Issue