Skip to content

Commit

Permalink
Better way to fix Linux key paste issue in tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Menghuan1918 committed Dec 7, 2024
1 parent 3673a01 commit 47ecf6a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/src/layout/Wnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 47ecf6a

Please sign in to comment.