Skip to content

Commit 8e64bb0

Browse files
shouwang0527zhaojianyongdatlechin
authored
fix(settings): persist font size changes in Appearance theme editor (#1381) (#1415)
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com> Co-authored-by: zhaojianyong <zhaojianyong@unipus.cn> Co-authored-by: Ngô Quốc Đạt <datlechin@gmail.com>
1 parent dd29fe5 commit 8e64bb0

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Changing the editor or data grid font size in Appearance settings now applies immediately and persists across relaunch, instead of resetting and leaving orphan custom themes behind (#1381)
1013
### Added
1114

1215
- Cloudflare Tunnel: connect to a database behind Cloudflare Access by letting TablePro start and stop `cloudflared access tcp` for you, the same way it manages SSH tunnels. Configure it per connection with browser sign-in or a service token. Needs cloudflared installed (`brew install cloudflared`). (#1285)

TablePro/Theme/ThemeEngine.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,14 @@ internal final class ThemeEngine {
150150

151151
func saveUserTheme(_ theme: ThemeDefinition) throws {
152152
try ThemeStorage.saveUserTheme(theme)
153+
154+
if let index = availableThemes.firstIndex(where: { $0.id == theme.id }) {
155+
availableThemes[index] = theme
156+
} else {
157+
availableThemes.append(theme)
158+
}
153159
reloadAvailableThemes()
154160

155-
// If editing the active theme, re-activate to apply changes
156161
if theme.id == activeTheme.id {
157162
activateTheme(theme)
158163
}

TablePro/Views/Settings/Appearance/ThemeEditorFontsSection.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ struct ThemeEditorFontsSection: View {
123123
var copy = engine.duplicateTheme(base, newName: base.name + " (Custom)")
124124
mutate(&copy.fonts)
125125
try? engine.saveUserTheme(copy)
126-
engine.activateTheme(copy)
127126
editingTheme = copy
128127
onThemeDuplicated?(copy)
129128
} else {

0 commit comments

Comments
 (0)