♿ move font size to project settings
This commit is contained in:
@@ -111,10 +111,11 @@ export interface ProjectConfig {
|
|||||||
authorAddress?: string
|
authorAddress?: string
|
||||||
authorEmail?: string
|
authorEmail?: string
|
||||||
authorPhone?: string
|
authorPhone?: string
|
||||||
|
fontSize?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
const PROJECT_CONFIG_FIELDS: (keyof ProjectConfig)[] = [
|
const PROJECT_CONFIG_FIELDS: (keyof ProjectConfig)[] = [
|
||||||
'projectTitle', 'authorName', 'penName', 'authorAddress', 'authorEmail', 'authorPhone'
|
'projectTitle', 'authorName', 'penName', 'authorAddress', 'authorEmail', 'authorPhone', 'fontSize'
|
||||||
]
|
]
|
||||||
|
|
||||||
export { PROJECT_CONFIG_FIELDS }
|
export { PROJECT_CONFIG_FIELDS }
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ export interface RecentProject {
|
|||||||
export interface GlobalConfig {
|
export interface GlobalConfig {
|
||||||
apiKey?: string
|
apiKey?: string
|
||||||
projectPath?: string
|
projectPath?: string
|
||||||
fontSize?: number
|
|
||||||
theme?: 'dark' | 'light'
|
theme?: 'dark' | 'light'
|
||||||
recentProjects?: RecentProject[]
|
recentProjects?: RecentProject[]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,38 @@
|
|||||||
border-color: var(--accent);
|
border-color: var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings-fontsize {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-fontsize-btn {
|
||||||
|
background: var(--btn-bg, rgba(255,255,255,0.08));
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 4px;
|
||||||
|
color: var(--text);
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 4px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-fontsize-btn:hover:not(:disabled) {
|
||||||
|
background: var(--btn-hover-bg, rgba(255,255,255,0.14));
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-fontsize-btn:disabled {
|
||||||
|
opacity: 0.35;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-fontsize-value {
|
||||||
|
font-size: 13px;
|
||||||
|
min-width: 36px;
|
||||||
|
text-align: center;
|
||||||
|
color: var(--text-muted, var(--text));
|
||||||
|
}
|
||||||
|
|
||||||
.settings-input--path {
|
.settings-input--path {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border-radius: 4px 0 0 4px;
|
border-radius: 4px 0 0 4px;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export function SettingsDialog({ onClose, onProjectChanged, isSetup }: Props): J
|
|||||||
const [authorAddress, setAuthorAddress] = useState('')
|
const [authorAddress, setAuthorAddress] = useState('')
|
||||||
const [authorEmail, setAuthorEmail] = useState('')
|
const [authorEmail, setAuthorEmail] = useState('')
|
||||||
const [authorPhone, setAuthorPhone] = useState('')
|
const [authorPhone, setAuthorPhone] = useState('')
|
||||||
|
const [fontSize, setFontSize] = useState<number>(15)
|
||||||
const [saved, setSaved] = useState(false)
|
const [saved, setSaved] = useState(false)
|
||||||
const overlayRef = useRef<HTMLDivElement>(null)
|
const overlayRef = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
@@ -31,6 +32,7 @@ export function SettingsDialog({ onClose, onProjectChanged, isSetup }: Props): J
|
|||||||
setAuthorAddress(cfg.authorAddress ?? '')
|
setAuthorAddress(cfg.authorAddress ?? '')
|
||||||
setAuthorEmail(cfg.authorEmail ?? '')
|
setAuthorEmail(cfg.authorEmail ?? '')
|
||||||
setAuthorPhone(cfg.authorPhone ?? '')
|
setAuthorPhone(cfg.authorPhone ?? '')
|
||||||
|
setFontSize(cfg.fontSize ?? 15)
|
||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@@ -62,6 +64,7 @@ export function SettingsDialog({ onClose, onProjectChanged, isSetup }: Props): J
|
|||||||
authorAddress: authorAddress.trim() || undefined,
|
authorAddress: authorAddress.trim() || undefined,
|
||||||
authorEmail: authorEmail.trim() || undefined,
|
authorEmail: authorEmail.trim() || undefined,
|
||||||
authorPhone: authorPhone.trim() || undefined,
|
authorPhone: authorPhone.trim() || undefined,
|
||||||
|
fontSize: fontSize,
|
||||||
})
|
})
|
||||||
if (projectPath !== originalPath) onProjectChanged?.()
|
if (projectPath !== originalPath) onProjectChanged?.()
|
||||||
setOriginalPath(projectPath)
|
setOriginalPath(projectPath)
|
||||||
@@ -131,6 +134,25 @@ export function SettingsDialog({ onClose, onProjectChanged, isSetup }: Props): J
|
|||||||
<p className="settings-hint">Used as the title in PDF exports. Defaults to the project folder name if left blank.</p>
|
<p className="settings-hint">Used as the title in PDF exports. Defaults to the project folder name if left blank.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="settings-field">
|
||||||
|
<label className="settings-label">Editor Font Size</label>
|
||||||
|
<div className="settings-fontsize">
|
||||||
|
<button
|
||||||
|
className="settings-fontsize-btn"
|
||||||
|
onClick={() => setFontSize((s) => Math.max(11, s - 1))}
|
||||||
|
disabled={fontSize <= 11}
|
||||||
|
type="button"
|
||||||
|
>A−</button>
|
||||||
|
<span className="settings-fontsize-value">{fontSize}px</span>
|
||||||
|
<button
|
||||||
|
className="settings-fontsize-btn"
|
||||||
|
onClick={() => setFontSize((s) => Math.min(24, s + 1))}
|
||||||
|
disabled={fontSize >= 24}
|
||||||
|
type="button"
|
||||||
|
>A+</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="settings-field">
|
<div className="settings-field">
|
||||||
<label className="settings-label" htmlFor="settings-author-name">Author Name</label>
|
<label className="settings-label" htmlFor="settings-author-name">Author Name</label>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -128,8 +128,6 @@ export function AnalysisToolbar(): JSX.Element {
|
|||||||
chatHistory,
|
chatHistory,
|
||||||
projectWordCount,
|
projectWordCount,
|
||||||
setProjectWordCount,
|
setProjectWordCount,
|
||||||
fontSize,
|
|
||||||
setFontSize,
|
|
||||||
setRightPanelTab,
|
setRightPanelTab,
|
||||||
outlineOpen,
|
outlineOpen,
|
||||||
toggleOutline,
|
toggleOutline,
|
||||||
@@ -535,25 +533,7 @@ export function AnalysisToolbar(): JSX.Element {
|
|||||||
>
|
>
|
||||||
≡
|
≡
|
||||||
</button>
|
</button>
|
||||||
<div className="toolbar-fontsize">
|
{selectionWordCount !== null && (
|
||||||
<button
|
|
||||||
className="toolbar-fontsize-btn"
|
|
||||||
onClick={() => setFontSize(fontSize - 1)}
|
|
||||||
disabled={fontSize <= 11}
|
|
||||||
title="Decrease font size"
|
|
||||||
>
|
|
||||||
A−
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
className="toolbar-fontsize-btn"
|
|
||||||
onClick={() => setFontSize(fontSize + 1)}
|
|
||||||
disabled={fontSize >= 24}
|
|
||||||
title="Increase font size"
|
|
||||||
>
|
|
||||||
A+
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{selectionWordCount !== null && (
|
|
||||||
<span className="toolbar-selection-wordcount" title={`${selectionWordCount} words selected`}>
|
<span className="toolbar-selection-wordcount" title={`${selectionWordCount} words selected`}>
|
||||||
{formatWordCount(selectionWordCount)} sel
|
{formatWordCount(selectionWordCount)} sel
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user