remove right click menu in production

This commit is contained in:
b1ek 2023-08-26 12:51:40 +10:00
parent e9c65b19c4
commit 5c5181c33e
Signed by: blek
GPG Key ID: 14546221E3595D0C
3 changed files with 14 additions and 0 deletions

5
src/index.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
declare module './App.svelte' {}
export {}
export const NODE_ENV: string

View File

@ -3,6 +3,12 @@ import '@fontsource-variable/red-hat-display';
import './lib/global_styles.scss'; import './lib/global_styles.scss';
// disable left click
console.log(NODE_ENV)
if (NODE_ENV !== 'development') {
document.addEventListener('contextmenu', event => event.preventDefault());
}
const app = new App({ const app = new App({
target: document.getElementById("app"), target: document.getElementById("app"),
}); });

View File

@ -13,6 +13,9 @@ export default defineConfig(async () => ({
], ],
}), }),
], ],
define: {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
},
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
// prevent vite from obscuring rust errors // prevent vite from obscuring rust errors