Skip to content

Commit e240846

Browse files
committed
Removed context menu in releases
1 parent 5bddbf3 commit e240846

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/main.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,30 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
1212
</React.StrictMode>
1313
);
1414

15-
appWindow.show().then(() => {});
15+
appWindow.show().then(() => {
16+
const disableMenu = () => {
17+
if (window.location.hostname !== "tauri.localhost") {
18+
return;
19+
}
20+
21+
document.addEventListener(
22+
"contextmenu",
23+
(e) => {
24+
e.preventDefault();
25+
return false;
26+
},
27+
{ capture: true }
28+
);
29+
30+
document.addEventListener(
31+
"selectstart",
32+
(e) => {
33+
e.preventDefault();
34+
return false;
35+
},
36+
{ capture: true }
37+
);
38+
};
39+
40+
disableMenu();
41+
});

0 commit comments

Comments
 (0)