|
|
@@ -373,7 +373,24 @@ export default {
|
|
|
* @param {KeyboardEvent} event 键盘事件
|
|
|
*/
|
|
|
handleCopy(event) {
|
|
|
- if (event.ctrlKey && event.key === 'c' && this.curComponentId.length > 0) {
|
|
|
+ if (!event || event.isComposing || event.repeat) return;
|
|
|
+
|
|
|
+ // 输入态下不拦截,避免影响用户正常输入
|
|
|
+ const activeElement = document.activeElement;
|
|
|
+ const isInputting =
|
|
|
+ activeElement &&
|
|
|
+ (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA' || activeElement.isContentEditable);
|
|
|
+ if (isInputting) return;
|
|
|
+
|
|
|
+ const isAltV =
|
|
|
+ event.altKey &&
|
|
|
+ !event.ctrlKey &&
|
|
|
+ !event.metaKey &&
|
|
|
+ !event.shiftKey &&
|
|
|
+ (event.code === 'KeyV' || String(event.key).toLowerCase() === 'c');
|
|
|
+
|
|
|
+ if (isAltV) {
|
|
|
+ event.preventDefault();
|
|
|
this.findChildComponentByKey(`grid-${this.curComponentId}`)?.copyComponent();
|
|
|
}
|
|
|
},
|