Better way to fix Linux key paste issue in tab
This commit is contained in:
parent
3673a01ac5
commit
47ecf6ab86
1 changed files with 11 additions and 3 deletions
|
@ -102,14 +102,22 @@ export class Wnd {
|
|||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
// 阻止 Linux 中键粘贴
|
||||
setTimeout(() => {
|
||||
window.getSelection().removeAllRanges();
|
||||
const activeElement = document.activeElement;
|
||||
window.addEventListener("paste", (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}, {
|
||||
capture: true,
|
||||
once: true
|
||||
});
|
||||
// 保持原有焦点
|
||||
if (activeElement instanceof HTMLElement) {
|
||||
activeElement.focus();
|
||||
}
|
||||
break;
|
||||
}
|
||||
target = target.parentElement;
|
||||
}
|
||||
|
||||
});
|
||||
this.headersElement.addEventListener("mousewheel", (event: WheelEvent) => {
|
||||
this.headersElement.scrollLeft = this.headersElement.scrollLeft + event.deltaY;
|
||||
|
|
Loading…
Add table
Reference in a new issue