mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 18:17:31 +08:00
feat(textarea): ionChange will only emit from user committed changes (#25953)
This commit is contained in:
@ -5,7 +5,7 @@ import { ValueAccessor } from './value-accessor';
|
||||
|
||||
@Directive({
|
||||
/* tslint:disable-next-line:directive-selector */
|
||||
selector: 'ion-textarea,ion-searchbar',
|
||||
selector: 'ion-searchbar',
|
||||
providers: [
|
||||
{
|
||||
provide: NG_VALUE_ACCESSOR,
|
||||
@ -26,7 +26,7 @@ export class TextValueAccessorDirective extends ValueAccessor {
|
||||
}
|
||||
|
||||
@Directive({
|
||||
selector: 'ion-input:not([type=number])',
|
||||
selector: 'ion-input:not([type=number]),ion-textarea',
|
||||
providers: [
|
||||
{
|
||||
provide: NG_VALUE_ACCESSOR,
|
||||
@ -35,6 +35,7 @@ export class TextValueAccessorDirective extends ValueAccessor {
|
||||
},
|
||||
],
|
||||
})
|
||||
// TODO rename this value accessor to `TextValueAccessorDirective` when search-bar is updated
|
||||
export class InputValueAccessorDirective extends ValueAccessor {
|
||||
constructor(injector: Injector, el: ElementRef) {
|
||||
super(injector, el);
|
||||
|
@ -1816,13 +1816,19 @@ export class IonText {
|
||||
import type { TextareaChangeEventDetail as ITextareaTextareaChangeEventDetail } from '@ionic/core';
|
||||
export declare interface IonTextarea extends Components.IonTextarea {
|
||||
/**
|
||||
* Emitted when the input value has changed.
|
||||
* The `ionChange` event is fired for `<ion-textarea>` elements when the user
|
||||
modifies the element's value. Unlike the `ionInput` event, the `ionChange`
|
||||
event is not necessarily fired for each alteration to an element's value.
|
||||
|
||||
The `ionChange` event is fired when the element loses focus after its value
|
||||
has been modified.
|
||||
*/
|
||||
ionChange: EventEmitter<CustomEvent<ITextareaTextareaChangeEventDetail>>;
|
||||
/**
|
||||
* Emitted when a keyboard input occurred.
|
||||
* Ths `ionInput` event fires when the `value` of an `<ion-textarea>` element
|
||||
has been changed.
|
||||
*/
|
||||
ionInput: EventEmitter<CustomEvent<InputEvent>>;
|
||||
ionInput: EventEmitter<CustomEvent<InputEvent | null>>;
|
||||
/**
|
||||
* Emitted when the input loses focus.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user