From 2cfab62e116939076b21896fea864ca44801c723 Mon Sep 17 00:00:00 2001 From: osborn Date: Tue, 13 Dec 2022 17:32:20 +0800 Subject: [PATCH] js: fix when first input, beforeTextChange pass editing undefined (#562) --- doric-js/index.d.ts | 4 ++-- doric-js/lib/src/widget/input.d.ts | 4 ++-- doric-js/src/widget/input.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doric-js/index.d.ts b/doric-js/index.d.ts index fde1f399..21c5a696 100644 --- a/doric-js/index.d.ts +++ b/doric-js/index.d.ts @@ -1274,10 +1274,10 @@ declare module "doric" { * @returns: true means the replacement will take effect, otherwise does not */ beforeTextChange?: (change: { - editing: string; + editing?: string; start: number; length: number; - replacement: string; + replacement?: string; }) => boolean; padding?: { left?: number; diff --git a/doric-js/lib/src/widget/input.d.ts b/doric-js/lib/src/widget/input.d.ts index 181e1150..20aa2cb1 100644 --- a/doric-js/lib/src/widget/input.d.ts +++ b/doric-js/lib/src/widget/input.d.ts @@ -40,10 +40,10 @@ export declare class Input extends View { * @returns: true means the replacement will take effect, otherwise does not */ beforeTextChange?: (change: { - editing: string; + editing?: string; start: number; length: number; - replacement: string; + replacement?: string; }) => boolean; padding?: { left?: number; diff --git a/doric-js/src/widget/input.ts b/doric-js/src/widget/input.ts index 8aa36c69..7c6c90ce 100644 --- a/doric-js/src/widget/input.ts +++ b/doric-js/src/widget/input.ts @@ -98,10 +98,10 @@ export class Input extends View { */ @Property beforeTextChange?: (change: { - editing: string, + editing?: string, start: number, length: number, - replacement: string, + replacement?: string, }) => boolean @Property