diff --git a/common/changes/@visactor/vtable/4912-bug-paste-performance_2026-01-12-09-17.json b/common/changes/@visactor/vtable/4912-bug-paste-performance_2026-01-12-09-17.json new file mode 100644 index 000000000..d84c202be --- /dev/null +++ b/common/changes/@visactor/vtable/4912-bug-paste-performance_2026-01-12-09-17.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: paste to table performance when has prepared edit cell #4912\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file diff --git a/packages/vtable-editors/src/input-editor.ts b/packages/vtable-editors/src/input-editor.ts index 44e745c6a..9f750b8b5 100644 --- a/packages/vtable-editors/src/input-editor.ts +++ b/packages/vtable-editors/src/input-editor.ts @@ -86,6 +86,16 @@ export class InputEditor implements IEditor { }; input.addEventListener('wheel', wheelHandler); this.eventHandlers.push({ type: 'wheel', handler: wheelHandler }); + + const pasteHandler: EventListener = (e: Event) => { + const pasteEvent = e as ClipboardEvent; + // 在prepare阶段(opacity为'0'时)禁止粘贴 + if (this.element.style.opacity === '0') { + pasteEvent.preventDefault(); + } + }; + input.addEventListener('paste', pasteHandler); + this.eventHandlers.push({ type: 'paste', handler: pasteHandler }); } setValue(value: string) {