mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
remove sf mono font in web reader font list. add sysstem default
This commit is contained in:
parent
3a1d75de29
commit
d547946e84
3 changed files with 32 additions and 10 deletions
|
|
@ -5,8 +5,17 @@ public enum WebFont: String, CaseIterable {
|
|||
case inter = "Inter"
|
||||
case merriweather = "Merriweather"
|
||||
case lyon = "Lyon"
|
||||
case sfmono = "SF Mono"
|
||||
case tisa = "Tisa"
|
||||
case system = "undefined"
|
||||
|
||||
var displayValue: String {
|
||||
switch self {
|
||||
case .inter, .merriweather, .lyon, .tisa:
|
||||
return rawValue
|
||||
case .system:
|
||||
return "System Default"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct WebPreferencesPopoverView: View {
|
||||
|
|
@ -55,7 +64,7 @@ public struct WebPreferencesPopoverView: View {
|
|||
},
|
||||
label: {
|
||||
HStack {
|
||||
Text(font.rawValue).foregroundColor(.appGrayTextContrast)
|
||||
Text(font.displayValue).foregroundColor(.appGrayTextContrast)
|
||||
Spacer()
|
||||
if font.rawValue == preferredFont {
|
||||
Image(systemName: "checkmark").foregroundColor(.appGrayTextContrast)
|
||||
|
|
@ -67,6 +76,7 @@ public struct WebPreferencesPopoverView: View {
|
|||
}
|
||||
.listStyle(.plain)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationTitle("Reader Font")
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -49,7 +49,9 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element {
|
|||
const [fontFamilyOverride, setFontFamilyOverride] = useState<string | null>(
|
||||
null
|
||||
)
|
||||
const [highContrastFont, setHighContrastFont] = useState(props.highContrastFont ?? false)
|
||||
const [highContrastFont, setHighContrastFont] = useState(
|
||||
props.highContrastFont ?? false
|
||||
)
|
||||
const highlightHref = useRef(
|
||||
window.location.hash ? window.location.hash.split('#')[1] : null
|
||||
)
|
||||
|
|
@ -113,8 +115,7 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element {
|
|||
}
|
||||
|
||||
const updateFontFamily = (event: UpdateFontFamilyEvent) => {
|
||||
const newFontFamily =
|
||||
event.fontFamily ?? fontFamilyOverride ?? props.fontFamily ?? 'inter'
|
||||
const newFontFamily = event.fontFamily ?? fontFamilyOverride
|
||||
console.log('setting font fam to', event.fontFamily)
|
||||
setFontFamilyOverride(newFontFamily)
|
||||
}
|
||||
|
|
@ -162,7 +163,10 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element {
|
|||
document.addEventListener('updateMargin', updateMargin)
|
||||
document.addEventListener('updateFontSize', handleFontSizeChange)
|
||||
document.addEventListener('updateColorMode', updateColorMode)
|
||||
document.addEventListener('handleFontContrastChange', handleFontContrastChange)
|
||||
document.addEventListener(
|
||||
'handleFontContrastChange',
|
||||
handleFontContrastChange
|
||||
)
|
||||
document.addEventListener('share', share)
|
||||
|
||||
return () => {
|
||||
|
|
@ -171,7 +175,10 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element {
|
|||
document.removeEventListener('updateMargin', updateMargin)
|
||||
document.removeEventListener('updateFontSize', handleFontSizeChange)
|
||||
document.removeEventListener('updateColorMode', updateColorMode)
|
||||
document.removeEventListener('handleFontContrastChange', handleFontContrastChange)
|
||||
document.removeEventListener(
|
||||
'handleFontContrastChange',
|
||||
handleFontContrastChange
|
||||
)
|
||||
document.removeEventListener('share', share)
|
||||
}
|
||||
})
|
||||
|
|
@ -180,8 +187,13 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element {
|
|||
fontSize,
|
||||
margin: marginOverride ?? props.margin ?? 360,
|
||||
lineHeight: lineHeightOverride ?? props.lineHeight ?? 150,
|
||||
fontFamily: fontFamilyOverride ?? props.fontFamily ?? 'inter',
|
||||
readerFontColor: highContrastFont ? theme.colors.readerFontHighContrast.toString() : theme.colors.readerFont.toString(),
|
||||
fontFamily:
|
||||
fontFamilyOverride ??
|
||||
props.fontFamily ??
|
||||
(props.isAppleAppEmbed ? undefined : 'inter'),
|
||||
readerFontColor: highContrastFont
|
||||
? theme.colors.readerFontHighContrast.toString()
|
||||
: theme.colors.readerFont.toString(),
|
||||
readerFontColorTransparent: theme.colors.readerFontTransparent.toString(),
|
||||
readerTableHeaderColor: theme.colors.readerTableHeader.toString(),
|
||||
readerHeadersColor: theme.colors.readerHeader.toString(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue