Only work on linux

This commit is contained in:
Menghuan1918 2024-12-08 11:25:08 +08:00
parent 47ecf6ab86
commit 4b89022d0c

View file

@ -102,17 +102,19 @@ export class Wnd {
event.stopPropagation();
event.preventDefault();
// 阻止 Linux 中键粘贴
const activeElement = document.activeElement;
window.addEventListener("paste", (e) => {
e.preventDefault();
e.stopPropagation();
}, {
capture: true,
once: true
});
// 保持原有焦点
if (activeElement instanceof HTMLElement) {
activeElement.focus();
if ("linux" === window.siyuan.config.system.os) {
const activeElement = document.activeElement;
window.addEventListener("paste", (e) => {
e.preventDefault();
e.stopPropagation();
}, {
capture: true,
once: true
});
// 保持原有焦点
if (activeElement instanceof HTMLElement) {
activeElement.focus();
}
}
break;
}