chore(desktop): 跟踪 apps/desktop/dist 静态资源并统一文档与忽略规则
This commit is contained in:
41
apps/desktop/dist/disable-features.js
vendored
Normal file
41
apps/desktop/dist/disable-features.js
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
(() => {
|
||||
const tauriInvoke = window.__TAURI_INTERNALS__?.invoke;
|
||||
|
||||
// Disable text selection globally, but keep inputs editable.
|
||||
document.addEventListener("selectstart", (event) => {
|
||||
const target = event.target;
|
||||
if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
async function applyProductionGuards() {
|
||||
if (!tauriInvoke) {
|
||||
return;
|
||||
}
|
||||
|
||||
let isDebugBuild = false;
|
||||
try {
|
||||
isDebugBuild = await tauriInvoke("is_debug_build");
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDebugBuild) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.addEventListener("contextmenu", (event) => event.preventDefault());
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.key === "F12") {
|
||||
event.preventDefault();
|
||||
}
|
||||
if ((event.ctrlKey || event.metaKey) && event.shiftKey && ["I", "C", "J"].includes(event.key.toUpperCase())) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void applyProductionGuards();
|
||||
})();
|
||||
Reference in New Issue
Block a user