Skip to content

Commit 8fbe8ad

Browse files
committed
fix: 修改部分细节问题
1 parent 15abca1 commit 8fbe8ad

9 files changed

Lines changed: 54 additions & 144 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "latex-ocr-electron",
3-
"version": "4.4.9",
3+
"version": "4.5.0",
44
"description": "TexStudio OCR",
55
"author": "TexStudio",
66
"main": "dist/electron/electron/main.js",

src/App.tsx

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import SettingsView from './views/SettingsView';
1010
import HistoryView from './views/HistoryView';
1111
import AboutView from './views/AboutView';
1212
import UpdateDialog from './components/UpdateDialog';
13-
import UpdateProgressIndicator from './components/UpdateProgressIndicator';
1413
import CopyOptionsDialog from './components/CopyOptionsDialog';
1514
import ExportOptionsDialog from './components/ExportOptionsDialog';
1615
import HandwritingDialog from './components/HandwritingDialog';
@@ -260,7 +259,12 @@ function App({ onThemeChange: onThemeChangeFromIndex }: AppProps = {}) {
260259

261260
const handleUpdateAvailable = (info: any) => {
262261
console.log('发现新版本:', info);
263-
setUpdateInfo(prev => ({ ...prev, showDialog: true, showIndicator: false, status: 'available', version: info.version }));
262+
// 直接开始下载,不显示对话框
263+
setUpdateInfo(prev => ({ ...prev, showDialog: false, showIndicator: false, status: 'available', version: info.version }));
264+
// 自动开始下载
265+
if (window.electronAPI) {
266+
window.electronAPI.downloadUpdate();
267+
}
264268
};
265269

266270
const handleUpdateNotAvailable = (info: any) => {
@@ -286,6 +290,7 @@ function App({ onThemeChange: onThemeChangeFromIndex }: AppProps = {}) {
286290

287291
const handleUpdateDownloaded = (info: any) => {
288292
setDownloadProgress(100);
293+
// 下载完成后显示对话框,让用户选择是否立即重启
289294
setUpdateInfo({
290295
showDialog: true,
291296
showIndicator: false,
@@ -1226,13 +1231,6 @@ function App({ onThemeChange: onThemeChangeFromIndex }: AppProps = {}) {
12261231
}));
12271232
};
12281233

1229-
const handleBackgroundDownload = () => {
1230-
setUpdateInfo(prev => ({
1231-
...prev,
1232-
showDialog: false,
1233-
showIndicator: true,
1234-
}));
1235-
};
12361234

12371235
const handleExportFormula = async (format: 'svg' | 'png' | 'jpg') => {
12381236
if (!appState.latexCode.trim()) {
@@ -1540,12 +1538,7 @@ function App({ onThemeChange: onThemeChangeFromIndex }: AppProps = {}) {
15401538
version={updateInfo.version}
15411539
onDownload={handleDownloadUpdate}
15421540
onRestart={handleRestartAndInstall}
1543-
onBackgroundDownload={handleBackgroundDownload}
1544-
/>
1545-
1546-
<UpdateProgressIndicator
1547-
isVisible={updateInfo.showIndicator}
1548-
progress={downloadProgress}
1541+
onBackgroundDownload={() => {}}
15491542
/>
15501543
</AppContainer>
15511544
);

src/components/FormulaExplanation.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const ButtonGroup = styled.div`
4242
const Label = styled.h3`
4343
font-size: 14px;
4444
font-weight: 600;
45-
color: #2c3e50;
45+
color: var(--color-text);
4646
margin: 0;
4747
display: flex;
4848
align-items: center;
@@ -72,7 +72,7 @@ const ExplainButton = styled.button<{ disabled: boolean }>`
7272
};
7373
7474
&:hover:not(:disabled) {
75-
background: linear-gradient(135deg, #5dade2 0%, #3498db 100%);
75+
background: linear-gradient(135deg, var(--color-buttonHoverStart) 0%, var(--color-buttonHoverEnd) 100%);
7676
transform: translateY(-1px);
7777
box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
7878
}
@@ -104,7 +104,7 @@ const ClearButton = styled.button<{ disabled: boolean }>`
104104
flex-shrink: 0; /* 防止按钮被压缩 */
105105
106106
&:hover:not(:disabled) {
107-
background: linear-gradient(135deg, #ec7063 0%, #e74c3c 100%);
107+
background: linear-gradient(135deg, #ec7063 0%, var(--color-error) 100%);
108108
transform: translateY(-1px);
109109
box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
110110
}
@@ -131,18 +131,18 @@ const ContentArea = styled.div`
131131
}
132132
133133
&::-webkit-scrollbar-track {
134-
background: #f1f1f1;
134+
background: var(--color-borderLight);
135135
border-radius: 3px;
136136
margin: 2px; /* 给滚动条轨道添加边距 */
137137
}
138138
139139
&::-webkit-scrollbar-thumb {
140-
background: #cbd5e0;
140+
background: var(--color-border);
141141
border-radius: 3px;
142142
}
143143
144144
&::-webkit-scrollbar-thumb:hover {
145-
background: #a0aec0;
145+
background: var(--color-textSecondary);
146146
}
147147
148148
/* 确保KaTeX公式正确显示 */

src/components/FormulaPreview.tsx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Container = styled.div`
1717
const Label = styled.h3`
1818
font-size: 14px;
1919
font-weight: 600;
20-
color: #2c3e50;
20+
color: var(--color-text);
2121
margin: 0 0 10px 0;
2222
display: flex;
2323
align-items: center;
@@ -29,9 +29,9 @@ const PreviewArea = styled.div`
2929
padding: 12px;
3030
min-height: 226px; /* 与LatexEditor保持一致 */
3131
height: 226px; /* 与LatexEditor保持一致 */
32-
border: 2px solid #dce1e8; /* 增加边框宽度使其更明显 */
32+
border: 2px solid var(--color-border); /* 增加边框宽度使其更明显 */
3333
border-radius: 8px;
34-
background: linear-gradient(135deg, #fefefe 0%, #f9fafb 100%);
34+
background: var(--color-surface);
3535
display: flex;
3636
overflow: auto;
3737
box-sizing: border-box;
@@ -50,16 +50,6 @@ const PreviewArea = styled.div`
5050
min-height: 226px;
5151
}
5252
53-
/* 添加淡色数学元素背景 */
54-
background-image:
55-
repeating-linear-gradient(
56-
-45deg,
57-
rgba(245, 247, 250, 0.5) 0px,
58-
rgba(245, 247, 250, 0.5) 1px,
59-
transparent 1px,
60-
transparent 20px
61-
);
62-
6353
.katex-display {
6454
margin: 0;
6555
}
@@ -70,14 +60,14 @@ const PreviewArea = styled.div`
7060
`;
7161

7262
const ErrorMessage = styled.div`
73-
color: #e74c3c;
63+
color: var(--color-error);
7464
font-size: 13px;
7565
padding: 8px;
7666
font-style: italic;
7767
`;
7868

7969
const PlaceholderText = styled.div`
80-
color: #95a5a6;
70+
color: var(--color-textSecondary);
8171
font-style: italic;
8272
font-size: 13px;
8373
text-align: center;

src/components/ImageDisplay.tsx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ const Container = styled.div`
66
display: flex;
77
flex-direction: column;
88
height: 100%;
9-
background-color: rgba(250, 250, 252, 0.7);
9+
background-color: var(--color-surfaceLight);
1010
border-radius: 6px;
1111
padding: 5px;
1212
`;
1313

1414
const Label = styled.h3`
1515
font-size: 14px;
1616
font-weight: 600;
17-
color: #3a4a5b;
17+
color: var(--color-text);
1818
margin: 0 0 10px 0;
1919
display: flex;
2020
align-items: center;
@@ -24,12 +24,9 @@ const Label = styled.h3`
2424

2525
const ImageContainer = styled.div<{ isDragActive: boolean }>`
2626
flex: 1;
27-
border: 1px dashed ${props => props.isDragActive ? '#4375b9' : '#dce1e8'};
27+
border: 1px dashed ${props => props.isDragActive ? 'var(--color-primary)' : 'var(--color-border)'};
2828
border-radius: 8px;
29-
background: ${props => props.isDragActive
30-
? 'linear-gradient(135deg, rgba(67, 117, 185, 0.08) 0%, rgba(67, 117, 185, 0.04) 100%)'
31-
: 'linear-gradient(135deg, #fefefe 0%, #f7f9fc 100%)'
32-
};
29+
background: var(--color-surface);
3330
display: flex;
3431
align-items: center;
3532
justify-content: center;
@@ -43,23 +40,23 @@ const ImageContainer = styled.div<{ isDragActive: boolean }>`
4340
4441
/* 添加淡色网格背景,类似于科学论文中的图表网格 */
4542
background-image:
46-
linear-gradient(rgba(220, 225, 232, 0.3) 1px, transparent 1px),
47-
linear-gradient(90deg, rgba(220, 225, 232, 0.3) 1px, transparent 1px);
43+
linear-gradient(var(--color-borderLight) 1px, transparent 1px),
44+
linear-gradient(90deg, var(--color-borderLight) 1px, transparent 1px);
4845
background-size: 20px 20px;
4946
5047
&:hover {
51-
border-color: #4375b9;
52-
background: linear-gradient(135deg, rgba(67, 117, 185, 0.05) 0%, rgba(67, 117, 185, 0.02) 100%);
48+
border-color: var(--color-primary);
49+
opacity: 0.95;
5350
}
5451
`;
5552

5653
const PlaceholderText = styled.div`
5754
text-align: center;
58-
color: #4a6583;
55+
color: var(--color-text);
5956
font-size: 15px;
6057
font-weight: 500;
6158
line-height: 1.4;
62-
background-color: rgba(255, 255, 255, 0.7);
59+
background-color: var(--color-surfaceLight);
6360
padding: 15px;
6461
border-radius: 8px;
6562
`;
@@ -78,7 +75,8 @@ const DragOverlay = styled.div<{ show: boolean }>`
7875
left: 0;
7976
right: 0;
8077
bottom: 0;
81-
background: rgba(67, 117, 185, 0.1);
78+
background: var(--color-primaryLight);
79+
opacity: 0.1;
8280
display: ${props => props.show ? 'flex' : 'none'};
8381
align-items: center;
8482
justify-content: center;
@@ -87,14 +85,15 @@ const DragOverlay = styled.div<{ show: boolean }>`
8785
`;
8886

8987
const DragText = styled.div`
90-
color: #4375b9;
88+
color: var(--color-primary);
9189
font-size: 16px;
9290
font-weight: 500;
9391
text-align: center;
9492
padding: 16px;
95-
border: 1px solid #4375b9;
93+
border: 1px solid var(--color-primary);
9694
border-radius: 6px;
97-
background: rgba(255, 255, 255, 0.9);
95+
background: var(--color-surface);
96+
opacity: 0.95;
9897
`;
9998

10099
const ManualRecognizeButton = styled.button`
@@ -200,7 +199,7 @@ const ImageDisplay: React.FC<ImageDisplayProps> = ({
200199
<PlaceholderText>
201200
<MaterialIcon name="photo_camera" /> 将在此处显示识别的图片
202201
<br />
203-
<small style={{ color: '#95a5a6', fontSize: '14px', marginTop: '8px', display: 'block' }}>
202+
<small style={{ color: 'var(--color-textSecondary)', fontSize: '14px', marginTop: '8px', display: 'block' }}>
204203
点击此区域选择图片或拖拽图片文件到此处(最大10MB)
205204
</small>
206205
</PlaceholderText>

src/components/LatexEditor.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const Container = styled.div`
1515
const Label = styled.h3`
1616
font-size: 14px;
1717
font-weight: 600;
18-
color: #2c3e50;
18+
color: var(--color-text);
1919
margin: 0 0 10px 0;
2020
display: flex;
2121
align-items: center;
@@ -28,9 +28,10 @@ const TextArea = styled.textarea<{ readOnly: boolean }>`
2828
min-height: 226px;
2929
max-height: 226px;
3030
padding: 12px;
31-
border: 2px solid #dce1e8; /* 增加边框宽度使其更明显 */
31+
border: 2px solid var(--color-border); /* 增加边框宽度使其更明显 */
3232
border-radius: 8px;
33-
color: #2c3e50;
33+
color: var(--color-text);
34+
background: var(--color-inputBackground);
3435
font-family: "Segoe UI","Microsoft YaHei",sans-serif;
3536
font-size: 13px;
3637
line-height: 1.5;
@@ -58,13 +59,13 @@ const TextArea = styled.textarea<{ readOnly: boolean }>`
5859
5960
&:focus {
6061
outline: none;
61-
border-color: #4a90e2;
62-
background: white;
62+
border-color: var(--color-inputFocus);
63+
background: var(--color-inputBackground);
6364
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 0 0 2px rgba(74, 144, 226, 0.1);
6465
}
6566
6667
&::placeholder {
67-
color: #95a5a6;
68+
color: var(--color-textSecondary);
6869
font-style: italic;
6970
}
7071
@@ -73,17 +74,17 @@ const TextArea = styled.textarea<{ readOnly: boolean }>`
7374
}
7475
7576
&::-webkit-scrollbar-track {
76-
background: #f1f1f1;
77+
background: var(--color-borderLight);
7778
border-radius: 3px;
7879
}
7980
8081
&::-webkit-scrollbar-thumb {
81-
background: #cbd5e0;
82+
background: var(--color-border);
8283
border-radius: 3px;
8384
}
8485
8586
&::-webkit-scrollbar-thumb:hover {
86-
background: #a0aec0;
87+
background: var(--color-textSecondary);
8788
}
8889
`;
8990

0 commit comments

Comments
 (0)