Better way to fix Linux key paste issue in tab

This commit is contained in:
Menghuan1918 2024-12-07 21:30:56 +08:00
parent 3673a01ac5
commit 47ecf6ab86

View file

@ -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;