codex-lens 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/public/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Codex Lens</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/main-
|
|
7
|
+
<script type="module" crossorigin src="./assets/main-DxHimI3w.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="./assets/main-CYNmzqDG.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/package.json
CHANGED
package/src/components/App.jsx
CHANGED
|
@@ -12,7 +12,6 @@ export function App() {
|
|
|
12
12
|
const [latestVersion, setLatestVersion] = useState(null);
|
|
13
13
|
const [hasUpdate, setHasUpdate] = useState(false);
|
|
14
14
|
const [projectName, setProjectName] = useState('');
|
|
15
|
-
const [saving, setSaving] = useState(false);
|
|
16
15
|
const wsRef = useRef(null);
|
|
17
16
|
|
|
18
17
|
useEffect(() => {
|
|
@@ -88,32 +87,35 @@ export function App() {
|
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
async function saveCurrentFile() {
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
setTabs(prevTabs => {
|
|
91
|
+
const activeTab = prevTabs.find(t => t.id === activeTabId);
|
|
92
|
+
if (!activeTab || activeTab.isDiff) return prevTabs;
|
|
93
93
|
|
|
94
|
-
setSaving(true);
|
|
95
|
-
try {
|
|
96
94
|
const port = window.location.port === '5173' ? '5174' : window.location.port;
|
|
97
95
|
const protocol = window.location.protocol === 'https:' ? 'https:' : 'http:';
|
|
98
|
-
|
|
96
|
+
|
|
97
|
+
fetch(`${protocol}//${window.location.hostname}:${port}/api/save-file`, {
|
|
99
98
|
method: 'POST',
|
|
100
99
|
headers: { 'Content-Type': 'application/json' },
|
|
101
100
|
body: JSON.stringify({ path: activeTab.path, content: activeTab.content })
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
101
|
+
})
|
|
102
|
+
.then(response => {
|
|
103
|
+
if (response.ok) {
|
|
104
|
+
setTabs(tabs => tabs.map(t =>
|
|
105
|
+
t.id === activeTabId ? { ...t, isModified: false } : t
|
|
106
|
+
));
|
|
107
|
+
} else {
|
|
108
|
+
response.json().then(error => {
|
|
109
|
+
console.error('Failed to save file:', error);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
.catch(error => {
|
|
114
|
+
console.error('Failed to save file:', error);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
return prevTabs;
|
|
118
|
+
});
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
function handleContentChange(newContent) {
|