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