From 60b7eb06543f333ecdf549c9b32db45f2e9761e2 Mon Sep 17 00:00:00 2001 From: TGuoW <15768620356@163.com> Date: Sat, 20 Aug 2022 22:16:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=83=85=E5=86=B5keypress=E4=B8=8D=E8=A7=A6=E5=8F=91,=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E8=BE=93=E5=85=A5=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/text-area/event-handlers/index.ts | 4 ++-- .../src/text-area/event-handlers/{keypress.ts => input.ts} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename packages/core/src/text-area/event-handlers/{keypress.ts => input.ts} (90%) diff --git a/packages/core/src/text-area/event-handlers/index.ts b/packages/core/src/text-area/event-handlers/index.ts index cc49b8666..0170b3942 100644 --- a/packages/core/src/text-area/event-handlers/index.ts +++ b/packages/core/src/text-area/event-handlers/index.ts @@ -13,7 +13,7 @@ import { handleCompositionUpdate, } from './composition' import handleOnKeydown from './keydown' -import handleKeypress from './keypress' +import handleInput from './input' import handleOnCopy from './copy' import handleOnCut from './cut' import handleOnPaste from './paste' @@ -29,7 +29,7 @@ const eventConf = { compositionend: handleCompositionEnd, compositionupdate: handleCompositionUpdate, keydown: handleOnKeydown, - keypress: handleKeypress, + input: handleInput, copy: handleOnCopy, cut: handleOnCut, paste: handleOnPaste, diff --git a/packages/core/src/text-area/event-handlers/keypress.ts b/packages/core/src/text-area/event-handlers/input.ts similarity index 90% rename from packages/core/src/text-area/event-handlers/keypress.ts rename to packages/core/src/text-area/event-handlers/input.ts index 9c42066f5..c10d5b1a3 100644 --- a/packages/core/src/text-area/event-handlers/keypress.ts +++ b/packages/core/src/text-area/event-handlers/input.ts @@ -11,7 +11,7 @@ import { hasEditableTarget } from '../helpers' // 【注意】虽然 keypress 事件已经过时(建议用 keydown 取代),但这里是为了兼容 beforeinput ,所以不会在高级浏览器生效,不用升级 keydown -function handleKeypress(event: Event, textarea: TextArea, editor: IDomEditor) { +function handleInput(event: Event, textarea: TextArea, editor: IDomEditor) { // 这里是兼容不完全支持 beforeInput 的浏览器。对于支持 beforeInput 的浏览器,会用 beforeinput 事件处理 if (HAS_BEFORE_INPUT_SUPPORT) return @@ -27,4 +27,4 @@ function handleKeypress(event: Event, textarea: TextArea, editor: IDomEditor) { Editor.insertText(editor, text) } -export default handleKeypress +export default handleInput