Skip to content

Commit 17eb62a

Browse files
committed
fix: disable autocorrect and context menu in production
1 parent a0e58b2 commit 17eb62a

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,29 @@
1010
<body>
1111
<div id="root"></div>
1212
<script type="module" src="/src/main.tsx"></script>
13+
<script>
14+
// Disable autocorrect/spellcheck globally for all inputs
15+
document.addEventListener('DOMContentLoaded', () => {
16+
const disableAutoCorrect = (el) => {
17+
el.setAttribute('autocorrect', 'off');
18+
el.setAttribute('autocomplete', 'off');
19+
el.setAttribute('autocapitalize', 'off');
20+
el.setAttribute('spellcheck', 'false');
21+
};
22+
// Apply to existing elements
23+
document.querySelectorAll('input, textarea, [contenteditable="true"]').forEach(disableAutoCorrect);
24+
// Watch for dynamically added elements
25+
new MutationObserver((mutations) => {
26+
mutations.forEach((m) => {
27+
m.addedNodes.forEach((node) => {
28+
if (node.nodeType === 1) {
29+
if (node.matches?.('input, textarea, [contenteditable="true"]')) disableAutoCorrect(node);
30+
node.querySelectorAll?.('input, textarea, [contenteditable="true"]').forEach(disableAutoCorrect);
31+
}
32+
});
33+
});
34+
}).observe(document.body, { childList: true, subtree: true });
35+
});
36+
</script>
1337
</body>
1438
</html>

src/components/ui/new-terminal-button.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ export const TERMINAL_OPTIONS: TerminalOption[] = [
2020
{ type: "codex", label: "Codex", command: "codex" },
2121
];
2222

23+
export interface ProjectOption {
24+
id: string;
25+
name: string;
26+
path: string;
27+
}
28+
2329
interface NewTerminalSplitButtonProps {
2430
onSelect: (command?: string) => void;
2531
variant?: "primary" | "icon";

src/main.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import "./index.css";
77
// Configure Monaco Editor to use local bundled version (avoid CDN issues)
88
loader.config({ paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs" } });
99

10+
// Disable browser context menu in production (no reload/inspect-element)
11+
if (import.meta.env.PROD) {
12+
document.addEventListener("contextmenu", (e) => e.preventDefault());
13+
}
14+
1015
const queryClient = new QueryClient({
1116
defaultOptions: {
1217
queries: {

0 commit comments

Comments
 (0)