Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the middle button to close a tab triggers pasting on Linux #13395

Merged
merged 4 commits into from
Dec 10, 2024

Conversation

Menghuan1918
Copy link
Contributor

@Menghuan1918 Menghuan1918 commented Dec 7, 2024

解决Linux中使用中键关闭标签页时会触发粘贴的问题(#13309)

Feature or bug? 特性或者缺陷?

解决#13309 中提到的问题,通过在关闭标签页操作中拦截粘贴事件解决该问题,这样不会影响其他场景下的中键粘贴功能

现有问题

Linux中,使用中键关闭标签页时会触发中键粘贴功能,如下视频所示:

Now.mp4

修复后在X11上的测试

X11.mp4

修复后在Wayland上的测试

wayland.mp4

@@ -101,11 +101,25 @@ export class Wnd {
window.siyuan.menus.menu.remove();
event.stopPropagation();
event.preventDefault();
// 阻止 Linux 中键粘贴
Copy link
Member

@Vanessa219 Vanessa219 Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样好像也不对,有些 Linux 没有这个问题,而且还有伺服后在浏览器中使用的情况。

@Vanessa219 Vanessa219 merged commit 6d66c80 into siyuan-note:dev Dec 10, 2024
@Vanessa219 Vanessa219 added this to the 3.1.15 milestone Dec 10, 2024
@88250 88250 changed the title 解决Linux中使用中键关闭标签页时会触发粘贴的问题(#13309) Using the middle button to close a tab triggers pasting on Linux Dec 10, 2024
}, 250);

// 保持原有焦点
if (activeElement instanceof HTMLElement) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

activeElement 看上去和 document.activeElement 在这个事件内看上去都是同一个变量,我这里没有环境,不知道实际上的情况,还麻烦解释一下。

Vanessa219 added a commit that referenced this pull request Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants